Zfilipin has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/114453

Change subject: WIP moved BROWSER_TIMEOUT implementation to the gem
......................................................................

WIP moved BROWSER_TIMEOUT implementation to the gem

Paired with Tobi Gritschacher.

Change-Id: If55392d1fc64e1e29d0cdff14ff228718bf290ca
---
M lib/mediawiki_selenium/support/env.rb
1 file changed, 13 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/selenium 
refs/changes/53/114453/1

diff --git a/lib/mediawiki_selenium/support/env.rb 
b/lib/mediawiki_selenium/support/env.rb
index f648935..694fbfa 100644
--- a/lib/mediawiki_selenium/support/env.rb
+++ b/lib/mediawiki_selenium/support/env.rb
@@ -27,8 +27,7 @@
   end
 end
 def environment
-  if ENV["BROWSER"] and ENV["BROWSER"] != "phantomjs" and
-      ENV["SAUCE_ONDEMAND_USERNAME"] and ENV["SAUCE_ONDEMAND_ACCESS_KEY"]
+  if ENV["SAUCE_ONDEMAND_USERNAME"] and ENV["SAUCE_ONDEMAND_ACCESS_KEY"] and 
ENV["BROWSER"] != "phantomjs"
     :saucelabs
   else
     :local
@@ -77,7 +76,17 @@
 def sauce_browser(test_name, language)
   abort "Environment variables BROWSER, PLATFORM and VERSION have to be set" 
if (ENV["BROWSER"] == nil) or (ENV["PLATFORM"] == nil) or (ENV["VERSION"] == 
nil)
 
-  if language == "default"
+  require "selenium/webdriver/remote/http/persistent" # http_client
+  client = Selenium::WebDriver::Remote::Http::Persistent.new
+
+  if language == "default" and ENV["BROWSER_TIMEOUT"] and ENV["BROWSER"] == 
"firefox"
+    timeout = ENV["BROWSER_TIMEOUT"].to_i
+    client.timeout = timeout
+
+    profile = Selenium::WebDriver::Firefox::Profile.new
+    profile["dom.max_script_run_time"] = timeout
+    caps = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile 
=> profile)
+  elsif language == "default"
     caps = Selenium::WebDriver::Remote::Capabilities.send(ENV["BROWSER"])
   elsif ENV["BROWSER"] == "firefox"
     profile = Selenium::WebDriver::Firefox::Profile.new
@@ -93,10 +102,9 @@
   caps.version = ENV["VERSION"]
   caps[:name] = "#{test_name} #{ENV['JOB_NAME']}##{ENV['BUILD_NUMBER']}"
 
-  require "selenium/webdriver/remote/http/persistent" # http_client
   browser = Watir::Browser.new(
     :remote,
-    http_client: Selenium::WebDriver::Remote::Http::Persistent.new,
+    http_client: client,
     url: 
"http://#{ENV['SAUCE_ONDEMAND_USERNAME']}:#{ENV['SAUCE_ONDEMAND_ACCESS_KEY']}@ondemand.saucelabs.com:80/wd/hub",
     desired_capabilities: caps)
   browser.wd.file_detector = lambda do |args|

-- 
To view, visit https://gerrit.wikimedia.org/r/114453
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If55392d1fc64e1e29d0cdff14ff228718bf290ca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/selenium
Gerrit-Branch: master
Gerrit-Owner: Zfilipin <zfili...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to