testcentricity_web 3.2.25 → 4.0.2
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 +4 -4
- data/CHANGELOG.md +43 -0
- data/README.md +66 -33
- data/lib/testcentricity_web/browser_helper.rb +21 -13
- data/lib/testcentricity_web/data_objects/data_objects_helper.rb +34 -5
- data/lib/testcentricity_web/data_objects/environment.rb +30 -5
- data/lib/testcentricity_web/data_objects/excel_helper.rb +1 -25
- 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 +100 -41
- 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
- data/lib/testcentricity_web/world_extensions.rb +1 -1
- data/lib/testcentricity_web.rb +1 -11
- metadata +6 -18
- data/Gemfile.lock +0 -114
- 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
|
@@ -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
|
|
@@ -240,25 +255,29 @@ module TestCentricity
|
|
|
240
255
|
options.args << '--headless' if browser == :firefox_headless
|
|
241
256
|
Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
|
|
242
257
|
when :chrome, :chrome_headless
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
options.add_preference(:download, prefs)
|
|
251
|
-
else
|
|
252
|
-
options = Selenium::WebDriver::Chrome::Options.new(args: %w[headless disable-gpu no-sandbox])
|
|
253
|
-
end
|
|
258
|
+
options = Selenium::WebDriver::Chrome::Options.new
|
|
259
|
+
prefs = {
|
|
260
|
+
prompt_for_download: false,
|
|
261
|
+
directory_upgrade: true,
|
|
262
|
+
default_directory: @downloads_path
|
|
263
|
+
}
|
|
264
|
+
options.add_preference(:download, prefs)
|
|
254
265
|
options.add_argument('--disable-infobars')
|
|
266
|
+
options.add_argument('--disable-dev-shm-usage')
|
|
255
267
|
options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
|
|
268
|
+
if browser == :chrome_headless
|
|
269
|
+
options.add_argument('--headless')
|
|
270
|
+
options.add_argument('--disable-gpu')
|
|
271
|
+
options.add_argument('--no-sandbox')
|
|
272
|
+
end
|
|
273
|
+
|
|
256
274
|
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
|
|
257
275
|
else
|
|
258
276
|
if ENV['HOST_BROWSER'] && ENV['HOST_BROWSER'].downcase.to_sym == :chrome
|
|
259
277
|
user_agent = Browsers.mobile_device_agent(ENV['WEB_BROWSER'])
|
|
260
278
|
options = Selenium::WebDriver::Chrome::Options.new
|
|
261
279
|
options.add_argument('--disable-infobars')
|
|
280
|
+
options.add_argument('--disable-dev-shm-usage')
|
|
262
281
|
options.add_argument("--user-agent='#{user_agent}'")
|
|
263
282
|
options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
|
|
264
283
|
Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
|
|
@@ -270,7 +289,7 @@ module TestCentricity
|
|
|
270
289
|
Capybara.default_driver = :selenium
|
|
271
290
|
end
|
|
272
291
|
|
|
273
|
-
def self.initialize_browserstack
|
|
292
|
+
def self.initialize_browserstack(desired_caps = nil, merge_caps = false)
|
|
274
293
|
browser = ENV['BS_BROWSER']
|
|
275
294
|
Environ.grid = :browserstack
|
|
276
295
|
|
|
@@ -282,19 +301,22 @@ module TestCentricity
|
|
|
282
301
|
elsif ENV['BS_OS']
|
|
283
302
|
Environ.os = "#{ENV['BS_OS']} #{ENV['BS_OS_VERSION']}"
|
|
284
303
|
end
|
|
304
|
+
Environ.device = if ENV['BS_REAL_MOBILE']
|
|
305
|
+
:device
|
|
306
|
+
elsif ENV['BS_PLATFORM']
|
|
307
|
+
:simulator
|
|
308
|
+
end
|
|
285
309
|
|
|
286
310
|
endpoint = "http://#{ENV['BS_USERNAME']}:#{ENV['BS_AUTHKEY']}@hub-cloud.browserstack.com/wd/hub"
|
|
287
311
|
Capybara.register_driver :browserstack do |app|
|
|
288
312
|
capabilities = Selenium::WebDriver::Remote::Capabilities.new
|
|
289
313
|
|
|
290
314
|
if ENV['BS_REAL_MOBILE']
|
|
291
|
-
Environ.device = :device
|
|
292
315
|
capabilities['device'] = ENV['BS_DEVICE']
|
|
293
316
|
capabilities['realMobile'] = true
|
|
294
317
|
capabilities['os_version'] = ENV['BS_OS_VERSION']
|
|
295
318
|
|
|
296
319
|
elsif ENV['BS_PLATFORM']
|
|
297
|
-
Environ.device = :simulator
|
|
298
320
|
capabilities[:platform] = ENV['BS_PLATFORM']
|
|
299
321
|
capabilities[:browserName] = browser
|
|
300
322
|
capabilities['device'] = ENV['BS_DEVICE'] if ENV['BS_DEVICE']
|
|
@@ -356,6 +378,10 @@ module TestCentricity
|
|
|
356
378
|
capabilities['cleanSession'] = 'true'
|
|
357
379
|
end
|
|
358
380
|
|
|
381
|
+
unless desired_caps.nil?
|
|
382
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
|
383
|
+
end
|
|
384
|
+
|
|
359
385
|
if ENV['TUNNELING']
|
|
360
386
|
@bs_local = BrowserStack::Local.new
|
|
361
387
|
bs_local_args = {'key' => "#{ENV['BS_AUTHKEY']}"}
|
|
@@ -384,7 +410,7 @@ module TestCentricity
|
|
|
384
410
|
end
|
|
385
411
|
end
|
|
386
412
|
|
|
387
|
-
def self.initialize_crossbrowser
|
|
413
|
+
def self.initialize_crossbrowser(desired_caps = nil, merge_caps = false)
|
|
388
414
|
browser = ENV['CB_BROWSER']
|
|
389
415
|
Environ.grid = :crossbrowser
|
|
390
416
|
|
|
@@ -411,6 +437,11 @@ module TestCentricity
|
|
|
411
437
|
elsif ENV['CB_PLATFORM']
|
|
412
438
|
capabilities['os_api_name'] = ENV['CB_PLATFORM']
|
|
413
439
|
end
|
|
440
|
+
|
|
441
|
+
unless desired_caps.nil?
|
|
442
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
|
443
|
+
end
|
|
444
|
+
|
|
414
445
|
Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
|
|
415
446
|
end
|
|
416
447
|
|
|
@@ -426,12 +457,11 @@ module TestCentricity
|
|
|
426
457
|
end
|
|
427
458
|
end
|
|
428
459
|
|
|
429
|
-
def self.initialize_gridlastic
|
|
460
|
+
def self.initialize_gridlastic(desired_caps = nil, merge_caps = false)
|
|
430
461
|
browser = ENV['GL_BROWSER']
|
|
431
462
|
Environ.grid = :gridlastic
|
|
432
463
|
Environ.os = ENV['GL_OS']
|
|
433
464
|
endpoint = "http://#{ENV['GL_USERNAME']}:#{ENV['GL_AUTHKEY']}@#{ENV['GL_SUBDOMAIN']}.gridlastic.com:80/wd/hub"
|
|
434
|
-
|
|
435
465
|
capabilities = Selenium::WebDriver::Remote::Capabilities.new
|
|
436
466
|
capabilities['browserName'] = browser
|
|
437
467
|
capabilities['version'] = ENV['GL_VERSION'] if ENV['GL_VERSION']
|
|
@@ -439,6 +469,10 @@ module TestCentricity
|
|
|
439
469
|
capabilities['platformName'] = ENV['GL_PLATFORM']
|
|
440
470
|
capabilities['video'] = ENV['RECORD_VIDEO'].capitalize if ENV['RECORD_VIDEO']
|
|
441
471
|
|
|
472
|
+
unless desired_caps.nil?
|
|
473
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
|
474
|
+
end
|
|
475
|
+
|
|
442
476
|
Capybara.register_driver :selenium do |app|
|
|
443
477
|
client = Selenium::WebDriver::Remote::Http::Default.new
|
|
444
478
|
client.timeout = 1200
|
|
@@ -462,7 +496,7 @@ module TestCentricity
|
|
|
462
496
|
end
|
|
463
497
|
end
|
|
464
498
|
|
|
465
|
-
def self.initialize_lambdatest
|
|
499
|
+
def self.initialize_lambdatest(desired_caps = nil, merge_caps = false)
|
|
466
500
|
browser = ENV['LT_BROWSER']
|
|
467
501
|
Environ.grid = :lambdatest
|
|
468
502
|
Environ.os = ENV['LT_OS']
|
|
@@ -501,6 +535,10 @@ module TestCentricity
|
|
|
501
535
|
end
|
|
502
536
|
capabilities['build'] = context_message
|
|
503
537
|
|
|
538
|
+
unless desired_caps.nil?
|
|
539
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
|
540
|
+
end
|
|
541
|
+
|
|
504
542
|
Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
|
|
505
543
|
end
|
|
506
544
|
|
|
@@ -525,13 +563,23 @@ module TestCentricity
|
|
|
525
563
|
when :firefox, :safari, :ie, :edge
|
|
526
564
|
capabilities = Selenium::WebDriver::Remote::Capabilities.send(browser)
|
|
527
565
|
when :chrome, :chrome_headless
|
|
528
|
-
options =
|
|
566
|
+
options = %w[--disable-infobars]
|
|
567
|
+
options.push('--disable-dev-shm-usage')
|
|
529
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
|
|
530
575
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome('goog:chromeOptions' => { args: options })
|
|
531
576
|
else
|
|
532
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'])
|
|
533
580
|
user_agent = Browsers.mobile_device_agent(ENV['WEB_BROWSER'])
|
|
534
581
|
options = %w[--disable-infobars]
|
|
582
|
+
options.push('--disable-dev-shm-usage')
|
|
535
583
|
options.push("--user-agent='#{user_agent}'")
|
|
536
584
|
options.push("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
|
|
537
585
|
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome('goog:chromeOptions' => { args: options })
|
|
@@ -539,19 +587,22 @@ module TestCentricity
|
|
|
539
587
|
raise "Requested browser '#{browser}' is not supported on Selenium Grid"
|
|
540
588
|
end
|
|
541
589
|
end
|
|
542
|
-
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
|
|
543
600
|
end
|
|
544
601
|
Capybara.current_driver = :remote_browser
|
|
545
602
|
Capybara.default_driver = :remote_browser
|
|
546
|
-
# configure file_detector for remote uploads
|
|
547
|
-
selenium = Capybara.page.driver.browser
|
|
548
|
-
selenium.file_detector = lambda do |args|
|
|
549
|
-
str = args.first.to_s
|
|
550
|
-
str if File.exist?(str)
|
|
551
|
-
end
|
|
552
603
|
end
|
|
553
604
|
|
|
554
|
-
def self.initialize_saucelabs
|
|
605
|
+
def self.initialize_saucelabs(desired_caps = nil, merge_caps = false)
|
|
555
606
|
browser = ENV['SL_BROWSER']
|
|
556
607
|
Environ.grid = :saucelabs
|
|
557
608
|
|
|
@@ -581,6 +632,10 @@ module TestCentricity
|
|
|
581
632
|
capabilities['deviceOrientation'] = ENV['ORIENTATION'] if ENV['ORIENTATION']
|
|
582
633
|
end
|
|
583
634
|
|
|
635
|
+
unless desired_caps.nil?
|
|
636
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
|
637
|
+
end
|
|
638
|
+
|
|
584
639
|
Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
|
|
585
640
|
end
|
|
586
641
|
|
|
@@ -596,7 +651,7 @@ module TestCentricity
|
|
|
596
651
|
end
|
|
597
652
|
end
|
|
598
653
|
|
|
599
|
-
def self.initialize_testingbot
|
|
654
|
+
def self.initialize_testingbot(desired_caps = nil, merge_caps = false)
|
|
600
655
|
browser = ENV['TB_BROWSER']
|
|
601
656
|
Environ.grid = :testingbot
|
|
602
657
|
|
|
@@ -629,6 +684,10 @@ module TestCentricity
|
|
|
629
684
|
capabilities['deviceName'] = ENV['TB_DEVICE']
|
|
630
685
|
end
|
|
631
686
|
|
|
687
|
+
unless desired_caps.nil?
|
|
688
|
+
capabilities = merge_caps ? capabilities.merge(desired_caps) : desired_caps
|
|
689
|
+
end
|
|
690
|
+
|
|
632
691
|
Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
|
|
633
692
|
end
|
|
634
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
|
#
|
|
@@ -101,7 +101,7 @@ module TestCentricity
|
|
|
101
101
|
# accept_terms_radio.unselect
|
|
102
102
|
#
|
|
103
103
|
def unselect
|
|
104
|
-
set_selected_state(false)
|
|
104
|
+
set_selected_state(state = false)
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
# Highlight a radio button with a 3 pixel wide, red dashed border for the specified wait time.
|
|
@@ -258,58 +258,6 @@ module TestCentricity
|
|
|
258
258
|
|
|
259
259
|
alias selected? get_selected_option
|
|
260
260
|
|
|
261
|
-
# Select the specified option in a Siebel OUI select box object.
|
|
262
|
-
#
|
|
263
|
-
# @param option [String] text of option to select
|
|
264
|
-
# @example
|
|
265
|
-
# country_select.choose_siebel_option('Cayman Islands')
|
|
266
|
-
#
|
|
267
|
-
def choose_siebel_option(option)
|
|
268
|
-
Capybara.wait_on_first_by_default = true
|
|
269
|
-
invoke_siebel_popup
|
|
270
|
-
first(:xpath, "//li[@class='ui-menu-item']", exact: true, match: :prefer_exact, text: option).click
|
|
271
|
-
end
|
|
272
|
-
|
|
273
|
-
# Return array of strings of all options in a Siebel OUI select box object.
|
|
274
|
-
#
|
|
275
|
-
# @return [Array]
|
|
276
|
-
# @example
|
|
277
|
-
# all_countries = country_select.get_siebel_options
|
|
278
|
-
#
|
|
279
|
-
def get_siebel_options
|
|
280
|
-
invoke_siebel_popup
|
|
281
|
-
sleep(0.5)
|
|
282
|
-
options = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
|
|
283
|
-
@base_object, = find_element
|
|
284
|
-
@base_object.native.send_keys(:escape)
|
|
285
|
-
options
|
|
286
|
-
end
|
|
287
|
-
|
|
288
|
-
def verify_siebel_options(expected, enqueue = false)
|
|
289
|
-
invoke_siebel_popup
|
|
290
|
-
sleep(0.5)
|
|
291
|
-
actual = page.all(:xpath, "//li[@class='ui-menu-item']").collect(&:text)
|
|
292
|
-
if enqueue
|
|
293
|
-
ExceptionQueue.enqueue_assert_equal(expected, actual, "Expected list of options in list #{object_ref_message}")
|
|
294
|
-
else
|
|
295
|
-
assert_equal(expected, actual, "Expected list of options in list #{object_ref_message} to be #{expected} but found #{actual}")
|
|
296
|
-
end
|
|
297
|
-
@base_object, = find_element
|
|
298
|
-
@base_object.native.send_keys(:escape)
|
|
299
|
-
end
|
|
300
|
-
|
|
301
|
-
# Is Siebel JComboBox set to read-only?
|
|
302
|
-
#
|
|
303
|
-
# @return [Boolean]
|
|
304
|
-
# @example
|
|
305
|
-
# country_select.read_only?
|
|
306
|
-
#
|
|
307
|
-
def read_only?
|
|
308
|
-
@base_object, = find_element
|
|
309
|
-
object_not_found_exception(@base_object, nil)
|
|
310
|
-
!@base_object.native.attribute('readonly')
|
|
311
|
-
end
|
|
312
|
-
|
|
313
261
|
private
|
|
314
262
|
|
|
315
263
|
def select_item(obj, option)
|
|
@@ -441,7 +441,7 @@ module TestCentricity
|
|
|
441
441
|
# button_width = my_button.width
|
|
442
442
|
#
|
|
443
443
|
def width
|
|
444
|
-
obj, type = find_element(false)
|
|
444
|
+
obj, type = find_element(visible = false)
|
|
445
445
|
object_not_found_exception(obj, type)
|
|
446
446
|
obj.get_width
|
|
447
447
|
end
|
|
@@ -453,7 +453,7 @@ module TestCentricity
|
|
|
453
453
|
# button_height = my_button.height
|
|
454
454
|
#
|
|
455
455
|
def height
|
|
456
|
-
obj, type = find_element(false)
|
|
456
|
+
obj, type = find_element(visible = false)
|
|
457
457
|
object_not_found_exception(obj, type)
|
|
458
458
|
obj.get_height
|
|
459
459
|
end
|
|
@@ -465,7 +465,7 @@ module TestCentricity
|
|
|
465
465
|
# button_x = my_button.x
|
|
466
466
|
#
|
|
467
467
|
def x
|
|
468
|
-
obj, type = find_element(false)
|
|
468
|
+
obj, type = find_element(visible = false)
|
|
469
469
|
object_not_found_exception(obj, type)
|
|
470
470
|
obj.get_x
|
|
471
471
|
end
|
|
@@ -477,7 +477,7 @@ module TestCentricity
|
|
|
477
477
|
# button_y = my_button.y
|
|
478
478
|
#
|
|
479
479
|
def y
|
|
480
|
-
obj, type = find_element(false)
|
|
480
|
+
obj, type = find_element(visible = false)
|
|
481
481
|
object_not_found_exception(obj, type)
|
|
482
482
|
obj.get_y
|
|
483
483
|
end
|
|
@@ -499,7 +499,7 @@ module TestCentricity
|
|
|
499
499
|
# basket_link.displayed??
|
|
500
500
|
#
|
|
501
501
|
def displayed?
|
|
502
|
-
obj, type = find_element(false)
|
|
502
|
+
obj, type = find_element(visible = false)
|
|
503
503
|
object_not_found_exception(obj, type)
|
|
504
504
|
obj.displayed?
|
|
505
505
|
end
|
|
@@ -1032,15 +1032,6 @@ module TestCentricity
|
|
|
1032
1032
|
end
|
|
1033
1033
|
end
|
|
1034
1034
|
|
|
1035
|
-
def invoke_siebel_popup
|
|
1036
|
-
obj, = find_element
|
|
1037
|
-
object_not_found_exception(obj, 'Siebel object')
|
|
1038
|
-
trigger_name = obj.native.attribute('aria-describedby').strip
|
|
1039
|
-
trigger = "span##{trigger_name}"
|
|
1040
|
-
trigger = "#{@parent.get_locator} #{trigger}" if @context == :section && !@parent.get_locator.nil?
|
|
1041
|
-
first(trigger).click
|
|
1042
|
-
end
|
|
1043
|
-
|
|
1044
1035
|
def object_ref_message
|
|
1045
1036
|
"object '#{get_name}' (#{get_locator})"
|
|
1046
1037
|
end
|
data/lib/testcentricity_web.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require 'capybara/
|
|
1
|
+
require 'capybara/rspec'
|
|
2
2
|
require 'test/unit'
|
|
3
3
|
require 'appium_lib'
|
|
4
4
|
|
|
@@ -35,16 +35,6 @@ require 'testcentricity_web/web_elements/range'
|
|
|
35
35
|
require 'testcentricity_web/web_elements/media'
|
|
36
36
|
require 'testcentricity_web/web_elements/audio'
|
|
37
37
|
require 'testcentricity_web/web_elements/video'
|
|
38
|
-
require 'testcentricity_web/web_elements/cell_element'
|
|
39
|
-
require 'testcentricity_web/web_elements/cell_button'
|
|
40
|
-
require 'testcentricity_web/web_elements/cell_checkbox'
|
|
41
|
-
require 'testcentricity_web/web_elements/cell_radio'
|
|
42
|
-
require 'testcentricity_web/web_elements/cell_image'
|
|
43
|
-
require 'testcentricity_web/web_elements/list_element'
|
|
44
|
-
require 'testcentricity_web/web_elements/list_button'
|
|
45
|
-
require 'testcentricity_web/web_elements/list_checkbox'
|
|
46
|
-
require 'testcentricity_web/web_elements/list_radio'
|
|
47
|
-
require 'testcentricity_web/web_elements/siebel_open_ui_helper'
|
|
48
38
|
|
|
49
39
|
|
|
50
40
|
module TestCentricity
|