Created
July 20, 2015 12:34
-
-
Save nikita-barsukov/cf1dd4d4a4027135874b to your computer and use it in GitHub Desktop.
Loading dashboard page of GotoAssist Service desk.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'selenium-webdriver' | |
module Scenario | |
def g2a_dashboard(driver, opts={}) | |
driver.get 'https://desk.gotoassist.com' | |
driver.find_element(:name, 'emailAddress').send_keys opts[:email] | |
driver.find_element(:name, 'password').send_keys opts [:password] | |
req_start = Time.now | |
driver.find_element(:id, 'credentials').submit | |
# waiting until all the incidents on dashboard are loaded | |
Selenium::WebDriver::Wait.new(timeout: 30).until do | |
driver.find_elements(css: '.customizable-table-data-row').length == opts[:rows] | |
end | |
latency = Time.now - req_start | |
opts[:log_file].puts latency if opts[:log_file] | |
puts latency | |
end | |
end | |
include Scenario | |
log_file = File.open('log/seq_browser.log', 'w') | |
100.times { | |
switches = %w[--ignore-certificate-errors --disable-popup-blocking --disable-translate] | |
driver = Selenium::WebDriver.for :chrome, switches: switches | |
Scenario::g2a_dashboard(driver, log_file: log_file, rows: 8, email: ENV['EMAIL'], password: ENV['PASS']) | |
driver.quit | |
} | |
log_file.close | |
puts 'Testing completed!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment