testcentricity_web 4.3.1 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -12
- data/LICENSE.md +1 -1
- data/README.md +1794 -697
- data/lib/devices/devices.yml +144 -216
- data/lib/testcentricity_web/browser_helper.rb +33 -4
- data/lib/testcentricity_web/data_objects/environment.rb +96 -13
- data/lib/testcentricity_web/exception_queue_helper.rb +5 -6
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/page_object.rb +53 -49
- data/lib/testcentricity_web/web_core/page_objects_helper.rb +20 -11
- data/lib/testcentricity_web/web_core/page_section.rb +31 -34
- data/lib/testcentricity_web/web_core/webdriver_helper.rb +379 -252
- data/lib/testcentricity_web/web_elements/audio.rb +6 -4
- data/lib/testcentricity_web/web_elements/button.rb +7 -4
- data/lib/testcentricity_web/web_elements/checkbox.rb +149 -147
- data/lib/testcentricity_web/web_elements/file_field.rb +38 -36
- data/lib/testcentricity_web/web_elements/image.rb +75 -70
- data/lib/testcentricity_web/web_elements/label.rb +6 -4
- data/lib/testcentricity_web/web_elements/link.rb +15 -13
- data/lib/testcentricity_web/web_elements/list.rb +171 -169
- data/lib/testcentricity_web/web_elements/media.rb +384 -379
- data/lib/testcentricity_web/web_elements/radio.rb +135 -133
- data/lib/testcentricity_web/web_elements/range.rb +16 -29
- data/lib/testcentricity_web/web_elements/select_list.rb +247 -245
- data/lib/testcentricity_web/web_elements/table.rb +575 -573
- data/lib/testcentricity_web/web_elements/textfield.rb +143 -139
- data/lib/testcentricity_web/web_elements/ui_element.rb +1171 -0
- data/lib/testcentricity_web/web_elements/video.rb +39 -37
- data/lib/testcentricity_web/world_extensions.rb +37 -4
- data/lib/testcentricity_web.rb +4 -23
- metadata +27 -79
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +0 -1148
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'selenium-webdriver'
|
2
2
|
require 'os'
|
3
3
|
require 'browserstack/local'
|
4
|
-
require 'webdrivers'
|
5
4
|
require 'fileutils'
|
6
5
|
|
7
6
|
|
@@ -10,41 +9,47 @@ module TestCentricity
|
|
10
9
|
include Capybara::DSL
|
11
10
|
|
12
11
|
attr_accessor :bs_local
|
12
|
+
attr_accessor :initialized
|
13
13
|
attr_accessor :downloads_path
|
14
14
|
attr_accessor :endpoint
|
15
15
|
attr_accessor :capabilities
|
16
|
+
attr_accessor :drivers
|
16
17
|
|
17
18
|
def self.initialize_web_driver(options = nil)
|
19
|
+
@initialized ||= false
|
20
|
+
initialize_downloads unless @initialized
|
18
21
|
@endpoint = nil
|
19
22
|
@capabilities = nil
|
23
|
+
Environ.driver_name = nil
|
24
|
+
Environ.device_orientation = nil
|
20
25
|
if options.is_a?(String)
|
21
26
|
Capybara.app_host = options
|
22
27
|
elsif options.is_a?(Hash)
|
23
28
|
Capybara.app_host = options[:app_host] if options.key?(:app_host)
|
24
29
|
@endpoint = options[:endpoint] if options.key?(:endpoint)
|
25
|
-
@capabilities = options[:
|
30
|
+
@capabilities = options[:capabilities] if options.key?(:capabilities)
|
31
|
+
Environ.driver = options[:driver] if options.key?(:driver)
|
32
|
+
Environ.driver_name = options[:driver_name] if options.key?(:driver_name)
|
33
|
+
Environ.device_type = options[:device_type] if options.key?(:device_type)
|
34
|
+
Environ.browser_size = if options.key?(:browser_size)
|
35
|
+
options[:browser_size]
|
36
|
+
else
|
37
|
+
ENV['BROWSER_SIZE'] if ENV['BROWSER_SIZE']
|
38
|
+
end
|
26
39
|
end
|
27
40
|
# determine browser type and driver
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
:webdriver
|
33
|
-
end
|
34
|
-
# set downloads folder path
|
35
|
-
@downloads_path = "#{Dir.pwd}/downloads"
|
36
|
-
if ENV['PARALLEL']
|
37
|
-
Environ.parallel = true
|
38
|
-
Environ.process_num = ENV['TEST_ENV_NUMBER']
|
39
|
-
if Dir.exist?(@downloads_path)
|
40
|
-
@downloads_path = "#{@downloads_path}/#{ENV['TEST_ENV_NUMBER']}"
|
41
|
-
Dir.mkdir(@downloads_path) unless Dir.exist?(@downloads_path)
|
42
|
-
end
|
41
|
+
if @capabilities.nil?
|
42
|
+
Environ.driver = ENV['DRIVER'].downcase.to_sym if ENV['DRIVER']
|
43
|
+
Environ.browser = ENV['WEB_BROWSER'] if ENV['WEB_BROWSER']
|
44
|
+
Environ.device_orientation = ENV['ORIENTATION'] if ENV['ORIENTATION']
|
43
45
|
else
|
44
|
-
Environ.
|
46
|
+
Environ.browser = @capabilities[:browserName]
|
47
|
+
Environ.device_orientation = @capabilities[:orientation] if @capabilities[:orientation]
|
48
|
+
Environ.device_orientation = @capabilities[:'appium:orientation'] if @capabilities[:'appium:orientation']
|
45
49
|
end
|
46
|
-
|
47
|
-
|
50
|
+
Environ.browser = Environ.browser.downcase.to_sym if Environ.browser.is_a?(String)
|
51
|
+
Environ.driver = :webdriver if Environ.driver.nil?
|
52
|
+
Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
|
48
53
|
# assume that we're testing within a local desktop web browser
|
49
54
|
Environ.platform = :desktop
|
50
55
|
Environ.headless = false
|
@@ -56,13 +61,11 @@ module TestCentricity
|
|
56
61
|
initialize_appium
|
57
62
|
'Appium'
|
58
63
|
when :webdriver
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
'local browser instance'
|
65
|
-
end
|
64
|
+
initialize_local_browser
|
65
|
+
'local browser instance'
|
66
|
+
when :selenium_grid, :grid
|
67
|
+
initialize_remote
|
68
|
+
'Selenium Grid'
|
66
69
|
when :browserstack
|
67
70
|
initialize_browserstack
|
68
71
|
'Browserstack cloud service'
|
@@ -70,41 +73,76 @@ module TestCentricity
|
|
70
73
|
initialize_testingbot
|
71
74
|
'TestingBot cloud service'
|
72
75
|
# :nocov:
|
73
|
-
when :lambdatest
|
74
|
-
initialize_lambdatest
|
75
|
-
'LambdaTest cloud service'
|
76
76
|
when :saucelabs
|
77
77
|
initialize_saucelabs
|
78
78
|
'Sauce Labs cloud service'
|
79
|
+
when :lambdatest
|
80
|
+
initialize_lambdatest
|
81
|
+
'LambdaTest cloud service'
|
79
82
|
# :nocov:
|
83
|
+
else
|
84
|
+
raise "#{Environ.driver} is not a supported driver"
|
80
85
|
end
|
81
86
|
|
82
87
|
# set browser window size only if testing with a desktop web browser
|
83
|
-
unless Environ.is_device? || Environ.is_simulator? ||
|
88
|
+
unless Environ.is_device? || Environ.is_simulator? || Environ.driver == :appium
|
84
89
|
initialize_browser_size
|
85
90
|
end
|
86
91
|
|
87
92
|
# set Capybara's server port if PARALLEL_PORT is true
|
88
|
-
Capybara.server_port = 9887 + ENV['TEST_ENV_NUMBER'].to_i if
|
93
|
+
Capybara.server_port = 9887 + ENV['TEST_ENV_NUMBER'].to_i if Environ.parallel
|
89
94
|
|
90
95
|
Environ.session_state = :running
|
91
96
|
puts "Using #{Environ.browser} browser via #{context}"
|
97
|
+
# add the new driver to the driver queue
|
98
|
+
@drivers[Environ.driver_name] = Environ.driver_state
|
92
99
|
end
|
93
100
|
|
94
|
-
def self.
|
95
|
-
|
101
|
+
def self.activate_driver(driver_name)
|
102
|
+
driver_state = @drivers[driver_name]
|
103
|
+
raise "Could not find a driver named '#{driver_name}'" if driver_state.nil?
|
104
|
+
|
105
|
+
Environ.restore_driver_state(driver_state)
|
106
|
+
Capybara.current_driver = driver_name
|
107
|
+
Capybara.default_driver = driver_name
|
108
|
+
end
|
109
|
+
|
110
|
+
# Return the number of driver instances
|
111
|
+
#
|
112
|
+
# @return [Integer]
|
113
|
+
def self.num_drivers
|
114
|
+
@drivers.length
|
115
|
+
end
|
116
|
+
|
117
|
+
# Close all browsers and terminate all driver instances
|
118
|
+
def self.close_all_drivers
|
119
|
+
@drivers.each do |key, _value|
|
120
|
+
Environ.restore_driver_state(@drivers[key])
|
121
|
+
Capybara.current_driver = key
|
122
|
+
Capybara.default_driver = key
|
123
|
+
Capybara.page.driver.quit
|
124
|
+
Capybara.current_session.quit
|
125
|
+
@drivers.delete(key)
|
126
|
+
end
|
127
|
+
Capybara.reset_sessions!
|
128
|
+
Environ.session_state = :quit
|
129
|
+
Capybara.current_driver = nil
|
130
|
+
@drivers = {}
|
131
|
+
@initialized = false
|
96
132
|
end
|
97
133
|
|
98
134
|
def self.initialize_browser_size
|
99
|
-
# tile browser windows if
|
100
|
-
if ENV['
|
101
|
-
|
102
|
-
|
135
|
+
# tile browser windows if BROWSER_TILE environment variable is true and running in multiple parallel threads
|
136
|
+
if ENV['BROWSER_TILE'] && (Environ.parallel || @drivers.length > 1)
|
137
|
+
thread = if Environ.parallel
|
138
|
+
ENV['TEST_ENV_NUMBER'].to_i
|
139
|
+
else
|
140
|
+
@drivers.length
|
141
|
+
end
|
103
142
|
if thread > 1
|
104
143
|
Browsers.set_browser_window_position(100 * thread - 1, 100 * thread - 1)
|
105
144
|
sleep(1)
|
106
145
|
end
|
107
|
-
# :nocov:
|
108
146
|
else
|
109
147
|
Browsers.set_browser_window_position(10, 10)
|
110
148
|
sleep(1)
|
@@ -112,20 +150,30 @@ module TestCentricity
|
|
112
150
|
|
113
151
|
browser = Environ.browser.to_s
|
114
152
|
if Environ.is_desktop?
|
115
|
-
|
153
|
+
case
|
154
|
+
when ENV['BROWSER_SIZE'] == 'max'
|
116
155
|
Browsers.maximize_browser
|
117
|
-
|
156
|
+
when ENV['BROWSER_SIZE']
|
118
157
|
Browsers.set_browser_window_size(ENV['BROWSER_SIZE'])
|
158
|
+
when Environ.browser_size == 'max'
|
159
|
+
Browsers.maximize_browser
|
160
|
+
when Environ.browser_size
|
161
|
+
Browsers.set_browser_window_size(Environ.browser_size)
|
119
162
|
else
|
120
|
-
Browsers.set_browser_window_size(Browsers.browser_size(browser,
|
163
|
+
Browsers.set_browser_window_size(Browsers.browser_size(browser, Environ.device_orientation))
|
121
164
|
end
|
122
165
|
elsif Environ.is_mobile? && !Environ.is_device?
|
123
|
-
Browsers.set_browser_window_size(Browsers.browser_size(browser,
|
166
|
+
Browsers.set_browser_window_size(Browsers.browser_size(browser, Environ.device_orientation))
|
124
167
|
end
|
125
168
|
Environ.session_state = :running
|
126
169
|
end
|
127
170
|
|
128
171
|
# :nocov:
|
172
|
+
|
173
|
+
def self.set_domain(url)
|
174
|
+
Capybara.app_host = url
|
175
|
+
end
|
176
|
+
|
129
177
|
def self.close_tunnel
|
130
178
|
unless @bs_local.nil?
|
131
179
|
@bs_local.stop
|
@@ -140,86 +188,98 @@ module TestCentricity
|
|
140
188
|
|
141
189
|
private
|
142
190
|
|
191
|
+
def self.initialize_downloads
|
192
|
+
@drivers = {}
|
193
|
+
# set downloads folder path
|
194
|
+
@downloads_path = "#{Dir.pwd}/downloads"
|
195
|
+
if ENV['PARALLEL']
|
196
|
+
Environ.parallel = true
|
197
|
+
Environ.process_num = ENV['TEST_ENV_NUMBER']
|
198
|
+
Environ.process_num = '1' if Environ.process_num.blank?
|
199
|
+
if Dir.exist?(@downloads_path)
|
200
|
+
@downloads_path = "#{@downloads_path}/#{Environ.process_num}"
|
201
|
+
Dir.mkdir(@downloads_path) unless Dir.exist?(@downloads_path)
|
202
|
+
end
|
203
|
+
else
|
204
|
+
Environ.parallel = false
|
205
|
+
end
|
206
|
+
@downloads_path = @downloads_path.tr('/', "\\") if OS.windows?
|
207
|
+
@initialized = true
|
208
|
+
end
|
209
|
+
|
143
210
|
def self.initialize_appium
|
144
211
|
Environ.platform = :mobile
|
145
212
|
Environ.device = :simulator
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
end
|
213
|
+
# define capabilities
|
214
|
+
caps = if @capabilities.nil?
|
215
|
+
Environ.browser = ENV['APP_BROWSER']
|
216
|
+
Environ.device_name = ENV['APP_DEVICE']
|
217
|
+
Environ.device_os = ENV['APP_PLATFORM_NAME'].downcase.to_sym
|
218
|
+
Environ.device_os_version = ENV['APP_VERSION']
|
219
|
+
caps = {
|
220
|
+
platformName: Environ.device_os,
|
221
|
+
browserName: Environ.browser,
|
222
|
+
'appium:platformVersion': Environ.device_os_version,
|
223
|
+
'appium:deviceName': Environ.device_name
|
224
|
+
}
|
225
|
+
caps[:'appium:avd'] = ENV['APP_DEVICE'] if Environ.device_os == :android
|
226
|
+
caps[:'appium:automationName'] = ENV['AUTOMATION_ENGINE'] if ENV['AUTOMATION_ENGINE']
|
227
|
+
if ENV['UDID']
|
228
|
+
# :nocov:
|
229
|
+
Environ.device = :device
|
230
|
+
caps[:'appium:udid'] = ENV['UDID']
|
231
|
+
caps[:'appium:xcodeOrgId'] = ENV['TEAM_ID'] if ENV['TEAM_ID']
|
232
|
+
caps[:'appium:xcodeSigningId'] = ENV['TEAM_NAME'] if ENV['TEAM_NAME']
|
233
|
+
# :nocov:
|
234
|
+
else
|
235
|
+
caps[:'appium:orientation'] = Environ.device_orientation.upcase if Environ.device_orientation
|
236
|
+
if Environ.device_os == :ios
|
237
|
+
caps[:'appium:language'] = Environ.language if Environ.language
|
238
|
+
caps[:'appium:locale'] = Environ.locale.gsub('-', '_') if Environ.locale
|
239
|
+
end
|
240
|
+
end
|
241
|
+
caps[:'appium:safariIgnoreFraudWarning'] = ENV['APP_IGNORE_FRAUD_WARNING'] if ENV['APP_IGNORE_FRAUD_WARNING']
|
242
|
+
caps[:'appium:safariInitialUrl'] = ENV['APP_INITIAL_URL'] if ENV['APP_INITIAL_URL']
|
243
|
+
caps[:'appium:safariAllowPopups'] = ENV['APP_ALLOW_POPUPS'] if ENV['APP_ALLOW_POPUPS']
|
244
|
+
caps[:'appium:shutdownOtherSimulators'] = ENV['SHUTDOWN_OTHER_SIMS'] if ENV['SHUTDOWN_OTHER_SIMS']
|
245
|
+
caps[:'appium:forceSimulatorSoftwareKeyboardPresence'] = ENV['SHOW_SIM_KEYBOARD'] if ENV['SHOW_SIM_KEYBOARD']
|
246
|
+
|
247
|
+
caps[:'appium:autoAcceptAlerts'] = ENV['AUTO_ACCEPT_ALERTS'] if ENV['AUTO_ACCEPT_ALERTS']
|
248
|
+
caps[:'appium:autoDismissAlerts'] = ENV['AUTO_DISMISS_ALERTS'] if ENV['AUTO_DISMISS_ALERTS']
|
249
|
+
caps[:'appium:isHeadless'] = ENV['HEADLESS'] if ENV['HEADLESS']
|
250
|
+
|
251
|
+
caps[:'appium:newCommandTimeout'] = ENV['NEW_COMMAND_TIMEOUT'] if ENV['NEW_COMMAND_TIMEOUT']
|
252
|
+
caps[:'appium:noReset'] = ENV['APP_NO_RESET'] if ENV['APP_NO_RESET']
|
253
|
+
caps[:'appium:fullReset'] = ENV['APP_FULL_RESET'] if ENV['APP_FULL_RESET']
|
254
|
+
caps[:'appium:webkitDebugProxyPort'] = ENV['WEBKIT_DEBUG_PROXY_PORT'] if ENV['WEBKIT_DEBUG_PROXY_PORT']
|
255
|
+
caps[:'appium:webDriverAgentUrl'] = ENV['WEBDRIVER_AGENT_URL'] if ENV['WEBDRIVER_AGENT_URL']
|
256
|
+
caps[:'appium:usePrebuiltWDA'] = ENV['USE_PREBUILT_WDA'] if ENV['USE_PREBUILT_WDA']
|
257
|
+
caps[:'appium:useNewWDA'] = ENV['USE_NEW_WDA'] if ENV['USE_NEW_WDA']
|
258
|
+
caps[:'appium:chromedriverExecutable'] = ENV['CHROMEDRIVER_EXECUTABLE'] if ENV['CHROMEDRIVER_EXECUTABLE']
|
259
|
+
# set wdaLocalPort (iOS) or systemPort (Android) if PARALLEL_PORT is true
|
260
|
+
if Environ.parallel
|
261
|
+
# :nocov:
|
262
|
+
if Environ.device_os == :ios
|
263
|
+
caps[:'appium:wdaLocalPort'] = 8100 + ENV['TEST_ENV_NUMBER'].to_i
|
264
|
+
else
|
265
|
+
caps[:'appium:systemPort'] = 8200 + ENV['TEST_ENV_NUMBER'].to_i
|
266
|
+
end
|
267
|
+
# :nocov:
|
268
|
+
else
|
269
|
+
caps[:'appium:wdaLocalPort'] = ENV['WDA_LOCAL_PORT'] if ENV['WDA_LOCAL_PORT']
|
270
|
+
caps[:'appium:systemPort'] = ENV['SYSTEM_PORT'] if ENV['SYSTEM_PORT']
|
271
|
+
end
|
272
|
+
caps
|
273
|
+
else
|
274
|
+
Environ.device_os = @capabilities[:platformName]
|
275
|
+
Environ.device_os_version = @capabilities[:'appium:platformVersion']
|
276
|
+
Environ.device_name = @capabilities[:'appium:deviceName']
|
277
|
+
@capabilities
|
278
|
+
end
|
213
279
|
# specify endpoint url
|
214
280
|
@endpoint = 'http://localhost:4723/wd/hub' if @endpoint.nil?
|
215
281
|
|
216
|
-
|
217
|
-
all_options = {
|
218
|
-
appium_lib: { server_url: @endpoint },
|
219
|
-
caps: desired_capabilities
|
220
|
-
}
|
221
|
-
Appium::Capybara::Driver.new(app, all_options)
|
222
|
-
end
|
282
|
+
register_remote_driver(Environ.browser, caps)
|
223
283
|
end
|
224
284
|
|
225
285
|
def self.initialize_local_browser
|
@@ -235,83 +295,72 @@ module TestCentricity
|
|
235
295
|
'unknown'
|
236
296
|
# :nocov:
|
237
297
|
end
|
238
|
-
|
239
|
-
|
240
|
-
case browser
|
241
|
-
when :firefox, :chrome, :ie, :safari, :edge
|
298
|
+
case Environ.browser
|
299
|
+
when :firefox, :chrome, :safari, :edge, :chrome_headless, :firefox_headless, :edge_headless
|
242
300
|
Environ.platform = :desktop
|
243
|
-
when :chrome_headless, :firefox_headless, :edge_headless
|
244
|
-
Environ.platform = :desktop
|
245
|
-
Environ.headless = true
|
246
301
|
else
|
247
302
|
Environ.platform = :mobile
|
248
303
|
Environ.device_name = Browsers.mobile_device_name(Environ.browser)
|
249
304
|
end
|
250
305
|
|
251
|
-
Capybara.register_driver
|
306
|
+
Capybara.register_driver driver_name do |app|
|
307
|
+
browser = Environ.browser
|
252
308
|
case browser
|
253
|
-
when :safari
|
309
|
+
when :safari
|
254
310
|
Capybara::Selenium::Driver.new(app, browser: browser)
|
255
311
|
when :firefox, :firefox_headless
|
256
312
|
options = firefox_options(browser)
|
257
|
-
Capybara::Selenium::Driver.new(app, browser: :firefox,
|
313
|
+
Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
|
258
314
|
when :chrome, :chrome_headless
|
259
315
|
options = chrome_edge_options(browser)
|
260
|
-
Capybara::Selenium::Driver.new(app, browser: :chrome,
|
316
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
|
261
317
|
when :edge, :edge_headless
|
262
318
|
options = chrome_edge_options(browser)
|
263
|
-
Capybara::Selenium::Driver.new(app, browser: :edge,
|
319
|
+
Capybara::Selenium::Driver.new(app, browser: :edge, options: options)
|
264
320
|
else
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
Capybara::Selenium::Driver.new(app, browser: :chrome, capabilities: [options])
|
272
|
-
else
|
273
|
-
raise "Requested browser '#{browser}' is not supported"
|
274
|
-
end
|
321
|
+
user_agent = Browsers.mobile_device_agent(Environ.browser)
|
322
|
+
options = Selenium::WebDriver::Chrome::Options.new(exclude_switches: ['enable-automation'])
|
323
|
+
options.add_argument('--disable-dev-shm-usage')
|
324
|
+
options.add_argument("--user-agent='#{user_agent}'")
|
325
|
+
options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
|
326
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
|
275
327
|
end
|
276
328
|
end
|
277
|
-
Capybara.default_driver =
|
329
|
+
Capybara.default_driver = Environ.driver_name
|
278
330
|
end
|
279
331
|
|
280
332
|
def self.initialize_remote
|
281
333
|
Environ.grid = :selenium_grid
|
282
|
-
browser
|
283
|
-
@endpoint =
|
284
|
-
|
334
|
+
browser = Environ.browser
|
335
|
+
@endpoint = if @endpoint.nil?
|
336
|
+
ENV['REMOTE_ENDPOINT'] if ENV['REMOTE_ENDPOINT']
|
337
|
+
else
|
338
|
+
'http://localhost:4444/wd/hub'
|
339
|
+
end
|
285
340
|
case browser
|
286
341
|
# :nocov:
|
287
342
|
when :safari
|
288
343
|
options = Selenium::WebDriver::Safari::Options.new
|
289
|
-
when :ie
|
290
|
-
options = Selenium::WebDriver::IE::Options.new
|
291
344
|
# :nocov:
|
292
345
|
when :firefox, :firefox_headless
|
293
346
|
options = firefox_options(browser)
|
294
347
|
when :chrome, :chrome_headless, :edge, :edge_headless
|
295
348
|
options = chrome_edge_options(browser)
|
296
349
|
else
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
|
305
|
-
else
|
306
|
-
raise "Requested browser '#{browser}' is not supported on Selenium Grid"
|
307
|
-
end
|
350
|
+
Environ.platform = :mobile
|
351
|
+
Environ.device_name = Browsers.mobile_device_name(Environ.browser)
|
352
|
+
user_agent = Browsers.mobile_device_agent(Environ.browser)
|
353
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
354
|
+
options.add_argument('--disable-dev-shm-usage')
|
355
|
+
options.add_argument("--user-agent='#{user_agent}'")
|
356
|
+
options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
|
308
357
|
end
|
309
358
|
|
310
|
-
Capybara.register_driver
|
359
|
+
Capybara.register_driver driver_name do |app|
|
311
360
|
Capybara::Selenium::Driver.new(app,
|
312
361
|
browser: :remote,
|
313
362
|
url: @endpoint,
|
314
|
-
|
363
|
+
options: options).tap do |driver|
|
315
364
|
# configure file_detector for remote uploads
|
316
365
|
driver.browser.file_detector = lambda do |args|
|
317
366
|
str = args.first.to_s
|
@@ -319,19 +368,23 @@ module TestCentricity
|
|
319
368
|
end
|
320
369
|
end
|
321
370
|
end
|
322
|
-
Capybara.current_driver =
|
323
|
-
Capybara.default_driver =
|
371
|
+
Capybara.current_driver = Environ.driver_name
|
372
|
+
Capybara.default_driver = Environ.driver_name
|
324
373
|
end
|
325
374
|
|
326
375
|
def self.initialize_browserstack
|
327
|
-
browser
|
376
|
+
# determine browser type
|
377
|
+
Environ.browser = if @capabilities.nil?
|
378
|
+
ENV['BS_BROWSER'] if ENV['BS_BROWSER']
|
379
|
+
else
|
380
|
+
@capabilities[:browserName]
|
381
|
+
end
|
382
|
+
browser = Environ.browser
|
328
383
|
Environ.grid = :browserstack
|
329
|
-
Environ.os = "#{ENV['BS_OS']} #{ENV['BS_OS_VERSION']}"
|
330
384
|
if ENV['BS_REAL_MOBILE'] || ENV['BS_DEVICE']
|
331
385
|
Environ.platform = :mobile
|
332
386
|
Environ.device_name = ENV['BS_DEVICE']
|
333
387
|
Environ.device_os = ENV['BS_OS']
|
334
|
-
Environ.device_orientation = ENV['ORIENTATION'] if ENV['ORIENTATION']
|
335
388
|
Environ.device = if ENV['BS_REAL_MOBILE']
|
336
389
|
:device
|
337
390
|
else
|
@@ -339,7 +392,7 @@ module TestCentricity
|
|
339
392
|
end
|
340
393
|
end
|
341
394
|
# specify endpoint url
|
342
|
-
@endpoint = "
|
395
|
+
@endpoint = "https://#{ENV['BS_USERNAME']}:#{ENV['BS_AUTHKEY']}@hub-cloud.browserstack.com/wd/hub" if @endpoint.nil?
|
343
396
|
# :nocov:
|
344
397
|
# enable tunneling if specified
|
345
398
|
if ENV['TUNNELING']
|
@@ -355,6 +408,7 @@ module TestCentricity
|
|
355
408
|
# :nocov:
|
356
409
|
# define BrowserStack options
|
357
410
|
options = if @capabilities.nil?
|
411
|
+
Environ.os = "#{ENV['BS_OS']} #{ENV['BS_OS_VERSION']}"
|
358
412
|
browser_options = {}
|
359
413
|
# define the required set of BrowserStack options
|
360
414
|
bs_options = {
|
@@ -401,7 +455,7 @@ module TestCentricity
|
|
401
455
|
else
|
402
456
|
# define desktop browser options
|
403
457
|
bs_options[:resolution] = ENV['RESOLUTION'] if ENV['RESOLUTION']
|
404
|
-
bs_options[:seleniumVersion] = '4.
|
458
|
+
bs_options[:seleniumVersion] = '4.15.0'
|
405
459
|
{
|
406
460
|
browserName: browser,
|
407
461
|
browserVersion: ENV['BS_VERSION'],
|
@@ -409,42 +463,57 @@ module TestCentricity
|
|
409
463
|
}
|
410
464
|
end
|
411
465
|
else
|
466
|
+
bs_options = @capabilities[:'bstack:options']
|
467
|
+
Environ.os = "#{bs_options[:os]} #{bs_options[:osVersion]}"
|
468
|
+
if bs_options.key?(:deviceName)
|
469
|
+
Environ.platform = :mobile
|
470
|
+
Environ.device_name = bs_options[:deviceName]
|
471
|
+
Environ.device_os = bs_options[:osVersion]
|
472
|
+
Environ.device = if bs_options.key?(:realMobile)
|
473
|
+
:device
|
474
|
+
else
|
475
|
+
:simulator
|
476
|
+
end
|
477
|
+
Environ.device_orientation = bs_options[:deviceOrientation] if bs_options.key?(:deviceOrientation)
|
478
|
+
end
|
412
479
|
@capabilities
|
413
480
|
end
|
414
|
-
register_remote_driver(
|
415
|
-
# configure file_detector for remote uploads
|
416
|
-
config_file_uploads
|
481
|
+
register_remote_driver(browser, options)
|
482
|
+
# configure file_detector for remote uploads if target is desktop web browser
|
483
|
+
config_file_uploads if Environ.platform == :desktop
|
417
484
|
Environ.tunneling = ENV['TUNNELING'] if ENV['TUNNELING']
|
418
|
-
Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
|
419
485
|
end
|
420
486
|
|
421
487
|
def self.initialize_testingbot
|
422
|
-
browser
|
488
|
+
# determine browser type
|
489
|
+
Environ.browser = if @capabilities.nil?
|
490
|
+
ENV['TB_BROWSER'] if ENV['TB_BROWSER']
|
491
|
+
else
|
492
|
+
@capabilities[:browserName]
|
493
|
+
end
|
494
|
+
browser = Environ.browser
|
423
495
|
Environ.grid = :testingbot
|
424
|
-
|
425
|
-
Environ.os = ENV['TB_OS']
|
426
496
|
if ENV['TB_PLATFORM']
|
427
|
-
Environ.
|
428
|
-
Environ.device_os = ENV['TB_PLATFORM']
|
497
|
+
Environ.device_os = ENV['TB_PLATFORM']
|
429
498
|
Environ.device_name = ENV['TB_DEVICE']
|
430
|
-
Environ.
|
431
|
-
Environ.
|
432
|
-
Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
|
499
|
+
Environ.platform = :mobile
|
500
|
+
Environ.device = :simulator
|
433
501
|
else
|
434
502
|
Environ.platform = :desktop
|
435
503
|
end
|
436
504
|
# specify endpoint url
|
437
505
|
if @endpoint.nil?
|
438
506
|
url = ENV['TUNNELING'] ? '@localhost:4445/wd/hub' : '@hub.testingbot.com/wd/hub'
|
439
|
-
@endpoint = "
|
507
|
+
@endpoint = "https://#{ENV['TB_USERNAME']}:#{ENV['TB_AUTHKEY']}#{url}"
|
440
508
|
end
|
441
509
|
# define TestingBot options
|
442
510
|
options = if @capabilities.nil?
|
511
|
+
Environ.os = ENV['TB_OS']
|
443
512
|
# define the required set of TestingBot options
|
444
513
|
tb_options = { build: test_context_message }
|
445
514
|
# define the optional TestingBot options
|
446
515
|
tb_options[:name] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
|
447
|
-
tb_options[
|
516
|
+
tb_options[:timeZone] = ENV['TIME_ZONE'] if ENV['TIME_ZONE']
|
448
517
|
tb_options['testingbot.geoCountryCode'] = ENV['GEO_LOCATION'] if ENV['GEO_LOCATION']
|
449
518
|
tb_options[:screenrecorder] = ENV['RECORD_VIDEO'] if ENV['RECORD_VIDEO']
|
450
519
|
tb_options[:screenshot] = ENV['SCREENSHOTS'] if ENV['SCREENSHOTS']
|
@@ -456,7 +525,7 @@ module TestCentricity
|
|
456
525
|
else
|
457
526
|
# define desktop browser options
|
458
527
|
tb_options['screen-resolution'] = ENV['RESOLUTION'] if ENV['RESOLUTION']
|
459
|
-
tb_options['selenium-version'] = '4.
|
528
|
+
tb_options['selenium-version'] = '4.14.1'
|
460
529
|
end
|
461
530
|
{
|
462
531
|
browserName: browser,
|
@@ -465,24 +534,112 @@ module TestCentricity
|
|
465
534
|
'tb:options': tb_options
|
466
535
|
}
|
467
536
|
else
|
537
|
+
tb_options = @capabilities[:'tb:options']
|
538
|
+
Environ.os = @capabilities[:platformName]
|
539
|
+
if tb_options.key?(:deviceName)
|
540
|
+
Environ.platform = :mobile
|
541
|
+
Environ.device_name = tb_options[:deviceName]
|
542
|
+
Environ.device_os = @capabilities[:browserVersion]
|
543
|
+
Environ.device_orientation = tb_options[:orientation] if tb_options.key?(:orientation)
|
544
|
+
Environ.device = :simulator
|
545
|
+
end
|
468
546
|
@capabilities
|
469
547
|
end
|
470
|
-
register_remote_driver(
|
548
|
+
register_remote_driver(browser, options)
|
471
549
|
# configure file_detector for remote uploads if target is desktop web browser
|
472
|
-
config_file_uploads
|
550
|
+
config_file_uploads if Environ.platform == :desktop
|
473
551
|
end
|
474
552
|
|
475
553
|
# :nocov:
|
554
|
+
def self.initialize_saucelabs
|
555
|
+
# determine browser type
|
556
|
+
Environ.browser = if @capabilities.nil?
|
557
|
+
ENV['SL_BROWSER'] if ENV['SL_BROWSER']
|
558
|
+
else
|
559
|
+
@capabilities[:browserName]
|
560
|
+
end
|
561
|
+
browser = Environ.browser
|
562
|
+
Environ.grid = :saucelabs
|
563
|
+
|
564
|
+
if ENV['SL_PLATFORM']
|
565
|
+
Environ.device_name = ENV['SL_DEVICE']
|
566
|
+
Environ.platform = :mobile
|
567
|
+
Environ.device = :simulator
|
568
|
+
elsif ENV['SL_OS']
|
569
|
+
Environ.platform = :desktop
|
570
|
+
Environ.os = ENV['SL_OS']
|
571
|
+
end
|
572
|
+
# specify endpoint url
|
573
|
+
if @endpoint.nil?
|
574
|
+
@endpoint = "https://#{ENV['SL_USERNAME']}:#{ENV['SL_AUTHKEY']}@ondemand.#{ENV['DATA_CENTER']}.saucelabs.com:443/wd/hub"
|
575
|
+
end
|
576
|
+
# define SauceLab options
|
577
|
+
options = if @capabilities.nil?
|
578
|
+
# define the required set of SauceLab options
|
579
|
+
sl_options = {
|
580
|
+
username: ENV['SL_USERNAME'],
|
581
|
+
access_key: ENV['SL_AUTHKEY'],
|
582
|
+
build: test_context_message
|
583
|
+
}
|
584
|
+
# define the optional SauceLab options
|
585
|
+
sl_options[:name] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
|
586
|
+
sl_options[:recordVideo] = ENV['RECORD_VIDEO'] if ENV['RECORD_VIDEO']
|
587
|
+
sl_options[:recordScreenshots] = ENV['SCREENSHOTS'] if ENV['SCREENSHOTS']
|
588
|
+
# define mobile device options
|
589
|
+
if ENV['SL_PLATFORM']
|
590
|
+
sl_options[:deviceOrientation] = ENV['ORIENTATION'].upcase if ENV['ORIENTATION']
|
591
|
+
sl_options[:appium_version] = '1.22.3'
|
592
|
+
{
|
593
|
+
browserName: browser,
|
594
|
+
platform_name: ENV['SL_PLATFORM'],
|
595
|
+
'appium:deviceName': ENV['SL_DEVICE'],
|
596
|
+
'appium:platformVersion': ENV['SL_VERSION'],
|
597
|
+
'appium:automationName': ENV['AUTOMATION_ENGINE'],
|
598
|
+
'sauce:options': sl_options
|
599
|
+
}
|
600
|
+
else
|
601
|
+
# define desktop browser options
|
602
|
+
sl_options[:screenResolution] = ENV['RESOLUTION'] if ENV['RESOLUTION']
|
603
|
+
{
|
604
|
+
browserName: browser,
|
605
|
+
browser_version: ENV['SL_VERSION'],
|
606
|
+
platform_name: ENV['SL_OS'],
|
607
|
+
'sauce:options': sl_options
|
608
|
+
}
|
609
|
+
end
|
610
|
+
else
|
611
|
+
sl_options = @capabilities[:'sauce:options']
|
612
|
+
Environ.os = @capabilities[:platform_name]
|
613
|
+
if @capabilities.key?(:'appium:deviceName')
|
614
|
+
Environ.platform = :mobile
|
615
|
+
Environ.device_name = @capabilities[:'appium:deviceName']
|
616
|
+
Environ.device_os = @capabilities[:'appium:platformVersion']
|
617
|
+
Environ.device = :simulator
|
618
|
+
Environ.device_orientation = sl_options[:deviceOrientation] if sl_options.key?(:deviceOrientation)
|
619
|
+
end
|
620
|
+
@capabilities
|
621
|
+
end
|
622
|
+
register_remote_driver(browser, options)
|
623
|
+
# configure file_detector for remote uploads
|
624
|
+
config_file_uploads if Environ.platform == :desktop
|
625
|
+
end
|
626
|
+
|
476
627
|
def self.initialize_lambdatest
|
477
|
-
browser
|
628
|
+
# determine browser type
|
629
|
+
Environ.browser = if @capabilities.nil?
|
630
|
+
ENV['LT_BROWSER'] if ENV['LT_BROWSER']
|
631
|
+
else
|
632
|
+
@capabilities[:browserName]
|
633
|
+
end
|
634
|
+
browser = Environ.browser
|
478
635
|
Environ.grid = :lambdatest
|
479
|
-
Environ.os = ENV['LT_OS']
|
480
636
|
Environ.platform = :desktop
|
481
637
|
Environ.tunneling = ENV['TUNNELING'] if ENV['TUNNELING']
|
482
638
|
# specify endpoint url
|
483
639
|
@endpoint = "https://#{ENV['LT_USERNAME']}:#{ENV['LT_AUTHKEY']}@hub.lambdatest.com/wd/hub" if @endpoint.nil?
|
484
640
|
# define LambdaTest options
|
485
641
|
options = if @capabilities.nil?
|
642
|
+
Environ.os = ENV['LT_OS']
|
486
643
|
# define the required set of LambdaTest options
|
487
644
|
lt_options = {
|
488
645
|
user: ENV['LT_USERNAME'],
|
@@ -490,7 +647,7 @@ module TestCentricity
|
|
490
647
|
build: test_context_message,
|
491
648
|
platformName: ENV['LT_OS'],
|
492
649
|
resolution: ENV['RESOLUTION'],
|
493
|
-
selenium_version: '4.
|
650
|
+
selenium_version: '4.13.0',
|
494
651
|
}
|
495
652
|
# define the optional LambdaTest options
|
496
653
|
lt_options[:name] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
|
@@ -517,76 +674,23 @@ module TestCentricity
|
|
517
674
|
'LT:Options': lt_options
|
518
675
|
}
|
519
676
|
else
|
677
|
+
Environ.os = @capabilities[:platform_name]
|
520
678
|
@capabilities
|
521
679
|
end
|
522
|
-
register_remote_driver(
|
523
|
-
# configure file_detector for remote uploads
|
524
|
-
config_file_uploads
|
525
|
-
end
|
526
|
-
|
527
|
-
def self.initialize_saucelabs
|
528
|
-
browser = ENV['SL_BROWSER']
|
529
|
-
Environ.grid = :saucelabs
|
530
|
-
|
531
|
-
if ENV['SL_OS']
|
532
|
-
Environ.platform = :desktop
|
533
|
-
Environ.os = ENV['SL_OS']
|
534
|
-
elsif ENV['SL_PLATFORM']
|
535
|
-
Environ.device_name = ENV['SL_DEVICE']
|
536
|
-
Environ.platform = :mobile
|
537
|
-
Environ.device_orientation = ENV['ORIENTATION'] if ENV['ORIENTATION']
|
538
|
-
Environ.device = :simulator
|
539
|
-
end
|
540
|
-
# specify endpoint url
|
541
|
-
@endpoint = "https://#{ENV['SL_USERNAME']}:#{ENV['SL_AUTHKEY']}@ondemand.#{ENV['DATA_CENTER']}.saucelabs.com/wd/hub" if @endpoint.nil?
|
542
|
-
# define SauceLab options
|
543
|
-
options = if @capabilities.nil?
|
544
|
-
# define the required set of SauceLab options
|
545
|
-
sl_options = {
|
546
|
-
userName: ENV['SL_USERNAME'],
|
547
|
-
accessKey: ENV['SL_AUTHKEY'],
|
548
|
-
build: test_context_message
|
549
|
-
}
|
550
|
-
# define the optional SauceLab options
|
551
|
-
sl_options[:name] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
|
552
|
-
sl_options[:recordVideo] = ENV['RECORD_VIDEO'] if ENV['RECORD_VIDEO']
|
553
|
-
sl_options[:recordScreenshots] = ENV['SCREENSHOTS'] if ENV['SCREENSHOTS']
|
554
|
-
# define mobile device options
|
555
|
-
if ENV['SL_PLATFORM']
|
556
|
-
sl_options[:deviceOrientation] = ENV['ORIENTATION'].upcase if ENV['ORIENTATION']
|
557
|
-
sl_options[:appiumVersion] = '1.22.3'
|
558
|
-
{
|
559
|
-
browserName: browser,
|
560
|
-
platformName: ENV['SL_PLATFORM'],
|
561
|
-
'appium:deviceName': ENV['SL_DEVICE'],
|
562
|
-
'appium:platformVersion': ENV['SL_VERSION'],
|
563
|
-
'sauce:options': sl_options
|
564
|
-
}
|
565
|
-
else
|
566
|
-
# define desktop browser options
|
567
|
-
sl_options[:screenResolution] = ENV['RESOLUTION'] if ENV['RESOLUTION']
|
568
|
-
{
|
569
|
-
browserName: browser,
|
570
|
-
browserVersion: ENV['SL_VERSION'],
|
571
|
-
platformName: ENV['SL_OS'],
|
572
|
-
'sauce:options': sl_options
|
573
|
-
}
|
574
|
-
end
|
575
|
-
else
|
576
|
-
@capabilities
|
577
|
-
end
|
578
|
-
register_remote_driver(:saucelabs, browser, options)
|
680
|
+
register_remote_driver(browser, options)
|
579
681
|
# configure file_detector for remote uploads
|
580
|
-
config_file_uploads
|
682
|
+
config_file_uploads if Environ.platform == :desktop
|
581
683
|
end
|
582
684
|
# :nocov:
|
583
685
|
|
584
686
|
def self.chrome_edge_options(browser)
|
585
687
|
options = case browser
|
586
688
|
when :chrome, :chrome_headless
|
587
|
-
Selenium::WebDriver::Chrome::Options.new
|
689
|
+
Selenium::WebDriver::Chrome::Options.new(exclude_switches: ['enable-automation'])
|
588
690
|
when :edge, :edge_headless
|
589
|
-
Selenium::WebDriver::Edge::Options.new
|
691
|
+
Selenium::WebDriver::Edge::Options.new(exclude_switches: ['enable-automation'])
|
692
|
+
else
|
693
|
+
raise "#{browser} is not a valid selector"
|
590
694
|
end
|
591
695
|
prefs = {
|
592
696
|
prompt_for_download: false,
|
@@ -594,12 +698,15 @@ module TestCentricity
|
|
594
698
|
default_directory: @downloads_path
|
595
699
|
}
|
596
700
|
options.add_preference(:download, prefs)
|
701
|
+
options.add_argument('--force-device-scale-factor=1')
|
702
|
+
options.add_argument('--disable-geolocation')
|
597
703
|
options.add_argument('--disable-dev-shm-usage')
|
704
|
+
options.add_argument('--no-sandbox')
|
598
705
|
options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
|
599
706
|
if browser == :chrome_headless || browser == :edge_headless
|
707
|
+
Environ.headless = true
|
600
708
|
options.add_argument('--headless')
|
601
709
|
options.add_argument('--disable-gpu')
|
602
|
-
options.add_argument('--no-sandbox')
|
603
710
|
end
|
604
711
|
options
|
605
712
|
end
|
@@ -621,7 +728,10 @@ module TestCentricity
|
|
621
728
|
|
622
729
|
profile['intl.accept_languages'] = ENV['LOCALE'] if ENV['LOCALE']
|
623
730
|
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
|
624
|
-
|
731
|
+
if browser == :firefox_headless
|
732
|
+
Environ.headless = true
|
733
|
+
options.args << '--headless'
|
734
|
+
end
|
625
735
|
options
|
626
736
|
end
|
627
737
|
|
@@ -631,7 +741,7 @@ module TestCentricity
|
|
631
741
|
else
|
632
742
|
Environ.test_environment.to_s.upcase
|
633
743
|
end
|
634
|
-
if
|
744
|
+
if Environ.parallel
|
635
745
|
thread_num = ENV['TEST_ENV_NUMBER']
|
636
746
|
thread_num = 1 if thread_num.blank?
|
637
747
|
context_message = "#{context_message} - Thread ##{thread_num}"
|
@@ -639,9 +749,25 @@ module TestCentricity
|
|
639
749
|
context_message
|
640
750
|
end
|
641
751
|
|
642
|
-
def self.
|
643
|
-
|
644
|
-
|
752
|
+
def self.driver_name
|
753
|
+
unless Environ.driver_name
|
754
|
+
driver = case Environ.driver
|
755
|
+
when :webdriver
|
756
|
+
:local
|
757
|
+
when :selenium_grid, :grid
|
758
|
+
:remote
|
759
|
+
else
|
760
|
+
Environ.driver
|
761
|
+
end
|
762
|
+
Environ.driver_name = "#{driver}_#{Environ.browser}".downcase.to_sym unless driver.nil?
|
763
|
+
end
|
764
|
+
Environ.driver_name
|
765
|
+
end
|
766
|
+
|
767
|
+
def self.register_remote_driver(browser, options)
|
768
|
+
Capybara.register_driver driver_name do |app|
|
769
|
+
browser = browser.gsub(/\s+/, '_').downcase.to_sym if browser.is_a?(String)
|
770
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.new(options)
|
645
771
|
Capybara::Selenium::Driver.new(app,
|
646
772
|
browser: :remote,
|
647
773
|
url: @endpoint,
|
@@ -650,7 +776,8 @@ module TestCentricity
|
|
650
776
|
|
651
777
|
Environ.browser = browser
|
652
778
|
|
653
|
-
Capybara.default_driver =
|
779
|
+
Capybara.default_driver = Environ.driver_name
|
780
|
+
Capybara.current_driver = Environ.driver_name
|
654
781
|
Capybara.run_server = false
|
655
782
|
end
|
656
783
|
|