testcentricity_web 0.8.8 → 0.9.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 42ed99dccff2f618eb499debb1cddd8c325d31e6
4
- data.tar.gz: 4dbd5db9f6aecdef99969f1a53eb86c614b7916f
3
+ metadata.gz: 72ebdc8a23d3951e0331e793891a986e90f9087d
4
+ data.tar.gz: 9bb16a5cdc5ee7dbbc8f271dcd9a06afeb7dc54c
5
5
  SHA512:
6
- metadata.gz: fb1ca9ad90740fb481c69b3aab09d9a48fe8f34bebc2b7eaa0553d599cf924d9bb0e7b641d607659c019a65cd214c312590169401eddebaf0ec5ad404f6aada9
7
- data.tar.gz: b9f0fbfa6aef8af141397216e1e2de40c55fcf51d6fbc8bdea78dc54f7dc90c91641c1a2cbae8f96e2301eef4b5e92ac33b3e1bc853a520a0795dca46f5a4a6a
6
+ metadata.gz: 460918f5625d82888571ab34ecb5de8d78ea310a1c411f28b898662121f1f53440273384a96c0687b335758e1dbaa924a8de4913d9001168c7bf67a708354c89
7
+ data.tar.gz: 21f1d4af406c383e94f7c338da5d29714facbcd909bb8f51ba230b65b5db967b73aa666cde0d221c0d6a96c396cd9467728c4876946c3abab20c189236b41296
data/README.md CHANGED
@@ -11,6 +11,7 @@ The TestCentricity™ Web gem supports running testing against the following web
11
11
  * locally hosted desktop browsers (Firefox, Chrome, Safari, IE, or Edge)
12
12
  * locally hosted emulated iOS, Android, and Windows Phone mobile browsers (using Firefox or Chrome)
13
13
  * a "headless" browser (using Poltergeist and PhantomJS)
14
+ * mobile Safari browsers on iOS device simulators (using Appium and XCode on OS X)
14
15
  * cloud hosted desktop or mobile web browsers using the BrowserStack, Sauce Labs, CrossBrowserTesting, or TestingBot services.
15
16
 
16
17
 
@@ -56,6 +57,22 @@ project's Gemfile:
56
57
  gem 'poltergeist'
57
58
 
58
59
 
60
+ ### Using Appium
61
+
62
+ If you will be running your tests on mobile Safari browsers on simulated iOS devices using Appium and XCode Simulators, you need to require
63
+ the following in your *env.rb* file:
64
+
65
+ require 'appium_capybara'
66
+
67
+ You also need to add this line to your automation project's Gemfile:
68
+
69
+ gem 'appium_capybara'
70
+
71
+ And then execute:
72
+
73
+ $ bundle
74
+
75
+
59
76
 
60
77
  ## Page Objects
61
78
 
@@ -153,11 +170,12 @@ the UI to hide implementation details, as shown below:
153
170
  trait(:page_locator) { 'body.login-body' }
154
171
 
155
172
  # Login page UI elements
156
- textfield :user_id_field, '#userName'
157
- textfield :password_field, '#password'
158
- button :login_button, '#login'
159
- checkbox :remember_checkbox, '#rememberUser'
160
- label :error_message_label, 'div#statusBar.login-error'
173
+ textfield :user_id_field, '#userName'
174
+ textfield :password_field, '#password'
175
+ button :login_button, '#login'
176
+ checkbox :remember_checkbox, '#rememberUser'
177
+ label :error_message_label, 'div#statusBar.login-error'
178
+ link :forgot_password_link, 'a.forgotPassword'
161
179
 
162
180
  def login(user_id, password)
163
181
  user_id_field.set(user_id)
@@ -168,6 +186,18 @@ the UI to hide implementation details, as shown below:
168
186
  def remember_me(state)
169
187
  remember_checkbox.set_checkbox_state(state)
170
188
  end
189
+
190
+ def verify_page_ui
191
+ ui = {
192
+ login_button => { :visible => true, :value => 'LOGIN' },
193
+ user_id_field => { :visible => true, :enabled => true },
194
+ password_field => { :visible => true, :enabled => true, :value => '', :placeholder => 'Password' },
195
+ remember_checkbox => { :exists => true, :enabled => true, :checked => false },
196
+ forgot_password_link => { :visible => true, :value => 'Forgot your password?' },
197
+ }
198
+ verify_ui_states(ui)
199
+ super
200
+ end
171
201
  end
172
202
 
173
203
 
@@ -389,6 +419,29 @@ To use a local instance of the Chrome desktop browser to host the emulated mobil
389
419
  to `chrome`.
390
420
 
391
421
 
422
+ ### Mobile Safari browser on iOS Simulators
423
+
424
+ You can run your mobile web tests against the mobile Safari browser on simulated iOS devices using Appium and XCode on OS X. You will need to install
425
+ XCode and Appium, and ensure that the `appium_capybara` gem is installed and required as described above.
426
+
427
+ Once your test environment is properly configured, the following **Environment Variables** must be set as described in the table below.
428
+
429
+ **Environment Variable** | **Description**
430
+ --------------- | ----------------
431
+ `WEB_BROWSER` | Must be set to `appium`
432
+ `APP_PLATFORM` | Must be set to `MAC`
433
+ `APP_PLATFORM_NAME` | Must be set to `iOS`
434
+ `APP_BROWSER` | Must be set to `Safari`
435
+ `APP_VERSION` | Must be set to `9.3`, `9.2`, or which ever iOS Simulator version are installed in XCode
436
+ `APP_DEVICE`| Set to iOS device name supported by the iOS Simulator (`iPhone 6s Plus`, `iPad Pro`, `iPad Air 2`, etc.)
437
+ `ORIENTATION` | [Optional] Set to `portrait` or `landscape`
438
+ `APP_ALLOW_POPUPS` | [Optional] Allow javascript to open new windows in Safari. Set to `true` or `false`
439
+ `APP_IGNORE_FRAUD_WARNING` | [Optional] Prevent Safari from showing a fraudulent website warning. Set to `true` or `false`
440
+ `APP_NO_RESET` | [Optional] Don't reset app state after each test. Set to `true` or `false`
441
+ `APP_INITIAL_URL` | [Optional] Initial URL, default is a local welcome page. e.g. `http://www.apple.com`
442
+
443
+
444
+
392
445
  ### Remotely hosted desktop and mobile web browsers
393
446
 
394
447
  You can run your automated tests against remotely hosted desktop and mobile web browsers using the BrowserStack, CrossBrowserTesting,
@@ -570,10 +623,30 @@ replace the placeholder text with your user account and authorization code for t
570
623
  #==============
571
624
  # profiles for mobile device screen orientation
572
625
  #==============
626
+
573
627
  portrait: ORIENTATION=portrait
574
628
  landscape: ORIENTATION=landscape
575
629
 
576
630
 
631
+ #==============
632
+ # profiles for mobile Safari web browsers hosted within XCode iOS simulator
633
+ # NOTE: Requires installation of XCode, iOS version specific target simulators, Appium, and the appium_capybara gem
634
+ #==============
635
+
636
+ appium_ios: WEB_BROWSER=appium APP_PLATFORM="MAC" APP_PLATFORM_NAME="iOS" APP_BROWSER="Safari" <%= mobile %>
637
+ app_ios_93: --profile appium_ios APP_VERSION="9.3"
638
+ app_ios_92: --profile appium_ios APP_VERSION="9.2"
639
+ ipad_retina_93_sim: --profile app_ios_93 APP_DEVICE="iPad Retina"
640
+ ipad_pro_93_sim: --profile app_ios_93 APP_DEVICE="iPad Pro"
641
+ ipad_air_93_sim: --profile app_ios_93 APP_DEVICE="iPad Air"
642
+ ipad_air2_93_sim: --profile app_ios_93 APP_DEVICE="iPad Air 2"
643
+ ipad_2_93_sim: --profile app_ios_93 APP_DEVICE="iPad 2"
644
+ iphone_6s_plus_93_sim: --profile app_ios_93 APP_DEVICE="iPhone 6s Plus"
645
+ iphone_6s_93_sim: --profile app_ios_93 APP_DEVICE="iPhone 6s"
646
+ iphone_5s_93_sim: --profile app_ios_93 APP_DEVICE="iPhone 5s"
647
+ iphone_4s_93_sim: --profile app_ios_93 APP_DEVICE="iPhone 4s"
648
+
649
+
577
650
  #==============
578
651
  # profiles for remotely hosted web browsers on the BrowserStack service
579
652
  #==============
@@ -810,17 +883,28 @@ invoking Cucumber in the command line. For instance, the following command invok
810
883
  will be used as the target web browser:
811
884
 
812
885
  $ cucumber -p chrome
813
-
886
+
887
+
814
888
  The following command specifies that Cucumber will run tests against a local instance of Firefox, which will be used to emulate an iPad Pro
815
889
  in landscape orientation:
816
890
 
817
891
  $ cucumber -p ipad_pro -p landscape
818
-
892
+
893
+
894
+ The following command specifies that Cucumber will run tests against an iPad Pro with iOS version 9.3 in an XCode Simulator
895
+ in landscape orientation:
896
+
897
+ $ cucumber -p ipad_pro_93_sim -p landscape
898
+
899
+ NOTE: Appium must me running prior to executing this command
900
+
901
+
819
902
  The following command specifies that Cucumber will run tests against a remotely hosted Safari web browser running on an OS X Yosemite
820
903
  virtual machine on the BrowserStack service:
821
904
 
822
905
  cucumber -p bs_safari_yos
823
906
 
907
+
824
908
  The following command specifies that Cucumber will run tests against a remotely hosted Mobile Safari web browser on an iPhone 6s Plus in
825
909
  landscape orientation running on the BrowserStack service:
826
910
 
@@ -255,7 +255,11 @@ module TestCentricity
255
255
  when :checked
256
256
  actual = ui_object.checked?
257
257
  when :selected
258
- actual = ui_object.selected?
258
+ if ui_object.get_object_type == :selectlist
259
+ actual = ui_object.get_selected_option
260
+ else
261
+ actual = ui_object.selected?
262
+ end
259
263
  when :value
260
264
  actual = ui_object.get_value
261
265
  when :maxlength
@@ -271,7 +271,11 @@ module TestCentricity
271
271
  when :checked
272
272
  actual = ui_object.checked?
273
273
  when :selected
274
- actual = ui_object.selected?
274
+ if ui_object.get_object_type == :selectlist
275
+ actual = ui_object.get_selected_option
276
+ else
277
+ actual = ui_object.selected?
278
+ end
275
279
  when :value
276
280
  actual = ui_object.get_value
277
281
  when :maxlength
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '0.8.8'
2
+ VERSION = '0.9.0'
3
3
  end
@@ -16,6 +16,9 @@ module TestCentricity
16
16
  Environ.set_device_type('browser')
17
17
 
18
18
  case browser.downcase.to_sym
19
+
20
+ when :appium
21
+ initialize_appium
19
22
  when :browserstack
20
23
  initialize_browserstack
21
24
  when :crossbrowser
@@ -31,13 +34,45 @@ module TestCentricity
31
34
  end
32
35
 
33
36
  # set browser window size only if testing with a desktop web browser
34
- initialize_browser_size unless Capybara.current_driver == :poltergeist
37
+ initialize_browser_size unless Capybara.current_driver == :poltergeist || Capybara.current_driver == :appium
35
38
 
36
39
  puts "Using #{Environ.browser.to_s} browser"
37
40
  end
38
41
 
39
42
  private
40
43
 
44
+ def self.initialize_appium
45
+ Environ.set_device(true)
46
+ Environ.set_platform(:mobile)
47
+ Environ.set_device(true)
48
+ Environ.set_device_type(ENV['APP_DEVICE'])
49
+ Capybara.default_driver = :appium
50
+ endpoint = 'http://localhost:4723/wd/hub'
51
+ desired_capabilities = {
52
+ platform: ENV['APP_PLATFORM'],
53
+ platformName: ENV['APP_PLATFORM_NAME'],
54
+ platformVersion: ENV['APP_VERSION'],
55
+ browserName: ENV['APP_BROWSER'],
56
+ deviceName: ENV['APP_DEVICE']
57
+ }
58
+ desired_capabilities['deviceOrientation'] = ENV['ORIENTATION'] if ENV['ORIENTATION']
59
+ desired_capabilities['udid'] = ENV['APP_UDID'] if ENV['APP_UDID']
60
+ desired_capabilities['safariInitialUrl'] = ENV['APP_INITIAL_URL'] if ENV['APP_INITIAL_URL']
61
+ desired_capabilities['safariAllowPopups'] = ENV['APP_ALLOW_POPUPS'] if ENV['APP_ALLOW_POPUPS']
62
+ desired_capabilities['safariIgnoreFraudWarning'] = ENV['APP_IGNORE_FRAUD_WARNING'] if ENV['APP_IGNORE_FRAUD_WARNING']
63
+ desired_capabilities['noReset'] = ENV['APP_NO_RESET'] if ENV['APP_NO_RESET']
64
+
65
+ Capybara.register_driver :appium do |app|
66
+ appium_lib_options = { server_url: endpoint }
67
+ all_options = {
68
+ browser: :safari,
69
+ appium_lib: appium_lib_options,
70
+ caps: desired_capabilities
71
+ }
72
+ Appium::Capybara::Driver.new app, all_options
73
+ end
74
+ end
75
+
41
76
  def self.initialize_local_browser(browser)
42
77
  Capybara.default_driver = :selenium
43
78
  Capybara.register_driver :selenium do |app|
@@ -15,8 +15,8 @@ Gem::Specification.new do |spec|
15
15
  TestCentricity™ core generic framework for desktop and mobile web site testing implements a Page Object Model DSL
16
16
  for use with Cucumber, Capybara, and Selenium-Webdriver. Supports testing against locally hosted desktop browsers
17
17
  (Firefox, Chrome, Safari, IE, or Edge), locally hosted emulated iOS and Android mobile browsers (using Firefox or
18
- Chrome), a "headless" browser (using Poltergeist and PhantomJS), or on cloud hosted browsers using the BrowserStack,
19
- Sauce Labs, CrossBrowserTesting, or TestingBot services.}
18
+ Chrome), a "headless" browser (using Poltergeist and PhantomJS), mobile Safari web browsers on iOS device simulators,
19
+ or on cloud hosted browsers using the BrowserStack, Sauce Labs, CrossBrowserTesting, or TestingBot services.}
20
20
  spec.homepage = ''
21
21
  spec.license = 'BSD3'
22
22
 
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: 0.8.8
4
+ version: 0.9.0
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: 2016-05-02 00:00:00.000000000 Z
11
+ date: 2016-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -147,8 +147,8 @@ description: |2-
147
147
  TestCentricity™ core generic framework for desktop and mobile web site testing implements a Page Object Model DSL
148
148
  for use with Cucumber, Capybara, and Selenium-Webdriver. Supports testing against locally hosted desktop browsers
149
149
  (Firefox, Chrome, Safari, IE, or Edge), locally hosted emulated iOS and Android mobile browsers (using Firefox or
150
- Chrome), a "headless" browser (using Poltergeist and PhantomJS), or on cloud hosted browsers using the BrowserStack,
151
- Sauce Labs, CrossBrowserTesting, or TestingBot services.
150
+ Chrome), a "headless" browser (using Poltergeist and PhantomJS), mobile Safari web browsers on iOS device simulators,
151
+ or on cloud hosted browsers using the BrowserStack, Sauce Labs, CrossBrowserTesting, or TestingBot services.
152
152
  email:
153
153
  - test_automation@icloud.com
154
154
  executables: []