testcentricity 2.4.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +29 -0
  3. data/.rspec +2 -1
  4. data/.rubocop.yml +38 -0
  5. data/.ruby-version +1 -1
  6. data/.simplecov +9 -0
  7. data/.yardopts +3 -0
  8. data/CHANGELOG.md +275 -0
  9. data/CODE_OF_CONDUCT.md +13 -0
  10. data/{LICENSE.txt → LICENSE.md} +3 -4
  11. data/README.md +938 -1384
  12. data/Rakefile +63 -1
  13. data/config/cucumber.yml +145 -0
  14. data/config/locales/en-US.yml +56 -0
  15. data/config/test_data/LOCAL_data.yml +11 -0
  16. data/config/test_data/data.yml +10 -0
  17. data/features/deep_links.feature +26 -0
  18. data/features/login.feature +30 -0
  19. data/features/navigation.feature +31 -0
  20. data/features/step_definitions/generic_steps.rb +72 -0
  21. data/features/support/android/screens/about_screen.rb +11 -0
  22. data/features/support/android/screens/base_app_screen.rb +29 -0
  23. data/features/support/android/screens/checkout_address_screen.rb +17 -0
  24. data/features/support/android/screens/checkout_payment_screen.rb +22 -0
  25. data/features/support/android/screens/login_screen.rb +18 -0
  26. data/features/support/android/screens/products_screen.rb +13 -0
  27. data/features/support/android/screens/saucebot_screen.rb +16 -0
  28. data/features/support/android/screens/webview_screen.rb +13 -0
  29. data/features/support/android/sections/nav_widgets/nav_menu.rb +39 -0
  30. data/features/support/env.rb +61 -0
  31. data/features/support/hooks.rb +135 -0
  32. data/features/support/ios/screens/about_screen.rb +11 -0
  33. data/features/support/ios/screens/base_app_screen.rb +19 -0
  34. data/features/support/ios/screens/checkout_address_screen.rb +17 -0
  35. data/features/support/ios/screens/checkout_payment_screen.rb +22 -0
  36. data/features/support/ios/screens/login_screen.rb +18 -0
  37. data/features/support/ios/screens/products_screen.rb +13 -0
  38. data/features/support/ios/screens/saucebot_screen.rb +16 -0
  39. data/features/support/ios/screens/webview_screen.rb +13 -0
  40. data/features/support/ios/sections/list_items/product_cell_item.rb +13 -0
  41. data/features/support/ios/sections/modals/base_modal.rb +23 -0
  42. data/features/support/ios/sections/modals/logout_modal.rb +6 -0
  43. data/features/support/ios/sections/modals/reset_app_state_modal.rb +6 -0
  44. data/features/support/ios/sections/nav_widgets/nav_bar.rb +31 -0
  45. data/features/support/ios/sections/nav_widgets/nav_menu.rb +41 -0
  46. data/features/support/shared_components/screens/base_app_screen.rb +31 -0
  47. data/features/support/shared_components/screens/checkout_address_screen.rb +17 -0
  48. data/features/support/shared_components/screens/checkout_payment_screen.rb +22 -0
  49. data/features/support/shared_components/screens/login_screen.rb +39 -0
  50. data/features/support/shared_components/screens/saucebot_screen.rb +17 -0
  51. data/features/support/shared_components/screens/webview_screen.rb +12 -0
  52. data/features/support/shared_components/sections/nav_menu.rb +58 -0
  53. data/features/support/world_data.rb +12 -0
  54. data/features/support/world_pages.rb +26 -0
  55. data/lib/testcentricity/app_core/appium_connect_helper.rb +343 -111
  56. data/lib/testcentricity/app_core/screen_object.rb +252 -0
  57. data/lib/testcentricity/app_core/screen_objects_helper.rb +29 -201
  58. data/lib/testcentricity/app_core/{screen_sections_helper.rb → screen_section.rb} +40 -105
  59. data/lib/testcentricity/app_elements/app_element_helper.rb +17 -8
  60. data/lib/testcentricity/app_elements/checkbox.rb +3 -3
  61. data/lib/testcentricity/data_objects/environment.rb +133 -39
  62. data/lib/testcentricity/version.rb +1 -1
  63. data/lib/testcentricity.rb +4 -129
  64. data/reports/.keep +1 -0
  65. data/spec/fixtures/page_object.rb +22 -0
  66. data/spec/fixtures/page_section_object.rb +21 -0
  67. data/spec/fixtures/screen_object.rb +16 -0
  68. data/spec/fixtures/screen_section_object.rb +16 -0
  69. data/spec/spec_helper.rb +28 -9
  70. data/spec/testcentricity/elements/button_spec.rb +18 -0
  71. data/spec/testcentricity/elements/checkbox_spec.rb +28 -0
  72. data/spec/testcentricity/elements/image_spec.rb +13 -0
  73. data/spec/testcentricity/elements/label_spec.rb +18 -0
  74. data/spec/testcentricity/elements/list_spec.rb +13 -0
  75. data/spec/testcentricity/elements/ui_element_spec.rb +72 -0
  76. data/spec/testcentricity/mobile/appium_connect_spec.rb +117 -0
  77. data/spec/testcentricity/mobile/screen_object_spec.rb +63 -0
  78. data/spec/testcentricity/mobile/screen_section_object_spec.rb +56 -0
  79. data/spec/testcentricity/version_spec.rb +7 -0
  80. data/spec/testcentricity/web/browser_spec.rb +41 -0
  81. data/spec/testcentricity/web/local_webdriver_spec.rb +86 -0
  82. data/spec/testcentricity/web/mobile_webdriver_spec.rb +123 -0
  83. data/spec/testcentricity/web/page_object_spec.rb +85 -0
  84. data/spec/testcentricity/web/page_section_object_spec.rb +72 -0
  85. data/testcentricity.gemspec +28 -27
  86. metadata +196 -127
  87. data/.ruby-gemset +0 -1
  88. data/Gemfile.lock +0 -93
  89. data/bin/console +0 -14
  90. data/bin/setup +0 -8
  91. data/lib/devices/devices.yml +0 -352
  92. data/lib/testcentricity/app_core/appium_server.rb +0 -69
  93. data/lib/testcentricity/browser_helper.rb +0 -174
  94. data/lib/testcentricity/data_objects/data_objects_helper.rb +0 -78
  95. data/lib/testcentricity/data_objects/excel_helper.rb +0 -242
  96. data/lib/testcentricity/exception_queue_helper.rb +0 -111
  97. data/lib/testcentricity/utility_helpers.rb +0 -32
  98. data/lib/testcentricity/web_core/drag_drop_helper.rb +0 -15
  99. data/lib/testcentricity/web_core/page_objects_helper.rb +0 -677
  100. data/lib/testcentricity/web_core/page_sections_helper.rb +0 -895
  101. data/lib/testcentricity/web_core/webdriver_helper.rb +0 -588
  102. data/lib/testcentricity/web_elements/button.rb +0 -8
  103. data/lib/testcentricity/web_elements/cell_button.rb +0 -8
  104. data/lib/testcentricity/web_elements/cell_checkbox.rb +0 -38
  105. data/lib/testcentricity/web_elements/cell_element.rb +0 -69
  106. data/lib/testcentricity/web_elements/cell_image.rb +0 -8
  107. data/lib/testcentricity/web_elements/cell_radio.rb +0 -31
  108. data/lib/testcentricity/web_elements/checkbox.rb +0 -100
  109. data/lib/testcentricity/web_elements/file_field.rb +0 -45
  110. data/lib/testcentricity/web_elements/image.rb +0 -34
  111. data/lib/testcentricity/web_elements/label.rb +0 -8
  112. data/lib/testcentricity/web_elements/link.rb +0 -8
  113. data/lib/testcentricity/web_elements/list.rb +0 -100
  114. data/lib/testcentricity/web_elements/list_button.rb +0 -8
  115. data/lib/testcentricity/web_elements/list_checkbox.rb +0 -38
  116. data/lib/testcentricity/web_elements/list_element.rb +0 -61
  117. data/lib/testcentricity/web_elements/list_radio.rb +0 -31
  118. data/lib/testcentricity/web_elements/radio.rb +0 -74
  119. data/lib/testcentricity/web_elements/select_list.rb +0 -208
  120. data/lib/testcentricity/web_elements/siebel_open_ui_helper.rb +0 -15
  121. data/lib/testcentricity/web_elements/table.rb +0 -612
  122. data/lib/testcentricity/web_elements/textfield.rb +0 -114
  123. data/lib/testcentricity/web_elements/ui_elements_helper.rb +0 -532
  124. data/lib/testcentricity/world_extensions.rb +0 -26
  125. data/my_templates/default/method_details/setup.rb +0 -3
  126. data/spec/testcentricity_spec.rb +0 -9
@@ -1,588 +0,0 @@
1
- require 'selenium-webdriver'
2
- require 'os'
3
- require 'browserstack/local'
4
-
5
-
6
- module TestCentricity
7
- module WebDriverConnect
8
- include Capybara::DSL
9
-
10
- attr_accessor :webdriver_path
11
- attr_accessor :bs_local
12
-
13
- def self.initialize_web_driver(app_host = nil)
14
- Capybara.app_host = app_host unless app_host.nil?
15
- browser = ENV['WEB_BROWSER']
16
-
17
- # assume that we're testing within a local desktop web browser
18
- Environ.driver = :webdriver
19
- Environ.platform = :desktop
20
- Environ.browser = browser
21
- Environ.device = :web
22
- Environ.device_name = 'browser'
23
-
24
- case browser.downcase.to_sym
25
- when :appium
26
- initialize_appium
27
- context = 'mobile device emulator'
28
- when :browserstack
29
- initialize_browserstack
30
- context = 'Browserstack cloud service'
31
- when :crossbrowser
32
- initialize_crossbrowser
33
- context = 'CrossBrowserTesting cloud service'
34
- when :poltergeist
35
- initialize_poltergeist
36
- context = 'PhantomJS'
37
- when :saucelabs
38
- initialize_saucelabs
39
- context = 'Sauce Labs cloud service'
40
- when :testingbot
41
- initialize_testingbot
42
- context = 'TestingBot cloud service'
43
- else
44
- if ENV['SELENIUM'] == 'remote'
45
- initialize_remote
46
- context = 'Selenium Grid2'
47
- else
48
- initialize_local_browser
49
- context = 'local instance'
50
- end
51
- end
52
-
53
- # set browser window size only if testing with a desktop web browser
54
- unless Environ.is_device? || [:poltergeist, :appium].include?(Capybara.current_driver)
55
- initialize_browser_size
56
- end
57
-
58
- Environ.session_state = :running
59
- puts "Using #{Environ.browser} browser via #{context}"
60
- end
61
-
62
- def self.set_domain(url)
63
- Capybara.app_host = url
64
- end
65
-
66
- # Set the WebDriver path for Chrome, Firefox, IE, or Edge browsers
67
- def self.set_webdriver_path(project_path)
68
- path_to_driver = nil
69
- # check for existence of /webdrivers or /features/support/drivers folders
70
- base_path = 'features/support/drivers'
71
- unless File.directory?(File.join(project_path, base_path))
72
- base_path = 'webdrivers'
73
- unless File.directory?(File.join(project_path, base_path))
74
- raise 'Could not find WebDriver files in /webdrivers or /features/support/drivers folders'
75
- end
76
- end
77
- # set WebDriver path based on browser and operating system
78
- case ENV['WEB_BROWSER'].downcase.to_sym
79
- when :chrome
80
- if OS.osx?
81
- path_to_driver = 'mac/chromedriver'
82
- elsif OS.windows?
83
- path_to_driver = 'windows/chromedriver.exe'
84
- end
85
- @webdriver_path = File.join(project_path, base_path, path_to_driver)
86
- Selenium::WebDriver::Chrome.driver_path = @webdriver_path
87
- # when :firefox
88
- # if OS.osx?
89
- # path_to_driver = 'mac/geckodriver'
90
- # elsif OS.windows?
91
- # path_to_driver = 'windows/geckodriver.exe'
92
- # end
93
- # @webdriver_path = File.join(project_path, base_path, path_to_driver)
94
- # Selenium::WebDriver::Firefox.driver_path = @webdriver_path
95
- when :ie
96
- path_to_driver = 'windows/IEDriverServer.exe'
97
- @webdriver_path = File.join(project_path, base_path, path_to_driver)
98
- Selenium::WebDriver::IE.driver_path = @webdriver_path
99
- when :edge
100
- path_to_driver = 'windows/MicrosoftWebDriver.exe'
101
- @webdriver_path = File.join(project_path, base_path, path_to_driver)
102
- Selenium::WebDriver::Edge.driver_path = @webdriver_path
103
- else
104
- if ENV['HOST_BROWSER']
105
- case ENV['HOST_BROWSER'].downcase.to_sym
106
- when :chrome
107
- if OS.osx?
108
- path_to_driver = 'mac/chromedriver'
109
- elsif OS.windows?
110
- path_to_driver = 'windows/chromedriver.exe'
111
- end
112
- @webdriver_path = File.join(project_path, base_path, path_to_driver)
113
- Selenium::WebDriver::Chrome.driver_path = @webdriver_path
114
- # when :firefox
115
- # if OS.osx?
116
- # path_to_driver = 'mac/geckodriver'
117
- # elsif OS.windows?
118
- # path_to_driver = 'windows/geckodriver.exe'
119
- # end
120
- # @webdriver_path = File.join(project_path, base_path, path_to_driver)
121
- # Selenium::WebDriver::Firefox.driver_path = @webdriver_path
122
- end
123
- end
124
- end
125
- puts "The webdriver path is: #{@webdriver_path}" unless path_to_driver.nil?
126
- end
127
-
128
- def self.initialize_browser_size
129
- # tile browser windows if running in multiple parallel threads and BROWSER_TILE environment variable is true
130
- if ENV['PARALLEL'] && ENV['BROWSER_TILE']
131
- thread = ENV['TEST_ENV_NUMBER'].to_i
132
- if thread > 1
133
- Browsers.set_browser_window_position(100 * thread - 1, 100 * thread - 1)
134
- sleep(1)
135
- end
136
- else
137
- Browsers.set_browser_window_position(10, 10)
138
- sleep(1)
139
- end
140
-
141
- browser = Environ.browser.to_s
142
- if Environ.is_desktop?
143
- if ENV['BROWSER_SIZE'] == 'max'
144
- Browsers.maximize_browser
145
- elsif ENV['BROWSER_SIZE']
146
- Browsers.set_browser_window_size(ENV['BROWSER_SIZE'])
147
- else
148
- Browsers.set_browser_window_size(Browsers.browser_size(browser, ENV['ORIENTATION']))
149
- end
150
- elsif Environ.is_mobile? && !Environ.is_device?
151
- Browsers.set_browser_window_size(Browsers.browser_size(browser, ENV['ORIENTATION']))
152
- end
153
- Environ.session_state = :running
154
- end
155
-
156
- def self.close_tunnel
157
- unless @bs_local.nil?
158
- @bs_local.stop
159
- if @bs_local.isRunning
160
- raise 'BrowserStack Local instance could not be stopped'
161
- else
162
- puts 'BrowserStack Local instance has been stopped'
163
- end
164
- end
165
- end
166
-
167
- private
168
-
169
- def self.initialize_appium
170
- Environ.platform = :mobile
171
- Environ.device_name = ENV['APP_DEVICE']
172
- Environ.device_os = ENV['APP_PLATFORM_NAME']
173
- Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
174
- Environ.device_orientation = ENV['ORIENTATION'] if ENV['ORIENTATION']
175
- Capybara.default_driver = :appium
176
- endpoint = 'http://localhost:4723/wd/hub'
177
- desired_capabilities = {
178
- platformName: ENV['APP_PLATFORM_NAME'],
179
- platformVersion: ENV['APP_VERSION'],
180
- browserName: ENV['APP_BROWSER'],
181
- deviceName: ENV['APP_DEVICE']
182
- }
183
- desired_capabilities[:avd] = ENV['APP_DEVICE'] if ENV['APP_PLATFORM_NAME'].downcase.to_sym == :android
184
- desired_capabilities[:automationName] = ENV['AUTOMATION_ENGINE'] if ENV['AUTOMATION_ENGINE']
185
- desired_capabilities[:orientation] = ENV['ORIENTATION'].upcase if ENV['ORIENTATION']
186
- if ENV['UDID']
187
- Environ.device = :device
188
- desired_capabilities[:udid] = ENV['UDID']
189
- desired_capabilities[:startIWDP] = true
190
- desired_capabilities[:xcodeOrgId] = ENV['TEAM_ID'] if ENV['TEAM_ID']
191
- desired_capabilities[:xcodeSigningId] = ENV['TEAM_NAME'] if ENV['TEAM_NAME']
192
- else
193
- Environ.device = :simulator
194
- end
195
- desired_capabilities[:safariIgnoreFraudWarning] = ENV['APP_IGNORE_FRAUD_WARNING'] if ENV['APP_IGNORE_FRAUD_WARNING']
196
- desired_capabilities[:safariInitialUrl] = ENV['APP_INITIAL_URL'] if ENV['APP_INITIAL_URL']
197
- desired_capabilities[:safariAllowPopups] = ENV['APP_ALLOW_POPUPS'] if ENV['APP_ALLOW_POPUPS']
198
- desired_capabilities[:newCommandTimeout] = ENV['NEW_COMMAND_TIMEOUT'] if ENV['NEW_COMMAND_TIMEOUT']
199
- desired_capabilities[:noReset] = ENV['APP_NO_RESET'] if ENV['APP_NO_RESET']
200
- desired_capabilities[:fullReset] = ENV['APP_FULL_RESET'] if ENV['APP_FULL_RESET']
201
- desired_capabilities[:webkitDebugProxyPort] = ENV['WEBKIT_DEBUG_PROXY_PORT'] if ENV['WEBKIT_DEBUG_PROXY_PORT']
202
- desired_capabilities[:webDriverAgentUrl] = ENV['WEBDRIVER_AGENT_URL'] if ENV['WEBDRIVER_AGENT_URL']
203
- desired_capabilities[:wdaLocalPort] = ENV['WDA_LOCAL_PORT'] if ENV['WDA_LOCAL_PORT']
204
- desired_capabilities[:usePrebuiltWDA] = ENV['USE_PREBUILT_WDA'] if ENV['USE_PREBUILT_WDA']
205
- desired_capabilities[:useNewWDA] = ENV['USE_NEW_WDA'] if ENV['USE_NEW_WDA']
206
- desired_capabilities[:chromedriverExecutable] = ENV['CHROMEDRIVER_EXECUTABLE'] if ENV['CHROMEDRIVER_EXECUTABLE']
207
-
208
- desired_capabilities[:language] = ENV['LANGUAGE'] if ENV['LANGUAGE']
209
- desired_capabilities[:locale] = ENV['LOCALE'].gsub('-', '_') if ENV['LOCALE']
210
-
211
- Capybara.register_driver :appium do |app|
212
- appium_lib_options = { server_url: endpoint }
213
- all_options = {
214
- appium_lib: appium_lib_options,
215
- caps: desired_capabilities
216
- }
217
- Appium::Capybara::Driver.new app, all_options
218
- end
219
- end
220
-
221
- def self.initialize_local_browser
222
- if OS.osx?
223
- Environ.os = 'OS X'
224
- elsif OS.windows?
225
- Environ.os = 'Windows'
226
- end
227
-
228
- browser = ENV['WEB_BROWSER']
229
-
230
- case browser.downcase.to_sym
231
- when :firefox, :chrome, :ie, :safari, :edge
232
- Environ.platform = :desktop
233
- else
234
- Environ.platform = :mobile
235
- Environ.device_name = Browsers.mobile_device_name(browser)
236
- end
237
-
238
- Capybara.default_driver = :selenium
239
- Capybara.register_driver :selenium do |app|
240
- case browser.downcase.to_sym
241
- when :ie, :safari, :edge
242
- Capybara::Selenium::Driver.new(app, :browser => browser.to_sym)
243
-
244
- when :firefox
245
- if ENV['LOCALE']
246
- profile = Selenium::WebDriver::Firefox::Profile.new
247
- profile['intl.accept_languages'] = ENV['LOCALE']
248
- Capybara::Selenium::Driver.new(app, :profile => profile)
249
- else
250
- Capybara::Selenium::Driver.new(app, :browser => :firefox)
251
- end
252
-
253
- when :chrome
254
- ENV['LOCALE'] ? args = ['--disable-infobars', "--lang=#{ENV['LOCALE']}"] : args = ['--disable-infobars']
255
- Capybara::Selenium::Driver.new(app, :browser => :chrome, :args => args)
256
-
257
- else
258
- user_agent = Browsers.mobile_device_agent(browser)
259
- ENV['HOST_BROWSER'] ? host_browser = ENV['HOST_BROWSER'].downcase.to_sym : host_browser = :chrome
260
- case host_browser
261
- when :firefox
262
- profile = Selenium::WebDriver::Firefox::Profile.new
263
- profile['general.useragent.override'] = user_agent
264
- profile['intl.accept_languages'] = ENV['LOCALE'] if ENV['LOCALE']
265
- Capybara::Selenium::Driver.new(app, :profile => profile)
266
-
267
- when :chrome
268
- ENV['LOCALE'] ?
269
- args = ["--user-agent='#{user_agent}'", "--lang=#{ENV['LOCALE']}", '--disable-infobars'] :
270
- args = ["--user-agent='#{user_agent}'", '--disable-infobars']
271
- Capybara::Selenium::Driver.new(app, :browser => :chrome, :args => args)
272
- end
273
- end
274
- end
275
- end
276
-
277
- def self.new_initialize_local_browser
278
- if OS.osx?
279
- Environ.os = 'OS X'
280
- elsif OS.windows?
281
- Environ.os = 'Windows'
282
- end
283
-
284
- browser = ENV['WEB_BROWSER']
285
-
286
- case browser.downcase.to_sym
287
- when :firefox, :chrome, :ie, :safari, :edge
288
- Environ.platform = :desktop
289
- else
290
- Environ.platform = :mobile
291
- Environ.device_name = Browsers.mobile_device_name(browser)
292
- end
293
-
294
- Capybara.default_driver = :selenium
295
- Capybara.register_driver :selenium do |app|
296
- case browser.downcase.to_sym
297
- when :ie, :safari, :edge
298
- Capybara::Selenium::Driver.new(app, browser: browser.to_sym)
299
- when :firefox
300
- profile = Selenium::WebDriver::Firefox::Profile.new
301
- profile['browser.download.dir'] = '/tmp/webdriver-downloads'
302
- profile['browser.download.folderList'] = 2
303
- profile['browser.helperApps.neverAsk.saveToDisk'] = 'text/csv, application/x-msexcel, application/excel, application/x-excel, application/vnd.ms-excel, image/png, image/jpeg, text/html, text/plain, application/pdf, application/octet-stream'
304
- profile['pdfjs.disabled'] = true
305
- profile['intl.accept_languages'] = ENV['LOCALE'] if ENV['LOCALE']
306
- options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
307
- if @webdriver_path.blank?
308
- Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
309
- else
310
- Capybara::Selenium::Driver.new(app, browser: :firefox, options: options, driver_path: @webdriver_path)
311
- end
312
- when :chrome
313
- options = Selenium::WebDriver::Chrome::Options.new
314
- options.add_argument('--disable-infobars')
315
- options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
316
- Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
317
- else
318
- user_agent = Browsers.mobile_device_agent(browser)
319
- ENV['HOST_BROWSER'] ? host_browser = ENV['HOST_BROWSER'].downcase.to_sym : host_browser = :firefox
320
- case host_browser
321
- when :firefox
322
- profile = Selenium::WebDriver::Firefox::Profile.new
323
- profile['general.useragent.override'] = user_agent
324
- profile['intl.accept_languages'] = ENV['LOCALE'] if ENV['LOCALE']
325
- options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
326
- if @webdriver_path.blank?
327
- Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
328
- else
329
- Capybara::Selenium::Driver.new(app, browser: :firefox, options: options, driver_path: @webdriver_path)
330
- end
331
- when :chrome
332
- options = Selenium::WebDriver::Chrome::Options.new
333
- options.add_argument('--disable-infobars')
334
- options.add_argument("--user-agent='#{user_agent}'")
335
- options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
336
- Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
337
- end
338
- end
339
- end
340
- end
341
-
342
- def self.initialize_browserstack
343
- browser = ENV['BS_BROWSER']
344
-
345
- if ENV['BS_REAL_MOBILE'] || ENV['BS_PLATFORM']
346
- Environ.platform = :mobile
347
- Environ.device_name = ENV['BS_DEVICE']
348
- Environ.device_os = ENV['BS_OS']
349
- Environ.device_orientation = ENV['ORIENTATION'] if ENV['ORIENTATION']
350
- elsif ENV['BS_OS']
351
- Environ.os = "#{ENV['BS_OS']} #{ENV['BS_OS_VERSION']}"
352
- end
353
-
354
- endpoint = "http://#{ENV['BS_USERNAME']}:#{ENV['BS_AUTHKEY']}@hub-cloud.browserstack.com/wd/hub"
355
- Capybara.register_driver :browserstack do |app|
356
- capabilities = Selenium::WebDriver::Remote::Capabilities.new
357
-
358
- if ENV['BS_REAL_MOBILE']
359
- Environ.device = :device
360
- capabilities['device'] = ENV['BS_DEVICE']
361
- capabilities['realMobile'] = true
362
- capabilities['os_version'] = ENV['BS_OS_VERSION']
363
-
364
- elsif ENV['BS_PLATFORM']
365
- Environ.device = :simulator
366
- capabilities[:platform] = ENV['BS_PLATFORM']
367
- capabilities[:browserName] = browser
368
- capabilities['device'] = ENV['BS_DEVICE'] if ENV['BS_DEVICE']
369
- capabilities['deviceOrientation'] = ENV['ORIENTATION'] if ENV['ORIENTATION']
370
-
371
- elsif ENV['BS_OS']
372
- capabilities['os'] = ENV['BS_OS']
373
- capabilities['os_version'] = ENV['BS_OS_VERSION']
374
- capabilities['browser'] = browser || 'chrome'
375
- capabilities['browser_version'] = ENV['BS_VERSION'] if ENV['BS_VERSION']
376
- capabilities['resolution'] = ENV['RESOLUTION'] if ENV['RESOLUTION']
377
- end
378
-
379
- capabilities['browserstack.timezone'] = ENV['TIME_ZONE'] if ENV['TIME_ZONE']
380
- capabilities['browserstack.video'] = ENV['RECORD_VIDEO'] if ENV['RECORD_VIDEO']
381
- capabilities['browserstack.debug'] = 'true'
382
- capabilities['project'] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
383
- capabilities['build'] = ENV['AUTOMATE_BUILD'] if ENV['AUTOMATE_BUILD']
384
-
385
- ENV['TEST_CONTEXT'] ?
386
- context_message = "#{Environ.test_environment} - #{ENV['TEST_CONTEXT']}" :
387
- context_message = Environ.test_environment
388
- if ENV['PARALLEL']
389
- thread_num = ENV['TEST_ENV_NUMBER']
390
- thread_num = 1 if thread_num.blank?
391
- context_message = "#{context_message} - Thread ##{thread_num}"
392
- end
393
- capabilities['name'] = context_message
394
-
395
- capabilities['acceptSslCerts'] = 'true'
396
- capabilities['browserstack.localIdentifier'] = ENV['BS_LOCAL_ID'] if ENV['BS_LOCAL_ID']
397
- capabilities['browserstack.local'] = 'true' if ENV['TUNNELING']
398
-
399
- case browser.downcase.to_sym
400
- when :ie
401
- capabilities['ie.ensureCleanSession'] = 'true'
402
- capabilities['ie.browserCommandLineSwitches'] = 'true'
403
- capabilities['nativeEvents'] = 'true'
404
- when :safari
405
- capabilities['cleanSession'] = 'true'
406
- when :iphone, :ipad
407
- capabilities['javascriptEnabled'] = 'true'
408
- capabilities['cleanSession'] = 'true'
409
- end
410
-
411
- if ENV['TUNNELING']
412
- @bs_local = BrowserStack::Local.new
413
- bs_local_args = {'key' => "#{ENV['BS_AUTHKEY']}"}
414
- @bs_local.start(bs_local_args)
415
- if @bs_local.isRunning
416
- puts 'BrowserStack Local instance has been started'
417
- else
418
- puts 'BrowserStack Local instance failed to start'
419
- end
420
- end
421
-
422
- Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
423
- end
424
-
425
- Environ.browser = browser
426
- Environ.tunneling = ENV['TUNNELING'] if ENV['TUNNELING']
427
- Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
428
-
429
- Capybara.default_driver = :browserstack
430
- Capybara.run_server = false
431
- end
432
-
433
- def self.initialize_crossbrowser
434
- browser = ENV['CB_BROWSER']
435
-
436
- if ENV['CB_OS']
437
- Environ.os = ENV['CB_OS']
438
- Environ.platform = :desktop
439
- elsif ENV['CB_PLATFORM']
440
- Environ.device_name = ENV['CB_PLATFORM']
441
- Environ.device = :device
442
- Environ.platform = :mobile
443
- Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
444
- end
445
-
446
- endpoint = "http://#{ENV['CB_USERNAME']}:#{ENV['CB_AUTHKEY']}@hub.crossbrowsertesting.com:80/wd/hub"
447
- Capybara.register_driver :crossbrowser do |app|
448
- capabilities = Selenium::WebDriver::Remote::Capabilities.new
449
- capabilities['name'] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
450
- capabilities['build'] = ENV['AUTOMATE_BUILD'] if ENV['AUTOMATE_BUILD']
451
- capabilities['browser_api_name'] = browser
452
- capabilities['screen_resolution'] = ENV['RESOLUTION'] if ENV['RESOLUTION']
453
- if ENV['CB_OS']
454
- capabilities['os_api_name'] = ENV['CB_OS']
455
- Environ.platform = :desktop
456
- elsif ENV['CB_PLATFORM']
457
- capabilities['os_api_name'] = ENV['CB_PLATFORM']
458
- end
459
- Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
460
- end
461
-
462
- Environ.browser = browser
463
-
464
- Capybara.default_driver = :crossbrowser
465
- Capybara.run_server = false
466
- end
467
-
468
- def self.initialize_poltergeist
469
- if ENV['BROWSER_SIZE']
470
- resolution = ENV['BROWSER_SIZE'].split(',')
471
- width = resolution[0]
472
- height = resolution[1]
473
- else
474
- width = 1650
475
- height = 1000
476
- end
477
- Capybara.default_driver = :poltergeist
478
- Capybara.register_driver :poltergeist do |app|
479
- options = {
480
- js_errors: true,
481
- timeout: 120,
482
- debug: false,
483
- phantomjs_options: ['--load-images=no', '--disk-cache=false'],
484
- inspector: true,
485
- window_size: [width, height]
486
- }
487
- Capybara::Poltergeist::Driver.new(app, options)
488
- end
489
- end
490
-
491
- def self.initialize_remote
492
- browser = ENV['WEB_BROWSER']
493
- endpoint = ENV['REMOTE_ENDPOINT'] || 'http://127.0.0.1:4444/wd/hub'
494
- capabilities = Selenium::WebDriver::Remote::Capabilities.send(browser.downcase.to_sym)
495
- Capybara.register_driver :remote_browser do |app|
496
- Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
497
- end
498
- Capybara.current_driver = :remote_browser
499
- Capybara.default_driver = :remote_browser
500
- end
501
-
502
- def self.initialize_saucelabs
503
- browser = ENV['SL_BROWSER']
504
-
505
- if ENV['SL_OS']
506
- Environ.platform = :desktop
507
- Environ.os = ENV['SL_OS']
508
- elsif ENV['SL_PLATFORM']
509
- Environ.device_name = ENV['SL_DEVICE']
510
- Environ.platform = :mobile
511
- end
512
-
513
- endpoint = "http://#{ENV['SL_USERNAME']}:#{ENV['SL_AUTHKEY']}@ondemand.saucelabs.com:80/wd/hub"
514
- Capybara.register_driver :saucelabs do |app|
515
- capabilities = Selenium::WebDriver::Remote::Capabilities.new
516
- capabilities['name'] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
517
- capabilities['build'] = ENV['AUTOMATE_BUILD'] if ENV['AUTOMATE_BUILD']
518
- capabilities['browserName'] = browser
519
- capabilities['version'] = ENV['SL_VERSION'] if ENV['SL_VERSION']
520
- capabilities['screenResolution'] = ENV['RESOLUTION'] if ENV['RESOLUTION']
521
- capabilities['recordVideo'] = ENV['RECORD_VIDEO'] if ENV['RECORD_VIDEO']
522
- if ENV['SL_OS']
523
- capabilities['platform'] = ENV['SL_OS']
524
- elsif ENV['SL_PLATFORM']
525
- capabilities['platform'] = ENV['SL_PLATFORM']
526
- capabilities['deviceName'] = ENV['SL_DEVICE']
527
- capabilities['deviceType'] = ENV['SL_DEVICE_TYPE'] if ENV['SL_DEVICE_TYPE']
528
- capabilities['deviceOrientation'] = ENV['ORIENTATION'] if ENV['ORIENTATION']
529
- end
530
-
531
- Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
532
- end
533
-
534
- Environ.browser = browser
535
-
536
- Capybara.default_driver = :saucelabs
537
- Capybara.run_server = false
538
- end
539
-
540
- def self.initialize_testingbot
541
- browser = ENV['TB_BROWSER']
542
-
543
- Environ.os = ENV['TB_OS']
544
- if ENV['TB_PLATFORM']
545
- if ENV['ORIENTATION']
546
- Environ.device_orientation = ENV['ORIENTATION']
547
- end
548
- Environ.device_os = ENV['TB_PLATFORM']
549
- Environ.device_name = ENV['TB_DEVICE']
550
- Environ.device = :device
551
- Environ.platform = :mobile
552
- Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
553
- else
554
- Environ.platform = :desktop
555
- end
556
-
557
- ENV['TUNNELING'] ?
558
- endpoint = '@localhost:4445/wd/hub' :
559
- endpoint = '@hub.testingbot.com:4444/wd/hub'
560
- endpoint = "http://#{ENV['TB_USERNAME']}:#{ENV['TB_AUTHKEY']}#{endpoint}"
561
- Capybara.register_driver :testingbot do |app|
562
- capabilities = Selenium::WebDriver::Remote::Capabilities.new
563
- capabilities['name'] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
564
- capabilities['build'] = ENV['AUTOMATE_BUILD'] if ENV['AUTOMATE_BUILD']
565
- capabilities['browserName'] = browser
566
- capabilities['version'] = ENV['TB_VERSION'] if ENV['TB_VERSION']
567
- capabilities['screen-resolution'] = ENV['RESOLUTION'] if ENV['RESOLUTION']
568
- capabilities['platform'] = ENV['TB_OS']
569
- capabilities['record_video'] = ENV['RECORD_VIDEO'] if ENV['RECORD_VIDEO']
570
- if ENV['TB_PLATFORM']
571
- if ENV['ORIENTATION']
572
- capabilities['orientation'] = ENV['ORIENTATION']
573
- end
574
- capabilities['platformName'] = ENV['TB_PLATFORM']
575
- capabilities['deviceName'] = ENV['TB_DEVICE']
576
- end
577
-
578
- Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
579
- end
580
-
581
- Environ.browser = browser
582
-
583
- Capybara.default_driver = :testingbot
584
- Capybara.run_server = false
585
-
586
- end
587
- end
588
- end
@@ -1,8 +0,0 @@
1
- module TestCentricity
2
- class Button < UIElement
3
- def initialize(name, parent, locator, context)
4
- super
5
- @type = :button
6
- end
7
- end
8
- end
@@ -1,8 +0,0 @@
1
- module TestCentricity
2
- class CellButton < CellElement
3
- def initialize(name, parent, locator, context, table, column, proxy = nil)
4
- super
5
- @type = :cell_button
6
- end
7
- end
8
- end
@@ -1,38 +0,0 @@
1
- module TestCentricity
2
- class CellCheckBox < CellElement
3
- attr_accessor :proxy
4
-
5
- def initialize(name, parent, locator, context, table, column, proxy = nil)
6
- super
7
- @type = :cell_checkbox
8
- @proxy = proxy
9
- end
10
-
11
- def checked?(row)
12
- obj, = find_cell_element(row)
13
- cell_object_not_found_exception(obj, 'Cell CheckBox', row)
14
- obj.checked?
15
- end
16
-
17
- def set_checkbox_state(row, state)
18
- obj, = find_cell_element(row)
19
- cell_object_not_found_exception(obj, 'Cell CheckBox', row)
20
- obj.set(state)
21
- end
22
-
23
- def check(row)
24
- set_checkbox_state(row, true)
25
- end
26
-
27
- def uncheck(row)
28
- set_checkbox_state(row, false)
29
- end
30
-
31
- def verify_check_state(row, state, enqueue = false)
32
- actual = checked?(row)
33
- enqueue ?
34
- ExceptionQueue.enqueue_assert_equal(state, actual, "Expected Row #{row}/Col #{@column} Cell Checkbox #{object_ref_message}") :
35
- assert_equal(state, actual, "Expected Row #{row}/Col #{@column} Cell Checkbox #{object_ref_message} to be #{state} but found #{actual} instead")
36
- end
37
- end
38
- end