<commit_before># For more information on writing hooks please read the cuke wiki
# https://github.com/cucumber/cucumber/wiki/Hooks
RESULTS_DIR="results"
TIMEOUT=180
Selenium::WebDriver::Chrome.driver_path = File.join(File.absolute_path('../..', File.dirname(__FILE__)),"chromedriver","chromedriver.exe")

 if ENV["DRIVER"]
    DRIVER = ENV["DRIVER"]
 else
    #DRIVER = "firefox"
    DRIVER = "chrome"
 end

# This method to set timeout came from
# http://stackoverflow.com/questions/9014121/how-do-i-change-the-page-load-timeouts-in-watir-webdriver-timeout-in-click-met/9044958#9044958
# however, it's not working as expected :(
# Maybe we can try solutions outlined here instead:
# http://stackoverflow.com/questions/17242404/watir-implicit-wait-doesnt-seem-to-work
# http://stackoverflow.com/questions/18204926/automate-timeout-handling-wait-and-refresh-in-watir
# http://stackoverflow.com/questions/18659847/reload-page-until-it-has-some-element-using-ruby-selenium-webdriver/18660166#18660166
def get_browser
  client = Selenium::WebDriver::Remote::Http::Default.new
  client.timeout = TIMEOUT # seconds – default is 30
  browser = Watir::Browser.new DRIVER.to_sym, :http_client => client
  return browser
end

Before ('@desktop') do
  @browser = get_browser
  screen_width = @browser.execute_script("return screen.width;")
  screen_height = @browser.execute_script("return screen.height;")
  @browser.driver.manage.window.resize_to(screen_width,screen_height)<commit_msg>Update hooks.rb<commit_after># For more information on writing hooks please read the cuke wiki
# https://github.com/cucumber/cucumber/wiki/Hooks
RESULTS_DIR="results"
TIMEOUT=180
Selenium::WebDriver::Chrome.driver_path = File.join(File.absolute_path('../..', File.dirname(__FILE__)),"chromedriver","chromedriver.exe")

 if ENV["DRIVER"]
    DRIVER = ENV["DRIVER"]
 else
    #DRIVER = "firefox"
    DRIVER = "chrome"
 end

# This method to set timeout came from
# http://stackoverflow.com/questions/9014121/how-do-i-change-the-page-load-timeouts-in-watir-webdriver-timeout-in-click-met/9044958#9044958
# however, it's not working as expected :(
# Maybe we can try solutions outlined here instead:
# http://stackoverflow.com/questions/17242404/watir-implicit-wait-doesnt-seem-to-work
# http://stackoverflow.com/questions/18204926/automate-timeout-handling-wait-and-refresh-in-watir
# http://stackoverflow.com/questions/18659847/reload-page-until-it-has-some-element-using-ruby-selenium-webdriver/18660166#18660166
def get_browser
 # client = Selenium::WebDriver::Remote::Http::Default.new
 # client.timeout = TIMEOUT # seconds – default is 30
 # browser = Watir::Browser.new DRIVER.to_sym, :http_client => client
 browser = Watir::Browser.new(:remote, :url=> "http://172.28.160.40:4444/wd/hub") 
  return browser
end

Before ('@desktop') do
  @browser = get_browser
  screen_width = @browser.execute_script("return screen.width;")
  screen_height = @browser.execute_script("return screen.height;")
  @browser.driver.manage.window.resize_to(screen_width,screen_height)
{'fraction_non_alphanumeric': 0.14003944773175542, 'fraction_numerical': 0.04799474030243261, 'mean_word_length': 5.366108786610878, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, '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': '5492325', 'n_tokens_mistral': 1132, 'n_tokens_neox': 1003, 'n_words': 172}