<commit_before># Copyright 2016 (c) SUSE LLC
# Licensed under the terms of the MIT license.
require 'timeout'

When(/^I click on preview$/) do
  find('button#preview').click
end

When(/^I click on run$/) do
  find('button#run').click
end

When(/^I should see my hostname$/) do
  fail unless page.has_content?($myhostname)
end

When(/^I should not see my hostname$/) do
  fail if page.has_content?($myhostname)
end

When(/^I expand the results$/) do
   find("div[id='#{$myhostname}']").click
end

When(/^I expand the results for "(.*)"$/) do |host|
   find("div[id=#{host}]").click
end

Then(/^I enter command "([^"]*)"$/) do |arg1|
  fill_in "command", with: "ls -la /etc"
end

Then(/^I should see "([^"]*)" in the command output$/) do |arg1|
  within("pre[id='#{$myhostname}-results']") do
    fail unless page.has_content?('SuSE-release')
  end
end


When(/^"(.*)" exists on the filesystem$/) do |file|
  begin
    Timeout.timeout(DEFAULT_TIMEOUT) do
      loop do
        break if File.exist?(file)
        sleep(1)
      end
    end
  rescue Timeout::Error
    puts "timeout waiting for the file to appear"<commit_msg>rubocop: C: Extra blank line detected<commit_after># Copyright 2016 (c) SUSE LLC
# Licensed under the terms of the MIT license.
require 'timeout'

When(/^I click on preview$/) do
  find('button#preview').click
end

When(/^I click on run$/) do
  find('button#run').click
end

When(/^I should see my hostname$/) do
  fail unless page.has_content?($myhostname)
end

When(/^I should not see my hostname$/) do
  fail if page.has_content?($myhostname)
end

When(/^I expand the results$/) do
   find("div[id='#{$myhostname}']").click
end

When(/^I expand the results for "(.*)"$/) do |host|
   find("div[id=#{host}]").click
end

Then(/^I enter command "([^"]*)"$/) do |arg1|
  fill_in "command", with: "ls -la /etc"
end

Then(/^I should see "([^"]*)" in the command output$/) do |arg1|
  within("pre[id='#{$myhostname}-results']") do
    fail unless page.has_content?('SuSE-release')
  end
end

When(/^"(.*)" exists on the filesystem$/) do |file|
  begin
    Timeout.timeout(DEFAULT_TIMEOUT) do
      loop do
        break if File.exist?(file)
        sleep(1)
      end
    end
  rescue Timeout::Error
    puts "timeout waiting for the file to appear"
{'fraction_non_alphanumeric': 0.1693868548742832, 'fraction_numerical': 0.0061755624172915745, 'mean_word_length': 3.715176715176715, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6879259', 'n_tokens_mistral': 797, 'n_tokens_neox': 789, 'n_words': 250}