<commit_before># Copyright 2011-2014 Novell

When(/^I make the credentials primary$/) do
  fail unless find('i.fa-star-o').click
end

When(/^I refresh scc$/) do
  sshcmd('echo -e "admin\nadmin\n" | mgr-sync refresh', ignore_err: true)
end

When(/^I delete the primary credentials$/) do
  fail unless find('i.fa-trash-o', :match => :first).click
  step 'I click on "Delete"'
end

When(/^I view the primary subscription list$/) do
  fail unless find('i.fa-th-list', :match => :first).click
end

When(/^I view the primary subscription list for asdf$/) do
  within(:xpath, "//h3[contains(text(), 'asdf')]/../..") do
    fail unless find('i.fa-th-list', :match => :first).click
  end
end

When(/^I click on "([^"]*)" link in the setup wizard$/) do |arg1|
  tag = case arg1
  when /Edit/ then "i.fa-pencil"
  when /List/ then "i.fa-th-list"
  when /Verify/ then "i.fa-check-square"
  else raise "Unknown element"
  end
  within(".text-left") do
     fail unless find(tag).click
  end
end

When(/^I select "([^\"]*)" as a product for the "([^\"]*)" architecture$/) do |product, architecture|
  within(:xpath, "(//span[contains(text(), '#{product}')]/ancestor::tr[td[contains(text(), '#{architecture}')]])[1]") do
    fail unless find("button.product-add-btn").click
  end
end

When(/^I select the addon "(.*?)" for the product "(.*?)" with arch "(.*?)"$/) do |addon, product, arch|
  # xpath query is too long, so breaking up on multiple lines.
  xpath =  "//span[contains(text(), '#{product}')]/"
  xpath += "ancestor::tr[td[contains(text(), '#{arch}')]]/following::span"
  xpath += "[contains(text(), '#{addon}')]/../.."
  within(:xpath, "#{xpath}") do
      fail unless find("button.product-add-btn").click
  end
end

When(/^I click the Add Product button$/) do
  fail unless find("button#synchronize").click
end

When(/^I wait until it has finished$/) do
  find("button#synchronize .fa-plus")
end

When(/^I verify the products were added$/) do
  output = sshcmd('echo -e "admin\nadmin\n" | mgr-sync list channels', ignore_err: true)
  fail unless output[:stdout].include? '[I] SLES12-SP1-Pool for x86_64 SUSE Linux Enterprise Server 12 SP1 x86_64 [sles12-sp1-pool-x86_64]'
  fail unless output[:stdout].include? '[I] SLE-Manager-Tools12-Pool x86_64 SP1 SUSE Manager Tools [sle-manager-tools12-pool-x86_64-sp1]'
  fail unless output[:stdout].include? '[I] SLE-Module-Legacy12-Updates for x86_64 SP1 Legacy Module 12 x86_64 [sle-module-legacy12-updates-x86_64-sp1]'
end

When(/^I click the channel list of product "(.*?)" for the "(.*?)" architecture$/) do |product, architecture|
  within(:xpath, "//span[contains(text(), '#{product}')]/ancestor::tr[td[contains(text(), '#{architecture}')]]") do
    fail unless find('.product-channels-btn').click
  end
end

Then(/^I see verification succeeded/) do
  find("i.text-success")
end<commit_msg>test for SP2 in wizard result<commit_after># Copyright 2011-2014 Novell

When(/^I make the credentials primary$/) do
  fail unless find('i.fa-star-o').click
end

When(/^I refresh scc$/) do
  sshcmd('echo -e "admin\nadmin\n" | mgr-sync refresh', ignore_err: true)
end

When(/^I delete the primary credentials$/) do
  fail unless find('i.fa-trash-o', :match => :first).click
  step 'I click on "Delete"'
end

When(/^I view the primary subscription list$/) do
  fail unless find('i.fa-th-list', :match => :first).click
end

When(/^I view the primary subscription list for asdf$/) do
  within(:xpath, "//h3[contains(text(), 'asdf')]/../..") do
    fail unless find('i.fa-th-list', :match => :first).click
  end
end

When(/^I click on "([^"]*)" link in the setup wizard$/) do |arg1|
  tag = case arg1
  when /Edit/ then "i.fa-pencil"
  when /List/ then "i.fa-th-list"
  when /Verify/ then "i.fa-check-square"
  else raise "Unknown element"
  end
  within(".text-left") do
     fail unless find(tag).click
  end
end

When(/^I select "([^\"]*)" as a product for the "([^\"]*)" architecture$/) do |product, architecture|
  within(:xpath, "(//span[contains(text(), '#{product}')]/ancestor::tr[td[contains(text(), '#{architecture}')]])[1]") do
    fail unless find("button.product-add-btn").click
  end
end

When(/^I select the addon "(.*?)" for the product "(.*?)" with arch "(.*?)"$/) do |addon, product, arch|
  # xpath query is too long, so breaking up on multiple lines.
  xpath =  "//span[contains(text(), '#{product}')]/"
  xpath += "ancestor::tr[td[contains(text(), '#{arch}')]]/following::span"
  xpath += "[contains(text(), '#{addon}')]/../.."
  within(:xpath, "#{xpath}") do
      fail unless find("button.product-add-btn").click
  end
end

When(/^I click the Add Product button$/) do
  fail unless find("button#synchronize").click
end

When(/^I wait until it has finished$/) do
  find("button#synchronize .fa-plus")
end

When(/^I verify the products were added$/) do
  output = sshcmd('echo -e "admin\nadmin\n" | mgr-sync list channels', ignore_err: true)
  fail unless output[:stdout].include? '[I] SLES12-SP2-Pool for x86_64 SUSE Linux Enterprise Server 12 SP2 x86_64 [sles12-sp2-pool-x86_64]'
  fail unless output[:stdout].include? '[I] SLE-Manager-Tools12-Pool x86_64 SP2 SUSE Manager Tools [sle-manager-tools12-pool-x86_64-sp2]'
  fail unless output[:stdout].include? '[I] SLE-Module-Legacy12-Updates for x86_64 SP2 Legacy Module 12 x86_64 [sle-module-legacy12-updates-x86_64-sp2]'
end

When(/^I click the channel list of product "(.*?)" for the "(.*?)" architecture$/) do |product, architecture|
  within(:xpath, "//span[contains(text(), '#{product}')]/ancestor::tr[td[contains(text(), '#{architecture}')]]") do
    fail unless find('.product-channels-btn').click
  end
end

Then(/^I see verification succeeded/) do
  find("i.text-success")
end
{'fraction_non_alphanumeric': 0.19022503516174402, 'fraction_numerical': 0.023734177215189875, 'mean_word_length': 4.219266055045871, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6634201', 'n_tokens_mistral': 2084, 'n_tokens_neox': 1992, 'n_words': 568}