<commit_before>Given /^user "([^"]*)" with barcode '(\d+)' exists$/ do |user_name, barcode|
  FakeUserBarcodeService.instance.user_barcode(user_name,barcode)
end

Given /^I have a "([^"]*)" instrument with barcode "([^"]*)"$/ do |instrument_name, instrument_barcode|
  Instrument.create!(:name => instrument_name, :barcode => instrument_barcode)
end

Given /^I have a process "([^"]*)" as part of the "([^"]*)" instrument$/ do |process_name, instrument_name|
  instrument = Instrument.find_by_name(instrument_name)
  instrument_process = InstrumentProcess.create!(:name => process_name, :key => process_name.gsub(/ /,'_'))
  instrument.instrument_processes << instrument_process
end

Then /^(?:|I )wait (\d+) seconds?$/ do |seconds|
  sleep(seconds.to_i)
end


When /^(?:|I )fill in AJAX field "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
  with_scope(selector) do
    fill_in(field, :with => value)
    id = "#" + find_field(field)[:id]
    page.execute_script("$('#{id}').trigger('change');")
  end
  step %Q{wait 1 second}
end
<commit_msg>Timeouts should be ajax waiting time.<commit_after>Given /^user "([^"]*)" with barcode '(\d+)' exists$/ do |user_name, barcode|
  FakeUserBarcodeService.instance.user_barcode(user_name,barcode)
end

Given /^I have a "([^"]*)" instrument with barcode "([^"]*)"$/ do |instrument_name, instrument_barcode|
  Instrument.create!(:name => instrument_name, :barcode => instrument_barcode)
end

Given /^I have a process "([^"]*)" as part of the "([^"]*)" instrument$/ do |process_name, instrument_name|
  instrument = Instrument.find_by_name(instrument_name)
  instrument_process = InstrumentProcess.create!(:name => process_name, :key => process_name.gsub(/ /,'_'))
  instrument.instrument_processes << instrument_process
end

Then /^(?:|I )wait (\d+) seconds?$/ do |seconds|
  #sleep(seconds.to_i)
  wait_for_ajax
end


When /^(?:|I )fill in AJAX field "([^"]*)" with "([^"]*)"(?: within "([^"]*)")?$/ do |field, value, selector|
  with_scope(selector) do
    fill_in(field, :with => value)
    id = "#" + find_field(field)[:id]
    page.execute_script("$('#{id}').trigger('change');")
  end
  step %Q{wait 1 second}
end

{'fraction_non_alphanumeric': 0.20374600274097762, 'fraction_numerical': 0.0009136592051164915, 'mean_word_length': 5.517857142857143, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, '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': '4427492', 'n_tokens_mistral': 792, 'n_tokens_neox': 754, 'n_words': 174}