testcentricity_web 4.1.2 → 4.1.4
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 +4 -4
- data/CHANGELOG.md +16 -1
- data/Gemfile.lock +3 -3
- data/README.md +328 -245
- data/lib/testcentricity_web/appium_server.rb +2 -2
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/webdriver_helper.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee1ff6311bce503168094dbc5546d00419187e6991d67073d590d0cf2dd6beac
|
4
|
+
data.tar.gz: 5a776195eb96437187dae63eb12f9e6c1cfe0580811dbc369dc09ac75d76e300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c05c61753313054175c4d3ae0a36dabe8fd089a2178918e6d796a26806be5af5d6a5020a55658b1951b4d62adfb63725c610afa4c0b4b4612e6e675de015b62
|
7
|
+
data.tar.gz: 279053b4a2323f9089c183bebf286afb6dbb9be22f9bfee0b22264d2810d1ce77e17b33cec22e26d9b1fd6bdd970c41e2cd1cd1c36a11f010fa0d125fd95e80f
|
data/CHANGELOG.md
CHANGED
@@ -2,10 +2,25 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
4
|
|
5
|
+
## [4.1.4] - 09-MAR-2022
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
* `Environ.driver` is now correctly set to `:appium` when target test browser is running on iOS or Android simulators or physical devices.
|
9
|
+
|
10
|
+
|
11
|
+
## [4.1.3] - 08-MAR-2022
|
12
|
+
|
13
|
+
### Fixed
|
14
|
+
* Fixed `AppiumServer.start` so that it no longer times out after failing to start Appium.
|
15
|
+
|
16
|
+
### Updated
|
17
|
+
* Updated docs regarding the `SHUTDOWN_OTHER_SIMS` Environment Variable when testing on iOS Simulators.
|
18
|
+
|
19
|
+
|
5
20
|
## [4.1.2] - 07-MAR-2022
|
6
21
|
|
7
22
|
### Changed
|
8
|
-
* Updated HTML documentation
|
23
|
+
* Updated HTML documentation.
|
9
24
|
|
10
25
|
|
11
26
|
## [4.1.1] - 03-MAR-2022
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
testcentricity_web (4.1.
|
4
|
+
testcentricity_web (4.1.4)
|
5
5
|
appium_lib
|
6
6
|
browserstack-local
|
7
7
|
capybara (>= 3.1, < 4)
|
@@ -50,8 +50,8 @@ GEM
|
|
50
50
|
descendants_tracker (0.0.4)
|
51
51
|
thread_safe (~> 0.3, >= 0.3.1)
|
52
52
|
eventmachine (1.2.7)
|
53
|
-
faker (2.
|
54
|
-
i18n (>= 1.
|
53
|
+
faker (2.20.0)
|
54
|
+
i18n (>= 1.8.11, < 2)
|
55
55
|
faye-websocket (0.11.1)
|
56
56
|
eventmachine (>= 0.12.0)
|
57
57
|
websocket-driver (>= 0.5.1)
|
data/README.md
CHANGED
@@ -4,13 +4,11 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
The TestCentricity™ Web core generic framework for desktop and mobile web browser-based app testing implements a Page Object and Data
|
7
|
-
Object Model DSL for use with Cucumber, Capybara (version 3.x), and Selenium-Webdriver (version 4.x).
|
8
|
-
|
9
|
-
**An example project that demonstrates the implementation of a page object model framework using Cucumber and TestCentricity™ can be found [here](https://github.com/TestCentricity/tc_web_sample).**
|
7
|
+
Object Model DSL for use with Cucumber, Capybara (version 3.x), and Selenium-Webdriver (version 4.x). It also facilitates the configuration
|
8
|
+
of the appropriate Selenium-Webdriver capabilities required to establish a connection with a local or cloud hosted desktop or mobile web browser.
|
10
9
|
|
11
10
|
The TestCentricity™ Web gem supports running automated tests against the following web test targets:
|
12
|
-
* locally hosted desktop browsers (
|
13
|
-
* 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)
|
14
12
|
* locally hosted "headless" Chrome, Firefox, or Edge browsers
|
15
13
|
* remote desktop and emulated mobile web browsers hosted on Selenium Grid 4 and Dockerized Selenium Grid 4 environments
|
16
14
|
* mobile Safari browsers on iOS device simulators or physical iOS devices (using Appium and XCode on OS X)
|
@@ -22,16 +20,20 @@ The TestCentricity™ Web gem supports running automated tests against the follo
|
|
22
20
|
* [LambdaTest](https://www.lambdatest.com/selenium-automation)
|
23
21
|
* web portals utilizing JavaScript front end application frameworks like Ember, React, Angular, and GWT
|
24
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)
|
25
24
|
|
26
25
|
|
27
26
|
## What's New
|
28
27
|
|
29
28
|
A complete history of bug fixes and new features can be found in the {file:CHANGELOG.md CHANGELOG} file.
|
30
29
|
|
30
|
+
An example project that demonstrates the implementation of a page object model framework using Cucumber and TestCentricity™
|
31
|
+
can be found [here](https://github.com/TestCentricity/tc_web_sample).
|
32
|
+
|
31
33
|
|
32
34
|
## Installation
|
33
35
|
|
34
|
-
TestCentricity requires Ruby 2.7 or later. To install the TestCentricity gem, add this line to your automation project's Gemfile:
|
36
|
+
TestCentricity version 4.1 and above requires Ruby 2.7 or later. To install the TestCentricity gem, add this line to your automation project's Gemfile:
|
35
37
|
|
36
38
|
gem 'testcentricity_web'
|
37
39
|
|
@@ -78,7 +80,7 @@ And then execute:
|
|
78
80
|
$ bundle
|
79
81
|
|
80
82
|
|
81
|
-
##
|
83
|
+
## PageObjects
|
82
84
|
|
83
85
|
The **Page Object Model** is a test automation pattern that aims to create an abstraction of your web app's User Interface that can be used
|
84
86
|
in tests. A **Page Object** is an object that represents a single page in your AUT (Application Under Test). **Page Objects** encapsulate the
|
@@ -87,14 +89,14 @@ implementation details of a web page and expose an API that supports interaction
|
|
87
89
|
**Page Objects** makes it easier to maintain automated tests because changes to page UI elements are updated in only one location - in the
|
88
90
|
**Page Object** class definition. By adopting a **Page Object Model**, Cucumber Feature files and step definitions are no longer required to
|
89
91
|
hold specific information about a page's UI objects, thus minimizing maintenance requirements. If any element on, or property of a page changes
|
90
|
-
(URL path, text field attributes, button captions, etc.), maintenance is performed in the
|
92
|
+
(URL path, text field attributes, button captions, etc.), maintenance is performed in the `PageObject` class definition only, typically with
|
91
93
|
no need to update the affected feature file, scenarios, or step definitions.
|
92
94
|
|
93
95
|
|
94
|
-
### Defining a
|
96
|
+
### Defining a PageObject
|
95
97
|
|
96
|
-
Your
|
97
|
-
test automation project. You define new
|
98
|
+
Your `PageObject` class definitions should be contained within individual `.rb` files in the `features/support/pages` folder of your
|
99
|
+
test automation project. You define new `PageObjects` as shown below:
|
98
100
|
|
99
101
|
class LoginPage < TestCentricity::PageObject
|
100
102
|
end
|
@@ -108,14 +110,14 @@ test automation project. You define new **Page Objects** as shown below:
|
|
108
110
|
end
|
109
111
|
|
110
112
|
|
111
|
-
### Adding Traits to your
|
113
|
+
### Adding Traits to your PageObject
|
112
114
|
|
113
115
|
Web pages typically have names and URLs associated with them. Web pages also typically have a unique object or attribute that, when present,
|
114
116
|
indicates that the page's contents have fully loaded.
|
115
117
|
|
116
|
-
The `page_name` trait is registered with the
|
117
|
-
parameter and returns an instance of the associated
|
118
|
-
trait for each
|
118
|
+
The `page_name` trait is registered with the `PageManager` object, which includes a `find_page` method that takes a page name as a
|
119
|
+
parameter and returns an instance of the associated `Page Object`. If you intend to use the `PageManager`, you must define a `page_name`
|
120
|
+
trait for each `PageObject` to be registered.
|
119
121
|
|
120
122
|
The `page_name` trait is usually a `String` value that represents the name of the page that will be matched by the `PageManager.findpage` method.
|
121
123
|
`page_name` traits are case and white-space sensitive. For pages that may be referenced with multiple names, the `page_name` trait may also be
|
@@ -133,36 +135,36 @@ for the `page_locator` trait to exist.
|
|
133
135
|
You define your page's **Traits** as shown below:
|
134
136
|
|
135
137
|
class LoginPage < TestCentricity::PageObject
|
136
|
-
trait(:page_name)
|
137
|
-
trait(:page_url)
|
138
|
-
trait(:page_locator)
|
138
|
+
trait(:page_name) { 'Login' }
|
139
|
+
trait(:page_url) { '/sign_in' }
|
140
|
+
trait(:page_locator) { 'body.login-body' }
|
139
141
|
end
|
140
142
|
|
141
143
|
|
142
144
|
class HomePage < TestCentricity::PageObject
|
143
145
|
# this page may be referred to as 'Home' or 'Dashboard' page so page_name trait is an Array of Strings
|
144
|
-
trait(:page_name)
|
145
|
-
trait(:page_url)
|
146
|
-
trait(:page_locator)
|
146
|
+
trait(:page_name) { ['Home', 'Dashboard'] }
|
147
|
+
trait(:page_url) { '/dashboard' }
|
148
|
+
trait(:page_locator) { 'body.dashboard' }
|
147
149
|
end
|
148
150
|
|
149
151
|
|
150
152
|
class RegistrationPage < TestCentricity::PageObject
|
151
|
-
trait(:page_name)
|
152
|
-
trait(:page_url)
|
153
|
-
trait(:page_locator)
|
153
|
+
trait(:page_name) { 'Registration' }
|
154
|
+
trait(:page_url) { '/register' }
|
155
|
+
trait(:page_locator) { 'body.registration' }
|
154
156
|
end
|
155
157
|
|
156
158
|
|
157
|
-
### Adding UI Elements to your
|
159
|
+
### Adding UI Elements to your PageObject
|
158
160
|
|
159
161
|
Web pages are made up of UI elements like text fields, check boxes, combo boxes, radio buttons, tables, lists, buttons, etc.
|
160
|
-
**UI Elements** are added to your
|
162
|
+
**UI Elements** are added to your `PageObject` class definition as shown below:
|
161
163
|
|
162
164
|
class LoginPage < TestCentricity::PageObject
|
163
|
-
trait(:page_name)
|
164
|
-
trait(:page_url)
|
165
|
-
trait(:page_locator)
|
165
|
+
trait(:page_name) { 'Login' }
|
166
|
+
trait(:page_url) { '/sign_in' }
|
167
|
+
trait(:page_locator) { 'body.login-body' }
|
166
168
|
|
167
169
|
# Login page UI elements
|
168
170
|
textfield :user_id_field, 'input#userName'
|
@@ -174,9 +176,9 @@ Web pages are made up of UI elements like text fields, check boxes, combo boxes,
|
|
174
176
|
|
175
177
|
|
176
178
|
class RegistrationPage < TestCentricity::PageObject
|
177
|
-
trait(:page_name)
|
178
|
-
trait(:page_url)
|
179
|
-
trait(:page_locator)
|
179
|
+
trait(:page_name) { 'Registration' }
|
180
|
+
trait(:page_url) { '/register' }
|
181
|
+
trait(:page_locator) { 'body.registration' }
|
180
182
|
|
181
183
|
# Registration page UI elements
|
182
184
|
textfields first_name_field: 'input#firstName',
|
@@ -196,16 +198,16 @@ Web pages are made up of UI elements like text fields, check boxes, combo boxes,
|
|
196
198
|
end
|
197
199
|
|
198
200
|
|
199
|
-
### Adding Methods to your
|
201
|
+
### Adding Methods to your PageObject
|
200
202
|
|
201
|
-
It is good practice for your Cucumber step definitions to call high level methods in your your
|
202
|
-
and interacting with a page object's UI elements. You can add high level methods to your
|
203
|
+
It is good practice for your Cucumber step definitions to call high level methods in your your `PageObject` instead of directly accessing
|
204
|
+
and interacting with a page object's UI elements. You can add high level methods to your `PageObject` class definition for interacting with
|
203
205
|
the UI to hide implementation details, as shown below:
|
204
206
|
|
205
207
|
class LoginPage < TestCentricity::PageObject
|
206
|
-
trait(:page_name)
|
207
|
-
trait(:page_url)
|
208
|
-
trait(:page_locator)
|
208
|
+
trait(:page_name) { 'Login' }
|
209
|
+
trait(:page_url) { '/sign_in' }
|
210
|
+
trait(:page_locator) { 'body.login-body' }
|
209
211
|
|
210
212
|
# Login page UI elements
|
211
213
|
textfield :user_id_field, 'input#userName'
|
@@ -232,9 +234,9 @@ the UI to hide implementation details, as shown below:
|
|
232
234
|
ui = {
|
233
235
|
self => { title: 'Login' },
|
234
236
|
login_button => { visible: true, caption: 'LOGIN' },
|
235
|
-
user_id_field => { visible: true, enabled: true },
|
237
|
+
user_id_field => { visible: true, enabled: true, value: '', placeholder: 'User name' },
|
236
238
|
password_field => { visible: true, enabled: true, value: '', placeholder: 'Password' },
|
237
|
-
remember_checkbox => { :
|
239
|
+
remember_checkbox => { exists: true, enabled: true, checked: false },
|
238
240
|
forgot_password_link => { visible: true, caption: 'Forgot your password?' },
|
239
241
|
error_message_label => { visible: false }
|
240
242
|
}
|
@@ -244,9 +246,9 @@ the UI to hide implementation details, as shown below:
|
|
244
246
|
|
245
247
|
|
246
248
|
class RegistrationPage < TestCentricity::PageObject
|
247
|
-
trait(:page_name)
|
248
|
-
trait(:page_url)
|
249
|
-
trait(:page_locator)
|
249
|
+
trait(:page_name) { 'Registration' }
|
250
|
+
trait(:page_url) { '/register' }
|
251
|
+
trait(:page_locator) { 'body.registration' }
|
250
252
|
|
251
253
|
# Registration page UI elements
|
252
254
|
textfields first_name_field: 'input#firstName',
|
@@ -278,7 +280,8 @@ the UI to hide implementation details, as shown below:
|
|
278
280
|
state_select => profile.state,
|
279
281
|
post_code_field => profile.postal_code,
|
280
282
|
password_field => profile.password,
|
281
|
-
pword_confirm_field => profile.confirm_password
|
283
|
+
pword_confirm_field => profile.confirm_password,
|
284
|
+
email_opt_in_check => profile.email_opt_in
|
282
285
|
}
|
283
286
|
populate_data_fields(fields)
|
284
287
|
sign_up_button.click
|
@@ -287,59 +290,59 @@ the UI to hide implementation details, as shown below:
|
|
287
290
|
|
288
291
|
|
289
292
|
|
290
|
-
Once your
|
293
|
+
Once your `PageObjects` have been instantiated, you can call your methods as shown below:
|
291
294
|
|
292
295
|
login_page.remember_me(true)
|
293
296
|
login_page.login('snicklefritz', 'Pa55w0rd')
|
294
297
|
|
295
298
|
|
296
299
|
|
297
|
-
##
|
300
|
+
## PageSections
|
298
301
|
|
299
|
-
A
|
302
|
+
A `PageSection` is a collection of **UI Elements** that may appear in multiple locations on a page, or on multiple pages in a web
|
300
303
|
app. It is a collection of **UI Elements** that represent a conceptual area of functionality, like a navigation bar, a search capability,
|
301
|
-
or a menu. **UI Elements** and functional behavior are confined to the scope of a
|
304
|
+
or a menu. **UI Elements** and functional behavior are confined to the scope of a `PageSection` object.
|
302
305
|
|
303
|
-
|
306
|
+
<img src="https://i.imgur.com/BTgi59R.jpg" alt="Navigation Header" title="Navigation Header">
|
304
307
|
|
305
|
-
|
308
|
+
<img src="https://i.imgur.com/dkxloE5.jpg" alt="Navigation Header" title="Navigation Header">
|
306
309
|
|
307
|
-
|
310
|
+
<img src="https://i.imgur.com/Yqgw4sP.jpg" alt="User Profile Popup" title="User Profile Popup">
|
308
311
|
|
309
312
|
|
310
|
-
A
|
313
|
+
A `PageSection` may contain other `PageSection` objects.
|
311
314
|
|
312
315
|
|
313
|
-
### Defining a PageSection
|
316
|
+
### Defining a PageSection
|
314
317
|
|
315
|
-
Your
|
316
|
-
your test automation project. You define new
|
318
|
+
Your `PageSection` class definitions should be contained within individual `.rb` files in the `features/support/sections` folder of
|
319
|
+
your test automation project. You define new `PageSection` as shown below:
|
317
320
|
|
318
321
|
class SearchForm < TestCentricity::PageSection
|
319
322
|
end
|
320
323
|
|
321
324
|
|
322
|
-
### Adding Traits to a PageSection
|
325
|
+
### Adding Traits to a PageSection
|
323
326
|
|
324
|
-
A
|
327
|
+
A `PageSection` typically has a root node object that encapsulates a collection of `UIElements`. The `section_locator` trait
|
325
328
|
specifies the CSS or Xpath expression that uniquely identifies that root node object.
|
326
329
|
|
327
|
-
You define your
|
330
|
+
You define your section's **Traits** as shown below:
|
328
331
|
|
329
332
|
class SearchForm < TestCentricity::PageSection
|
330
|
-
trait(:section_locator)
|
331
|
-
trait(:section_name)
|
333
|
+
trait(:section_locator) { 'form#gnav-search' }
|
334
|
+
trait(:section_name) { 'Search widget' }
|
332
335
|
end
|
333
336
|
|
334
337
|
|
335
|
-
### Adding UI Elements to your PageSection
|
338
|
+
### Adding UI Elements to your PageSection
|
336
339
|
|
337
|
-
|
338
|
-
**UI Elements** are added to your
|
340
|
+
`PageSections` are typically made up of UI elements like text fields, check boxes, combo boxes, radio buttons, tables, lists, buttons, etc.
|
341
|
+
**UI Elements** are added to your `PageSection` class definition as shown below:
|
339
342
|
|
340
343
|
class SearchForm < TestCentricity::PageSection
|
341
|
-
trait(:section_locator)
|
342
|
-
trait(:section_name)
|
344
|
+
trait(:section_locator) { 'form#gnav-search' }
|
345
|
+
trait(:section_name) { 'Search widget' }
|
343
346
|
|
344
347
|
# Search Form UI elements
|
345
348
|
textfield :search_field, 'input#search-query'
|
@@ -347,13 +350,13 @@ Page sections are typically made up of UI elements like text fields, check boxes
|
|
347
350
|
end
|
348
351
|
|
349
352
|
|
350
|
-
### Adding Methods to your PageSection
|
353
|
+
### Adding Methods to your PageSection
|
351
354
|
|
352
|
-
You can add high level methods to your
|
355
|
+
You can add high level methods to your `PageSection` class definition, as shown below:
|
353
356
|
|
354
357
|
class SearchForm < TestCentricity::PageSection
|
355
|
-
trait(:section_locator)
|
356
|
-
trait(:section_name)
|
358
|
+
trait(:section_locator) { 'form#gnav-search' }
|
359
|
+
trait(:section_name) { 'Search widget' }
|
357
360
|
|
358
361
|
# Search Form UI elements
|
359
362
|
textfield :search_field, 'input#search-query'
|
@@ -366,48 +369,48 @@ You can add high level methods to your **PageSection** class definition, as show
|
|
366
369
|
end
|
367
370
|
|
368
371
|
|
369
|
-
### Adding
|
372
|
+
### Adding PageSections to your PageObject
|
370
373
|
|
371
|
-
You add a
|
374
|
+
You add a `PageSection` to its associated `PageObject` as shown below:
|
372
375
|
|
373
376
|
class HomePage < TestCentricity::PageObject
|
374
|
-
trait(:page_name)
|
375
|
-
trait(:page_url)
|
376
|
-
trait(:page_locator)
|
377
|
+
trait(:page_name) { 'Home' }
|
378
|
+
trait(:page_url) { '/dashboard' }
|
379
|
+
trait(:page_locator) { 'body.dashboard' }
|
377
380
|
|
378
381
|
# Home page Section Objects
|
379
382
|
section :search_form, SearchForm
|
380
383
|
end
|
381
384
|
|
382
|
-
Once your
|
385
|
+
Once your `PageObject` has been instantiated, you can call its `PageSection` methods as shown below:
|
383
386
|
|
384
387
|
home_page.search_form.search_for('ocarina')
|
385
388
|
|
386
389
|
|
387
390
|
|
388
|
-
##
|
391
|
+
## UIElements
|
389
392
|
|
390
|
-
|
391
|
-
tables, lists, buttons, images, HTML5 video objects, HTML5 audio objects, etc. **UI Elements** are declared
|
392
|
-
definition of the
|
393
|
-
the
|
393
|
+
`PageObjects` and `PageSections` are typically made up of **UI Element** like text fields, check boxes, select lists (combo boxes),
|
394
|
+
radio buttons, tables, ordered and unordered lists, buttons, images, HTML5 video objects, HTML5 audio objects, etc. **UI Elements** are declared
|
395
|
+
and instantiated within the class definition of the `PageObject` or `PageSection` in which they are contained. With TestCentricity Web,
|
396
|
+
all UI elements are based on the `UIElement` class.
|
394
397
|
|
395
398
|
|
396
|
-
### Declaring and Instantiating
|
399
|
+
### Declaring and Instantiating UIElements
|
397
400
|
|
398
|
-
Single
|
401
|
+
Single `UIElement` declarations have the following format:
|
399
402
|
|
400
403
|
elementType :element Name, locator
|
401
404
|
|
402
|
-
* The `element name` is the unique name that you will use to refer to the UI element and is specified as a
|
403
|
-
* The `locator` is the CSS or XPath attribute that uniquely and unambiguously identifies the
|
405
|
+
* The `element name` is the unique name that you will use to refer to the UI element and is specified as a `Symbol`.
|
406
|
+
* The `locator` is the CSS or XPath attribute that uniquely and unambiguously identifies the `UIElement`.
|
404
407
|
|
405
|
-
Multiple
|
408
|
+
Multiple `UIElement` declarations for a collection of elements of the same type can be performed by passing a hash table containing the
|
406
409
|
names and locators of each individual element.
|
407
410
|
|
408
|
-
### Example
|
411
|
+
### Example UIElement Declarations
|
409
412
|
|
410
|
-
Supported
|
413
|
+
Supported `UIElement` elementTypes and their declarations have the following format:
|
411
414
|
|
412
415
|
*Single element declarations:*
|
413
416
|
|
@@ -469,14 +472,14 @@ Supported **UI Element** elementTypes and their declarations have the following
|
|
469
472
|
end
|
470
473
|
|
471
474
|
|
472
|
-
Refer to the Class List documentation for the
|
473
|
-
and instantiating
|
475
|
+
Refer to the Class List documentation for the `PageObject` and `PageSection` classes for details on the class methods used for declaring
|
476
|
+
and instantiating `UIElements`. Examples of UI element declarations can be found in the ***Adding UI Elements to your Page Object*** and
|
474
477
|
***Adding UI Elements to your PageSection Object*** sections above.
|
475
478
|
|
476
479
|
|
477
480
|
### UIElement Inherited Methods
|
478
481
|
|
479
|
-
With TestCentricity, all UI elements are based on the
|
482
|
+
With TestCentricity, all UI elements are based on the `UIElement` class, and inherit the following methods:
|
480
483
|
|
481
484
|
**Action methods:**
|
482
485
|
|
@@ -600,7 +603,7 @@ for each `UIElement` that requires verification. Depending on the complexity and
|
|
600
603
|
verify the presence of `UIElements` and their correct states can become cumbersome.
|
601
604
|
|
602
605
|
The `PageObject.verify_ui_states` and `PageSection.verify_ui_states` methods support the verification of multiple properties of multiple
|
603
|
-
UI elements on a
|
606
|
+
UI elements on a `PageObject` or `PageSection`. The `verify_ui_states` method accepts a hash containing key/hash pairs of UI
|
604
607
|
elements and their properties or attributes to be verified.
|
605
608
|
|
606
609
|
ui = {
|
@@ -699,6 +702,8 @@ The `verify_ui_states` method supports the following property/state pairs:
|
|
699
702
|
:preload String
|
700
703
|
:poster String
|
701
704
|
|
705
|
+
#### ARIA accessibility property/state pairs
|
706
|
+
|
702
707
|
The `verify_ui_states` method supports the following ARIA accessibility property/state pairs:
|
703
708
|
|
704
709
|
**All Objects:**
|
@@ -734,11 +739,12 @@ The `verify_ui_states` method supports the following ARIA accessibility property
|
|
734
739
|
:aria_multiselectable Boolean
|
735
740
|
:content_editable Boolean
|
736
741
|
|
742
|
+
#### Comparison States
|
737
743
|
The `verify_ui_states` method supports comparison states using property/comparison state pairs:
|
738
744
|
|
739
745
|
object => { property: { comparison_state: value } }
|
740
746
|
|
741
|
-
|
747
|
+
Comparison States:
|
742
748
|
|
743
749
|
:lt or :less_than Integer or String
|
744
750
|
:lt_eq or :less_than_or_equal Integer or String
|
@@ -773,19 +779,19 @@ values appear in the associated text fields after entering data and performing a
|
|
773
779
|
end
|
774
780
|
|
775
781
|
|
776
|
-
|
782
|
+
#### I18n Translation Validation
|
777
783
|
|
778
784
|
The `verify_ui_states` method also supports I18n string translations using property/I18n key name pairs:
|
779
785
|
|
780
|
-
object => { property: { translate_key:
|
786
|
+
object => { property: { translate_key: 'name of key in I18n compatible .yml file' } }
|
781
787
|
|
782
788
|
**I18n Translation Keys:**
|
783
789
|
|
784
|
-
:translate String
|
785
|
-
:translate_upcase String
|
786
|
-
:translate_downcase String
|
787
|
-
:translate_capitalize String
|
788
|
-
translate_titlecase
|
790
|
+
:translate String
|
791
|
+
:translate_upcase String
|
792
|
+
:translate_downcase String
|
793
|
+
:translate_capitalize String
|
794
|
+
:translate_titlecase String
|
789
795
|
|
790
796
|
The example below depicts the usage of the `verify_ui_states` method to verify that the captions for menu items are correctly
|
791
797
|
translated.
|
@@ -804,27 +810,46 @@ translated.
|
|
804
810
|
verify_ui_states(ui)
|
805
811
|
end
|
806
812
|
|
807
|
-
|
808
|
-
|
813
|
+
Each supported language/locale combination has a corresponding `.yml` file. I18n `.yml` file naming convention uses
|
814
|
+
[ISO-639 language codes and ISO-3166 country codes](https://docs.oracle.com/cd/E13214_01/wli/docs92/xref/xqisocodes.html). For example:
|
809
815
|
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
816
|
+
| Language (Country) | File name |
|
817
|
+
|-----------------------|-----------|
|
818
|
+
| English | en.yml |
|
819
|
+
| English (Canada) | en-CA.yml |
|
820
|
+
| French (Canada) | fr-CA.yml |
|
821
|
+
| French | fr.yml |
|
822
|
+
| Spanish | es.yml |
|
823
|
+
| German | de.yml |
|
824
|
+
| Portuguese (Brazil) | pt-BR.yml |
|
825
|
+
| Portuguese (Portugal) | pt-PT.yml |
|
818
826
|
|
819
827
|
I18n `.yml` files contain key/value pairs representing the name of a translated string (key) and the string value.
|
820
828
|
|
829
|
+
Baseline translation strings are stored in `.yml` files in the `config/locales/` folder.
|
830
|
+
|
831
|
+
my_automation_project
|
832
|
+
├── config
|
833
|
+
│ ├── locales
|
834
|
+
│ │ ├── en.yml
|
835
|
+
│ │ ├── es.yml
|
836
|
+
│ │ ├── fr.yml
|
837
|
+
│ │ ├── fr-CA.yml
|
838
|
+
│ │ └── en-AU.yml
|
839
|
+
│ ├── test_data
|
840
|
+
│ └── cucumber.yml
|
841
|
+
├── downloads
|
842
|
+
├── features
|
843
|
+
├── Gemfile
|
844
|
+
└── README.md
|
845
|
+
|
821
846
|
|
822
847
|
|
823
|
-
## Instantiating your
|
848
|
+
## Instantiating your PageObjects
|
824
849
|
|
825
|
-
Before you can call the methods in your
|
826
|
-
|
827
|
-
There are several ways to instantiate your
|
850
|
+
Before you can call the methods in your `PageObjects` and `PageSections`, you must instantiate the `PageObjects` of your web
|
851
|
+
application, as well as create instance variables which can be used when calling a `PageObject`'s methods from your step definitions.
|
852
|
+
There are several ways to instantiate your `PageObjects`.
|
828
853
|
|
829
854
|
One common implementation is shown below:
|
830
855
|
|
@@ -851,14 +876,14 @@ One common implementation is shown below:
|
|
851
876
|
The `WorldPages` module above can be defined in your `env.rb` file, or you can define it in a separate `world_pages.rb` file in the
|
852
877
|
`features/support` folder.
|
853
878
|
|
854
|
-
While this approach is effective for small web applications with only a few pages (and hence few
|
855
|
-
cumbersome to manage if your web application has dozens of
|
879
|
+
While this approach is effective for small web applications with only a few pages (and hence few `PageObjects`), it quickly becomes
|
880
|
+
cumbersome to manage if your web application has dozens of `PageObjects` that need to be instantiated and managed.
|
856
881
|
|
857
882
|
### Using the PageManager
|
858
883
|
|
859
|
-
The
|
860
|
-
the `page_objects` method contains a hash table of your
|
861
|
-
|
884
|
+
The `PageManager` class provides methods for supporting the instantiation and management of `PageObjects`. In the code example below,
|
885
|
+
the `page_objects` method contains a hash table of your `PageObject` instances and their associated `PageObject` class names to be
|
886
|
+
instantiated by `PageManager`:
|
862
887
|
|
863
888
|
module WorldPages
|
864
889
|
def page_objects
|
@@ -888,13 +913,13 @@ to be instantiated by **PageManager**:
|
|
888
913
|
|
889
914
|
The `WorldPages` module above should be defined in the `world_pages.rb` file in the `features/support` folder.
|
890
915
|
|
891
|
-
Include the code below in your `env.rb` file to ensure that your
|
916
|
+
Include the code below in your `env.rb` file to ensure that your `PageObjects` are instantiated before your Cucumber scenarios are
|
892
917
|
executed:
|
893
918
|
|
894
919
|
include WorldPages
|
895
920
|
WorldPages.instantiate_page_objects
|
896
921
|
|
897
|
-
**NOTE:** If you intend to use the
|
922
|
+
**NOTE:** If you intend to use the `PageManager`, you must define a `page_name` trait for each of the `PageObjects` to be registered.
|
898
923
|
|
899
924
|
|
900
925
|
### Leveraging the PageManager in your Cucumber tests
|
@@ -956,14 +981,13 @@ In the above example, the step definitions associated with the 3 steps might be
|
|
956
981
|
end
|
957
982
|
|
958
983
|
|
984
|
+
While this approach may be effective for small web applications with only a few pages (and hence few `PageObjects`), it quickly becomes
|
985
|
+
cumbersome to manage if your web application has dozens of `PageObjects` that need to be managed.
|
959
986
|
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
The **PageManager** class provides a `find_page` method that replaces the cumbersome and difficult to maintain `case` statement used in the
|
964
|
-
above example. The **PageManager** `current_page` method allows you to set or get an instance of the currently active Page Object.
|
987
|
+
The `PageManager` class provides a `find_page` method that replaces the cumbersome and difficult to maintain `case` statement used in the
|
988
|
+
above example. The `PageManager.current_page` method allows you to set or get an instance of the currently active Page Object.
|
965
989
|
|
966
|
-
To use these
|
990
|
+
To use these `PageManager` methods, include the step definitions and code below in a `page_steps.rb` or `generic_steps.rb` file in the
|
967
991
|
`features/step_definitions` folder:
|
968
992
|
|
969
993
|
include TestCentricity
|
@@ -1017,7 +1041,7 @@ values from the table below:
|
|
1017
1041
|
| `safari` | OS X only |
|
1018
1042
|
| `ie` | Windows only (IE version 10.x or greater only) |
|
1019
1043
|
|
1020
|
-
Refer to **section 8.
|
1044
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1021
1045
|
|
1022
1046
|
|
1023
1047
|
#### Setting desktop browser window size
|
@@ -1033,16 +1057,13 @@ To maximize a desktop browser window, you set the `BROWSER_SIZE` Environment Var
|
|
1033
1057
|
|
1034
1058
|
#### Testing file downloads with desktop browsers
|
1035
1059
|
|
1036
|
-
File download functionality can be tested with locally hosted instances of Chrome or Firefox desktop browsers. Your automation project must include
|
1060
|
+
File download functionality can be tested with locally hosted instances of Chrome, Edge, or Firefox desktop browsers. Your automation project must include
|
1037
1061
|
a `/downloads` folder at the same level as the `/config` and `/features` folders, as depicted below:
|
1038
1062
|
|
1039
1063
|
my_automation_project
|
1040
1064
|
├── config
|
1041
|
-
│ └── test_data
|
1042
1065
|
├── downloads
|
1043
1066
|
├── features
|
1044
|
-
│ ├── step_definitions
|
1045
|
-
│ └── support
|
1046
1067
|
├── Gemfile
|
1047
1068
|
└── README.md
|
1048
1069
|
|
@@ -1053,15 +1074,12 @@ test thread. This is to ensure that files downloaded in each test thread are iso
|
|
1053
1074
|
|
1054
1075
|
my_automation_project
|
1055
1076
|
├── config
|
1056
|
-
│ └── test_data
|
1057
1077
|
├── downloads
|
1058
1078
|
│ ├── 1
|
1059
1079
|
│ ├── 2
|
1060
1080
|
│ ├── 3
|
1061
1081
|
│ └── 4
|
1062
1082
|
├── features
|
1063
|
-
│ ├── step_definitions
|
1064
|
-
│ └── support
|
1065
1083
|
├── Gemfile
|
1066
1084
|
└── README.md
|
1067
1085
|
|
@@ -1138,7 +1156,7 @@ To change the emulated device's screen orientation from the default setting, set
|
|
1138
1156
|
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
|
1139
1157
|
to `chrome`.
|
1140
1158
|
|
1141
|
-
Refer to **section 8.
|
1159
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1142
1160
|
|
1143
1161
|
|
1144
1162
|
#### User defined mobile device profiles
|
@@ -1156,8 +1174,6 @@ of the Chrome desktop browser. The user specified device profiles must be locate
|
|
1156
1174
|
│ └── cucumber.yml
|
1157
1175
|
├── downloads
|
1158
1176
|
├── features
|
1159
|
-
│ ├── step_definitions
|
1160
|
-
│ └── support
|
1161
1177
|
├── Gemfile
|
1162
1178
|
└── README.md
|
1163
1179
|
|
@@ -1183,10 +1199,12 @@ For remote desktop and emulated mobile web browsers running on Selenium Grid 4 o
|
|
1183
1199
|
| `SELENIUM` | Must be set to `remote` |
|
1184
1200
|
| `REMOTE_ENDPOINT` | Must be set to the URL of the Grid hub, which is usually `http://localhost:4444/wd/hub` |
|
1185
1201
|
|
1186
|
-
Refer to **section 8.
|
1202
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1187
1203
|
|
1188
1204
|
|
1189
|
-
### Mobile
|
1205
|
+
### Mobile browsers on Simulators or Physical Devices
|
1206
|
+
|
1207
|
+
#### Mobile Safari browser on iOS Simulators or iOS Physical Devices
|
1190
1208
|
|
1191
1209
|
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
|
1192
1210
|
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
|
@@ -1197,34 +1215,38 @@ The Appium server must be running prior to invoking Cucumber to run your feature
|
|
1197
1215
|
|
1198
1216
|
Once your test environment is properly configured, the following **Environment Variables** must be set as described in the table below.
|
1199
1217
|
|
1200
|
-
| **Environment Variable** | **Description**
|
1201
|
-
|
1202
|
-
| `WEB_BROWSER` | Must be set to `appium`
|
1203
|
-
| `APP_PLATFORM_NAME` | Must be set to `iOS`
|
1204
|
-
| `APP_BROWSER` | Must be set to `Safari`
|
1205
|
-
| `APP_VERSION` | Must be set to `
|
1206
|
-
| `APP_DEVICE` | Set to iOS device name supported by the iOS Simulator (`iPhone
|
1207
|
-
| `DEVICE_TYPE` | Must be set to `phone` or `tablet`
|
1208
|
-
| `APP_UDID` | UDID of physically connected iOS device (not used for simulators)
|
1209
|
-
| `TEAM_ID` | unique 10-character Apple developer team identifier string (not used for simulators)
|
1210
|
-
| `TEAM_NAME` | String representing a signing certificate (not used for simulators)
|
1211
|
-
| `APP_ALLOW_POPUPS` | [Optional] Allow javascript to open new windows in Safari. Set to `true` or `false`
|
1212
|
-
| `APP_IGNORE_FRAUD_WARNING` | [Optional] Prevent Safari from showing a fraudulent website warning. Set to `true` or `false`
|
1213
|
-
| `APP_NO_RESET` | [Optional] Don't reset app state after each test. Set to `true` or `false`
|
1214
|
-
| `APP_FULL_RESET` | [Optional] Perform a complete reset. Set to `true` or `false`
|
1215
|
-
| `APP_INITIAL_URL` | [Optional] Initial URL, default is a local welcome page. e.g. `http://www.apple.com`
|
1216
|
-
| `WDA_LOCAL_PORT` | [Optional] Used to forward traffic from Mac host to real iOS devices over USB. Default value is same as port number used by WDA on device.
|
1217
|
-
| `LOCALE` | [Optional] Locale to set for the simulator. e.g. `fr_CA`
|
1218
|
-
| `LANGUAGE` | [Optional] Language to set for the simulator. e.g. `fr`
|
1219
|
-
| `ORIENTATION` | [Optional] Set to `portrait` or `landscape` (only for iOS simulators)
|
1220
|
-
| `NEW_COMMAND_TIMEOUT` | [Optional] Time (in Seconds) that Appium will wait for a new command from the client
|
1221
|
-
| `SHOW_SIM_KEYBOARD` | [Optional] Show the simulator keyboard during text entry. Set to `true` or `false`
|
1222
|
-
| `SHUTDOWN_OTHER_SIMS` | [Optional] Close any other running simulators. Set to `true` or `false
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1218
|
+
| **Environment Variable** | **Description** |
|
1219
|
+
|----------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
1220
|
+
| `WEB_BROWSER` | Must be set to `appium` |
|
1221
|
+
| `APP_PLATFORM_NAME` | Must be set to `iOS` |
|
1222
|
+
| `APP_BROWSER` | Must be set to `Safari` |
|
1223
|
+
| `APP_VERSION` | Must be set to `15.2`, `14.5`, or which ever iOS version you wish to run within the XCode Simulator |
|
1224
|
+
| `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 |
|
1225
|
+
| `DEVICE_TYPE` | Must be set to `phone` or `tablet` |
|
1226
|
+
| `APP_UDID` | UDID of physically connected iOS device (not used for simulators) |
|
1227
|
+
| `TEAM_ID` | unique 10-character Apple developer team identifier string (not used for simulators) |
|
1228
|
+
| `TEAM_NAME` | String representing a signing certificate (not used for simulators) |
|
1229
|
+
| `APP_ALLOW_POPUPS` | [Optional] Allow javascript to open new windows in Safari. Set to `true` or `false` |
|
1230
|
+
| `APP_IGNORE_FRAUD_WARNING` | [Optional] Prevent Safari from showing a fraudulent website warning. Set to `true` or `false` |
|
1231
|
+
| `APP_NO_RESET` | [Optional] Don't reset app state after each test. Set to `true` or `false` |
|
1232
|
+
| `APP_FULL_RESET` | [Optional] Perform a complete reset. Set to `true` or `false` |
|
1233
|
+
| `APP_INITIAL_URL` | [Optional] Initial URL, default is a local welcome page. e.g. `http://www.apple.com` |
|
1234
|
+
| `WDA_LOCAL_PORT` | [Optional] Used to forward traffic from Mac host to real iOS devices over USB. Default value is same as port number used by WDA on device. |
|
1235
|
+
| `LOCALE` | [Optional] Locale to set for the simulator. e.g. `fr_CA` |
|
1236
|
+
| `LANGUAGE` | [Optional] Language to set for the simulator. e.g. `fr` |
|
1237
|
+
| `ORIENTATION` | [Optional] Set to `portrait` or `landscape` (only for iOS simulators) |
|
1238
|
+
| `NEW_COMMAND_TIMEOUT` | [Optional] Time (in Seconds) that Appium will wait for a new command from the client |
|
1239
|
+
| `SHOW_SIM_KEYBOARD` | [Optional] Show the simulator keyboard during text entry. Set to `true` or `false` |
|
1240
|
+
| `SHUTDOWN_OTHER_SIMS` | [Optional] Close any other running simulators. Set to `true` or `false`. See note below. |
|
1241
|
+
|
1242
|
+
The `SHUTDOWN_OTHER_SIMS` environment variable can only be set if you are running Appium Server with the `--relaxed-security` or
|
1243
|
+
`--allow-insecure=shutdown_other_sims` arguments passed when starting it from the command line, or when running the server from the
|
1244
|
+
Appium Server GUI app. A security violation error will occur without relaxed security enabled.
|
1245
|
+
|
1246
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1247
|
+
|
1248
|
+
|
1249
|
+
#### Mobile Chrome or Android browsers on Android Studio Virtual Device emulators
|
1228
1250
|
|
1229
1251
|
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
|
1230
1252
|
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)
|
@@ -1241,7 +1263,7 @@ Once your test environment is properly configured, the following **Environment V
|
|
1241
1263
|
| `WEB_BROWSER` | Must be set to `appium` |
|
1242
1264
|
| `APP_PLATFORM_NAME` | Must be set to `Android` |
|
1243
1265
|
| `APP_BROWSER` | Must be set to `Chrome` or `Browser` |
|
1244
|
-
| `APP_VERSION` | Must be set to `
|
1266
|
+
| `APP_VERSION` | Must be set to `12.0`, or which ever Android OS version you wish to run with the Android Virtual Device |
|
1245
1267
|
| `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 |
|
1246
1268
|
| `DEVICE_TYPE` | Must be set to `phone` or `tablet` |
|
1247
1269
|
| `ORIENTATION` | [Optional] Set to `portrait` or `landscape` |
|
@@ -1253,16 +1275,47 @@ Once your test environment is properly configured, the following **Environment V
|
|
1253
1275
|
| `NEW_COMMAND_TIMEOUT` | [Optional] Time (in Seconds) that Appium will wait for a new command from the client |
|
1254
1276
|
| `CHROMEDRIVER_EXECUTABLE` | [Optional] Absolute local path to webdriver executable |
|
1255
1277
|
|
1256
|
-
Refer to **section 8.
|
1278
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1279
|
+
|
1257
1280
|
|
1281
|
+
#### Starting and stopping Appium Server
|
1258
1282
|
|
1259
|
-
|
1283
|
+
The Appium server must be running prior to invoking Cucumber to run your features/scenarios on mobile simulators or physical
|
1284
|
+
device. To programmatically control the starting and stopping of Appium server with the execution of your automated tests, place
|
1285
|
+
the code shown below in your `hooks.rb` file.
|
1286
|
+
|
1287
|
+
BeforeAll do
|
1288
|
+
# start Appium Server if APPIUM_SERVER = 'run' and target browser is a mobile simulator or device
|
1289
|
+
if ENV['APPIUM_SERVER'] == 'run' && Environ.driver == :appium
|
1290
|
+
$server = TestCentricity::AppiumServer.new
|
1291
|
+
$server.start
|
1292
|
+
end
|
1293
|
+
end
|
1294
|
+
|
1295
|
+
AfterAll do
|
1296
|
+
# terminate Appium Server if APPIUM_SERVER = 'run' and target browser is a mobile simulator or device
|
1297
|
+
$server.stop if ENV['APPIUM_SERVER'] == 'run' && Environ.driver == :appium && $server.running?
|
1298
|
+
# close driver
|
1299
|
+
Capybara.page.driver.quit
|
1300
|
+
Capybara.reset_sessions!
|
1301
|
+
Environ.session_state = :quit
|
1302
|
+
end
|
1260
1303
|
|
1261
|
-
|
1304
|
+
|
1305
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1306
|
+
|
1307
|
+
|
1308
|
+
### Remote cloud hosted desktop and mobile web browsers
|
1309
|
+
|
1310
|
+
You can run your automated tests against remote cloud hosted desktop and mobile web browsers using the BrowserStack, SauceLabs, TestingBot, or
|
1262
1311
|
LambdaTest services. If your tests are running against a web site hosted on your local computer (`localhost`), or on a staging server inside
|
1263
1312
|
your LAN, you must set the `TUNNELING` Environment Variable to `true`.
|
1264
1313
|
|
1265
|
-
|
1314
|
+
Due to lack of support for Selenium 4.x and the W3C browser capabilities protocol, support for CrossBrowserTesting and Gridlastic cloud hosted
|
1315
|
+
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
|
1316
|
+
Selenium version 3.x, you should use earlier versions of this gem.
|
1317
|
+
|
1318
|
+
Refer to **section 8.6 (Using Browser specific Profiles in cucumber.yml)** below.
|
1266
1319
|
|
1267
1320
|
|
1268
1321
|
#### Remote desktop browsers on the BrowserStack service
|
@@ -1271,24 +1324,24 @@ For remotely hosted desktop web browsers on the BrowserStack service, the follow
|
|
1271
1324
|
the table below. Refer to the [Browserstack-specific capabilities chart page](https://www.browserstack.com/automate/capabilities?tag=selenium-4)
|
1272
1325
|
for information regarding the specific capabilities.
|
1273
1326
|
|
1274
|
-
| **Environment Variable** | **Description**
|
1275
|
-
|
1276
|
-
| `WEB_BROWSER` | Must be set to `browserstack`
|
1277
|
-
| `BS_USERNAME` | Must be set to your BrowserStack account user name
|
1278
|
-
| `BS_AUTHKEY` | Must be set to your BrowserStack account access key
|
1279
|
-
| `BS_OS` | Must be set to `OS X` or `Windows`
|
1280
|
-
| `BS_OS_VERSION` | Refer to `os_version` capability in chart
|
1281
|
-
| `BS_BROWSER` | Refer to `
|
1282
|
-
| `BS_VERSION` | [Optional] Refer to `browser_version` capability in chart. If not specified, latest stable version of browser will be used.
|
1283
|
-
| `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. |
|
1284
|
-
| `RESOLUTION` | [Optional] Refer to supported screen `resolution` capability in chart
|
1285
|
-
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`)
|
1286
|
-
| `TIME_ZONE` | [Optional] Specify custom time zone. Refer to `browserstack.timezone` capability in chart
|
1287
|
-
| `IP_GEOLOCATION` | [Optional] Specify IP Geolocation. Refer to [IP Geolocation](https://www.browserstack.com/ip-geolocation) to select a country code.
|
1288
|
-
| `ALLOW_POPUPS` | [Optional] Allow popups (`true` or `false`) - for Safari, IE, and Edge browsers only
|
1289
|
-
| `ALLOW_COOKIES` | [Optional] Allow all cookies (`true` or `false`) - for Safari browsers only
|
1290
|
-
| `SCREENSHOTS` | [Optional] Generate screenshots for debugging (`true` or `false`)
|
1291
|
-
| `NETWORK_LOGS` | [Optional] Capture network logs (`true` or `false`)
|
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 `OS X` or `Windows` |
|
1333
|
+
| `BS_OS_VERSION` | Refer to `os_version` capability in chart |
|
1334
|
+
| `BS_BROWSER` | Refer to `browserName` capability in chart |
|
1335
|
+
| `BS_VERSION` | [Optional] Refer to `browser_version` capability in chart. If not specified, latest stable version of browser will be used. |
|
1336
|
+
| `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. |
|
1337
|
+
| `RESOLUTION` | [Optional] Refer to supported screen `resolution` capability in chart |
|
1338
|
+
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`) |
|
1339
|
+
| `TIME_ZONE` | [Optional] Specify custom time zone. Refer to `browserstack.timezone` capability in chart |
|
1340
|
+
| `IP_GEOLOCATION` | [Optional] Specify IP Geolocation. Refer to [IP Geolocation](https://www.browserstack.com/ip-geolocation) to select a country code. |
|
1341
|
+
| `ALLOW_POPUPS` | [Optional] Allow popups (`true` or `false`) - for Safari, IE, and Edge browsers only |
|
1342
|
+
| `ALLOW_COOKIES` | [Optional] Allow all cookies (`true` or `false`) - for Safari browsers only |
|
1343
|
+
| `SCREENSHOTS` | [Optional] Generate screenshots for debugging (`true` or `false`) |
|
1344
|
+
| `NETWORK_LOGS` | [Optional] Capture network logs (`true` or `false`) |
|
1292
1345
|
|
1293
1346
|
If the BrowserStack Local instance is running (`TUNNELING` Environment Variable is `true`), call the`TestCentricity::WebDriverConnect.close_tunnel` method
|
1294
1347
|
upon completion of your test suite to stop the Local instance. Place the code shown below in your `env.rb` or `hooks.rb` file.
|
@@ -1305,43 +1358,43 @@ For remotely hosted mobile web browsers on the BrowserStack service, the followi
|
|
1305
1358
|
the table below. Refer to the [Browserstack-specific capabilities chart page](https://www.browserstack.com/automate/capabilities?tag=selenium-4)
|
1306
1359
|
for information regarding the specific capabilities.
|
1307
1360
|
|
1308
|
-
| **Environment Variable** | **Description**
|
1309
|
-
|
1310
|
-
| `WEB_BROWSER` | Must be set to `browserstack`
|
1311
|
-
| `BS_USERNAME` | Must be set to your BrowserStack account user name
|
1312
|
-
| `BS_AUTHKEY` | Must be set to your BrowserStack account access key
|
1313
|
-
| `BS_OS` | Must be set to `ios` or `android`
|
1314
|
-
| `BS_BROWSER` | Must be set to `Safari` (for iOS) or `Chrome` (for Android)
|
1315
|
-
| `BS_DEVICE` | Refer to `
|
1316
|
-
| `BS_REAL_MOBILE` | Set to `true` if running against a real device
|
1317
|
-
| `DEVICE_TYPE` | Must be set to `phone` or `tablet`
|
1318
|
-
| `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. |
|
1319
|
-
| `ORIENTATION` | [Optional] Set to `portrait` or `landscape`
|
1320
|
-
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`)
|
1321
|
-
| `TIME_ZONE` | [Optional] Specify custom time zone. Refer to `browserstack.timezone` capability in chart
|
1322
|
-
| `IP_GEOLOCATION` | [Optional] Specify IP Geolocation. Refer to [IP Geolocation](https://www.browserstack.com/ip-geolocation) to select a country code.
|
1323
|
-
| `SCREENSHOTS` | [Optional] Generate screenshots for debugging (`true` or `false`)
|
1324
|
-
| `NETWORK_LOGS` | [Optional] Capture network logs (`true` or `false`)
|
1325
|
-
| `APPIUM_LOGS` | [Optional] Generate Appium logs (`true` or `false`)
|
1361
|
+
| **Environment Variable** | **Description** |
|
1362
|
+
|--------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
1363
|
+
| `WEB_BROWSER` | Must be set to `browserstack` |
|
1364
|
+
| `BS_USERNAME` | Must be set to your BrowserStack account user name |
|
1365
|
+
| `BS_AUTHKEY` | Must be set to your BrowserStack account access key |
|
1366
|
+
| `BS_OS` | Must be set to `ios` or `android` |
|
1367
|
+
| `BS_BROWSER` | Must be set to `Safari` (for iOS) or `Chrome` (for Android) |
|
1368
|
+
| `BS_DEVICE` | Refer to `deviceName` capability in chart |
|
1369
|
+
| `BS_REAL_MOBILE` | Set to `true` if running against a real device |
|
1370
|
+
| `DEVICE_TYPE` | Must be set to `phone` or `tablet` |
|
1371
|
+
| `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. |
|
1372
|
+
| `ORIENTATION` | [Optional] Set to `portrait` or `landscape` |
|
1373
|
+
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`) |
|
1374
|
+
| `TIME_ZONE` | [Optional] Specify custom time zone. Refer to `browserstack.timezone` capability in chart |
|
1375
|
+
| `IP_GEOLOCATION` | [Optional] Specify IP Geolocation. Refer to [IP Geolocation](https://www.browserstack.com/ip-geolocation) to select a country code. |
|
1376
|
+
| `SCREENSHOTS` | [Optional] Generate screenshots for debugging (`true` or `false`) |
|
1377
|
+
| `NETWORK_LOGS` | [Optional] Capture network logs (`true` or `false`) |
|
1378
|
+
| `APPIUM_LOGS` | [Optional] Generate Appium logs (`true` or `false`) |
|
1326
1379
|
|
1327
1380
|
#### Remote desktop browsers on the Sauce Labs service
|
1328
1381
|
|
1329
|
-
For remotely hosted desktop web browsers on the Sauce Labs service, the following **Environment Variables** must be set as described in
|
1330
|
-
|
1331
|
-
information regarding the specific capabilities.
|
1332
|
-
|
1333
|
-
| **Environment Variable** | **Description**
|
1334
|
-
|
1335
|
-
| `WEB_BROWSER` | Must be set to `saucelabs`
|
1336
|
-
| `SL_USERNAME` | Must be set to your Sauce Labs account user name or email address
|
1337
|
-
| `SL_AUTHKEY` | Must be set to your Sauce Labs account access key
|
1338
|
-
| `DATA_CENTER` | Must be set to your Sauce Labs account Data Center assignment (`us-west-1`, `eu-central-1`, `apac-southeast-1`)
|
1339
|
-
| `SL_OS` | Refer to `
|
1340
|
-
| `SL_BROWSER` | Must be set to `chrome`, `firefox`, `safari`, `internet explorer`, or `
|
1341
|
-
| `SL_VERSION` | Refer to `
|
1342
|
-
| `RESOLUTION` | [Optional] Refer to supported `screenResolution` capability in the
|
1343
|
-
| `BROWSER_SIZE ` | [Optional] Specify width, height of browser window
|
1344
|
-
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`)
|
1382
|
+
For remotely hosted desktop web browsers on the Sauce Labs service, the following **Environment Variables** must be set as described in the
|
1383
|
+
table below. Use the Selenium 4 selection on the [Platform Configurator page](https://wiki.saucelabs.com/display/DOCS/Platform+Configurator#/)
|
1384
|
+
to obtain information regarding the specific capabilities.
|
1385
|
+
|
1386
|
+
| **Environment Variable** | **Description** |
|
1387
|
+
|--------------------------|----------------------------------------------------------------------------------------------------------------------------|
|
1388
|
+
| `WEB_BROWSER` | Must be set to `saucelabs` |
|
1389
|
+
| `SL_USERNAME` | Must be set to your Sauce Labs account user name or email address |
|
1390
|
+
| `SL_AUTHKEY` | Must be set to your Sauce Labs account access key |
|
1391
|
+
| `DATA_CENTER` | Must be set to your Sauce Labs account Data Center assignment (`us-west-1`, `eu-central-1`, `apac-southeast-1`) |
|
1392
|
+
| `SL_OS` | Refer to `platformName` capability in the Config Script section of the Platform Configurator page |
|
1393
|
+
| `SL_BROWSER` | Must be set to `chrome`, `firefox`, `safari`, `internet explorer`, or `MicrosoftEdge` |
|
1394
|
+
| `SL_VERSION` | Refer to `browserVersion` capability in the Config Script section of the Platform Configurator page |
|
1395
|
+
| `RESOLUTION` | [Optional] Refer to supported `screenResolution` capability in the Config Script section of the Platform Configurator page |
|
1396
|
+
| `BROWSER_SIZE ` | [Optional] Specify width, height of browser window |
|
1397
|
+
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`) |
|
1345
1398
|
|
1346
1399
|
#### Remote desktop browsers on the TestingBot service
|
1347
1400
|
|
@@ -1357,24 +1410,24 @@ regarding the specific capabilities.
|
|
1357
1410
|
| `TB_OS` | Refer to `platform` capability in chart |
|
1358
1411
|
| `TB_BROWSER` | Refer to `browserName` capability in chart |
|
1359
1412
|
| `TB_VERSION` | Refer to `version` capability in chart |
|
1360
|
-
| `TUNNELING` | Must be `true` if you are testing against internal/local servers (`true` or `false`)
|
1413
|
+
| `TUNNELING` | [Optional] Must be `true` if you are testing against internal/local servers (`true` or `false`) |
|
1361
1414
|
| `RESOLUTION` | [Optional] Possible values: `800x600`, `1024x768`, `1280x960`, `1280x1024`, `1600x1200`, `1920x1200`, `2560x1440` |
|
1362
1415
|
| `BROWSER_SIZE` | [Optional] Specify width, height of browser window |
|
1363
1416
|
|
1364
1417
|
#### Remote desktop browsers on the LambdaTest service
|
1365
1418
|
|
1366
1419
|
For remotely hosted desktop web browsers on the LambdaTest service, the following **Environment Variables** must be set as described in the table
|
1367
|
-
below. Use the Configuration Wizard on the [Selenium Desired Capabilities Generator](https://www.lambdatest.com/capabilities-generator/)
|
1368
|
-
information regarding the specific capabilities.
|
1420
|
+
below. Use the Selenium 4 Configuration Wizard on the [Selenium Desired Capabilities Generator](https://www.lambdatest.com/capabilities-generator/)
|
1421
|
+
to obtain information regarding the specific capabilities.
|
1369
1422
|
|
1370
1423
|
| **Environment Variable** | **Description** |
|
1371
1424
|
|--------------------------|------------------------------------------------------------------------------------------|
|
1372
1425
|
| `WEB_BROWSER` | Must be set to `lambdatest` |
|
1373
1426
|
| `LT_USERNAME` | Must be set to your LambdaTest account user name or email address |
|
1374
1427
|
| `LT_AUTHKEY` | Must be set to your LambdaTest account access key |
|
1375
|
-
| `LT_OS` | Refer to `
|
1428
|
+
| `LT_OS` | Refer to `platformName` capability in the sample script of the Wizard |
|
1376
1429
|
| `LT_BROWSER` | Refer to `browserName` capability in the sample script of the Wizard |
|
1377
|
-
| `LT_VERSION` | Refer to `
|
1430
|
+
| `LT_VERSION` | Refer to `browserVersion` capability in chart |
|
1378
1431
|
| `RESOLUTION` | [Optional] Refer to supported `resolution` capability in the sample script of the Wizard |
|
1379
1432
|
| `BROWSER_SIZE` | [Optional] Specify width, height of browser window |
|
1380
1433
|
| `RECORD_VIDEO` | [Optional] Enable screen video recording during test execution (`true` or `false`) |
|
@@ -1480,14 +1533,21 @@ that you intend to connect with.
|
|
1480
1533
|
|
1481
1534
|
portrait: ORIENTATION=portrait
|
1482
1535
|
landscape: ORIENTATION=landscape
|
1536
|
+
|
1483
1537
|
|
1538
|
+
#==============
|
1539
|
+
# profile to start Appium Server prior to running mobile browser tests on iOS or Android simulators or physical devices
|
1540
|
+
#==============
|
1484
1541
|
|
1542
|
+
run_appium: APPIUM_SERVER=run
|
1543
|
+
|
1544
|
+
|
1485
1545
|
#==============
|
1486
1546
|
# profiles for mobile Safari web browsers hosted within XCode iOS simulator
|
1487
1547
|
# NOTE: Requires installation of XCode, iOS version specific target simulators, Appium, and the appium_capybara gem
|
1488
1548
|
#==============
|
1489
1549
|
|
1490
|
-
appium_ios: WEB_BROWSER=appium AUTOMATION_ENGINE=XCUITest APP_PLATFORM_NAME="ios" APP_BROWSER="Safari" NEW_COMMAND_TIMEOUT=30
|
1550
|
+
appium_ios: WEB_BROWSER=appium AUTOMATION_ENGINE=XCUITest APP_PLATFORM_NAME="ios" APP_BROWSER="Safari" NEW_COMMAND_TIMEOUT=30 SHOW_SIM_KEYBOARD=false
|
1491
1551
|
app_ios_15: --profile appium_ios APP_VERSION="15.2"
|
1492
1552
|
ipad_pro_12_9_15_sim: --profile app_ios_15 DEVICE_TYPE=tablet APP_DEVICE="iPad Pro (12.9-inch) (5th generation)" <%= desktop %>
|
1493
1553
|
ipad_air_15_sim: --profile app_ios_15 DEVICE_TYPE=tablet APP_DEVICE="iPad Air (4th generation)" <%= desktop %>
|
@@ -1608,46 +1668,69 @@ To specify a locally hosted target browser using a profile at runtime, you use t
|
|
1608
1668
|
invoking Cucumber in the command line. For instance, the following command invokes Cucumber and specifies that a local instance of Firefox
|
1609
1669
|
will be used as the target web browser:
|
1610
1670
|
|
1611
|
-
|
1671
|
+
cucumber -p firefox
|
1612
1672
|
|
1613
1673
|
|
1614
|
-
The following command specifies that Cucumber will run tests against an instance of Chrome hosted within a Dockerized Selenium Grid
|
1674
|
+
The following command specifies that Cucumber will run tests against an instance of Chrome hosted within a Dockerized Selenium Grid 4
|
1675
|
+
environment:
|
1615
1676
|
|
1616
|
-
|
1677
|
+
cucumber -p chrome -p grid
|
1617
1678
|
|
1618
1679
|
|
1619
1680
|
The following command specifies that Cucumber will run tests against a local instance of Chrome, which will be used to emulate an iPad Pro
|
1620
1681
|
in landscape orientation:
|
1621
1682
|
|
1622
|
-
|
1683
|
+
cucumber -p ipad_pro -p landscape
|
1623
1684
|
|
1624
1685
|
|
1625
|
-
The following command specifies that Cucumber will run tests against an iPad Pro with iOS version
|
1626
|
-
in landscape orientation:
|
1686
|
+
The following command specifies that Cucumber will run tests against an iPad Pro (12.9-inch) (5th generation) with iOS version 15.2 in an
|
1687
|
+
XCode Simulator in landscape orientation:
|
1627
1688
|
|
1628
|
-
|
1689
|
+
cucumber -p ipad_pro_12_9_15_sim -p landscape
|
1629
1690
|
|
1630
1691
|
NOTE: Appium must be running prior to executing this command
|
1631
1692
|
|
1693
|
+
You can ensure that Appium Server is running by including `-p run_appium` in your command line:
|
1694
|
+
|
1695
|
+
cucumber -p ipad_pro_12_9_15_sim -p landscape -p run_appium
|
1632
1696
|
|
1633
|
-
|
1697
|
+
|
1698
|
+
The following command specifies that Cucumber will run tests against a remotely hosted Safari web browser running on a macOS Monterey
|
1634
1699
|
virtual machine on the BrowserStack service:
|
1635
1700
|
|
1636
|
-
cucumber -p
|
1637
|
-
|
1701
|
+
cucumber -p bs_safari_monterey
|
1638
1702
|
|
1639
|
-
The following command specifies that Cucumber will run tests against a remotely hosted Mobile Safari web browser on an iPhone 6s Plus in
|
1640
|
-
landscape orientation running on the BrowserStack service:
|
1641
1703
|
|
1642
|
-
$ cucumber -p bs_iphone6_plus -p landscape
|
1643
1704
|
|
1705
|
+
## Recommended Project Organization and Structure
|
1644
1706
|
|
1707
|
+
Below is an example of the project structure of a typical Cucumber based test automation framework with a Page Object Model
|
1708
|
+
architecture. `PageObject` class definitions should be stored in the `/features/support/pages` folder, organized in functional
|
1709
|
+
area sub-folders as needed. Likewise, `PageSection` class definitions should be stored in the `/features/support/sections` folder.
|
1645
1710
|
|
1646
|
-
|
1711
|
+
my_automation_project
|
1712
|
+
├── config
|
1713
|
+
│ ├── locales
|
1714
|
+
│ ├── test_data
|
1715
|
+
│ └── cucumber.yml
|
1716
|
+
├── downloads
|
1717
|
+
├── features
|
1718
|
+
│ ├── step_definitions
|
1719
|
+
│ └── support
|
1720
|
+
│ │ ├── pages
|
1721
|
+
│ │ ├── sections
|
1722
|
+
│ │ ├── env.rb
|
1723
|
+
│ │ ├── hooks.rb
|
1724
|
+
│ │ └── world_pages.rb
|
1725
|
+
├── Gemfile
|
1726
|
+
└── README.md
|
1647
1727
|
|
1648
|
-

|
1649
1728
|
|
1650
1729
|
|
1730
|
+
## Web Test Automation Framework Implementation
|
1731
|
+
|
1732
|
+
<img src="https://i.imgur.com/eukmEan.jpg" alt="TestCentricity Web Framework Overview" title="TestCentricity Web Framework Overview">
|
1733
|
+
|
1651
1734
|
|
1652
1735
|
|
1653
1736
|
## Copyright and License
|
@@ -26,7 +26,7 @@ module TestCentricity
|
|
26
26
|
puts 'Appium Server is starting'
|
27
27
|
end
|
28
28
|
# start new Appium Server
|
29
|
-
@process = ChildProcess.build
|
29
|
+
@process = ChildProcess.build(*parameters)
|
30
30
|
process.start
|
31
31
|
# wait until confirmation that Appium Server is running
|
32
32
|
wait = Selenium::WebDriver::Wait.new(timeout: 30)
|
@@ -40,7 +40,7 @@ module TestCentricity
|
|
40
40
|
def running?
|
41
41
|
response = nil
|
42
42
|
begin
|
43
|
-
response = Net::HTTP.get_response(URI('http://
|
43
|
+
response = Net::HTTP.get_response(URI('http://0.0.0.0:4723/wd/hub/sessions'))
|
44
44
|
rescue
|
45
45
|
end
|
46
46
|
response && response.code_type == Net::HTTPOK
|
@@ -137,6 +137,7 @@ module TestCentricity
|
|
137
137
|
Environ.device_os_version = ENV['APP_VERSION']
|
138
138
|
Environ.device_orientation = ENV['ORIENTATION'] if ENV['ORIENTATION']
|
139
139
|
Capybara.default_driver = :appium
|
140
|
+
Environ.driver = :appium
|
140
141
|
@endpoint = 'http://localhost:4723/wd/hub' if @endpoint.nil?
|
141
142
|
desired_capabilities = {
|
142
143
|
platformName: Environ.device_os,
|
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: 4.1.
|
4
|
+
version: 4.1.4
|
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: 2022-03-
|
11
|
+
date: 2022-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|