mediawiki_selenium 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 803af6a3b0e01b71f76fdc2f8b5a386a68275c76
|
4
|
+
data.tar.gz: 7fa1c41c012a31f926cb147f213b6b2b3de2b7de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aee7c180a02d04d8407b442682ead80a33fa9079228578cbce893799aecbb51c112b64be81f188c4557e35aac4d9f310119fa608e133f1341d3e4cbe6934d446
|
7
|
+
data.tar.gz: daa100d2ce022f1077b3007aa6d0354bd5879f2ee5e5e67bd82caaced05541a4b22e93b7e3e12a44d73ad9a0f3e667f43c8831cf69eda43ec7f11d92111f6362
|
@@ -19,11 +19,11 @@ require "yaml"
|
|
19
19
|
|
20
20
|
World(PageObject::PageFactory)
|
21
21
|
|
22
|
-
def browser(
|
22
|
+
def browser(test_name, configuration = nil)
|
23
23
|
if environment == :saucelabs
|
24
|
-
sauce_browser(test_name,
|
24
|
+
sauce_browser(test_name, configuration)
|
25
25
|
else
|
26
|
-
local_browser(
|
26
|
+
local_browser(configuration)
|
27
27
|
end
|
28
28
|
end
|
29
29
|
def environment
|
@@ -33,14 +33,14 @@ def environment
|
|
33
33
|
:local
|
34
34
|
end
|
35
35
|
end
|
36
|
-
def local_browser(
|
36
|
+
def local_browser(configuration)
|
37
37
|
if ENV["BROWSER"]
|
38
38
|
browser_name = ENV["BROWSER"].to_sym
|
39
39
|
else
|
40
40
|
browser_name = :firefox
|
41
41
|
end
|
42
42
|
|
43
|
-
if
|
43
|
+
if ENV["BROWSER_TIMEOUT"] && browser_name == :firefox
|
44
44
|
timeout = ENV["BROWSER_TIMEOUT"].to_i
|
45
45
|
|
46
46
|
client = Selenium::WebDriver::Remote::Http::Default.new
|
@@ -50,24 +50,23 @@ def local_browser(language)
|
|
50
50
|
profile["dom.max_script_run_time"] = timeout
|
51
51
|
profile["dom.max_chrome_script_run_time"] = timeout
|
52
52
|
browser = Watir::Browser.new browser_name, :http_client => client, :profile => profile
|
53
|
-
elsif language ==
|
54
|
-
|
53
|
+
elsif configuration && configuration[:language] && browser_name == :firefox
|
54
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
55
|
+
profile["intl.accept_languages"] = configuration[:language]
|
56
|
+
browser = Watir::Browser.new browser_name, profile: profile
|
57
|
+
elsif configuration && configuration[:language] && browser_name == :chrome
|
58
|
+
prefs = {intl: {accept_languages: configuration[:language]}}
|
59
|
+
browser = Watir::Browser.new browser_name, prefs: prefs
|
60
|
+
elsif configuration && configuration[:language] && browser_name == :phantomjs
|
61
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.phantomjs
|
62
|
+
capabilities["phantomjs.page.customHeaders.Accept-Language"] = configuration[:language]
|
63
|
+
browser = Watir::Browser.new browser_name, desired_capabilities: capabilities
|
64
|
+
elsif configuration && configuration[:user_agent] && browser_name == :firefox
|
65
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
66
|
+
profile["general.useragent.override"] = configuration[:user_agent]
|
67
|
+
browser = Watir::Browser.new browser_name, profile: profile
|
55
68
|
else
|
56
|
-
|
57
|
-
profile = Selenium::WebDriver::Firefox::Profile.new
|
58
|
-
profile["intl.accept_languages"] = language
|
59
|
-
browser = Watir::Browser.new browser_name, profile: profile
|
60
|
-
elsif browser_name == :chrome
|
61
|
-
profile = Selenium::WebDriver::Chrome::Profile.new
|
62
|
-
profile["intl.accept_languages"] = language
|
63
|
-
browser = Watir::Browser.new browser_name, profile: profile
|
64
|
-
elsif browser_name == :phantomjs
|
65
|
-
capabilities = Selenium::WebDriver::Remote::Capabilities.phantomjs
|
66
|
-
capabilities["phantomjs.page.customHeaders.Accept-Language"] = language
|
67
|
-
browser = Watir::Browser.new browser_name, desired_capabilities: capabilities
|
68
|
-
else
|
69
|
-
raise "Changing default language is currently supported only for Chrome, Firefox and PhantomJS!"
|
70
|
-
end
|
69
|
+
browser = Watir::Browser.new browser_name
|
71
70
|
end
|
72
71
|
|
73
72
|
browser.window.resize_to 1280, 1024
|
@@ -83,13 +82,13 @@ RestClient::Request.execute(
|
|
83
82
|
:payload => json
|
84
83
|
)
|
85
84
|
end
|
86
|
-
def sauce_browser(test_name,
|
85
|
+
def sauce_browser(test_name, configuration)
|
87
86
|
abort "Environment variables BROWSER, PLATFORM and VERSION have to be set" if (ENV["BROWSER"] == nil) or (ENV["PLATFORM"] == nil) or (ENV["VERSION"] == nil)
|
88
87
|
|
89
88
|
require "selenium/webdriver/remote/http/persistent" # http_client
|
90
89
|
client = Selenium::WebDriver::Remote::Http::Persistent.new
|
91
90
|
|
92
|
-
if
|
91
|
+
if ENV["BROWSER_TIMEOUT"] && ENV["BROWSER"] == "firefox"
|
93
92
|
timeout = ENV["BROWSER_TIMEOUT"].to_i
|
94
93
|
client.timeout = timeout
|
95
94
|
|
@@ -97,16 +96,20 @@ def sauce_browser(test_name, language)
|
|
97
96
|
profile["dom.max_script_run_time"] = timeout
|
98
97
|
profile["dom.max_chrome_script_run_time"] = timeout
|
99
98
|
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
|
100
|
-
elsif language == "
|
101
|
-
caps = Selenium::WebDriver::Remote::Capabilities.send(ENV["BROWSER"])
|
102
|
-
elsif ENV["BROWSER"] == "firefox"
|
99
|
+
elsif configuration && configuration[:language] && ENV["BROWSER"] == "firefox"
|
103
100
|
profile = Selenium::WebDriver::Firefox::Profile.new
|
104
|
-
profile["intl.accept_languages"] = language
|
101
|
+
profile["intl.accept_languages"] = configuration[:language]
|
105
102
|
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
|
106
|
-
elsif ENV["BROWSER"] == "chrome"
|
103
|
+
elsif configuration && configuration[:language] && ENV["BROWSER"] == "chrome"
|
107
104
|
profile = Selenium::WebDriver::Chrome::Profile.new
|
108
|
-
profile["intl.accept_languages"] = language
|
105
|
+
profile["intl.accept_languages"] = configuration[:language]
|
109
106
|
caps = Selenium::WebDriver::Remote::Capabilities.chrome("chrome.profile" => profile.as_json["zip"])
|
107
|
+
elsif configuration && configuration[:user_agent] && ENV["BROWSER"] == "firefox"
|
108
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
109
|
+
profile["general.useragent.override"] = configuration[:user_agent]
|
110
|
+
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:firefox_profile => profile)
|
111
|
+
else
|
112
|
+
caps = Selenium::WebDriver::Remote::Capabilities.send(ENV["BROWSER"])
|
110
113
|
end
|
111
114
|
|
112
115
|
caps.platform = ENV["PLATFORM"]
|
@@ -26,7 +26,7 @@ Before do |scenario|
|
|
26
26
|
elsif scenario.source_tag_names.include? "@custom-browser"
|
27
27
|
# browser will be started in Cucumber step
|
28
28
|
else
|
29
|
-
@browser = browser(
|
29
|
+
@browser = browser(test_name(scenario))
|
30
30
|
$browser = @browser # CirrusSearch and VisualEditor need this
|
31
31
|
$session_id = @browser.driver.instance_variable_get(:@bridge).session_id
|
32
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mediawiki_selenium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris McMahon
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-03-
|
15
|
+
date: 2014-03-18 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: cucumber
|