testcentricity_web 4.1.3 → 4.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +18 -0
- data/.simplecov +5 -0
- data/CHANGELOG.md +30 -1
- data/Gemfile.lock +170 -0
- data/README.md +287 -102
- data/Rakefile +37 -1
- data/config/cucumber.yml +150 -0
- data/docker-compose-v3.yml +48 -0
- data/features/basic_test_page_css.feature +24 -0
- data/features/basic_test_page_xpath.feature +24 -0
- data/features/step_definitions/generic_steps.rb.rb +37 -0
- data/features/support/env.rb +43 -0
- data/features/support/hooks.rb +245 -0
- data/features/support/pages/basic_css_test_page.rb +49 -0
- data/features/support/pages/basic_test_page.rb +238 -0
- data/features/support/pages/basic_xpath_test_page.rb +49 -0
- data/features/support/pages/media_page.rb +11 -0
- data/features/support/world_pages.rb +15 -0
- data/lib/testcentricity_web/data_objects/environment.rb +4 -0
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/page_object.rb +13 -6
- data/lib/testcentricity_web/web_core/page_objects_helper.rb +41 -8
- data/lib/testcentricity_web/web_core/page_section.rb +1 -16
- data/lib/testcentricity_web/web_core/webdriver_helper.rb +78 -120
- data/lib/testcentricity_web/web_elements/select_list.rb +18 -7
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +13 -0
- data/reports/.keep +1 -0
- data/test_site/basic_test_page.html +240 -0
- data/test_site/images/Granny.jpg +0 -0
- data/test_site/images/Wilder.jpg +0 -0
- data/test_site/images/You_Betcha.jpg +0 -0
- data/test_site/media/MP4_small.mp4 +0 -0
- data/test_site/media/MPS_sample.mp3 +0 -0
- data/test_site/media_page.html +33 -0
- data/testcentricity_web.gemspec +5 -0
- metadata +105 -4
- data/test_site/test_page.html +0 -11
data/README.md
CHANGED
@@ -3,12 +3,12 @@
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/testcentricity_web.svg)](https://badge.fury.io/rb/testcentricity_web) [![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause)
|
4
4
|
|
5
5
|
|
6
|
-
The TestCentricity™ Web core generic framework for desktop and mobile web browser-based app testing implements a Page Object
|
7
|
-
|
6
|
+
The TestCentricity™ Web core generic framework for desktop and mobile web browser-based app testing implements a Page Object Model DSL
|
7
|
+
for use with Cucumber, Capybara (version 3.x), and Selenium-Webdriver (version 4.x). It also facilitates the configuration of the appropriate
|
8
|
+
Selenium-Webdriver capabilities required to establish a connection with a local or cloud hosted desktop or mobile web browser.
|
8
9
|
|
9
10
|
The TestCentricity™ Web gem supports running automated tests against the following web test targets:
|
10
|
-
* locally hosted desktop browsers (
|
11
|
-
* locally hosted emulated iOS Mobile Safari, Android, Windows Phone, or Blackberry mobile browsers (running within a local instance of Chrome)
|
11
|
+
* locally hosted desktop browsers (Chrome, Edge, Firefox, Safari, or IE)
|
12
12
|
* locally hosted "headless" Chrome, Firefox, or Edge browsers
|
13
13
|
* remote desktop and emulated mobile web browsers hosted on Selenium Grid 4 and Dockerized Selenium Grid 4 environments
|
14
14
|
* mobile Safari browsers on iOS device simulators or physical iOS devices (using Appium and XCode on OS X)
|
@@ -20,6 +20,7 @@ The TestCentricity™ Web gem supports running automated tests against the follo
|
|
20
20
|
* [LambdaTest](https://www.lambdatest.com/selenium-automation)
|
21
21
|
* web portals utilizing JavaScript front end application frameworks like Ember, React, Angular, and GWT
|
22
22
|
* web pages containing HTML5 Video and Audio objects
|
23
|
+
* locally hosted emulated iOS Mobile Safari, Android, Windows Phone, or Blackberry mobile browsers (running within a local instance of Chrome)
|
23
24
|
|
24
25
|
|
25
26
|
## What's New
|
@@ -48,7 +49,7 @@ Or install it yourself as:
|
|
48
49
|
## Setup
|
49
50
|
### Using Cucumber
|
50
51
|
|
51
|
-
If you are using Cucumber, you need to require the following in your
|
52
|
+
If you are using Cucumber, you need to require the following in your `env.rb` file:
|
52
53
|
|
53
54
|
require 'capybara/cucumber'
|
54
55
|
require 'testcentricity_web'
|
@@ -56,7 +57,7 @@ If you are using Cucumber, you need to require the following in your *env.rb* fi
|
|
56
57
|
|
57
58
|
### Using RSpec
|
58
59
|
|
59
|
-
If you are using RSpec instead, you need to require the following in your
|
60
|
+
If you are using RSpec instead, you need to require the following in your `env.rb` file:
|
60
61
|
|
61
62
|
require 'capybara'
|
62
63
|
require 'capybara/rspec'
|
@@ -66,7 +67,7 @@ If you are using RSpec instead, you need to require the following in your *env.r
|
|
66
67
|
### Using Appium
|
67
68
|
|
68
69
|
If you will be running your tests on mobile Safari browsers on simulated iOS devices using Appium and XCode Simulators, you need to require
|
69
|
-
the following in your
|
70
|
+
the following in your `env.rb` file:
|
70
71
|
|
71
72
|
require 'appium_capybara'
|
72
73
|
|
@@ -238,7 +239,7 @@ the UI to hide implementation details, as shown below:
|
|
238
239
|
remember_checkbox => { exists: true, enabled: true, checked: false },
|
239
240
|
forgot_password_link => { visible: true, caption: 'Forgot your password?' },
|
240
241
|
error_message_label => { visible: false }
|
241
|
-
|
242
|
+
}
|
242
243
|
verify_ui_states(ui)
|
243
244
|
end
|
244
245
|
end
|
@@ -281,7 +282,7 @@ the UI to hide implementation details, as shown below:
|
|
281
282
|
password_field => profile.password,
|
282
283
|
pword_confirm_field => profile.confirm_password,
|
283
284
|
email_opt_in_check => profile.email_opt_in
|
284
|
-
|
285
|
+
}
|
285
286
|
populate_data_fields(fields)
|
286
287
|
sign_up_button.click
|
287
288
|
end
|
@@ -502,6 +503,7 @@ With TestCentricity, all UI elements are based on the `UIElement` class, and inh
|
|
502
503
|
element.displayed?
|
503
504
|
element.obscured?
|
504
505
|
element.focused?
|
506
|
+
element.required?
|
505
507
|
element.content_editable?
|
506
508
|
element.get_value
|
507
509
|
element.count
|
@@ -568,9 +570,10 @@ interacted with.
|
|
568
570
|
|
569
571
|
The `PageObject.populate_data_fields` and `PageSection.populate_data_fields` methods support the entry of test data into a collection of
|
570
572
|
`UIElements`. The `populate_data_fields` method accepts a hash containing key/hash pairs of `UIElements` and their associated data to be
|
571
|
-
entered. Data values must be in the form of a `String` for `textfield` and `
|
572
|
-
must either be a `Boolean` or a `String` that evaluates to a `Boolean` value (Yes, No, 1, 0, true, false). For `
|
573
|
-
must be
|
573
|
+
entered. Data values must be in the form of a `String` for `textfield`, `selectlist`, and `filefield` controls. For `checkbox` and `radio`
|
574
|
+
controls, data must either be a `Boolean` or a `String` that evaluates to a `Boolean` value (Yes, No, 1, 0, true, false). For `range` controls,
|
575
|
+
data must be an `Integer`. For `input(type='color')` color picker controls, which are specified as a `textfield`, data must be in the form
|
576
|
+
of a hex color `String`. For `section` objects, data values must be a `String`, and the `section` object must have a `set` method defined.
|
574
577
|
|
575
578
|
The `populate_data_fields` method verifies that data attributes associated with each `UIElement` is not `nil` or `empty` before attempting to
|
576
579
|
enter data into the `UIElement`.
|
@@ -633,6 +636,14 @@ The `verify_ui_states` method supports the following property/state pairs:
|
|
633
636
|
:class String
|
634
637
|
:value or :caption String
|
635
638
|
:attribute Hash
|
639
|
+
:style String
|
640
|
+
:tabindex Integer
|
641
|
+
:required Boolean
|
642
|
+
|
643
|
+
**Pages:**
|
644
|
+
|
645
|
+
:secure Boolean
|
646
|
+
:title String
|
636
647
|
|
637
648
|
**Text Fields:**
|
638
649
|
|
@@ -645,12 +656,17 @@ The `verify_ui_states` method supports the following property/state pairs:
|
|
645
656
|
|
646
657
|
**Checkboxes:**
|
647
658
|
|
648
|
-
:checked
|
659
|
+
:checked Boolean
|
660
|
+
:indeterminate Boolean
|
649
661
|
|
650
662
|
**Radio Buttons:**
|
651
663
|
|
652
664
|
:selected Boolean
|
653
665
|
|
666
|
+
**Links:**
|
667
|
+
|
668
|
+
:href String
|
669
|
+
|
654
670
|
**Images**
|
655
671
|
|
656
672
|
:loaded Boolean
|
@@ -670,6 +686,8 @@ The `verify_ui_states` method supports the following property/state pairs:
|
|
670
686
|
:items or :options Array of Strings
|
671
687
|
:itemcount or :optioncount Integer
|
672
688
|
:selected String
|
689
|
+
:groupcount Integer
|
690
|
+
:group_headings Array of Strings
|
673
691
|
|
674
692
|
**Tables**
|
675
693
|
|
@@ -705,8 +723,6 @@ The `verify_ui_states` method supports the following property/state pairs:
|
|
705
723
|
|
706
724
|
The `verify_ui_states` method supports the following ARIA accessibility property/state pairs:
|
707
725
|
|
708
|
-
**All Objects:**
|
709
|
-
|
710
726
|
:aria_label String
|
711
727
|
:aria_disabled Boolean
|
712
728
|
:aria_labelledby String
|
@@ -737,8 +753,10 @@ The `verify_ui_states` method supports the following ARIA accessibility property
|
|
737
753
|
:aria_multiline Boolean
|
738
754
|
:aria_multiselectable Boolean
|
739
755
|
:content_editable Boolean
|
756
|
+
:role String
|
740
757
|
|
741
758
|
#### Comparison States
|
759
|
+
|
742
760
|
The `verify_ui_states` method supports comparison states using property/comparison state pairs:
|
743
761
|
|
744
762
|
object => { property: { comparison_state: value } }
|
@@ -843,6 +861,126 @@ Baseline translation strings are stored in `.yml` files in the `config/locales/`
|
|
843
861
|
└── README.md
|
844
862
|
|
845
863
|
|
864
|
+
### Working with custom UIElements
|
865
|
+
|
866
|
+
Many responsive and touch-enabled web based user interfaces are implemented using front-end JavaScript libraries for building user
|
867
|
+
interfaces based on UI components. Popular JS libraries include React, Angular, and Ember.js. These stylized and adorned controls can
|
868
|
+
present a challenge when attempting to interact with them using Capybara and Selenium based automated tests.
|
869
|
+
|
870
|
+
#### Radio and Checkbox UIElements
|
871
|
+
|
872
|
+
Sometimes, radio buttons and checkboxes implemented using JS component libraries cannot be interacted with due to other UI elements
|
873
|
+
being overlaid on top of them and the base `input(type='radio')` or `input(type='checkbox')` element not being visible.
|
874
|
+
|
875
|
+
In the screenshots below of an airline flight search and booking page, the **Roundtrip** and **One-way** radio buttons are adorned with
|
876
|
+
`label` elements that also acts as proxies for their associated `input(type='radio')` elements, and they intercept the `click` actions
|
877
|
+
that would normally be handled by the `input(type='radio')` elements.
|
878
|
+
|
879
|
+
<img src="https://i.imgur.com/7bW5u4c.jpg" alt="Roundtrip Radio button Input" title="Roundtrip Radio button Input">
|
880
|
+
|
881
|
+
|
882
|
+
This screenshot shows the `label` element that is overlaid above the **Roundtrip** `input(type='radio')` element.
|
883
|
+
|
884
|
+
<img src="https://i.imgur.com/2stWiyR.jpg" alt="Roundtrip Radio button Label" title="Roundtrip Radio button Label">
|
885
|
+
|
886
|
+
|
887
|
+
The checkbox controls in this web UI are also adorned with `label` elements that act as proxies for their associated `input(type='checkbox')`
|
888
|
+
elements.
|
889
|
+
|
890
|
+
<img src="https://i.imgur.com/JcOANqZ.jpg" alt="One-way Radio button Label" title="One-way Radio button Label">
|
891
|
+
|
892
|
+
|
893
|
+
The `Radio.define_custom_elements` and `CheckBox.define_custom_elements` methods provide a way to specify the `proxy` and/or `label`
|
894
|
+
elements associated with the `input(type='radio')` or `input(type='checkbox')` elements. The `define_custom_elements` method
|
895
|
+
should be called from an `initialize` method for the `PageObject` or `PageSection` where the `radio` or `checkbox` element is instantiated.
|
896
|
+
The code snippet below demonstrates the use of the `Radio.define_custom_elements` and `CheckBox.define_custom_elements` methods to
|
897
|
+
resolve the testability issues posed by the adorned **Roundtrip** and **One-way** radio buttons and the **Flexible dates** checkbox.
|
898
|
+
|
899
|
+
class FlightBookingPage < TestCentricity::PageObject
|
900
|
+
trait(:page_name) { 'Flight Booking Home' }
|
901
|
+
trait(:page_locator) { "div[class*='bookerContainer']" }
|
902
|
+
|
903
|
+
# Flight Booking page UI elements
|
904
|
+
radios roundtrip_radio: 'input#roundtrip',
|
905
|
+
one_way_radio: 'input#oneway'
|
906
|
+
checkbox :flexible_check, 'input#flexibleDates'
|
907
|
+
|
908
|
+
def initialize
|
909
|
+
# define the custom element components for the Round Trip radio button
|
910
|
+
radio_spec = { proxy: "label[for='roundtrip']" }
|
911
|
+
roundtrip_radio.define_custom_elements(radio_spec)
|
912
|
+
# define the custom element components for the One Way radio button
|
913
|
+
radio_spec = { proxy: "label[for='oneway']" }
|
914
|
+
one_way_radio.define_custom_elements(radio_spec)
|
915
|
+
# define the custom element components for the Flexible Date checkbox
|
916
|
+
check_spec = { proxy: 'label#flexDatesLabel' }
|
917
|
+
flexible_check.define_custom_elements(check_spec)
|
918
|
+
end
|
919
|
+
end
|
920
|
+
|
921
|
+
|
922
|
+
#### SelectList UIElements
|
923
|
+
|
924
|
+
The basic HTML `select` element is typically composed of the parent `select` object, and one or more `option` elements representing
|
925
|
+
the selectable items in the drop-down list. However, `select` type controls implemented using JS component libraries can be composed
|
926
|
+
of multiple elements representing the various components of a drop-down style `selectlist` implementation.
|
927
|
+
|
928
|
+
In the screenshots below of an airline flight search and booking page, there are no `select` or `option` elements associated with the
|
929
|
+
**Month**, **Day**, and **Cabin Type** drop-down style selectors. An inspection of the **Month** selector reveals that it is a `div`
|
930
|
+
element that contains a `button` element (outlined in red) for triggering the drop-down list, a `ul` element (outlined in green) that
|
931
|
+
contains the drop-down list, and multiple `li` elements (outlined in blue) that represent the list items or options that can be
|
932
|
+
selected. The currently selected item or option can be identified by either the `listBoxOptionSelected` snippet in its `class` name or
|
933
|
+
the `aria-selected` attribute (outlined in orange).
|
934
|
+
|
935
|
+
Further examination of the **Day** and **Cabin Type** drop-down style selectors reveal that their composition is identical to the
|
936
|
+
**Month** selector.
|
937
|
+
|
938
|
+
<img src="https://i.imgur.com/LYAC2lh.jpg" alt="Custom SelectList" title="Custom SelectList">
|
939
|
+
|
940
|
+
|
941
|
+
The `SelectList.define_list_elements` method provides a means of specifying the various elements that make up the key components of
|
942
|
+
a `selectlist` control. The method accepts a hash of element designators (key) and a CSS or Xpath expression (value) that expression
|
943
|
+
that uniquely identifies the element. Valid element designators are `list_item:`, `options_list:`, `list_trigger:`, `selected_item:`,
|
944
|
+
`text_field:`, `group_heading:`, and `group_item:`.
|
945
|
+
|
946
|
+
The code snippet below demonstrates the use of the `SelectList.define_list_elements` method to define the common components that make
|
947
|
+
up the **Month**, **Day**, and **Cabin Type** drop-down style selectors. Note the use of the ARIA `role` and `aria-selected` attributes
|
948
|
+
as element locators.
|
949
|
+
|
950
|
+
class FlightBookingPage < TestCentricity::PageObject
|
951
|
+
trait(:page_name) { 'Flight Booking Home' }
|
952
|
+
trait(:page_locator) { "div[class*='bookerContainer']" }
|
953
|
+
|
954
|
+
# Flight Booking page UI elements
|
955
|
+
selectlists month_select: "div[class*='expandFlexMonth']",
|
956
|
+
duration_select: "div[class*='expandFlexDay']",
|
957
|
+
cabin_type_select: "div[class*='bookFlightForm__optionField'] > div[class*='app-components-ListBox']"
|
958
|
+
|
959
|
+
def initialize
|
960
|
+
# define the custom list element components for the Month, Duration, and Cabin Type selectlist objects
|
961
|
+
list_spec = {
|
962
|
+
selected_item: "li[aria-selected=true]",
|
963
|
+
options_list: "ul[role='listbox']",
|
964
|
+
list_item: "li[role='option']",
|
965
|
+
list_trigger: "button[role='combobox']"
|
966
|
+
}
|
967
|
+
month_select.define_list_elements(list_spec)
|
968
|
+
duration_select.define_list_elements(list_spec)
|
969
|
+
cabin_type_select.define_list_elements(list_spec)
|
970
|
+
end
|
971
|
+
end
|
972
|
+
|
973
|
+
|
974
|
+
#### List UIElements
|
975
|
+
|
976
|
+
The basic HTML list is typically composed of the parent `ul` object, and one or more `li` elements representing the items
|
977
|
+
in the list. However, list controls implemented using JS component libraries can be composed of multiple elements representing the
|
978
|
+
components of a list implementation.
|
979
|
+
|
980
|
+
The `List.define_list_elements` method provides a means of specifying the elements that make up the key components of a `list` control.
|
981
|
+
The method accepts a hash of element designators (key) and a CSS or Xpath expression (value) that expression that uniquely identifies
|
982
|
+
the element. Valid element designators are `list_item:`and `selected_item:`.
|
983
|
+
|
846
984
|
|
847
985
|
## Instantiating your PageObjects
|
848
986
|
|
@@ -1040,7 +1178,7 @@ values from the table below:
|
|
1040
1178
|
| `safari` | OS X only |
|
1041
1179
|
| `ie` | Windows only (IE version 10.x or greater only) |
|
1042
1180
|
|
1043
|
-
Refer to **section 8.
|
1181
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1044
1182
|
|
1045
1183
|
|
1046
1184
|
#### Setting desktop browser window size
|
@@ -1155,7 +1293,7 @@ To change the emulated device's screen orientation from the default setting, set
|
|
1155
1293
|
To use a local instance of the Chrome desktop browser to host the emulated mobile web browser, you must set the `HOST_BROWSER` Environment Variable
|
1156
1294
|
to `chrome`.
|
1157
1295
|
|
1158
|
-
Refer to **section 8.
|
1296
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1159
1297
|
|
1160
1298
|
|
1161
1299
|
#### User defined mobile device profiles
|
@@ -1198,10 +1336,12 @@ For remote desktop and emulated mobile web browsers running on Selenium Grid 4 o
|
|
1198
1336
|
| `SELENIUM` | Must be set to `remote` |
|
1199
1337
|
| `REMOTE_ENDPOINT` | Must be set to the URL of the Grid hub, which is usually `http://localhost:4444/wd/hub` |
|
1200
1338
|
|
1201
|
-
Refer to **section 8.
|
1339
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1202
1340
|
|
1203
1341
|
|
1204
|
-
### Mobile
|
1342
|
+
### Mobile browsers on Simulators or Physical Devices
|
1343
|
+
|
1344
|
+
#### Mobile Safari browser on iOS Simulators or iOS Physical Devices
|
1205
1345
|
|
1206
1346
|
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
|
1207
1347
|
OS X. You must install Appium, XCode, and the iOS version-specific device simulators for XCode. You must also ensure that the `appium_capybara` gem is
|
@@ -1217,7 +1357,7 @@ Once your test environment is properly configured, the following **Environment V
|
|
1217
1357
|
| `WEB_BROWSER` | Must be set to `appium` |
|
1218
1358
|
| `APP_PLATFORM_NAME` | Must be set to `iOS` |
|
1219
1359
|
| `APP_BROWSER` | Must be set to `Safari` |
|
1220
|
-
| `APP_VERSION` | Must be set to `15.
|
1360
|
+
| `APP_VERSION` | Must be set to `15.4`, `14.5`, or which ever iOS version you wish to run within the XCode Simulator |
|
1221
1361
|
| `APP_DEVICE` | Set to iOS device name supported by the iOS Simulator (`iPhone 13 Pro Max`, `iPad Pro (12.9-inch) (5th generation)`, etc.) or name of physically connected iOS device |
|
1222
1362
|
| `DEVICE_TYPE` | Must be set to `phone` or `tablet` |
|
1223
1363
|
| `APP_UDID` | UDID of physically connected iOS device (not used for simulators) |
|
@@ -1238,12 +1378,12 @@ Once your test environment is properly configured, the following **Environment V
|
|
1238
1378
|
|
1239
1379
|
The `SHUTDOWN_OTHER_SIMS` environment variable can only be set if you are running Appium Server with the `--relaxed-security` or
|
1240
1380
|
`--allow-insecure=shutdown_other_sims` arguments passed when starting it from the command line, or when running the server from the
|
1241
|
-
Appium Server GUI app. A security violation error will occur without relaxed
|
1381
|
+
Appium Server GUI app. A security violation error will occur without relaxed security enabled.
|
1242
1382
|
|
1243
|
-
Refer to **section 8.
|
1383
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1244
1384
|
|
1245
1385
|
|
1246
|
-
|
1386
|
+
#### Mobile Chrome or Android browsers on Android Studio Virtual Device emulators
|
1247
1387
|
|
1248
1388
|
You can run your mobile web tests against the mobile Chrome or Android browser on emulated Android devices using Appium and Android Studio on OS X. You
|
1249
1389
|
must install Android Studio, the desired Android version-specific virtual device emulators, and Appium. Refer to [this page](http://appium.io/docs/en/drivers/android-uiautomator2/index.html)
|
@@ -1260,7 +1400,7 @@ Once your test environment is properly configured, the following **Environment V
|
|
1260
1400
|
| `WEB_BROWSER` | Must be set to `appium` |
|
1261
1401
|
| `APP_PLATFORM_NAME` | Must be set to `Android` |
|
1262
1402
|
| `APP_BROWSER` | Must be set to `Chrome` or `Browser` |
|
1263
|
-
| `APP_VERSION` | Must be set to `
|
1403
|
+
| `APP_VERSION` | Must be set to `12.0`, or which ever Android OS version you wish to run with the Android Virtual Device |
|
1264
1404
|
| `APP_DEVICE` | Set to Android Virtual Device ID (`Pixel_2_XL_API_26`, `Nexus_6_API_23`, etc.) found in Advanced Settings of AVD Configuration |
|
1265
1405
|
| `DEVICE_TYPE` | Must be set to `phone` or `tablet` |
|
1266
1406
|
| `ORIENTATION` | [Optional] Set to `portrait` or `landscape` |
|
@@ -1272,16 +1412,54 @@ Once your test environment is properly configured, the following **Environment V
|
|
1272
1412
|
| `NEW_COMMAND_TIMEOUT` | [Optional] Time (in Seconds) that Appium will wait for a new command from the client |
|
1273
1413
|
| `CHROMEDRIVER_EXECUTABLE` | [Optional] Absolute local path to webdriver executable |
|
1274
1414
|
|
1275
|
-
Refer to **section 8.
|
1415
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1416
|
+
|
1417
|
+
|
1418
|
+
#### Starting and stopping Appium Server
|
1419
|
+
|
1420
|
+
The Appium server must be running prior to invoking Cucumber to run your features/scenarios on mobile simulators or physical
|
1421
|
+
device. To programmatically control the starting and stopping of Appium server with the execution of your automated tests, place
|
1422
|
+
the code shown below in your `hooks.rb` file.
|
1423
|
+
|
1424
|
+
BeforeAll do
|
1425
|
+
# start Appium Server if APPIUM_SERVER = 'run' and target browser is a mobile simulator or device
|
1426
|
+
if ENV['APPIUM_SERVER'] == 'run' && Environ.driver == :appium
|
1427
|
+
$server = TestCentricity::AppiumServer.new
|
1428
|
+
$server.start
|
1429
|
+
end
|
1430
|
+
end
|
1431
|
+
|
1432
|
+
AfterAll do
|
1433
|
+
# terminate Appium Server if APPIUM_SERVER = 'run' and target browser is a mobile simulator or device
|
1434
|
+
$server.stop if ENV['APPIUM_SERVER'] == 'run' && Environ.driver == :appium && $server.running?
|
1435
|
+
# close driver
|
1436
|
+
Capybara.page.driver.quit
|
1437
|
+
Capybara.reset_sessions!
|
1438
|
+
Environ.session_state = :quit
|
1439
|
+
end
|
1440
|
+
|
1441
|
+
|
1442
|
+
The `APPIUM_SERVER` environment variable must be set to `run` in order to programmatically start and stop Appium server. This can be
|
1443
|
+
set by adding the following to your `cucumber.yml` file and including `-p run_appium` in your command line when starting your Cucumber
|
1444
|
+
test suite(s):
|
1276
1445
|
|
1446
|
+
run_appium: APPIUM_SERVER=run
|
1277
1447
|
|
1278
|
-
### Remotely hosted desktop and mobile web browsers
|
1279
1448
|
|
1280
|
-
|
1449
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1450
|
+
|
1451
|
+
|
1452
|
+
### Remote cloud hosted desktop and mobile web browsers
|
1453
|
+
|
1454
|
+
You can run your automated tests against remote cloud hosted desktop and mobile web browsers using the BrowserStack, SauceLabs, TestingBot, or
|
1281
1455
|
LambdaTest services. If your tests are running against a web site hosted on your local computer (`localhost`), or on a staging server inside
|
1282
1456
|
your LAN, you must set the `TUNNELING` Environment Variable to `true`.
|
1283
1457
|
|
1284
|
-
|
1458
|
+
Due to lack of support for Selenium 4.x and the W3C browser capabilities protocol, support for CrossBrowserTesting and Gridlastic cloud hosted
|
1459
|
+
Selenium grid services was removed as of version 4.1 of this gem. If your testing requires access to either of those services, or support for
|
1460
|
+
Selenium version 3.x, you should use earlier versions of this gem.
|
1461
|
+
|
1462
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1285
1463
|
|
1286
1464
|
|
1287
1465
|
#### Remote desktop browsers on the BrowserStack service
|
@@ -1290,24 +1468,24 @@ For remotely hosted desktop web browsers on the BrowserStack service, the follow
|
|
1290
1468
|
the table below. Refer to the [Browserstack-specific capabilities chart page](https://www.browserstack.com/automate/capabilities?tag=selenium-4)
|
1291
1469
|
for information regarding the specific capabilities.
|
1292
1470
|
|
1293
|
-
| **Environment Variable** | **Description**
|
1294
|
-
|
1295
|
-
| `WEB_BROWSER` | Must be set to `browserstack`
|
1296
|
-
| `BS_USERNAME` | Must be set to your BrowserStack account user name
|
1297
|
-
| `BS_AUTHKEY` | Must be set to your BrowserStack account access key
|
1298
|
-
| `BS_OS` | Must be set to `OS X` or `Windows`
|
1299
|
-
| `BS_OS_VERSION` | Refer to `os_version` capability in chart
|
1300
|
-
| `BS_BROWSER` | Refer to `
|
1301
|
-
| `BS_VERSION` | [Optional] Refer to `browser_version` capability in chart. If not specified, latest stable version of browser will be used.
|
1302
|
-
| `TUNNELING` | Must be `true` if you are testing against internal/local servers (`true` or `false`). If `true`, the BrowserStack Local instance will be automatically started. |
|
1303
|
-
| `RESOLUTION` | [Optional] Refer to supported screen `resolution` capability in chart
|
1304
|
-
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`)
|
1305
|
-
| `TIME_ZONE` | [Optional] Specify custom time zone. Refer to `browserstack.timezone` capability in chart
|
1306
|
-
| `IP_GEOLOCATION` | [Optional] Specify IP Geolocation. Refer to [IP Geolocation](https://www.browserstack.com/ip-geolocation) to select a country code.
|
1307
|
-
| `ALLOW_POPUPS` | [Optional] Allow popups (`true` or `false`) - for Safari, IE, and Edge browsers only
|
1308
|
-
| `ALLOW_COOKIES` | [Optional] Allow all cookies (`true` or `false`) - for Safari browsers only
|
1309
|
-
| `SCREENSHOTS` | [Optional] Generate screenshots for debugging (`true` or `false`)
|
1310
|
-
| `NETWORK_LOGS` | [Optional] Capture network logs (`true` or `false`)
|
1471
|
+
| **Environment Variable** | **Description** |
|
1472
|
+
|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
1473
|
+
| `WEB_BROWSER` | Must be set to `browserstack` |
|
1474
|
+
| `BS_USERNAME` | Must be set to your BrowserStack account user name |
|
1475
|
+
| `BS_AUTHKEY` | Must be set to your BrowserStack account access key |
|
1476
|
+
| `BS_OS` | Must be set to `OS X` or `Windows` |
|
1477
|
+
| `BS_OS_VERSION` | Refer to `os_version` capability in chart |
|
1478
|
+
| `BS_BROWSER` | Refer to `browserName` capability in chart |
|
1479
|
+
| `BS_VERSION` | [Optional] Refer to `browser_version` capability in chart. If not specified, latest stable version of browser will be used. |
|
1480
|
+
| `TUNNELING` | [Optional] Must be `true` if you are testing against internal/local servers (`true` or `false`). If `true`, the BrowserStack Local instance will be automatically started. |
|
1481
|
+
| `RESOLUTION` | [Optional] Refer to supported screen `resolution` capability in chart |
|
1482
|
+
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`) |
|
1483
|
+
| `TIME_ZONE` | [Optional] Specify custom time zone. Refer to `browserstack.timezone` capability in chart |
|
1484
|
+
| `IP_GEOLOCATION` | [Optional] Specify IP Geolocation. Refer to [IP Geolocation](https://www.browserstack.com/ip-geolocation) to select a country code. |
|
1485
|
+
| `ALLOW_POPUPS` | [Optional] Allow popups (`true` or `false`) - for Safari, IE, and Edge browsers only |
|
1486
|
+
| `ALLOW_COOKIES` | [Optional] Allow all cookies (`true` or `false`) - for Safari browsers only |
|
1487
|
+
| `SCREENSHOTS` | [Optional] Generate screenshots for debugging (`true` or `false`) |
|
1488
|
+
| `NETWORK_LOGS` | [Optional] Capture network logs (`true` or `false`) |
|
1311
1489
|
|
1312
1490
|
If the BrowserStack Local instance is running (`TUNNELING` Environment Variable is `true`), call the`TestCentricity::WebDriverConnect.close_tunnel` method
|
1313
1491
|
upon completion of your test suite to stop the Local instance. Place the code shown below in your `env.rb` or `hooks.rb` file.
|
@@ -1324,43 +1502,43 @@ For remotely hosted mobile web browsers on the BrowserStack service, the followi
|
|
1324
1502
|
the table below. Refer to the [Browserstack-specific capabilities chart page](https://www.browserstack.com/automate/capabilities?tag=selenium-4)
|
1325
1503
|
for information regarding the specific capabilities.
|
1326
1504
|
|
1327
|
-
| **Environment Variable** | **Description**
|
1328
|
-
|
1329
|
-
| `WEB_BROWSER` | Must be set to `browserstack`
|
1330
|
-
| `BS_USERNAME` | Must be set to your BrowserStack account user name
|
1331
|
-
| `BS_AUTHKEY` | Must be set to your BrowserStack account access key
|
1332
|
-
| `BS_OS` | Must be set to `ios` or `android`
|
1333
|
-
| `BS_BROWSER` | Must be set to `Safari` (for iOS) or `Chrome` (for Android)
|
1334
|
-
| `BS_DEVICE` | Refer to `
|
1335
|
-
| `BS_REAL_MOBILE` | Set to `true` if running against a real device
|
1336
|
-
| `DEVICE_TYPE` | Must be set to `phone` or `tablet`
|
1337
|
-
| `TUNNELING` | Must be `true` if you are testing against internal/local servers (`true` or `false`). If `true`, the BrowserStack Local instance will be automatically started. |
|
1338
|
-
| `ORIENTATION` | [Optional] Set to `portrait` or `landscape`
|
1339
|
-
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`)
|
1340
|
-
| `TIME_ZONE` | [Optional] Specify custom time zone. Refer to `browserstack.timezone` capability in chart
|
1341
|
-
| `IP_GEOLOCATION` | [Optional] Specify IP Geolocation. Refer to [IP Geolocation](https://www.browserstack.com/ip-geolocation) to select a country code.
|
1342
|
-
| `SCREENSHOTS` | [Optional] Generate screenshots for debugging (`true` or `false`)
|
1343
|
-
| `NETWORK_LOGS` | [Optional] Capture network logs (`true` or `false`)
|
1344
|
-
| `APPIUM_LOGS` | [Optional] Generate Appium logs (`true` or `false`)
|
1505
|
+
| **Environment Variable** | **Description** |
|
1506
|
+
|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
1507
|
+
| `WEB_BROWSER` | Must be set to `browserstack` |
|
1508
|
+
| `BS_USERNAME` | Must be set to your BrowserStack account user name |
|
1509
|
+
| `BS_AUTHKEY` | Must be set to your BrowserStack account access key |
|
1510
|
+
| `BS_OS` | Must be set to `ios` or `android` |
|
1511
|
+
| `BS_BROWSER` | Must be set to `Safari` (for iOS) or `Chrome` (for Android) |
|
1512
|
+
| `BS_DEVICE` | Refer to `deviceName` capability in chart |
|
1513
|
+
| `BS_REAL_MOBILE` | Set to `true` if running against a real device |
|
1514
|
+
| `DEVICE_TYPE` | Must be set to `phone` or `tablet` |
|
1515
|
+
| `TUNNELING` | [Optional] Must be `true` if you are testing against internal/local servers (`true` or `false`). If `true`, the BrowserStack Local instance will be automatically started. |
|
1516
|
+
| `ORIENTATION` | [Optional] Set to `portrait` or `landscape` |
|
1517
|
+
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`) |
|
1518
|
+
| `TIME_ZONE` | [Optional] Specify custom time zone. Refer to `browserstack.timezone` capability in chart |
|
1519
|
+
| `IP_GEOLOCATION` | [Optional] Specify IP Geolocation. Refer to [IP Geolocation](https://www.browserstack.com/ip-geolocation) to select a country code. |
|
1520
|
+
| `SCREENSHOTS` | [Optional] Generate screenshots for debugging (`true` or `false`) |
|
1521
|
+
| `NETWORK_LOGS` | [Optional] Capture network logs (`true` or `false`) |
|
1522
|
+
| `APPIUM_LOGS` | [Optional] Generate Appium logs (`true` or `false`) |
|
1345
1523
|
|
1346
1524
|
#### Remote desktop browsers on the Sauce Labs service
|
1347
1525
|
|
1348
|
-
For remotely hosted desktop web browsers on the Sauce Labs service, the following **Environment Variables** must be set as described in
|
1349
|
-
|
1350
|
-
information regarding the specific capabilities.
|
1351
|
-
|
1352
|
-
| **Environment Variable** | **Description**
|
1353
|
-
|
1354
|
-
| `WEB_BROWSER` | Must be set to `saucelabs`
|
1355
|
-
| `SL_USERNAME` | Must be set to your Sauce Labs account user name or email address
|
1356
|
-
| `SL_AUTHKEY` | Must be set to your Sauce Labs account access key
|
1357
|
-
| `DATA_CENTER` | Must be set to your Sauce Labs account Data Center assignment (`us-west-1`, `eu-central-1`, `apac-southeast-1`)
|
1358
|
-
| `SL_OS` | Refer to `
|
1359
|
-
| `SL_BROWSER` | Must be set to `chrome`, `firefox`, `safari`, `internet explorer`, or `
|
1360
|
-
| `SL_VERSION` | Refer to `
|
1361
|
-
| `RESOLUTION` | [Optional] Refer to supported `screenResolution` capability in the
|
1362
|
-
| `BROWSER_SIZE ` | [Optional] Specify width, height of browser window
|
1363
|
-
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`)
|
1526
|
+
For remotely hosted desktop web browsers on the Sauce Labs service, the following **Environment Variables** must be set as described in the
|
1527
|
+
table below. Use the Selenium 4 selection on the [Platform Configurator page](https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/)
|
1528
|
+
to obtain information regarding the specific capabilities.
|
1529
|
+
|
1530
|
+
| **Environment Variable** | **Description** |
|
1531
|
+
|--------------------------|----------------------------------------------------------------------------------------------------------------------------|
|
1532
|
+
| `WEB_BROWSER` | Must be set to `saucelabs` |
|
1533
|
+
| `SL_USERNAME` | Must be set to your Sauce Labs account user name or email address |
|
1534
|
+
| `SL_AUTHKEY` | Must be set to your Sauce Labs account access key |
|
1535
|
+
| `DATA_CENTER` | Must be set to your Sauce Labs account Data Center assignment (`us-west-1`, `eu-central-1`, `apac-southeast-1`) |
|
1536
|
+
| `SL_OS` | Refer to `platformName` capability in the Config Script section of the Platform Configurator page |
|
1537
|
+
| `SL_BROWSER` | Must be set to `chrome`, `firefox`, `safari`, `internet explorer`, or `MicrosoftEdge` |
|
1538
|
+
| `SL_VERSION` | Refer to `browserVersion` capability in the Config Script section of the Platform Configurator page |
|
1539
|
+
| `RESOLUTION` | [Optional] Refer to supported `screenResolution` capability in the Config Script section of the Platform Configurator page |
|
1540
|
+
| `BROWSER_SIZE ` | [Optional] Specify width, height of browser window |
|
1541
|
+
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`) |
|
1364
1542
|
|
1365
1543
|
#### Remote desktop browsers on the TestingBot service
|
1366
1544
|
|
@@ -1376,24 +1554,24 @@ regarding the specific capabilities.
|
|
1376
1554
|
| `TB_OS` | Refer to `platform` capability in chart |
|
1377
1555
|
| `TB_BROWSER` | Refer to `browserName` capability in chart |
|
1378
1556
|
| `TB_VERSION` | Refer to `version` capability in chart |
|
1379
|
-
| `TUNNELING` | Must be `true` if you are testing against internal/local servers (`true` or `false`)
|
1557
|
+
| `TUNNELING` | [Optional] Must be `true` if you are testing against internal/local servers (`true` or `false`) |
|
1380
1558
|
| `RESOLUTION` | [Optional] Possible values: `800x600`, `1024x768`, `1280x960`, `1280x1024`, `1600x1200`, `1920x1200`, `2560x1440` |
|
1381
1559
|
| `BROWSER_SIZE` | [Optional] Specify width, height of browser window |
|
1382
1560
|
|
1383
1561
|
#### Remote desktop browsers on the LambdaTest service
|
1384
1562
|
|
1385
1563
|
For remotely hosted desktop web browsers on the LambdaTest service, the following **Environment Variables** must be set as described in the table
|
1386
|
-
below. Use the Configuration Wizard on the [Selenium Desired Capabilities Generator](https://www.lambdatest.com/capabilities-generator/)
|
1387
|
-
information regarding the specific capabilities.
|
1564
|
+
below. Use the Selenium 4 Configuration Wizard on the [Selenium Desired Capabilities Generator](https://www.lambdatest.com/capabilities-generator/)
|
1565
|
+
to obtain information regarding the specific capabilities.
|
1388
1566
|
|
1389
1567
|
| **Environment Variable** | **Description** |
|
1390
1568
|
|--------------------------|------------------------------------------------------------------------------------------|
|
1391
1569
|
| `WEB_BROWSER` | Must be set to `lambdatest` |
|
1392
1570
|
| `LT_USERNAME` | Must be set to your LambdaTest account user name or email address |
|
1393
1571
|
| `LT_AUTHKEY` | Must be set to your LambdaTest account access key |
|
1394
|
-
| `LT_OS` | Refer to `
|
1572
|
+
| `LT_OS` | Refer to `platformName` capability in the sample script of the Wizard |
|
1395
1573
|
| `LT_BROWSER` | Refer to `browserName` capability in the sample script of the Wizard |
|
1396
|
-
| `LT_VERSION` | Refer to `
|
1574
|
+
| `LT_VERSION` | Refer to `browserVersion` capability in chart |
|
1397
1575
|
| `RESOLUTION` | [Optional] Refer to supported `resolution` capability in the sample script of the Wizard |
|
1398
1576
|
| `BROWSER_SIZE` | [Optional] Specify width, height of browser window |
|
1399
1577
|
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`) |
|
@@ -1499,17 +1677,25 @@ that you intend to connect with.
|
|
1499
1677
|
|
1500
1678
|
portrait: ORIENTATION=portrait
|
1501
1679
|
landscape: ORIENTATION=landscape
|
1680
|
+
|
1502
1681
|
|
1682
|
+
#==============
|
1683
|
+
# profile to start Appium Server prior to running mobile browser tests on iOS or Android simulators or physical devices
|
1684
|
+
#==============
|
1503
1685
|
|
1686
|
+
run_appium: APPIUM_SERVER=run
|
1687
|
+
|
1688
|
+
|
1504
1689
|
#==============
|
1505
1690
|
# profiles for mobile Safari web browsers hosted within XCode iOS simulator
|
1506
1691
|
# NOTE: Requires installation of XCode, iOS version specific target simulators, Appium, and the appium_capybara gem
|
1507
1692
|
#==============
|
1508
1693
|
|
1509
1694
|
appium_ios: WEB_BROWSER=appium AUTOMATION_ENGINE=XCUITest APP_PLATFORM_NAME="ios" APP_BROWSER="Safari" NEW_COMMAND_TIMEOUT=30 SHOW_SIM_KEYBOARD=false
|
1510
|
-
app_ios_15: --profile appium_ios APP_VERSION="15.
|
1511
|
-
|
1512
|
-
ipad_air_15_sim:
|
1695
|
+
app_ios_15: --profile appium_ios APP_VERSION="15.4"
|
1696
|
+
ipad_pro_12_15_sim: --profile app_ios_15 DEVICE_TYPE=tablet APP_DEVICE="iPad Pro (12.9-inch) (5th generation)"
|
1697
|
+
ipad_air_15_sim: --profile app_ios_15 DEVICE_TYPE=tablet APP_DEVICE="iPad Air (5th generation)" <%= desktop %>
|
1698
|
+
ipad_15_sim: --profile app_ios_15 DEVICE_TYPE=tablet APP_DEVICE="iPad (9th generation)"
|
1513
1699
|
|
1514
1700
|
|
1515
1701
|
#==============
|
@@ -1627,38 +1813,37 @@ To specify a locally hosted target browser using a profile at runtime, you use t
|
|
1627
1813
|
invoking Cucumber in the command line. For instance, the following command invokes Cucumber and specifies that a local instance of Firefox
|
1628
1814
|
will be used as the target web browser:
|
1629
1815
|
|
1630
|
-
|
1816
|
+
cucumber -p firefox
|
1631
1817
|
|
1632
1818
|
|
1633
|
-
The following command specifies that Cucumber will run tests against an instance of Chrome hosted within a Dockerized Selenium Grid
|
1819
|
+
The following command specifies that Cucumber will run tests against an instance of Chrome hosted within a Dockerized Selenium Grid 4
|
1820
|
+
environment:
|
1634
1821
|
|
1635
|
-
|
1822
|
+
cucumber -p chrome -p grid
|
1636
1823
|
|
1637
1824
|
|
1638
1825
|
The following command specifies that Cucumber will run tests against a local instance of Chrome, which will be used to emulate an iPad Pro
|
1639
1826
|
in landscape orientation:
|
1640
1827
|
|
1641
|
-
|
1828
|
+
cucumber -p ipad_pro -p landscape
|
1642
1829
|
|
1643
1830
|
|
1644
|
-
The following command specifies that Cucumber will run tests against an iPad Pro with iOS version
|
1645
|
-
in landscape orientation:
|
1831
|
+
The following command specifies that Cucumber will run tests against an iPad Pro (12.9-inch) (5th generation) with iOS version 15.4 in an
|
1832
|
+
XCode Simulator in landscape orientation:
|
1646
1833
|
|
1647
|
-
|
1834
|
+
cucumber -p ipad_pro_12_15_sim -p landscape
|
1648
1835
|
|
1649
1836
|
NOTE: Appium must be running prior to executing this command
|
1650
1837
|
|
1838
|
+
You can ensure that Appium Server is running by including `-p run_appium` in your command line:
|
1651
1839
|
|
1652
|
-
|
1653
|
-
virtual machine on the BrowserStack service:
|
1840
|
+
cucumber -p ipad_pro_12_15_sim -p landscape -p run_appium
|
1654
1841
|
|
1655
|
-
cucumber -p bs_safari_mojave
|
1656
|
-
|
1657
1842
|
|
1658
|
-
The following command specifies that Cucumber will run tests against a remotely hosted
|
1659
|
-
|
1843
|
+
The following command specifies that Cucumber will run tests against a remotely hosted Safari web browser running on a macOS Monterey
|
1844
|
+
virtual machine on the BrowserStack service:
|
1660
1845
|
|
1661
|
-
|
1846
|
+
cucumber -p bs_safari_monterey
|
1662
1847
|
|
1663
1848
|
|
1664
1849
|
|