testcentricity_web 3.0.6 → 3.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c1b260cf07c5bbde1a8e388a38605c85da10263
4
- data.tar.gz: 001ed7c67c0146160a1fd7d1636fd9b5feb054e9
3
+ metadata.gz: 9740d09f5ae251d5d16505b76876418ac8d64dfd
4
+ data.tar.gz: bfbb4d31516bb66df59855505678317b88938ce8
5
5
  SHA512:
6
- metadata.gz: 0014e310b243eb33481428654b7918d8ff46bcbf70d28912aacd4b09969bdeb1cf0f759ba7ebd6b0a8c54dcc917f4156484ca98810c134b8a65fa9312a30cb6a
7
- data.tar.gz: 179a4593392024d766230348ac9b049bf503006fc7bf3ead0d0384dc996ed75a1eebc1e7db6bb90794649afc0bfa3003cddaab4c7aae95afe532c0cba3ada175
6
+ metadata.gz: ee417aeb72511576084eb0cd2820c38c1ebc86cfaeeee3c9d275300ec789f885ea8bec537d61f19b666c61e2e48cb6ad41a78df9cd69d7bee1c4706ca4c08b9c
7
+ data.tar.gz: d6711b2fd8ff0e84963596650a292380b807d0dfd34344cb6e09e5fabbcba9731a9f7a881c24e23811cdb1ebb95cdc8679f71b31d5710836e9c01c196f00423f
data/HISTORY.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # HISTORY
2
2
 
3
+ ###Version 3.0.7
4
+
5
+ * Added support for connecting to and running your tests in desktop and emulated mobile web browsers hosted on Selenium Grid and Dockerized Selenium
6
+ Grid environments.
7
+ * Added `Environ.report_header` method that can be used to provide formatted test environment information in HTML test results.
8
+ * Deprecated `TestCentricity::WebDriverConnect.set_webdriver_path` method because the correct WebDriver is now automatically set.
9
+
3
10
  ###Version 3.0.6
4
11
 
5
12
  * Added support for connecting to and running your tests on cloud hosted browsers on the Gridlastic cloud platform.
data/README.md CHANGED
@@ -12,6 +12,7 @@ The TestCentricity™ Web gem supports running automated tests against the follo
12
12
  * locally hosted desktop browsers (Firefox, Chrome, Safari, or IE)
13
13
  * locally hosted emulated iOS Mobile Safari, Android, Windows Phone, or Blackberry mobile browsers (running within a local instance of Chrome)
14
14
  * locally hosted "headless" Chrome or Firefox browsers
15
+ * desktop and emulated mobile web browsers hosted on Selenium Grid and Dockerized Selenium Grid environments
15
16
  * mobile Safari browsers on iOS device simulators or physical iOS devices (using Appium and XCode on OS X)
16
17
  * mobile Chrome or Android browsers on Android Studio virtual device emulators (using Appium and Android Studio on OS X)
17
18
  * cloud hosted desktop (Firefox, Chrome, Safari, IE, or Edge) or mobile (iOS Mobile Safari or Android) web browsers using the [Browserstack](https://www.browserstack.com/list-of-browsers-and-platforms?product=automate),
@@ -25,6 +26,13 @@ The TestCentricity™ Web gem supports running automated tests against the follo
25
26
 
26
27
  A complete history of bug fixes and new features can be found in the {file:HISTORY.md HISTORY} file.
27
28
 
29
+ ###Version 3.0.7
30
+
31
+ * Added support for connecting to and running your tests in desktop and emulated mobile web browsers hosted on Selenium Grid and Dockerized Selenium
32
+ Grid environments.
33
+ * Added `Environ.report_header` method that can be used to provide formatted test environment information in HTML test results.
34
+ * Deprecated `TestCentricity::WebDriverConnect.set_webdriver_path` method because the correct WebDriver is now automatically set.
35
+
28
36
  ###Version 3.0.6
29
37
 
30
38
  * Added support for connecting to and running your tests on cloud hosted browsers on the Gridlastic cloud platform.
@@ -798,6 +806,18 @@ To use a local instance of the Chrome desktop browser to host the emulated mobil
798
806
  to `chrome`.
799
807
 
800
808
 
809
+ ### Selenium Grid and Dockerized Selenium Grid hosted desktop and emulated mobile web browsers
810
+
811
+ For desktop and emulated mobile web browsers running on Selenium Grid or Dockerized Selenium Grid environments, the following **Environment Variables** must be set
812
+ as described in the table below.
813
+
814
+ **Environment Variable** | **Description**
815
+ --------------- | ----------------
816
+ `WEB_BROWSER` | Must be set to one of the following desktop browsers - `chrome`, `chrome_headless`, `firefox`, `ie`, `edge`, or `safari` or any of the mobile web browsers described above.
817
+ `SELENIUM` | Must be set to `remote`
818
+ `REMOTE_ENDPOINT` | Must be set to the URL of the Grid hub, which is usually `http://localhost:4444/wd/hub`
819
+
820
+
801
821
  ### Mobile Safari browser on iOS Simulators or iOS Physical Devices
802
822
 
803
823
  You can run your mobile web tests against the mobile Safari browser on simulated iOS devices or physically connected iOS devices using Appium and XCode on
@@ -1050,9 +1070,10 @@ target web browsers is to create browser specific **Profiles** that set the appr
1050
1070
  in your `cucumber.yml` file.
1051
1071
 
1052
1072
  Below is a list of Cucumber **Profiles** for supported locally and remotely hosted desktop and mobile web browsers (put these in in your
1053
- `cucumber.yml` file). Before you can use the BrowserStack, CrossBrowserTesting, Sauce Labs, or TestingBot services, you will need to
1073
+ `cucumber.yml` file). Before you can use the BrowserStack, CrossBrowserTesting, Sauce Labs, TestingBot, or Gridlastic services, you will need to
1054
1074
  replace the *INSERT USER NAME HERE* and *INSERT PASSWORD HERE* placeholder text with your user account and authorization code for the cloud
1055
- service(s) that you intend to connect with.
1075
+ service(s) that you intend to connect with. When using the Gridlastic service, you will also need replace the *INSERT SUBDOMAIN HERE* placeholder
1076
+ text with the Subdomain specified on the Grid Configuration Parameters section of the Gridlastic Dashboard.
1056
1077
 
1057
1078
 
1058
1079
  <% desktop = "--tags @desktop --require features BROWSER_TILE=true BROWSER_SIZE=1500,1000" %>
@@ -1072,6 +1093,11 @@ service(s) that you intend to connect with.
1072
1093
  firefox_headless: WEB_BROWSER=firefox_headless <%= desktop %>
1073
1094
  firefox_legacy: WEB_BROWSER=firefox_legacy <%= desktop %>
1074
1095
 
1096
+ #==============
1097
+ # profile for Selenium Grid and Dockerized Selenium Grid hosted desktop web browsers
1098
+ #==============
1099
+ grid: SELENIUM=remote REMOTE_ENDPOINT="http://localhost:4444/wd/hub"
1100
+
1075
1101
 
1076
1102
  #==============
1077
1103
  # profiles for locally hosted mobile web browsers (emulated locally in Chrome browser)
@@ -1462,13 +1488,18 @@ service(s) that you intend to connect with.
1462
1488
 
1463
1489
 
1464
1490
  To specify a locally hosted target browser using a profile at runtime, you use the flag `--profile` or `-p` followed by the profile name when
1465
- invoking Cucumber in the command line. For instance, the following command invokes Cucumber and specifies that a local instance of Chrome
1491
+ invoking Cucumber in the command line. For instance, the following command invokes Cucumber and specifies that a local instance of Firefox
1466
1492
  will be used as the target web browser:
1467
1493
 
1468
- $ cucumber -p chrome
1494
+ $ cucumber -p firefox
1495
+
1496
+
1497
+ The following command specifies that Cucumber will run tests against an instance of Chrome hosted within a Dockerized Selenium Grid environment"
1498
+
1499
+ $ cucumber -p chrome -p grid
1469
1500
 
1470
1501
 
1471
- The following command specifies that Cucumber will run tests against a local instance of Firefox, which will be used to emulate an iPad Pro
1502
+ The following command specifies that Cucumber will run tests against a local instance of Chrome, which will be used to emulate an iPad Pro
1472
1503
  in landscape orientation:
1473
1504
 
1474
1505
  $ cucumber -p ipad_pro -p landscape
@@ -1497,7 +1528,7 @@ landscape orientation running on the BrowserStack service:
1497
1528
 
1498
1529
  ## Web Test Automation Framework Implementation
1499
1530
 
1500
- <img src="http://i.imgur.com/RvpxjzW.jpg" width="1024" alt="Web Framework Overview" title="Web Framework Overview">
1531
+ <img src="https://i.imgur.com/Ca6XPCS.jpg" width="1024" alt="Web Framework Overview" title="Web Framework Overview">
1501
1532
 
1502
1533
 
1503
1534
 
@@ -39,6 +39,7 @@ module TestCentricity
39
39
  attr_accessor :device_orientation
40
40
  attr_accessor :platform
41
41
  attr_accessor :driver
42
+ attr_accessor :grid
42
43
  attr_accessor :tunneling
43
44
 
44
45
  attr_accessor :signed_in
@@ -205,6 +206,14 @@ module TestCentricity
205
206
  @driver
206
207
  end
207
208
 
209
+ def self.grid=(type)
210
+ @grid = type
211
+ end
212
+
213
+ def self.grid
214
+ @grid
215
+ end
216
+
208
217
  def self.tunneling=(state)
209
218
  @tunneling = state
210
219
  end
@@ -268,5 +277,20 @@ module TestCentricity
268
277
  def self.reset_contexts
269
278
  @screen_shots = []
270
279
  end
280
+
281
+ def self.report_header
282
+ report_header = "\n<b><u>TEST ENVIRONMENT</u>:</b> #{ENV['TEST_ENVIRONMENT']}\n"\
283
+ " <b>Browser:</b>\t #{Environ.browser.capitalize}\n"
284
+ report_header = "#{report_header} <b>Device:</b>\t\t #{Environ.device_name}\n" if Environ.device_name
285
+ report_header = "#{report_header} <b>Device OS:</b>\t #{Environ.device_os}\n" if Environ.device_os
286
+ report_header = "#{report_header} <b>Device type:</b>\t #{Environ.device_type}\n" if Environ.device_type
287
+ report_header = "#{report_header} <b>Driver:</b>\t\t #{Environ.driver}\n" if Environ.driver
288
+ report_header = "#{report_header} <b>Grid:</b>\t\t #{Environ.grid}\n" if Environ.grid
289
+ report_header = "#{report_header} <b>OS:</b>\t\t\t #{Environ.os}\n" if Environ.os
290
+ report_header = "#{report_header} <b>Locale:</b>\t\t #{ENV['LOCALE']}\n" if ENV['LOCALE']
291
+ report_header = "#{report_header} <b>Language:</b>\t #{ENV['LANGUAGE']}\n" if ENV['LANGUAGE']
292
+ report_header = "#{report_header} <b>Country:</b>\t #{ENV['COUNTRY']}\n" if ENV['COUNTRY']
293
+ "#{report_header}\n\n"
294
+ end
271
295
  end
272
296
  end
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '3.0.6'
2
+ VERSION = '3.0.7'
3
3
  end
@@ -1,13 +1,13 @@
1
1
  require 'selenium-webdriver'
2
2
  require 'os'
3
3
  require 'browserstack/local'
4
+ require 'webdrivers'
4
5
 
5
6
 
6
7
  module TestCentricity
7
8
  module WebDriverConnect
8
9
  include Capybara::DSL
9
10
 
10
- attr_accessor :webdriver_path
11
11
  attr_accessor :bs_local
12
12
 
13
13
  def self.initialize_web_driver(app_host = nil)
@@ -44,7 +44,7 @@ module TestCentricity
44
44
  else
45
45
  if ENV['SELENIUM'] == 'remote'
46
46
  initialize_remote
47
- context = 'Selenium Grid2'
47
+ context = 'Selenium Grid'
48
48
  else
49
49
  initialize_local_browser
50
50
  context = 'local browser instance'
@@ -64,68 +64,10 @@ module TestCentricity
64
64
  Capybara.app_host = url
65
65
  end
66
66
 
67
+ # @deprecated Correct webdriver is now automatically loaded
67
68
  # Set the WebDriver path for Chrome, Firefox, IE, or Edge browsers
68
69
  def self.set_webdriver_path(project_path)
69
- path_to_driver = nil
70
- # check for existence of /webdrivers or /features/support/drivers folders
71
- base_path = 'features/support/drivers'
72
- unless File.directory?(File.join(project_path, base_path))
73
- base_path = 'webdrivers'
74
- unless File.directory?(File.join(project_path, base_path))
75
- raise 'Could not find WebDriver files in /webdrivers or /features/support/drivers folders'
76
- end
77
- end
78
- # set WebDriver path based on browser and operating system
79
- case ENV['WEB_BROWSER'].downcase.to_sym
80
- when :chrome, :chrome_headless
81
- if OS.osx?
82
- path_to_driver = 'mac/chromedriver'
83
- elsif OS.windows?
84
- path_to_driver = 'windows/chromedriver.exe'
85
- end
86
- @webdriver_path = File.join(project_path, base_path, path_to_driver)
87
- Selenium::WebDriver::Chrome.driver_path = @webdriver_path
88
- when :firefox, :firefox_headless
89
- if OS.osx?
90
- path_to_driver = 'mac/geckodriver'
91
- elsif OS.windows?
92
- path_to_driver = 'windows/geckodriver.exe'
93
- end
94
- @webdriver_path = File.join(project_path, base_path, path_to_driver)
95
- Selenium::WebDriver::Firefox.driver_path = @webdriver_path
96
- when :ie
97
- path_to_driver = 'windows/IEDriverServer.exe'
98
- @webdriver_path = File.join(project_path, base_path, path_to_driver)
99
- Selenium::WebDriver::IE.driver_path = @webdriver_path
100
- when :edge
101
- path_to_driver = 'windows/MicrosoftWebDriver.exe'
102
- @webdriver_path = File.join(project_path, base_path, path_to_driver)
103
- Selenium::WebDriver::Edge.driver_path = @webdriver_path
104
- else
105
- if ENV['HOST_BROWSER']
106
- case ENV['HOST_BROWSER'].downcase.to_sym
107
- when :chrome
108
- if OS.osx?
109
- path_to_driver = 'mac/chromedriver'
110
- elsif OS.windows?
111
- path_to_driver = 'windows/chromedriver.exe'
112
- end
113
- @webdriver_path = File.join(project_path, base_path, path_to_driver)
114
- Selenium::WebDriver::Chrome.driver_path = @webdriver_path
115
- when :firefox
116
- if OS.osx?
117
- path_to_driver = 'mac/geckodriver'
118
- elsif OS.windows?
119
- path_to_driver = 'windows/geckodriver.exe'
120
- end
121
- @webdriver_path = File.join(project_path, base_path, path_to_driver)
122
- Selenium::WebDriver::Firefox.driver_path = @webdriver_path
123
- else
124
- raise "#{ENV['HOST_BROWSER']} is not a valid host browser for mobile browser emulation"
125
- end
126
- end
127
- end
128
- puts "The webdriver path is: #{@webdriver_path}" unless path_to_driver.nil?
70
+ warn "[DEPRECATION] 'TestCentricity::WebDriverConnect.set_webdriver_path' is deprecated. Correct webdrivers are now automatically loaded."
129
71
  end
130
72
 
131
73
  def self.initialize_browser_size
@@ -260,11 +202,7 @@ module TestCentricity
260
202
  profile['intl.accept_languages'] = ENV['LOCALE'] if ENV['LOCALE']
261
203
  options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
262
204
  options.args << '--headless' if browser == :firefox_headless
263
- if @webdriver_path.blank?
264
- Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
265
- else
266
- Capybara::Selenium::Driver.new(app, browser: :firefox, options: options, driver_path: @webdriver_path)
267
- end
205
+ Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
268
206
  when :chrome, :chrome_headless
269
207
  (browser == :chrome) ?
270
208
  options = Selenium::WebDriver::Chrome::Options.new :
@@ -273,25 +211,15 @@ module TestCentricity
273
211
  options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
274
212
  Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
275
213
  else
276
- user_agent = Browsers.mobile_device_agent(ENV['WEB_BROWSER'])
277
- ENV['HOST_BROWSER'] ? host_browser = ENV['HOST_BROWSER'].downcase.to_sym : host_browser = :chrome
278
- case host_browser
279
- when :firefox
280
- profile = Selenium::WebDriver::Firefox::Profile.new
281
- profile['general.useragent.override'] = user_agent
282
- profile['intl.accept_languages'] = ENV['LOCALE'] if ENV['LOCALE']
283
- options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
284
- if @webdriver_path.blank?
285
- Capybara::Selenium::Driver.new(app, browser: :firefox, options: options)
286
- else
287
- Capybara::Selenium::Driver.new(app, browser: :firefox, options: options, driver_path: @webdriver_path)
288
- end
289
- when :chrome
214
+ if ENV['HOST_BROWSER'] && ENV['HOST_BROWSER'].downcase.to_sym == :chrome
215
+ user_agent = Browsers.mobile_device_agent(ENV['WEB_BROWSER'])
290
216
  options = Selenium::WebDriver::Chrome::Options.new
291
217
  options.add_argument('--disable-infobars')
292
218
  options.add_argument("--user-agent='#{user_agent}'")
293
219
  options.add_argument("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
294
220
  Capybara::Selenium::Driver.new(app, browser: :chrome, options: options)
221
+ else
222
+ raise "Requested browser '#{browser}' is not supported"
295
223
  end
296
224
  end
297
225
  end
@@ -300,6 +228,7 @@ module TestCentricity
300
228
 
301
229
  def self.initialize_browserstack
302
230
  browser = ENV['BS_BROWSER']
231
+ Environ.grid = :browserstack
303
232
 
304
233
  if ENV['BS_REAL_MOBILE'] || ENV['BS_PLATFORM']
305
234
  Environ.platform = :mobile
@@ -397,6 +326,7 @@ module TestCentricity
397
326
 
398
327
  def self.initialize_crossbrowser
399
328
  browser = ENV['CB_BROWSER']
329
+ Environ.grid = :crossbrowser
400
330
 
401
331
  if ENV['CB_OS']
402
332
  Environ.os = ENV['CB_OS']
@@ -432,6 +362,7 @@ module TestCentricity
432
362
 
433
363
  def self.initialize_gridlastic
434
364
  browser = ENV['GL_BROWSER']
365
+ Environ.grid = :gridlastic
435
366
  Environ.os = ENV['GL_OS']
436
367
  endpoint = "http://#{ENV['GL_USERNAME']}:#{ENV['GL_AUTHKEY']}@#{ENV['GL_SUBDOMAIN']}.gridlastic.com:80/wd/hub"
437
368
 
@@ -448,6 +379,8 @@ module TestCentricity
448
379
  Capybara::Selenium::Driver.new(app, http_client: client, browser: :remote, url: endpoint, desired_capabilities: capabilities)
449
380
  end
450
381
 
382
+ Environ.browser = browser
383
+
451
384
  Capybara.default_driver = :selenium
452
385
  Capybara.run_server = false
453
386
 
@@ -458,10 +391,30 @@ module TestCentricity
458
391
  end
459
392
 
460
393
  def self.initialize_remote
461
- browser = ENV['WEB_BROWSER']
394
+ Environ.grid = :selenium_grid
395
+ browser = ENV['WEB_BROWSER'].downcase.to_sym
462
396
  endpoint = ENV['REMOTE_ENDPOINT'] || 'http://127.0.0.1:4444/wd/hub'
463
- capabilities = Selenium::WebDriver::Remote::Capabilities.send(browser.downcase.to_sym)
464
397
  Capybara.register_driver :remote_browser do |app|
398
+ case browser
399
+ when :firefox, :safari, :ie, :edge
400
+ capabilities = Selenium::WebDriver::Remote::Capabilities.send(browser)
401
+ when :chrome, :chrome_headless
402
+ (browser == :chrome) ?
403
+ options = %w[--disable-infobars] :
404
+ options = %w[headless disable-gpu no-sandbox --disable-infobars]
405
+ options.push("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
406
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome('goog:chromeOptions' => { args: options })
407
+ else
408
+ if ENV['HOST_BROWSER'] && ENV['HOST_BROWSER'].downcase.to_sym == :chrome
409
+ user_agent = Browsers.mobile_device_agent(ENV['WEB_BROWSER'])
410
+ options = %w[--disable-infobars]
411
+ options.push("--user-agent='#{user_agent}'")
412
+ options.push("--lang=#{ENV['LOCALE']}") if ENV['LOCALE']
413
+ capabilities = Selenium::WebDriver::Remote::Capabilities.chrome('goog:chromeOptions' => { args: options })
414
+ else
415
+ raise "Requested browser '#{browser}' is not supported on Selenium Grid"
416
+ end
417
+ end
465
418
  Capybara::Selenium::Driver.new(app, browser: :remote, url: endpoint, desired_capabilities: capabilities)
466
419
  end
467
420
  Capybara.current_driver = :remote_browser
@@ -470,6 +423,7 @@ module TestCentricity
470
423
 
471
424
  def self.initialize_saucelabs
472
425
  browser = ENV['SL_BROWSER']
426
+ Environ.grid = :saucelabs
473
427
 
474
428
  if ENV['SL_OS']
475
429
  Environ.platform = :desktop
@@ -508,6 +462,7 @@ module TestCentricity
508
462
 
509
463
  def self.initialize_testingbot
510
464
  browser = ENV['TB_BROWSER']
465
+ Environ.grid = :testingbot
511
466
 
512
467
  Environ.os = ENV['TB_OS']
513
468
  if ENV['TB_PLATFORM']
@@ -41,6 +41,6 @@ Gem::Specification.new do |spec|
41
41
  spec.add_runtime_dependency 'i18n'
42
42
  spec.add_runtime_dependency 'browserstack-local'
43
43
  spec.add_runtime_dependency 'appium_lib'
44
-
44
+ spec.add_runtime_dependency 'webdrivers', '~> 3.3'
45
45
  spec.add_runtime_dependency 'childprocess', '~> 0.5'
46
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcentricity_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.6
4
+ version: 3.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.J. Mrozinski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-14 00:00:00.000000000 Z
11
+ date: 2018-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -184,6 +184,20 @@ dependencies:
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
+ - !ruby/object:Gem::Dependency
188
+ name: webdrivers
189
+ requirement: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - "~>"
192
+ - !ruby/object:Gem::Version
193
+ version: '3.3'
194
+ type: :runtime
195
+ prerelease: false
196
+ version_requirements: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '3.3'
187
201
  - !ruby/object:Gem::Dependency
188
202
  name: childprocess
189
203
  requirement: !ruby/object:Gem::Requirement