testcentricity_web 4.1.10 → 4.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +92 -1
  3. data/README.md +301 -230
  4. data/lib/testcentricity_web/browser_helper.rb +2 -1
  5. data/lib/testcentricity_web/data_objects/environment.rb +0 -3
  6. data/lib/testcentricity_web/version.rb +1 -1
  7. data/lib/testcentricity_web/web_core/page_objects_helper.rb +39 -2
  8. data/lib/testcentricity_web/web_core/webdriver_helper.rb +162 -152
  9. data/lib/testcentricity_web/web_elements/media.rb +108 -0
  10. data/lib/testcentricity_web/web_elements/textfield.rb +28 -0
  11. data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +39 -1
  12. metadata +18 -162
  13. data/.gitignore +0 -39
  14. data/.idea/.name +0 -1
  15. data/.idea/encodings.xml +0 -6
  16. data/.idea/misc.xml +0 -4
  17. data/.idea/modules.xml +0 -8
  18. data/.idea/vcs.xml +0 -7
  19. data/.rspec +0 -4
  20. data/.rubocop.yml +0 -38
  21. data/.ruby-version +0 -1
  22. data/.simplecov +0 -9
  23. data/CODE_OF_CONDUCT.md +0 -13
  24. data/Gemfile +0 -6
  25. data/Rakefile +0 -115
  26. data/config/cucumber.yml +0 -171
  27. data/config/locales/en-US.yml +0 -56
  28. data/config/test_data/LOCAL_data.json +0 -15
  29. data/config/test_data/LOCAL_data.xls +0 -0
  30. data/config/test_data/LOCAL_data.yml +0 -11
  31. data/config/test_data/data.json +0 -25
  32. data/config/test_data/data.xls +0 -0
  33. data/config/test_data/data.yml +0 -20
  34. data/docker-compose.yml +0 -48
  35. data/features/basic_form_page_css.feature +0 -54
  36. data/features/basic_form_page_xpath.feature +0 -26
  37. data/features/custom_controls.feature +0 -29
  38. data/features/media_players.feature +0 -67
  39. data/features/step_definitions/generic_steps.rb.rb +0 -124
  40. data/features/step_definitions/media_steps.rb +0 -30
  41. data/features/support/data/form_data.rb +0 -43
  42. data/features/support/env.rb +0 -53
  43. data/features/support/hooks.rb +0 -270
  44. data/features/support/pages/base_test_page.rb +0 -22
  45. data/features/support/pages/basic_css_form_page.rb +0 -57
  46. data/features/support/pages/basic_form_page.rb +0 -500
  47. data/features/support/pages/basic_xpath_form_page.rb +0 -58
  48. data/features/support/pages/custom_controls_page.rb +0 -263
  49. data/features/support/pages/indexed_sections_page.rb +0 -57
  50. data/features/support/pages/media_test_page.rb +0 -207
  51. data/features/support/sections/header_nav.rb +0 -48
  52. data/features/support/sections/product_card.rb +0 -39
  53. data/features/support/world_data.rb +0 -12
  54. data/features/support/world_pages.rb +0 -18
  55. data/reports/.keep +0 -1
  56. data/spec/fixtures/page_object.rb +0 -22
  57. data/spec/fixtures/section_object.rb +0 -21
  58. data/spec/spec_helper.rb +0 -33
  59. data/spec/testcentricity_web/browser_spec.rb +0 -41
  60. data/spec/testcentricity_web/elements/audio_spec.rb +0 -68
  61. data/spec/testcentricity_web/elements/button_spec.rb +0 -18
  62. data/spec/testcentricity_web/elements/checkbox_spec.rb +0 -33
  63. data/spec/testcentricity_web/elements/file_field_spec.rb +0 -13
  64. data/spec/testcentricity_web/elements/image_spec.rb +0 -33
  65. data/spec/testcentricity_web/elements/label_spec.rb +0 -18
  66. data/spec/testcentricity_web/elements/link_spec.rb +0 -23
  67. data/spec/testcentricity_web/elements/list_spec.rb +0 -13
  68. data/spec/testcentricity_web/elements/radio_spec.rb +0 -28
  69. data/spec/testcentricity_web/elements/ui_element_spec.rb +0 -125
  70. data/spec/testcentricity_web/elements/video_spec.rb +0 -68
  71. data/spec/testcentricity_web/helper_specs/object_helpers_spec.rb +0 -39
  72. data/spec/testcentricity_web/helper_specs/string_helpers_spec.rb +0 -49
  73. data/spec/testcentricity_web/page_object_spec.rb +0 -90
  74. data/spec/testcentricity_web/section_object_spec.rb +0 -72
  75. data/spec/testcentricity_web/version_spec.rb +0 -7
  76. data/spec/testcentricity_web/webdriver_connect/grid_webdriver_spec.rb +0 -72
  77. data/spec/testcentricity_web/webdriver_connect/local_webdriver_spec.rb +0 -86
  78. data/spec/testcentricity_web/webdriver_connect/mobile_webdriver_spec.rb +0 -65
  79. data/test_site/basic_test_page.html +0 -269
  80. data/test_site/chosen/chosen-sprite.png +0 -0
  81. data/test_site/chosen/chosen-sprite@2x.png +0 -0
  82. data/test_site/chosen/chosen.css +0 -496
  83. data/test_site/chosen/chosen.jquery.js +0 -1359
  84. data/test_site/chosen/chosen.jquery.min.js +0 -3
  85. data/test_site/chosen/chosen.min.css +0 -11
  86. data/test_site/chosen/chosen.proto.js +0 -1399
  87. data/test_site/chosen/chosen.proto.min.js +0 -3
  88. data/test_site/chosen/composer.json +0 -36
  89. data/test_site/custom_controls_page.html +0 -629
  90. data/test_site/docsupport/chosen.png +0 -0
  91. data/test_site/docsupport/init.js +0 -11
  92. data/test_site/docsupport/init.proto.js +0 -16
  93. data/test_site/docsupport/jquery-1.12.4.min.js +0 -5
  94. data/test_site/docsupport/jquery-3.2.1.min.js +0 -4
  95. data/test_site/docsupport/oss-credit.png +0 -0
  96. data/test_site/docsupport/prism.css +0 -108
  97. data/test_site/docsupport/prism.js +0 -9
  98. data/test_site/docsupport/prototype-1.7.0.0.js +0 -6082
  99. data/test_site/docsupport/style.css +0 -219
  100. data/test_site/images/Blouse_Black.jpg +0 -0
  101. data/test_site/images/Granny.jpg +0 -0
  102. data/test_site/images/Printed_Dress.jpg +0 -0
  103. data/test_site/images/T-shirt.jpg +0 -0
  104. data/test_site/images/Wilder.jpg +0 -0
  105. data/test_site/images/You_Betcha.jpg +0 -0
  106. data/test_site/images/jeans3.jpg +0 -0
  107. data/test_site/indexed_sections_page.html +0 -215
  108. data/test_site/media/MIB2-subtitles-pt-BR.vtt +0 -49
  109. data/test_site/media/MIB2.mp4 +0 -0
  110. data/test_site/media/MP4_small.mp4 +0 -0
  111. data/test_site/media/MPS_sample.mp3 +0 -0
  112. data/test_site/media/bbc_scotland_report.mp3 +0 -0
  113. data/test_site/media/count_and_bars.mp4 +0 -0
  114. data/test_site/media_page.html +0 -86
  115. data/testcentricity_web.gemspec +0 -59
@@ -173,7 +173,8 @@ module TestCentricity
173
173
  @devices = @devices.merge(ext_devices)
174
174
  end
175
175
  end
176
- @devices[device.gsub(/\s+/, '').downcase.to_sym]
176
+ device = device.gsub(/\s+/, '').downcase.to_sym if device.is_a?(String)
177
+ @devices[device]
177
178
  end
178
179
  end
179
180
  end
@@ -396,7 +396,6 @@ module TestCentricity
396
396
  @screen_shots = []
397
397
  end
398
398
 
399
- # :nocov:
400
399
  def self.report_header
401
400
  report_header = "\n<b><u>TEST ENVIRONMENT</u>:</b> #{ENV['TEST_ENVIRONMENT']}\n"\
402
401
  " <b>Browser:</b>\t #{Environ.browser.capitalize}\n"
@@ -412,7 +411,5 @@ module TestCentricity
412
411
  report_header = "#{report_header} <b>WCAG Accessibility Standard:</b>\t #{ENV['ACCESSIBILITY_STANDARD']}\n" if ENV['ACCESSIBILITY_STANDARD']
413
412
  "#{report_header}\n\n"
414
413
  end
415
- # :nocov:
416
414
  end
417
415
  end
418
-
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '4.1.10'
2
+ VERSION = '4.3.1'
3
3
  end
@@ -9,7 +9,7 @@ module TestCentricity
9
9
  attr_accessor :locator_type
10
10
 
11
11
  XPATH_SELECTORS = ['//', '[@', '[contains(']
12
- CSS_SELECTORS = ['#', ':nth-child(', ':first-child', ':last-child', ':nth-of-type(', ':first-of-type', ':last-of-type', '^=', '$=', '*=', ':contains(']
12
+ CSS_SELECTORS = %w[# :nth-child( :first-child :last-child :nth-of-type( :first-of-type :last-of-type ^= $= *= :contains(]
13
13
 
14
14
  def set_locator_type(locator = nil)
15
15
  locator = @locator if locator.nil?
@@ -139,6 +139,16 @@ module TestCentricity
139
139
  ui_object.ready_state
140
140
  when :volume
141
141
  ui_object.volume
142
+ when :track_count
143
+ ui_object.track_count
144
+ when :active_track
145
+ ui_object.active_track
146
+ when :active_track_data
147
+ ui_object.active_track_data
148
+ when :active_track_source
149
+ ui_object.active_track_source
150
+ when :all_tracks_data
151
+ ui_object.all_tracks_data
142
152
  when :crossorigin
143
153
  ui_object.crossorigin
144
154
  when :preload
@@ -181,6 +191,8 @@ module TestCentricity
181
191
  ui_object.aria_describedby
182
192
  when :aria_live
183
193
  ui_object.aria_live
194
+ when :aria_busy
195
+ ui_object.aria_busy?
184
196
  when :aria_selected
185
197
  ui_object.aria_selected?
186
198
  when :aria_hidden
@@ -231,6 +243,30 @@ module TestCentricity
231
243
  ui_object.aria_multiselectable?
232
244
  when :content_editable
233
245
  ui_object.content_editable?
246
+ when :validation_message
247
+ ui_object.validation_message
248
+ when :badInput
249
+ ui_object.validity?(:badInput)
250
+ when :customError
251
+ ui_object.validity?(:customError)
252
+ when :patternMismatch
253
+ ui_object.validity?(:patternMismatch)
254
+ when :rangeOverflow
255
+ ui_object.validity?(:rangeOverflow)
256
+ when :rangeUnderflow
257
+ ui_object.validity?(:rangeUnderflow)
258
+ when :stepMismatch
259
+ ui_object.validity?(:stepMismatch)
260
+ when :tooLong
261
+ ui_object.validity?(:tooLong)
262
+ when :tooShort
263
+ ui_object.validity?(:tooShort)
264
+ when :typeMismatch
265
+ ui_object.validity?(:typeMismatch)
266
+ when :valid
267
+ ui_object.validity?(:valid)
268
+ when :valueMissing
269
+ ui_object.validity?(:valueMissing)
234
270
  else
235
271
  if property.is_a?(Hash)
236
272
  property.map do |key, value|
@@ -356,5 +392,6 @@ module TestCentricity
356
392
  raise "Expected element '#{expected_element.get_name}' to have focus but found '#{focused_obj[:id]} is focused instead'" unless focused_obj == expected_obj.native
357
393
 
358
394
  puts "Element '#{expected_element.get_name}' is focused as expected"
359
- end end
395
+ end
396
+ end
360
397
  end
@@ -24,56 +24,59 @@ module TestCentricity
24
24
  @endpoint = options[:endpoint] if options.key?(:endpoint)
25
25
  @capabilities = options[:desired_capabilities] if options.key?(:desired_capabilities)
26
26
  end
27
-
28
- browser = ENV['WEB_BROWSER']
27
+ # determine browser type and driver
28
+ Environ.browser = ENV['WEB_BROWSER'] if ENV['WEB_BROWSER']
29
+ Environ.driver = if ENV['DRIVER']
30
+ ENV['DRIVER'].downcase.to_sym
31
+ else
32
+ :webdriver
33
+ end
29
34
  # set downloads folder path
30
35
  @downloads_path = "#{Dir.pwd}/downloads"
31
36
  if ENV['PARALLEL']
32
- # :nocov:
33
37
  Environ.parallel = true
34
38
  Environ.process_num = ENV['TEST_ENV_NUMBER']
35
- @downloads_path = "#{@downloads_path}/#{ENV['TEST_ENV_NUMBER']}"
36
- Dir.mkdir(@downloads_path) unless Dir.exist?(@downloads_path)
37
- # :nocov:
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
38
43
  else
39
44
  Environ.parallel = false
40
45
  end
41
46
  @downloads_path = @downloads_path.tr('/', "\\") if OS.windows?
42
47
 
43
48
  # assume that we're testing within a local desktop web browser
44
- Environ.driver = :webdriver
45
49
  Environ.platform = :desktop
46
- Environ.browser = browser
47
50
  Environ.headless = false
48
51
  Environ.device = :web
49
52
  Environ.device_name = 'browser'
50
53
 
51
- context = case browser.downcase.to_sym
54
+ context = case Environ.driver
52
55
  when :appium
53
56
  initialize_appium
54
57
  'Appium'
55
- # :nocov:
58
+ when :webdriver
59
+ if ENV['SELENIUM'] == 'remote'
60
+ initialize_remote
61
+ 'Selenium Grid'
62
+ else
63
+ initialize_local_browser
64
+ 'local browser instance'
65
+ end
56
66
  when :browserstack
57
67
  initialize_browserstack
58
68
  'Browserstack cloud service'
69
+ when :testingbot
70
+ initialize_testingbot
71
+ 'TestingBot cloud service'
72
+ # :nocov:
59
73
  when :lambdatest
60
74
  initialize_lambdatest
61
75
  'LambdaTest cloud service'
62
76
  when :saucelabs
63
77
  initialize_saucelabs
64
78
  'Sauce Labs cloud service'
65
- when :testingbot
66
- initialize_testingbot
67
- 'TestingBot cloud service'
68
- # :nocov:
69
- else
70
- if ENV['SELENIUM'] == 'remote'
71
- initialize_remote
72
- 'Selenium Grid'
73
- else
74
- initialize_local_browser
75
- 'local browser instance'
76
- end
79
+ # :nocov:
77
80
  end
78
81
 
79
82
  # set browser window size only if testing with a desktop web browser
@@ -138,70 +141,75 @@ module TestCentricity
138
141
  private
139
142
 
140
143
  def self.initialize_appium
141
- Environ.platform = :mobile
144
+ Environ.platform = :mobile
145
+ Environ.device = :simulator
146
+ Environ.browser = ENV['APP_BROWSER']
142
147
  Environ.device_name = ENV['APP_DEVICE']
143
- Environ.device_os = ENV['APP_PLATFORM_NAME'].downcase.to_sym
148
+ Environ.device_os = ENV['APP_PLATFORM_NAME'].downcase.to_sym
144
149
  Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
145
150
  Environ.device_os_version = ENV['APP_VERSION']
146
151
  Environ.device_orientation = ENV['ORIENTATION'] if ENV['ORIENTATION']
147
152
  Capybara.default_driver = :appium
148
153
  Environ.driver = :appium
149
- desired_capabilities = {
150
- platformName: Environ.device_os,
151
- platformVersion: Environ.device_os_version,
152
- browserName: ENV['APP_BROWSER'],
153
- deviceName: Environ.device_name
154
- }
155
- desired_capabilities[:avd] = ENV['APP_DEVICE'] if Environ.device_os == :android
156
- desired_capabilities[:automationName] = ENV['AUTOMATION_ENGINE'] if ENV['AUTOMATION_ENGINE']
157
- if ENV['UDID']
158
- # :nocov:
159
- Environ.device = :device
160
- desired_capabilities[:udid] = ENV['UDID']
161
- desired_capabilities[:xcodeOrgId] = ENV['TEAM_ID'] if ENV['TEAM_ID']
162
- desired_capabilities[:xcodeSigningId] = ENV['TEAM_NAME'] if ENV['TEAM_NAME']
163
- # :nocov:
164
- else
165
- Environ.device = :simulator
166
- desired_capabilities[:orientation] = Environ.device_orientation.upcase if Environ.device_orientation
167
- if Environ.device_os == :ios
168
- desired_capabilities[:language] = Environ.language if Environ.language
169
- desired_capabilities[:locale] = Environ.locale.gsub('-', '_') if Environ.locale
170
- end
171
- end
172
- desired_capabilities[:safariIgnoreFraudWarning] = ENV['APP_IGNORE_FRAUD_WARNING'] if ENV['APP_IGNORE_FRAUD_WARNING']
173
- desired_capabilities[:safariInitialUrl] = ENV['APP_INITIAL_URL'] if ENV['APP_INITIAL_URL']
174
- desired_capabilities[:safariAllowPopups] = ENV['APP_ALLOW_POPUPS'] if ENV['APP_ALLOW_POPUPS']
175
- desired_capabilities[:shutdownOtherSimulators] = ENV['SHUTDOWN_OTHER_SIMS'] if ENV['SHUTDOWN_OTHER_SIMS']
176
- desired_capabilities[:forceSimulatorSoftwareKeyboardPresence] = ENV['SHOW_SIM_KEYBOARD'] if ENV['SHOW_SIM_KEYBOARD']
177
-
178
- desired_capabilities[:autoAcceptAlerts] = ENV['AUTO_ACCEPT_ALERTS'] if ENV['AUTO_ACCEPT_ALERTS']
179
- desired_capabilities[:autoDismissAlerts] = ENV['AUTO_DISMISS_ALERTS'] if ENV['AUTO_DISMISS_ALERTS']
180
- desired_capabilities[:isHeadless] = ENV['HEADLESS'] if ENV['HEADLESS']
181
-
182
- desired_capabilities[:newCommandTimeout] = ENV['NEW_COMMAND_TIMEOUT'] if ENV['NEW_COMMAND_TIMEOUT']
183
- desired_capabilities[:noReset] = ENV['APP_NO_RESET'] if ENV['APP_NO_RESET']
184
- desired_capabilities[:fullReset] = ENV['APP_FULL_RESET'] if ENV['APP_FULL_RESET']
185
- desired_capabilities[:webkitDebugProxyPort] = ENV['WEBKIT_DEBUG_PROXY_PORT'] if ENV['WEBKIT_DEBUG_PROXY_PORT']
186
- desired_capabilities[:webDriverAgentUrl] = ENV['WEBDRIVER_AGENT_URL'] if ENV['WEBDRIVER_AGENT_URL']
187
- desired_capabilities[:usePrebuiltWDA] = ENV['USE_PREBUILT_WDA'] if ENV['USE_PREBUILT_WDA']
188
- desired_capabilities[:useNewWDA] = ENV['USE_NEW_WDA'] if ENV['USE_NEW_WDA']
189
- desired_capabilities[:chromedriverExecutable] = ENV['CHROMEDRIVER_EXECUTABLE'] if ENV['CHROMEDRIVER_EXECUTABLE']
190
- # set wdaLocalPort (iOS) or systemPort (Android) if PARALLEL_PORT is true
191
- if ENV['PARALLEL'] && ENV['PARALLEL_PORT']
192
- # :nocov:
193
- if Environ.device_os == :ios
194
- desired_capabilities[:wdaLocalPort] = 8100 + ENV['TEST_ENV_NUMBER'].to_i
195
- else
196
- desired_capabilities[:systemPort] = 8200 + ENV['TEST_ENV_NUMBER'].to_i
197
- end
198
- # :nocov:
199
- else
200
- desired_capabilities[:wdaLocalPort] = ENV['WDA_LOCAL_PORT'] if ENV['WDA_LOCAL_PORT']
201
- desired_capabilities[:systemPort] = ENV['SYSTEM_PORT'] if ENV['SYSTEM_PORT']
202
- end
203
-
204
- desired_capabilities = @capabilities unless @capabilities.nil?
154
+ # define capabilites
155
+ desired_capabilities = if @capabilities.nil?
156
+ desired_capabilities = {
157
+ platformName: Environ.device_os,
158
+ platformVersion: Environ.device_os_version,
159
+ browserName: Environ.browser,
160
+ deviceName: Environ.device_name
161
+ }
162
+ desired_capabilities[:avd] = ENV['APP_DEVICE'] if Environ.device_os == :android
163
+ desired_capabilities[:automationName] = ENV['AUTOMATION_ENGINE'] if ENV['AUTOMATION_ENGINE']
164
+ if ENV['UDID']
165
+ # :nocov:
166
+ Environ.device = :device
167
+ desired_capabilities[:udid] = ENV['UDID']
168
+ desired_capabilities[:xcodeOrgId] = ENV['TEAM_ID'] if ENV['TEAM_ID']
169
+ desired_capabilities[:xcodeSigningId] = ENV['TEAM_NAME'] if ENV['TEAM_NAME']
170
+ # :nocov:
171
+ else
172
+ desired_capabilities[:orientation] = Environ.device_orientation.upcase if Environ.device_orientation
173
+ if Environ.device_os == :ios
174
+ desired_capabilities[:language] = Environ.language if Environ.language
175
+ desired_capabilities[:locale] = Environ.locale.gsub('-', '_') if Environ.locale
176
+ end
177
+ end
178
+ desired_capabilities[:safariIgnoreFraudWarning] = ENV['APP_IGNORE_FRAUD_WARNING'] if ENV['APP_IGNORE_FRAUD_WARNING']
179
+ desired_capabilities[:safariInitialUrl] = ENV['APP_INITIAL_URL'] if ENV['APP_INITIAL_URL']
180
+ desired_capabilities[:safariAllowPopups] = ENV['APP_ALLOW_POPUPS'] if ENV['APP_ALLOW_POPUPS']
181
+ desired_capabilities[:shutdownOtherSimulators] = ENV['SHUTDOWN_OTHER_SIMS'] if ENV['SHUTDOWN_OTHER_SIMS']
182
+ desired_capabilities[:forceSimulatorSoftwareKeyboardPresence] = ENV['SHOW_SIM_KEYBOARD'] if ENV['SHOW_SIM_KEYBOARD']
183
+
184
+ desired_capabilities[:autoAcceptAlerts] = ENV['AUTO_ACCEPT_ALERTS'] if ENV['AUTO_ACCEPT_ALERTS']
185
+ desired_capabilities[:autoDismissAlerts] = ENV['AUTO_DISMISS_ALERTS'] if ENV['AUTO_DISMISS_ALERTS']
186
+ desired_capabilities[:isHeadless] = ENV['HEADLESS'] if ENV['HEADLESS']
187
+
188
+ desired_capabilities[:newCommandTimeout] = ENV['NEW_COMMAND_TIMEOUT'] if ENV['NEW_COMMAND_TIMEOUT']
189
+ desired_capabilities[:noReset] = ENV['APP_NO_RESET'] if ENV['APP_NO_RESET']
190
+ desired_capabilities[:fullReset] = ENV['APP_FULL_RESET'] if ENV['APP_FULL_RESET']
191
+ desired_capabilities[:webkitDebugProxyPort] = ENV['WEBKIT_DEBUG_PROXY_PORT'] if ENV['WEBKIT_DEBUG_PROXY_PORT']
192
+ desired_capabilities[:webDriverAgentUrl] = ENV['WEBDRIVER_AGENT_URL'] if ENV['WEBDRIVER_AGENT_URL']
193
+ desired_capabilities[:usePrebuiltWDA] = ENV['USE_PREBUILT_WDA'] if ENV['USE_PREBUILT_WDA']
194
+ desired_capabilities[:useNewWDA] = ENV['USE_NEW_WDA'] if ENV['USE_NEW_WDA']
195
+ desired_capabilities[:chromedriverExecutable] = ENV['CHROMEDRIVER_EXECUTABLE'] if ENV['CHROMEDRIVER_EXECUTABLE']
196
+ # set wdaLocalPort (iOS) or systemPort (Android) if PARALLEL_PORT is true
197
+ if ENV['PARALLEL'] && ENV['PARALLEL_PORT']
198
+ # :nocov:
199
+ if Environ.device_os == :ios
200
+ desired_capabilities[:wdaLocalPort] = 8100 + ENV['TEST_ENV_NUMBER'].to_i
201
+ else
202
+ desired_capabilities[:systemPort] = 8200 + ENV['TEST_ENV_NUMBER'].to_i
203
+ end
204
+ # :nocov:
205
+ else
206
+ desired_capabilities[:wdaLocalPort] = ENV['WDA_LOCAL_PORT'] if ENV['WDA_LOCAL_PORT']
207
+ desired_capabilities[:systemPort] = ENV['SYSTEM_PORT'] if ENV['SYSTEM_PORT']
208
+ end
209
+ desired_capabilities
210
+ else
211
+ @capabilities
212
+ end
205
213
  # specify endpoint url
206
214
  @endpoint = 'http://localhost:4723/wd/hub' if @endpoint.nil?
207
215
 
@@ -218,14 +226,16 @@ module TestCentricity
218
226
  Environ.os = case
219
227
  when OS.osx?
220
228
  'OS X'
229
+ # :nocov:
221
230
  when OS.windows?
222
231
  'Windows'
223
232
  when OS.linux?
224
233
  'Linux'
225
234
  else
226
235
  'unknown'
236
+ # :nocov:
227
237
  end
228
- browser = ENV['WEB_BROWSER'].downcase.to_sym
238
+ browser = Environ.browser.downcase.to_sym
229
239
 
230
240
  case browser
231
241
  when :firefox, :chrome, :ie, :safari, :edge
@@ -235,7 +245,7 @@ module TestCentricity
235
245
  Environ.headless = true
236
246
  else
237
247
  Environ.platform = :mobile
238
- Environ.device_name = Browsers.mobile_device_name(ENV['WEB_BROWSER'])
248
+ Environ.device_name = Browsers.mobile_device_name(Environ.browser)
239
249
  end
240
250
 
241
251
  Capybara.register_driver :selenium do |app|
@@ -253,8 +263,8 @@ module TestCentricity
253
263
  Capybara::Selenium::Driver.new(app, browser: :edge, capabilities: [options])
254
264
  else
255
265
  if ENV['HOST_BROWSER'] && ENV['HOST_BROWSER'].downcase.to_sym == :chrome
256
- user_agent = Browsers.mobile_device_agent(ENV['WEB_BROWSER'])
257
- options = Selenium::WebDriver::Chrome::Options.new(options: {'excludeSwitches' => ['enable-automation']})
266
+ user_agent = Browsers.mobile_device_agent(Environ.browser)
267
+ options = Selenium::WebDriver::Chrome::Options.new
258
268
  options.add_argument('--disable-dev-shm-usage')
259
269
  options.add_argument("--user-agent='#{user_agent}'")
260
270
  options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
@@ -269,14 +279,16 @@ module TestCentricity
269
279
 
270
280
  def self.initialize_remote
271
281
  Environ.grid = :selenium_grid
272
- browser = ENV['WEB_BROWSER'].downcase.to_sym
282
+ browser = Environ.browser.downcase.to_sym
273
283
  @endpoint = ENV['REMOTE_ENDPOINT'] || 'http://127.0.0.1:4444/wd/hub' if @endpoint.nil?
274
284
 
275
285
  case browser
286
+ # :nocov:
276
287
  when :safari
277
288
  options = Selenium::WebDriver::Safari::Options.new
278
289
  when :ie
279
290
  options = Selenium::WebDriver::IE::Options.new
291
+ # :nocov:
280
292
  when :firefox, :firefox_headless
281
293
  options = firefox_options(browser)
282
294
  when :chrome, :chrome_headless, :edge, :edge_headless
@@ -284,9 +296,9 @@ module TestCentricity
284
296
  else
285
297
  if ENV['HOST_BROWSER'] && ENV['HOST_BROWSER'].downcase.to_sym == :chrome
286
298
  Environ.platform = :mobile
287
- Environ.device_name = Browsers.mobile_device_name(ENV['WEB_BROWSER'])
288
- user_agent = Browsers.mobile_device_agent(ENV['WEB_BROWSER'])
289
- options = Selenium::WebDriver::Chrome::Options.new(options: {'excludeSwitches' => ['enable-automation']})
299
+ Environ.device_name = Browsers.mobile_device_name(Environ.browser)
300
+ user_agent = Browsers.mobile_device_agent(Environ.browser)
301
+ options = Selenium::WebDriver::Chrome::Options.new
290
302
  options.add_argument('--disable-dev-shm-usage')
291
303
  options.add_argument("--user-agent='#{user_agent}'")
292
304
  options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
@@ -311,11 +323,10 @@ module TestCentricity
311
323
  Capybara.default_driver = :remote_browser
312
324
  end
313
325
 
314
- # :nocov:
315
326
  def self.initialize_browserstack
316
327
  browser = ENV['BS_BROWSER']
317
328
  Environ.grid = :browserstack
318
-
329
+ Environ.os = "#{ENV['BS_OS']} #{ENV['BS_OS_VERSION']}"
319
330
  if ENV['BS_REAL_MOBILE'] || ENV['BS_DEVICE']
320
331
  Environ.platform = :mobile
321
332
  Environ.device_name = ENV['BS_DEVICE']
@@ -326,11 +337,10 @@ module TestCentricity
326
337
  else
327
338
  :simulator
328
339
  end
329
- elsif ENV['BS_OS']
330
- Environ.os = "#{ENV['BS_OS']} #{ENV['BS_OS_VERSION']}"
331
340
  end
332
341
  # specify endpoint url
333
342
  @endpoint = "http://#{ENV['BS_USERNAME']}:#{ENV['BS_AUTHKEY']}@hub-cloud.browserstack.com/wd/hub" if @endpoint.nil?
343
+ # :nocov:
334
344
  # enable tunneling if specified
335
345
  if ENV['TUNNELING']
336
346
  @bs_local = BrowserStack::Local.new
@@ -342,6 +352,7 @@ module TestCentricity
342
352
  puts 'BrowserStack Local instance failed to start'
343
353
  end
344
354
  end
355
+ # :nocov:
345
356
  # define BrowserStack options
346
357
  options = if @capabilities.nil?
347
358
  browser_options = {}
@@ -390,7 +401,7 @@ module TestCentricity
390
401
  else
391
402
  # define desktop browser options
392
403
  bs_options[:resolution] = ENV['RESOLUTION'] if ENV['RESOLUTION']
393
- bs_options[:seleniumVersion] = '4.1.0'
404
+ bs_options[:seleniumVersion] = '4.3.0'
394
405
  {
395
406
  browserName: browser,
396
407
  browserVersion: ENV['BS_VERSION'],
@@ -407,6 +418,61 @@ module TestCentricity
407
418
  Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
408
419
  end
409
420
 
421
+ def self.initialize_testingbot
422
+ browser = ENV['TB_BROWSER']
423
+ Environ.grid = :testingbot
424
+
425
+ Environ.os = ENV['TB_OS']
426
+ if ENV['TB_PLATFORM']
427
+ Environ.device_orientation = ENV['ORIENTATION'] if ENV['ORIENTATION']
428
+ Environ.device_os = ENV['TB_PLATFORM']
429
+ Environ.device_name = ENV['TB_DEVICE']
430
+ Environ.device = :device
431
+ Environ.platform = :mobile
432
+ Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
433
+ else
434
+ Environ.platform = :desktop
435
+ end
436
+ # specify endpoint url
437
+ if @endpoint.nil?
438
+ url = ENV['TUNNELING'] ? '@localhost:4445/wd/hub' : '@hub.testingbot.com/wd/hub'
439
+ @endpoint = "http://#{ENV['TB_USERNAME']}:#{ENV['TB_AUTHKEY']}#{url}"
440
+ end
441
+ # define TestingBot options
442
+ options = if @capabilities.nil?
443
+ # define the required set of TestingBot options
444
+ tb_options = { build: test_context_message }
445
+ # define the optional TestingBot options
446
+ tb_options[:name] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
447
+ tb_options['timeZone'] = ENV['TIME_ZONE'] if ENV['TIME_ZONE']
448
+ tb_options['testingbot.geoCountryCode'] = ENV['GEO_LOCATION'] if ENV['GEO_LOCATION']
449
+ tb_options[:screenrecorder] = ENV['RECORD_VIDEO'] if ENV['RECORD_VIDEO']
450
+ tb_options[:screenshot] = ENV['SCREENSHOTS'] if ENV['SCREENSHOTS']
451
+ # define mobile device options
452
+ if ENV['TB_PLATFORM']
453
+ tb_options[:platform] = ENV['TB_PLATFORM']
454
+ tb_options[:orientation] = ENV['ORIENTATION'].upcase if ENV['ORIENTATION']
455
+ tb_options[:deviceName] = ENV['TB_DEVICE'] if ENV['TB_DEVICE']
456
+ else
457
+ # define desktop browser options
458
+ tb_options['screen-resolution'] = ENV['RESOLUTION'] if ENV['RESOLUTION']
459
+ tb_options['selenium-version'] = '4.3.0'
460
+ end
461
+ {
462
+ browserName: browser,
463
+ browserVersion: ENV['TB_VERSION'],
464
+ platformName: ENV['TB_OS'],
465
+ 'tb:options': tb_options
466
+ }
467
+ else
468
+ @capabilities
469
+ end
470
+ register_remote_driver(:testingbot, browser, options)
471
+ # configure file_detector for remote uploads if target is desktop web browser
472
+ config_file_uploads unless ENV['TB_PLATFORM']
473
+ end
474
+
475
+ # :nocov:
410
476
  def self.initialize_lambdatest
411
477
  browser = ENV['LT_BROWSER']
412
478
  Environ.grid = :lambdatest
@@ -488,7 +554,7 @@ module TestCentricity
488
554
  # define mobile device options
489
555
  if ENV['SL_PLATFORM']
490
556
  sl_options[:deviceOrientation] = ENV['ORIENTATION'].upcase if ENV['ORIENTATION']
491
- sl_options[:appiumVersion] = '1.22.0'
557
+ sl_options[:appiumVersion] = '1.22.3'
492
558
  {
493
559
  browserName: browser,
494
560
  platformName: ENV['SL_PLATFORM'],
@@ -513,68 +579,14 @@ module TestCentricity
513
579
  # configure file_detector for remote uploads
514
580
  config_file_uploads
515
581
  end
516
-
517
- def self.initialize_testingbot
518
- browser = ENV['TB_BROWSER']
519
- Environ.grid = :testingbot
520
-
521
- Environ.os = ENV['TB_OS']
522
- if ENV['TB_PLATFORM']
523
- Environ.device_orientation = ENV['ORIENTATION'] if ENV['ORIENTATION']
524
- Environ.device_os = ENV['TB_PLATFORM']
525
- Environ.device_name = ENV['TB_DEVICE']
526
- Environ.device = :device
527
- Environ.platform = :mobile
528
- Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
529
- else
530
- Environ.platform = :desktop
531
- end
532
- # specify endpoint url
533
- if @endpoint.nil?
534
- url = ENV['TUNNELING'] ? '@localhost:4445/wd/hub' : '@hub.testingbot.com/wd/hub'
535
- @endpoint = "http://#{ENV['TB_USERNAME']}:#{ENV['TB_AUTHKEY']}#{url}"
536
- end
537
- # define TestingBot options
538
- options = if @capabilities.nil?
539
- # define the required set of TestingBot options
540
- tb_options = { build: test_context_message }
541
- # define the optional TestingBot options
542
- tb_options[:name] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
543
- tb_options[:timeZone] = ENV['TIME_ZONE'] if ENV['TIME_ZONE']
544
- tb_options['testingbot.geoCountryCode'] = ENV['GEO_LOCATION'] if ENV['GEO_LOCATION']
545
- tb_options[:screenrecorder] = ENV['RECORD_VIDEO'] if ENV['RECORD_VIDEO']
546
- tb_options[:screenshot] = ENV['SCREENSHOTS'] if ENV['SCREENSHOTS']
547
- # define mobile device options
548
- if ENV['TB_PLATFORM']
549
- tb_options[:platform] = ENV['TB_PLATFORM']
550
- tb_options[:orientation] = ENV['ORIENTATION'].upcase if ENV['ORIENTATION']
551
- tb_options[:deviceName] = ENV['TB_DEVICE'] if ENV['TB_DEVICE']
552
- else
553
- # define desktop browser options
554
- tb_options['screen-resolution'] = ENV['RESOLUTION'] if ENV['RESOLUTION']
555
- tb_options['selenium-version'] = '4.1.0'
556
- end
557
- {
558
- browserName: browser,
559
- browserVersion: ENV['TB_VERSION'],
560
- platformName: ENV['TB_OS'],
561
- 'tb:options': tb_options
562
- }
563
- else
564
- @capabilities
565
- end
566
- register_remote_driver(:testingbot, browser, options)
567
- # configure file_detector for remote uploads if target is desktop web browser
568
- config_file_uploads unless ENV['TB_PLATFORM']
569
- end
570
582
  # :nocov:
571
583
 
572
584
  def self.chrome_edge_options(browser)
573
585
  options = case browser
574
586
  when :chrome, :chrome_headless
575
- Selenium::WebDriver::Chrome::Options.new(options: {'excludeSwitches' => ['enable-automation']})
587
+ Selenium::WebDriver::Chrome::Options.new
576
588
  when :edge, :edge_headless
577
- Selenium::WebDriver::Edge::Options.new(options: {'excludeSwitches' => ['enable-automation']})
589
+ Selenium::WebDriver::Edge::Options.new
578
590
  end
579
591
  prefs = {
580
592
  prompt_for_download: false,
@@ -613,7 +625,6 @@ module TestCentricity
613
625
  options
614
626
  end
615
627
 
616
- # :nocov:
617
628
  def self.test_context_message
618
629
  context_message = if ENV['TEST_CONTEXT']
619
630
  "#{Environ.test_environment.to_s.upcase} - #{ENV['TEST_CONTEXT']}"
@@ -651,6 +662,5 @@ module TestCentricity
651
662
  str if File.exist?(str)
652
663
  end
653
664
  end
654
- # :nocov:
655
665
  end
656
666
  end