<commit_before># require 'spec_helper'
require 'selenium-webdriver'
require 'rspec-expectations'


include RSpec::Matchers


def setup

  @driver = Selenium::WebDriver.for :chrome
  @driver.get "https://dash-dev.ucop.edu/xtf/search"

  users = YAML.load_file("spec/support/features/credentials.yml")
  @username = users[ucop]
  @password = ''

end

def teardown
  @driver.quit
end

def run
  setup
  yield
  teardown
end


def wait_for(seconds)
  Selenium::WebDriver::Wait.new(timeout: seconds).until { yield }
end


run do
  
  @driver.find_element(link: 'My Datasets').click
  @driver.find_element(id: 'j_username').send_keys @username
  @driver.find_element(id: 'j_password').send_keys <PASSWORD>
  @driver.find_element(id: 'Login').click


  @driver.find_element(id: 'new_record').click
  @driver.find_element(id: 'record_title').send_keys "test"

  drop_down_list = @driver.find_element(id: 'record_resourcetype')

  select_list = Selenium::WebDriver::Support::Select.new(drop_down_list)
  select_list.select_by(:value, "Collection,Collection")

  @driver.find_element(id: 'record_creators_attributes_0_creatorName').send_keys "auth1"
  @driver.find_element(id: 'save_and_continue').click

  @driver.execute_script("$('span.fileinput-button').removeClass('fileinput-button');")
  
  # filename = 'selenium_test_spec.rb'
  # file = File.join(Dir.pwd, filename)
  
  @driver.find_element(id: 'upload_upload').send_keys "/spec/features/selenium_test_spec.rb"
  # @driver.find_element(id: 'upload_upload').send_keys "/spec/features/selenium_test_spec.rb"

  @driver.find_element(id: 'start_button').click

  wait_for(10) { @driver.find_element(id: 'delete_button').displayed? }

  @driver.find_element(id: 'submit_button').click
  


#     expect(page).to have_content 'Review Before Submitting'  


end


<commit_msg>update load test<commit_after># require 'spec_helper'
require 'selenium-webdriver'
require 'rspec-expectations'
require 'yaml'



include RSpec::Matchers


def setup

  @driver = Selenium::WebDriver.for :chrome
  @driver.get "https://dash-dev.ucop.edu/xtf/search"
  @driver.get "localhost:3000/records"

  users = YAML.load_file("spec/support/features/credentials.yml")
  @username = users['ucop']['USERNAME']
  @password = users['ucop']['PASSWORD']

end

def teardown
  @driver.quit
end

def run
  setup
  yield
  teardown
end


def wait_for(seconds)
  Selenium::WebDriver::Wait.new(timeout: seconds).until { yield }
end


run do
  
  @driver.find_element(link: 'My Datasets').click
  # @driver.find_element(id: 'j_username').send_keys @username
  # @driver.find_element(id: 'j_password').send_keys <PASSWORD>
  # @driver.find_element(id: 'Login').click
  @driver.find_element(id: 'new_record').click
  @driver.find_element(id: 'record_title').send_keys "LOAD_TEST"

  drop_down_list = @driver.find_element(id: 'record_resourcetype')

  select_list = Selenium::WebDriver::Support::Select.new(drop_down_list)
  select_list.select_by(:value, "Collection,Collection")

  @driver.find_element(id: 'record_creators_attributes_0_creatorName').send_keys "auth1"
  @driver.find_element(id: 'save_and_continue').click

  @driver.execute_script("$('span.fileinput-button').removeClass('fileinput-button');")

  # @driver.find_element(id: 'upload_upload').click

  # filename = File.dirname(__FILE__) + "/selenium-test_spec.rb"


  filename = File.join(File.expand_path(File.dirname(__FILE__)), "selenium-test_spec.rb")

  puts filename
  
  @driver.find_element(id: 'upload_upload').send_keys filename

  @driver.find_element(id: 'start_button').click

  wait_for(20) { @driver.find_element(id: 'delete_button').displayed? }

  @driver.find_element(id: 'submit_button').click
  
  expect(@driver.find_element(css: 'h1').text).to eql 'Review Before Submitting'

end



{'fraction_non_alphanumeric': 0.1450886947312682, 'fraction_numerical': 0.003441885093989939, 'mean_word_length': 5.628070175438596, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '3287305', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1320, 'n_words': 196}