testcentricity_web 3.3.0 → 4.0.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 +29 -0
- data/Gemfile.lock +9 -7
- data/README.md +44 -12
- data/lib/testcentricity_web.rb +0 -10
- data/lib/testcentricity_web/browser_helper.rb +21 -13
- data/lib/testcentricity_web/data_objects/data_objects_helper.rb +5 -5
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/page_object.rb +1 -93
- data/lib/testcentricity_web/web_core/page_objects_helper.rb +1 -7
- data/lib/testcentricity_web/web_core/page_section.rb +0 -91
- data/lib/testcentricity_web/web_core/webdriver_helper.rb +89 -31
- data/lib/testcentricity_web/web_elements/checkbox.rb +1 -15
- data/lib/testcentricity_web/web_elements/file_field.rb +1 -1
- data/lib/testcentricity_web/web_elements/radio.rb +1 -1
- data/lib/testcentricity_web/web_elements/select_list.rb +0 -52
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +5 -14
- metadata +2 -12
- data/lib/testcentricity_web/web_elements/cell_button.rb +0 -8
- data/lib/testcentricity_web/web_elements/cell_checkbox.rb +0 -38
- data/lib/testcentricity_web/web_elements/cell_element.rb +0 -69
- data/lib/testcentricity_web/web_elements/cell_image.rb +0 -8
- data/lib/testcentricity_web/web_elements/cell_radio.rb +0 -31
- data/lib/testcentricity_web/web_elements/list_button.rb +0 -8
- data/lib/testcentricity_web/web_elements/list_checkbox.rb +0 -38
- data/lib/testcentricity_web/web_elements/list_element.rb +0 -61
- data/lib/testcentricity_web/web_elements/list_radio.rb +0 -31
- data/lib/testcentricity_web/web_elements/siebel_open_ui_helper.rb +0 -15
@@ -137,8 +137,6 @@ module TestCentricity
|
|
137
137
|
ui_object.count(visible = true)
|
138
138
|
when :count_all
|
139
139
|
ui_object.count(visible = :all)
|
140
|
-
when :siebel_options
|
141
|
-
ui_object.get_siebel_options
|
142
140
|
when :style
|
143
141
|
ui_object.style
|
144
142
|
when :href
|
@@ -282,11 +280,7 @@ module TestCentricity
|
|
282
280
|
check_state = data_param.is_a?(String) ? data_param.to_bool : data_param
|
283
281
|
data_field.set_checkbox_state(check_state)
|
284
282
|
when :selectlist
|
285
|
-
|
286
|
-
data_field.set("#{data_param}\t")
|
287
|
-
else
|
288
|
-
data_field.choose_option(data_param)
|
289
|
-
end
|
283
|
+
data_field.choose_option(data_param)
|
290
284
|
when :radio
|
291
285
|
check_state = data_param.is_a?(String) ? data_param.to_bool : data_param
|
292
286
|
data_field.set_selected_state(check_state)
|
@@ -407,97 +407,6 @@ module TestCentricity
|
|
407
407
|
element_hash.each(&method(:filefield))
|
408
408
|
end
|
409
409
|
|
410
|
-
# Declare and instantiate a cell button in a table column on this page section.
|
411
|
-
#
|
412
|
-
# @param element_name [Symbol] name of cell button object (as a symbol)
|
413
|
-
# @param locator [String] XPath expression that uniquely identifies cell button within row and column of parent table object
|
414
|
-
# @param table [Symbol] Name (as a symbol) of parent table object
|
415
|
-
# @param column [Integer] 1-based index of table column that contains the cell button object
|
416
|
-
# @example
|
417
|
-
# cell_button :show_button, "a[@class='show']", :data_table, 5
|
418
|
-
# cell_button :edit_button, "a[@class='edit']", :data_table, 5
|
419
|
-
#
|
420
|
-
def self.cell_button(element_name, locator, table, column)
|
421
|
-
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CellButton.new("#{element_name}", self, "#{locator}", :section, #{table}, #{column});end))
|
422
|
-
end
|
423
|
-
|
424
|
-
# Declare and instantiate a cell checkbox in a table column on this page section.
|
425
|
-
#
|
426
|
-
# @param element_name [Symbol] name of cell checkbox object (as a symbol)
|
427
|
-
# @param locator [String] XPath expression that uniquely identifies cell checkbox within row and column of parent table object
|
428
|
-
# @param table [Symbol] Name (as a symbol) of parent table object
|
429
|
-
# @param column [Integer] 1-based index of table column that contains the cell checkbox object
|
430
|
-
# @example
|
431
|
-
# cell_checkbox :is_registered_check, "a[@class='registered']", :data_table, 4
|
432
|
-
#
|
433
|
-
def self.cell_checkbox(element_name, locator, table, column, proxy = nil)
|
434
|
-
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CellCheckBox.new("#{element_name}", self, "#{locator}", :section, #{table}, #{column}, #{proxy});end))
|
435
|
-
end
|
436
|
-
|
437
|
-
# Declare and instantiate a cell radio in a table column on this page section.
|
438
|
-
#
|
439
|
-
# @param element_name [Symbol] name of cell radio object (as a symbol)
|
440
|
-
# @param locator [String] XPath expression that uniquely identifies cell radio within row and column of parent table object
|
441
|
-
# @param table [Symbol] Name (as a symbol) of parent table object
|
442
|
-
# @param column [Integer] 1-based index of table column that contains the cell radio object
|
443
|
-
# @example
|
444
|
-
# cell_radio :track_a_radio, "a[@class='track_a']", :data_table, 8
|
445
|
-
#
|
446
|
-
def self.cell_radio(element_name, locator, table, column, proxy = nil)
|
447
|
-
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CellRadio.new("#{element_name}", self, "#{locator}", :section, #{table}, #{column}, #{proxy});end))
|
448
|
-
end
|
449
|
-
|
450
|
-
# Declare and instantiate a cell image in a table column on this page object.
|
451
|
-
#
|
452
|
-
# @param element_name [Symbol] name of cell image object (as a symbol)
|
453
|
-
# @param locator [String] XPath expression that uniquely identifies cell image within row and column of parent table object
|
454
|
-
# @param table [Symbol] Name (as a symbol) of parent table object
|
455
|
-
# @param column [Integer] 1-based index of table column that contains the cell image object
|
456
|
-
# @example
|
457
|
-
# cell_image :ready_icon, "img[@class='ready']", :data_table, 3
|
458
|
-
# cell_image :send_icon, "img[@class='send']", :data_table, 3
|
459
|
-
#
|
460
|
-
def self.cell_image(element_name, locator, table, column)
|
461
|
-
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CellImage.new("#{element_name}", self, "#{locator}", :section, #{table}, #{column});end))
|
462
|
-
end
|
463
|
-
|
464
|
-
# Declare and instantiate a list button in a row of a list object on this section object.
|
465
|
-
#
|
466
|
-
# @param element_name [Symbol] name of list button object (as a symbol)
|
467
|
-
# @param locator [String] XPath expression that uniquely identifies list button within row of parent list object
|
468
|
-
# @param list [Symbol] Name (as a symbol) of parent list object
|
469
|
-
# @example
|
470
|
-
# list_button :delete_button, "a[@class='delete']", :icon_list
|
471
|
-
# list_button :edit_button, "a[@class='edit']", :icon_list
|
472
|
-
#
|
473
|
-
def self.list_button(element_name, locator, list)
|
474
|
-
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::ListButton.new("#{element_name}", self, "#{locator}", :section, #{list});end))
|
475
|
-
end
|
476
|
-
|
477
|
-
# Declare and instantiate a list checkbox in a row of a list object on this section object.
|
478
|
-
#
|
479
|
-
# @param element_name [Symbol] name of list checkbox object (as a symbol)
|
480
|
-
# @param locator [String] XPath expression that uniquely identifies list checkbox within row of parent list object
|
481
|
-
# @param list [Symbol] Name (as a symbol) of parent list object
|
482
|
-
# @example
|
483
|
-
# list_checkbox :is_registered_check, "a[@class='registered']", :data_list
|
484
|
-
#
|
485
|
-
def self.list_checkbox(element_name, locator, list, proxy = nil)
|
486
|
-
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::ListCheckBox.new("#{element_name}", self, "#{locator}", :section, #{list}, #{proxy});end))
|
487
|
-
end
|
488
|
-
|
489
|
-
# Declare and instantiate a list radio in a row of a list object on this section object.
|
490
|
-
#
|
491
|
-
# @param element_name [Symbol] name of list radio object (as a symbol)
|
492
|
-
# @param locator [String] XPath expression that uniquely identifies list radio within row of parent list object
|
493
|
-
# @param list [Symbol] Name (as a symbol) of parent list object
|
494
|
-
# @example
|
495
|
-
# list_radio :sharing_radio, "a[@class='sharing']", :data_list
|
496
|
-
#
|
497
|
-
def self.list_radio(element_name, locator, list, proxy = nil)
|
498
|
-
class_eval(%(def #{element_name};@#{element_name} ||= TestCentricity::CellRadio.new("#{element_name}", self, "#{locator}", :section, #{list}, #{proxy});end))
|
499
|
-
end
|
500
|
-
|
501
410
|
# Instantiate a single PageSection object within this PageSection object.
|
502
411
|
#
|
503
412
|
# @param section_name [Symbol] name of PageSection object (as a symbol)
|
@@ -6,14 +6,23 @@ require 'fileutils'
|
|
6
6
|
|
7
7
|
|
8
8
|
module TestCentricity
|
9
|
-
|
9
|
+
class WebDriverConnect
|
10
10
|
include Capybara::DSL
|
11
11
|
|
12
12
|
attr_accessor :bs_local
|
13
13
|
attr_accessor :downloads_path
|
14
14
|
|
15
|
-
def self.initialize_web_driver(
|
16
|
-
|
15
|
+
def self.initialize_web_driver(options = nil)
|
16
|
+
desired_caps = nil
|
17
|
+
merge_caps = nil
|
18
|
+
if options.is_a?(String)
|
19
|
+
Capybara.app_host = options
|
20
|
+
elsif options.is_a?(Hash)
|
21
|
+
Capybara.app_host = options[:app_host] if options.key?(:app_host)
|
22
|
+
desired_caps = options[:desired_capabilities] if options.key?(:desired_capabilities)
|
23
|
+
merge_caps = options[:merge_capabilities] if options.key?(:merge_capabilities)
|
24
|
+
end
|
25
|
+
|
17
26
|
browser = ENV['WEB_BROWSER']
|
18
27
|
# set downloads folder path
|
19
28
|
@downloads_path = "#{Dir.pwd}/downloads"
|
@@ -37,25 +46,25 @@ module TestCentricity
|
|
37
46
|
|
38
47
|
context = case browser.downcase.to_sym
|
39
48
|
when :appium
|
40
|
-
initialize_appium
|
49
|
+
initialize_appium(desired_caps, merge_caps)
|
41
50
|
'mobile device emulator'
|
42
51
|
when :browserstack
|
43
|
-
initialize_browserstack
|
52
|
+
initialize_browserstack(desired_caps, merge_caps)
|
44
53
|
'Browserstack cloud service'
|
45
54
|
when :crossbrowser
|
46
|
-
initialize_crossbrowser
|
55
|
+
initialize_crossbrowser(desired_caps, merge_caps)
|
47
56
|
'CrossBrowserTesting cloud service'
|
48
57
|
when :gridlastic
|
49
|
-
initialize_gridlastic
|
58
|
+
initialize_gridlastic(desired_caps, merge_caps)
|
50
59
|
'Gridlastic cloud service'
|
51
60
|
when :lambdatest
|
52
|
-
initialize_lambdatest
|
61
|
+
initialize_lambdatest(desired_caps, merge_caps)
|
53
62
|
'LambdaTest cloud service'
|
54
63
|
when :saucelabs
|
55
|
-
initialize_saucelabs
|
64
|
+
initialize_saucelabs(desired_caps, merge_caps)
|
56
65
|
'Sauce Labs cloud service'
|
57
66
|
when :testingbot
|
58
|
-
initialize_testingbot
|
67
|
+
initialize_testingbot(desired_caps, merge_caps)
|
59
68
|
'TestingBot cloud service'
|
60
69
|
else
|
61
70
|
if ENV['SELENIUM'] == 'remote'
|
@@ -124,7 +133,7 @@ module TestCentricity
|
|
124
133
|
|
125
134
|
private
|
126
135
|
|
127
|
-
def self.initialize_appium
|
136
|
+
def self.initialize_appium(desired_caps = nil, merge_caps = false)
|
128
137
|
Environ.platform = :mobile
|
129
138
|
Environ.device_name = ENV['APP_DEVICE']
|
130
139
|
Environ.device_os = ENV['APP_PLATFORM_NAME'].downcase.to_sym
|
@@ -183,6 +192,10 @@ module TestCentricity
|
|
183
192
|
desired_capabilities[:systemPort] = ENV['SYSTEM_PORT'] if ENV['SYSTEM_PORT']
|
184
193
|
end
|
185
194
|
|
195
|
+
unless desired_caps.nil?
|
196
|
+
desired_capabilities = merge_caps ? desired_capabilities.merge(desired_caps) : desired_caps
|
197
|
+
end
|
198
|
+
|
186
199
|
Capybara.register_driver :appium do |app|
|
187
200
|
appium_lib_options = { server_url: endpoint }
|
188
201
|
all_options = {
|
@@ -198,6 +211,8 @@ module TestCentricity
|
|
198
211
|
'OS X'
|
199
212
|
elsif OS.windows?
|
200
213
|
'Windows'
|
214
|
+
elsif OS.linux?
|
215
|
+
'Linux'
|
201
216
|
end
|
202
217
|
|
203
218
|
browser = ENV['WEB_BROWSER'].downcase.to_sym
|
@@ -216,8 +231,8 @@ module TestCentricity
|
|
216
231
|
Capybara.register_driver :selenium do |app|
|
217
232
|
case browser
|
218
233
|
when :safari
|
219
|
-
|
220
|
-
Capybara::Selenium::Driver.new(app, browser: browser, desired_capabilities:
|
234
|
+
caps = Selenium::WebDriver::Remote::Capabilities.safari(cleanSession: true)
|
235
|
+
Capybara::Selenium::Driver.new(app, browser: browser, desired_capabilities: caps)
|
221
236
|
when :ie, :edge
|
222
237
|
Capybara::Selenium::Driver.new(app, browser: browser)
|
223
238
|
when :firefox, :firefox_headless
|
@@ -248,6 +263,7 @@ module TestCentricity
|
|
248
263
|
}
|
249
264
|
options.add_preference(:download, prefs)
|
250
265
|
options.add_argument('--disable-infobars')
|
266
|
+
options.add_argument('--disable-dev-shm-usage')
|
251
267
|
options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
|
252
268
|
if browser == :chrome_headless
|
253
269
|
options.add_argument('--headless')
|
@@ -255,11 +271,13 @@ module TestCentricity
|
|
255
271
|
options.add_argument('--no-sandbox')
|
256
272
|
end
|
257
273
|
|
258
|
-
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
|
274
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
|
275
|
+
else
|
259
276
|
if ENV['HOST_BROWSER'] && ENV['HOST_BROWSER'].downcase.to_sym == :chrome
|
260
277
|
user_agent = Browsers.mobile_device_agent(ENV['WEB_BROWSER'])
|
261
278
|
options = Selenium::WebDriver::Chrome::Options.new
|
262
279
|
options.add_argument('--disable-infobars')
|
280
|
+
options.add_argument('--disable-dev-shm-usage')
|
263
281
|
options.add_argument("--user-agent='#{user_agent}'")
|
264
282
|
options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
|
265
283
|
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
|
@@ -271,7 +289,7 @@ module TestCentricity
|
|
271
289
|
Capybara.default_driver = :selenium
|
272
290
|
end
|
273
291
|
|
274
|
-
def self.initialize_browserstack
|
292
|
+
def self.initialize_browserstack(desired_caps = nil, merge_caps = false)
|
275
293
|
browser = ENV['BS_BROWSER']
|
276
294
|
Environ.grid = :browserstack
|
277
295
|
|
@@ -283,19 +301,22 @@ module TestCentricity
|
|
283
301
|
elsif ENV['BS_OS']
|
284
302
|
Environ.os = "#{ENV['BS_OS']} #{ENV['BS_OS_VERSION']}"
|
285
303
|
end
|
304
|
+
Environ.device = if ENV['BS_REAL_MOBILE']
|
305
|
+
:device
|
306
|
+
elsif ENV['BS_PLATFORM']
|
307
|
+
:simulator
|
308
|
+
end
|
286
309
|
|
287
310
|
endpoint = "http://#{ENV['BS_USERNAME']}:#{ENV['BS_AUTHKEY']}@hub-cloud.browserstack.com/wd/hub"
|
288
311
|
Capybara.register_driver :browserstack do |app|
|
289
312
|
capabilities = Selenium::WebDriver::Remote::Capabilities.new
|
290
313
|
|
291
314
|
if ENV['BS_REAL_MOBILE']
|
292
|
-
Environ.device = :device
|
293
315
|
capabilities['device'] = ENV['BS_DEVICE']
|
294
316
|
capabilities['realMobile'] = true
|
295
317
|
capabilities['os_version'] = ENV['BS_OS_VERSION']
|
296
318
|
|
297
319
|
elsif ENV['BS_PLATFORM']
|
298
|
-
Environ.device = :simulator
|
299
320
|
capabilities[:platform] = ENV['BS_PLATFORM']
|
300
321
|
capabilities[:browserName] = browser
|
301
322
|
capabilities['device'] = ENV['BS_DEVICE'] if ENV['BS_DEVICE']
|
@@ -357,6 +378,10 @@ module TestCentricity
|
|
357
378
|
capabilities['cleanSession'] = 'true'
|
358
379
|
end
|
359
380
|
|
381
|
+
unless desired_caps.nil?
|
382
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
383
|
+
end
|
384
|
+
|
360
385
|
if ENV['TUNNELING']
|
361
386
|
@bs_local = BrowserStack::Local.new
|
362
387
|
bs_local_args = {'key' => "#{ENV['BS_AUTHKEY']}"}
|
@@ -385,7 +410,7 @@ module TestCentricity
|
|
385
410
|
end
|
386
411
|
end
|
387
412
|
|
388
|
-
def self.initialize_crossbrowser
|
413
|
+
def self.initialize_crossbrowser(desired_caps = nil, merge_caps = false)
|
389
414
|
browser = ENV['CB_BROWSER']
|
390
415
|
Environ.grid = :crossbrowser
|
391
416
|
|
@@ -412,6 +437,11 @@ module TestCentricity
|
|
412
437
|
elsif ENV['CB_PLATFORM']
|
413
438
|
capabilities['os_api_name'] = ENV['CB_PLATFORM']
|
414
439
|
end
|
440
|
+
|
441
|
+
unless desired_caps.nil?
|
442
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
443
|
+
end
|
444
|
+
|
415
445
|
Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
|
416
446
|
end
|
417
447
|
|
@@ -427,12 +457,11 @@ module TestCentricity
|
|
427
457
|
end
|
428
458
|
end
|
429
459
|
|
430
|
-
def self.initialize_gridlastic
|
460
|
+
def self.initialize_gridlastic(desired_caps = nil, merge_caps = false)
|
431
461
|
browser = ENV['GL_BROWSER']
|
432
462
|
Environ.grid = :gridlastic
|
433
463
|
Environ.os = ENV['GL_OS']
|
434
464
|
endpoint = "http://#{ENV['GL_USERNAME']}:#{ENV['GL_AUTHKEY']}@#{ENV['GL_SUBDOMAIN']}.gridlastic.com:80/wd/hub"
|
435
|
-
|
436
465
|
capabilities = Selenium::WebDriver::Remote::Capabilities.new
|
437
466
|
capabilities['browserName'] = browser
|
438
467
|
capabilities['version'] = ENV['GL_VERSION'] if ENV['GL_VERSION']
|
@@ -440,6 +469,10 @@ module TestCentricity
|
|
440
469
|
capabilities['platformName'] = ENV['GL_PLATFORM']
|
441
470
|
capabilities['video'] = ENV['RECORD_VIDEO'].capitalize if ENV['RECORD_VIDEO']
|
442
471
|
|
472
|
+
unless desired_caps.nil?
|
473
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
474
|
+
end
|
475
|
+
|
443
476
|
Capybara.register_driver :selenium do |app|
|
444
477
|
client = Selenium::WebDriver::Remote::Http::Default.new
|
445
478
|
client.timeout = 1200
|
@@ -463,7 +496,7 @@ module TestCentricity
|
|
463
496
|
end
|
464
497
|
end
|
465
498
|
|
466
|
-
def self.initialize_lambdatest
|
499
|
+
def self.initialize_lambdatest(desired_caps = nil, merge_caps = false)
|
467
500
|
browser = ENV['LT_BROWSER']
|
468
501
|
Environ.grid = :lambdatest
|
469
502
|
Environ.os = ENV['LT_OS']
|
@@ -502,6 +535,10 @@ module TestCentricity
|
|
502
535
|
end
|
503
536
|
capabilities['build'] = context_message
|
504
537
|
|
538
|
+
unless desired_caps.nil?
|
539
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
540
|
+
end
|
541
|
+
|
505
542
|
Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
|
506
543
|
end
|
507
544
|
|
@@ -526,13 +563,23 @@ module TestCentricity
|
|
526
563
|
when :firefox, :safari, :ie, :edge
|
527
564
|
capabilities = Selenium::WebDriver::Remote::Capabilities.send(browser)
|
528
565
|
when :chrome, :chrome_headless
|
529
|
-
options =
|
566
|
+
options = %w[--disable-infobars]
|
567
|
+
options.push('--disable-dev-shm-usage')
|
530
568
|
options.push("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
|
569
|
+
if browser == :chrome_headless
|
570
|
+
Environ.headless = true
|
571
|
+
options.push('--headless')
|
572
|
+
options.push('--disable-gpu')
|
573
|
+
options.push('--no-sandbox')
|
574
|
+
end
|
531
575
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome('goog:chromeOptions' => { args: options })
|
532
576
|
else
|
533
577
|
if ENV['HOST_BROWSER'] && ENV['HOST_BROWSER'].downcase.to_sym == :chrome
|
578
|
+
Environ.platform = :mobile
|
579
|
+
Environ.device_name = Browsers.mobile_device_name(ENV['WEB_BROWSER'])
|
534
580
|
user_agent = Browsers.mobile_device_agent(ENV['WEB_BROWSER'])
|
535
581
|
options = %w[--disable-infobars]
|
582
|
+
options.push('--disable-dev-shm-usage')
|
536
583
|
options.push("--user-agent='#{user_agent}'")
|
537
584
|
options.push("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
|
538
585
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome('goog:chromeOptions' => { args: options })
|
@@ -540,19 +587,22 @@ module TestCentricity
|
|
540
587
|
raise "Requested browser '#{browser}' is not supported on Selenium Grid"
|
541
588
|
end
|
542
589
|
end
|
543
|
-
Capybara::Selenium::Driver.new(app,
|
590
|
+
Capybara::Selenium::Driver.new(app,
|
591
|
+
browser: :remote,
|
592
|
+
url: endpoint,
|
593
|
+
desired_capabilities: capabilities).tap do |driver|
|
594
|
+
# configure file_detector for remote uploads
|
595
|
+
driver.browser.file_detector = lambda do |args|
|
596
|
+
str = args.first.to_s
|
597
|
+
str if File.exist?(str)
|
598
|
+
end
|
599
|
+
end
|
544
600
|
end
|
545
601
|
Capybara.current_driver = :remote_browser
|
546
602
|
Capybara.default_driver = :remote_browser
|
547
|
-
# configure file_detector for remote uploads
|
548
|
-
selenium = Capybara.page.driver.browser
|
549
|
-
selenium.file_detector = lambda do |args|
|
550
|
-
str = args.first.to_s
|
551
|
-
str if File.exist?(str)
|
552
|
-
end
|
553
603
|
end
|
554
604
|
|
555
|
-
def self.initialize_saucelabs
|
605
|
+
def self.initialize_saucelabs(desired_caps = nil, merge_caps = false)
|
556
606
|
browser = ENV['SL_BROWSER']
|
557
607
|
Environ.grid = :saucelabs
|
558
608
|
|
@@ -582,6 +632,10 @@ module TestCentricity
|
|
582
632
|
capabilities['deviceOrientation'] = ENV['ORIENTATION'] if ENV['ORIENTATION']
|
583
633
|
end
|
584
634
|
|
635
|
+
unless desired_caps.nil?
|
636
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
637
|
+
end
|
638
|
+
|
585
639
|
Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
|
586
640
|
end
|
587
641
|
|
@@ -597,7 +651,7 @@ module TestCentricity
|
|
597
651
|
end
|
598
652
|
end
|
599
653
|
|
600
|
-
def self.initialize_testingbot
|
654
|
+
def self.initialize_testingbot(desired_caps = nil, merge_caps = false)
|
601
655
|
browser = ENV['TB_BROWSER']
|
602
656
|
Environ.grid = :testingbot
|
603
657
|
|
@@ -630,6 +684,10 @@ module TestCentricity
|
|
630
684
|
capabilities['deviceName'] = ENV['TB_DEVICE']
|
631
685
|
end
|
632
686
|
|
687
|
+
unless desired_caps.nil?
|
688
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
689
|
+
end
|
690
|
+
|
633
691
|
Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
|
634
692
|
end
|
635
693
|
|
@@ -117,7 +117,7 @@ module TestCentricity
|
|
117
117
|
# remember_me_checkbox.uncheck
|
118
118
|
#
|
119
119
|
def uncheck
|
120
|
-
set_checkbox_state(false)
|
120
|
+
set_checkbox_state(state = false)
|
121
121
|
end
|
122
122
|
|
123
123
|
def verify_check_state(state, enqueue = false)
|
@@ -127,20 +127,6 @@ module TestCentricity
|
|
127
127
|
assert_equal(state, actual, "Expected checkbox #{object_ref_message} to be #{state} but found #{actual} instead")
|
128
128
|
end
|
129
129
|
|
130
|
-
# Set the check state of a Siebel OUI JCheckBox object.
|
131
|
-
#
|
132
|
-
# @param state [Boolean] true = checked / false = unchecked
|
133
|
-
# @example
|
134
|
-
# remember_me_checkbox.set_siebel_checkbox_state(true)
|
135
|
-
#
|
136
|
-
def set_siebel_checkbox_state(state)
|
137
|
-
obj, = find_element
|
138
|
-
object_not_found_exception(obj, 'Siebel checkbox')
|
139
|
-
raise "UI #{object_ref_message} is not a Siebel CheckBox object" unless get_siebel_object_type == 'JCheckBox'
|
140
|
-
expected = state.to_bool
|
141
|
-
obj.click unless expected == obj.checked?
|
142
|
-
end
|
143
|
-
|
144
130
|
# Highlight a checkbox with a 3 pixel wide, red dashed border for the specified wait time.
|
145
131
|
# If wait time is zero, then the highlight will remain until the page is refreshed
|
146
132
|
#
|