@serenity-js/webdriverio 3.0.0-rc.3 → 3.0.0-rc.7
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.
- package/CHANGELOG.md +134 -0
- package/lib/screenplay/abilities/BrowseTheWebWithWebdriverIO.d.ts +4 -17
- package/lib/screenplay/abilities/BrowseTheWebWithWebdriverIO.js +7 -24
- package/lib/screenplay/abilities/BrowseTheWebWithWebdriverIO.js.map +1 -1
- package/lib/screenplay/models/WebdriverIOPageElement.js +1 -2
- package/lib/screenplay/models/WebdriverIOPageElement.js.map +1 -1
- package/lib/screenplay/models/index.d.ts +0 -2
- package/lib/screenplay/models/index.js +0 -2
- package/lib/screenplay/models/index.js.map +1 -1
- package/lib/screenplay/models/locators/WebdriverIOLocator.d.ts +9 -0
- package/lib/screenplay/models/locators/WebdriverIOLocator.js +22 -0
- package/lib/screenplay/models/locators/WebdriverIOLocator.js.map +1 -0
- package/lib/screenplay/models/{WebdriverIONativeElementRoot.d.ts → locators/WebdriverIONativeElementRoot.d.ts} +0 -0
- package/lib/screenplay/models/{WebdriverIONativeElementRoot.js → locators/WebdriverIONativeElementRoot.js} +0 -0
- package/lib/screenplay/models/locators/WebdriverIONativeElementRoot.js.map +1 -0
- package/lib/screenplay/models/locators/index.d.ts +2 -0
- package/lib/screenplay/models/locators/index.js +15 -0
- package/lib/screenplay/models/locators/index.js.map +1 -0
- package/package.json +15 -15
- package/src/screenplay/abilities/BrowseTheWebWithWebdriverIO.ts +12 -35
- package/src/screenplay/models/WebdriverIOPageElement.ts +1 -3
- package/src/screenplay/models/index.ts +0 -2
- package/src/screenplay/models/locators/WebdriverIOLocator.ts +43 -0
- package/src/screenplay/models/{WebdriverIONativeElementRoot.ts → locators/WebdriverIONativeElementRoot.ts} +0 -0
- package/src/screenplay/models/locators/index.ts +2 -0
- package/lib/screenplay/models/WebdriverIONativeElementLocator.d.ts +0 -27
- package/lib/screenplay/models/WebdriverIONativeElementLocator.js +0 -56
- package/lib/screenplay/models/WebdriverIONativeElementLocator.js.map +0 -1
- package/lib/screenplay/models/WebdriverIONativeElementRoot.js.map +0 -1
- package/src/screenplay/models/WebdriverIONativeElementLocator.ts +0 -78
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,121 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [3.0.0-rc.7](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.6...v3.0.0-rc.7) (2022-01-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @serenity-js/webdriverio
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.0.0-rc.6](https://github.com/serenity-js/serenity-js/compare/v2.32.7...v3.0.0-rc.6) (2022-01-10)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
# [3.0.0-rc.5](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.4...v3.0.0-rc.5) (2022-01-07)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* **web:** support for advanced PageElement locator patterns ([c1ff8b7](https://github.com/serenity-js/serenity-js/commit/c1ff8b7539ebc1da8f79ea2b6d17bb01c42f443d)), closes [#1084](https://github.com/serenity-js/serenity-js/issues/1084)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# [3.0.0-rc.4](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.3...v3.0.0-rc.4) (2021-12-30)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
# [3.0.0-rc.3](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.2...v3.0.0-rc.3) (2021-12-29)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* **core:** refactored Mappable so that it's easier to implement filters ([176e0cd](https://github.com/serenity-js/serenity-js/commit/176e0cd0303d63271477b2b7a8e7b0572dda99a0)), closes [#1074](https://github.com/serenity-js/serenity-js/issues/1074)
|
|
37
|
+
* **deps:** updated tiny-types to 1.17.0 ([3187051](https://github.com/serenity-js/serenity-js/commit/3187051594158b4b450c82e851e417fd2ed21652))
|
|
38
|
+
* **web:** refactored Selector and NativeElementLocator classes to simplify the implementation ([f0c8f11](https://github.com/serenity-js/serenity-js/commit/f0c8f113433958877d36f13d0bc7f355ea68d280))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* **web:** isVisible checks if the element is in viewport and not hidden behind other elements ([429040f](https://github.com/serenity-js/serenity-js/commit/429040fb32b04cd4bc7524100635203fd8128eb6))
|
|
44
|
+
* **web:** re-introduced PageElements.where DSL and universal By selectors ([39fe0a1](https://github.com/serenity-js/serenity-js/commit/39fe0a10edf7f652e93911159e4a4689c36d6876)), closes [#1081](https://github.com/serenity-js/serenity-js/issues/1081)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# [3.0.0-rc.2](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.1...v3.0.0-rc.2) (2021-12-09)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
# [3.0.0-rc.1](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.0...v3.0.0-rc.1) (2021-12-09)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# [3.0.0-rc.0](https://github.com/serenity-js/serenity-js/compare/v2.32.5...v3.0.0-rc.0) (2021-12-08)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
### Bug Fixes
|
|
60
|
+
|
|
61
|
+
* **core:** 3.0 RC ([469d54e](https://github.com/serenity-js/serenity-js/commit/469d54e4f81ef430566b93852e3174826f8ef672)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
62
|
+
* **deps:** updated WebdriverIO ([9de63d4](https://github.com/serenity-js/serenity-js/commit/9de63d460d9735abfc5bb066671f6f28c3274597))
|
|
63
|
+
* **deps:** web ([b075b8e](https://github.com/serenity-js/serenity-js/commit/b075b8ecd8e00014469dda15a90175d60ed80c91))
|
|
64
|
+
* **web:** corrected timestamp rounding when retrieving the expiry date of a cookie ([d636965](https://github.com/serenity-js/serenity-js/commit/d63696586618cd701e703e33dd8b476efaac65b6))
|
|
65
|
+
* **webdriverio:** ensure getLastScriptExecutionResult returns undefined for void functions ([aa00dfd](https://github.com/serenity-js/serenity-js/commit/aa00dfd3ab320a5d7ee786feea1ce0355ac42638))
|
|
66
|
+
* **webdriverio:** fixed synchronisation issue in ModalDialog ([12324b2](https://github.com/serenity-js/serenity-js/commit/12324b2cef9c161df8b68960d5b958c1f208f70a)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
67
|
+
* **webdriverio:** separated UIElement.hoverOver from UIElement.scrollIntoView ([cf4ca2c](https://github.com/serenity-js/serenity-js/commit/cf4ca2c531e0f90f9a27917e322359c13bfbc6e6))
|
|
68
|
+
* **webdriverio:** updated WebdriverIO to 7.13.2 ([ef79d19](https://github.com/serenity-js/serenity-js/commit/ef79d1962224e8dd04a1b0e099662c91ea118dfe))
|
|
69
|
+
* **webdriverio:** updated WebdriverIO to 7.16.7 ([3316e29](https://github.com/serenity-js/serenity-js/commit/3316e2905e68b1cabf76086da353072376f95f4a))
|
|
70
|
+
* **web:** removed window-specific APIs from BrowseTheWeb that got replaced by Page ([918f447](https://github.com/serenity-js/serenity-js/commit/918f447c1d8f326fbf5730f1aa61108045556212)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
71
|
+
* **web:** renamed Element and associated classes to PageElement to avoid name conflicts ([1e4204b](https://github.com/serenity-js/serenity-js/commit/1e4204b5507469e6574c87a6d84454e39e8a813e))
|
|
72
|
+
* **web:** renamed PageElementList to PageElements to improve readability ([a9903a7](https://github.com/serenity-js/serenity-js/commit/a9903a7389b00106ef94d2bdb9f86a7fd04be541)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
73
|
+
* **web:** standardised getters across PageElement implementations ([336472b](https://github.com/serenity-js/serenity-js/commit/336472b1a6882412f6a88483e51266909a1d51d0))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Features
|
|
77
|
+
|
|
78
|
+
* **protractor:** compatibility with @serenity-js/web ([9df4db2](https://github.com/serenity-js/serenity-js/commit/9df4db27a6e0ae62bf0d0e679a170d4865041043)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
79
|
+
* **web:** a common way to run the tests for all the web adapters ([c7e584a](https://github.com/serenity-js/serenity-js/commit/c7e584a9bf288ebc7781affdb720097527e8ed3a))
|
|
80
|
+
* **web:** added Page.viewportSize and Page.setViewportSize methods ([4cabbe2](https://github.com/serenity-js/serenity-js/commit/4cabbe21a7fbac3457c6a6ea3d4442a62c3f1f3c))
|
|
81
|
+
* **web:** all Screenplay APIs migrated from @serenity-js/webdriverio to @serenity-js/web ([7b6b95d](https://github.com/serenity-js/serenity-js/commit/7b6b95dc255446c29ae213ba2a1d142d426d16c8))
|
|
82
|
+
* **webdriverio:** support for native WebdriverIO services ([8d5ad22](https://github.com/serenity-js/serenity-js/commit/8d5ad22594cdb2ebddedc58a30259ca8430e360c))
|
|
83
|
+
* **web:** interaction to set a Cookie ([c056439](https://github.com/serenity-js/serenity-js/commit/c056439746a8f57c3edd937b8862f2babb70e94e)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
84
|
+
* **web:** interaction to setViewportSize of a Page ([dd7f180](https://github.com/serenity-js/serenity-js/commit/dd7f18057b857d2e69c19265888bfd5b15fda21b))
|
|
85
|
+
* **web:** ModalDialog available for both Protractor and WebdriverIO adapters ([ef3c566](https://github.com/serenity-js/serenity-js/commit/ef3c566aed12b52aa22c54058992d369172b8597)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
86
|
+
* **web:** new module @serenity-js/web to provide Web-related Screenplay Pattern APIs ([bead861](https://github.com/serenity-js/serenity-js/commit/bead8612af1a5c99b775e680a3904f44d0281cf9))
|
|
87
|
+
* **web:** Page.url() and Page.title() replace Website.url() and Website.title() ([49fe009](https://github.com/serenity-js/serenity-js/commit/49fe0094422ab53ec67d4ba303f80c33e382eebd)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
88
|
+
* **web:** removed Target in favour of PageElement ([69496c4](https://github.com/serenity-js/serenity-js/commit/69496c47c4a1ec7b92e7ab6c83da1559e926f28e)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
89
|
+
* **web:** support for switching browsing context ([a73a635](https://github.com/serenity-js/serenity-js/commit/a73a635f93183d67229acde78e74526564008869)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
90
|
+
* **web:** support for working with cookies ([39cde6d](https://github.com/serenity-js/serenity-js/commit/39cde6de7a36d27a8b1c596493efbec94900af6b)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
### BREAKING CHANGES
|
|
94
|
+
|
|
95
|
+
* **core:** Introduced @serenity-js/web - a shared library for Serenity/JS Web integration
|
|
96
|
+
modules such as @serenity-js/protractor and @serenity-js/webdriverio. Dropped support for Node 12.
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# [3.0.0-rc.5](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.4...v3.0.0-rc.5) (2022-01-07)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
### Features
|
|
106
|
+
|
|
107
|
+
* **web:** support for advanced PageElement locator patterns ([c1ff8b7](https://github.com/serenity-js/serenity-js/commit/c1ff8b7539ebc1da8f79ea2b6d17bb01c42f443d)), closes [#1084](https://github.com/serenity-js/serenity-js/issues/1084)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# [3.0.0-rc.4](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.3...v3.0.0-rc.4) (2021-12-30)
|
|
114
|
+
|
|
115
|
+
**Note:** Version bump only for package @serenity-js/webdriverio
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
6
121
|
# [3.0.0-rc.3](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.2...v3.0.0-rc.3) (2021-12-29)
|
|
7
122
|
|
|
8
123
|
|
|
@@ -84,6 +199,25 @@ modules such as @serenity-js/protractor and @serenity-js/webdriverio. Dropped su
|
|
|
84
199
|
|
|
85
200
|
|
|
86
201
|
|
|
202
|
+
## [2.32.7](https://github.com/serenity-js/serenity-js/compare/v2.32.6...v2.32.7) (2022-01-10)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
### Bug Fixes
|
|
206
|
+
|
|
207
|
+
* **webdriverio:** SECURITY: updated WebdriverIO to 7.16.13 ([2062dfd](https://github.com/serenity-js/serenity-js/commit/2062dfd3277b68335502082df1abe7a5bcb4ca7f)), closes [Marak/colors.js#285](https://github.com/Marak/colors.js/issues/285)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
## [2.32.6](https://github.com/serenity-js/serenity-js/compare/v2.32.5...v2.32.6) (2022-01-10)
|
|
214
|
+
|
|
215
|
+
**Note:** Version bump only for package @serenity-js/webdriverio
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
87
221
|
## [2.32.5](https://github.com/serenity-js/serenity-js/compare/v2.32.4...v2.32.5) (2021-12-08)
|
|
88
222
|
|
|
89
223
|
**Note:** Version bump only for package @serenity-js/webdriverio
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Duration
|
|
2
|
-
import { BrowserCapabilities, BrowseTheWeb, Cookie, CookieData, Key, ModalDialog,
|
|
1
|
+
import { Duration } from '@serenity-js/core';
|
|
2
|
+
import { BrowserCapabilities, BrowseTheWeb, Cookie, CookieData, Key, ModalDialog, Page, PageElement } from '@serenity-js/web';
|
|
3
3
|
import type * as wdio from 'webdriverio';
|
|
4
|
-
import {
|
|
4
|
+
import { WebdriverIONativeElementRoot } from '../models/locators';
|
|
5
5
|
/**
|
|
6
6
|
* @desc
|
|
7
7
|
* An {@link @serenity-js/core/lib/screenplay~Ability} that enables the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
@@ -35,23 +35,13 @@ import { WebdriverIOPageElement } from '../models';
|
|
|
35
35
|
* @implements {@serenity-js/core/lib/screenplay~Ability}
|
|
36
36
|
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
37
37
|
*/
|
|
38
|
-
export declare class BrowseTheWebWithWebdriverIO extends BrowseTheWeb<wdio.Element<'async'
|
|
38
|
+
export declare class BrowseTheWebWithWebdriverIO extends BrowseTheWeb<wdio.Element<'async'>, WebdriverIONativeElementRoot> {
|
|
39
39
|
readonly browser: wdio.Browser<'async'>;
|
|
40
40
|
/**
|
|
41
41
|
* @param {@wdio/types~Browser} browserInstance
|
|
42
42
|
* @returns {BrowseTheWebWithWebdriverIO}
|
|
43
43
|
*/
|
|
44
44
|
static using(browserInstance: wdio.Browser<'async'>): BrowseTheWebWithWebdriverIO;
|
|
45
|
-
/**
|
|
46
|
-
* @desc
|
|
47
|
-
* Used to access the Actor's ability to {@link BrowseTheWebWithWebdriverIO}
|
|
48
|
-
* from within the {@link @serenity-js/core/lib/screenplay~Interaction} classes,
|
|
49
|
-
* such as {@link @serenity-js/web/lib/screenplay/interactions~Navigate}.
|
|
50
|
-
*
|
|
51
|
-
* @param {@serenity-js/core/lib/screenplay/actor~UsesAbilities} actor
|
|
52
|
-
* @return {BrowseTheWebWithWebdriverIO}
|
|
53
|
-
*/
|
|
54
|
-
static as(actor: UsesAbilities): BrowseTheWebWithWebdriverIO;
|
|
55
45
|
/**
|
|
56
46
|
* @private
|
|
57
47
|
*/
|
|
@@ -64,9 +54,6 @@ export declare class BrowseTheWebWithWebdriverIO extends BrowseTheWeb<wdio.Eleme
|
|
|
64
54
|
cookie(name: string): Promise<Cookie>;
|
|
65
55
|
setCookie(cookieData: CookieData): Promise<void>;
|
|
66
56
|
deleteAllCookies(): Promise<void>;
|
|
67
|
-
locate<T>(selector: Selector<T>, locator?: NativeElementLocator<wdio.Element<'async'>>): WebdriverIOPageElement;
|
|
68
|
-
locateAll<T>(selector: Selector<T>, locator?: NativeElementLocator<wdio.Element<'async'>>): Promise<WebdriverIOPageElement[]>;
|
|
69
|
-
nativeElementLocator(): NativeElementLocator<wdio.Element<'async'>>;
|
|
70
57
|
/**
|
|
71
58
|
* @desc
|
|
72
59
|
* Navigate to a given destination, specified as an absolute URL
|
|
@@ -4,6 +4,7 @@ exports.BrowseTheWebWithWebdriverIO = void 0;
|
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
const web_1 = require("@serenity-js/web");
|
|
6
6
|
const models_1 = require("../models");
|
|
7
|
+
const locators_1 = require("../models/locators");
|
|
7
8
|
/**
|
|
8
9
|
* @desc
|
|
9
10
|
* An {@link @serenity-js/core/lib/screenplay~Ability} that enables the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
@@ -42,7 +43,12 @@ class BrowseTheWebWithWebdriverIO extends web_1.BrowseTheWeb {
|
|
|
42
43
|
* @param {@wdio/types~Browser} browser
|
|
43
44
|
*/
|
|
44
45
|
constructor(browser) {
|
|
45
|
-
super()
|
|
46
|
+
super(new Map()
|
|
47
|
+
.set(web_1.ByCss, (selector) => locators_1.WebdriverIOLocator.createRootLocator(this.browser, selector, selector.value))
|
|
48
|
+
.set(web_1.ByCssContainingText, (selector) => locators_1.WebdriverIOLocator.createRootLocator(this.browser, selector, `${selector.value}*=${selector.text}`))
|
|
49
|
+
.set(web_1.ById, (selector) => locators_1.WebdriverIOLocator.createRootLocator(this.browser, selector, `#${selector.value}`))
|
|
50
|
+
.set(web_1.ByTagName, (selector) => locators_1.WebdriverIOLocator.createRootLocator(this.browser, selector, `<${selector.value} />`))
|
|
51
|
+
.set(web_1.ByXPath, (selector) => locators_1.WebdriverIOLocator.createRootLocator(this.browser, selector, selector.value)));
|
|
46
52
|
this.browser = browser;
|
|
47
53
|
if (!this.browser.$ || !this.browser.$$) {
|
|
48
54
|
throw new core_1.LogicError(`WebdriverIO browser object is not initialised yet, so can't be assigned to an actor. Are you trying to instantiate an actor outside of a test or a test hook?`);
|
|
@@ -55,18 +61,6 @@ class BrowseTheWebWithWebdriverIO extends web_1.BrowseTheWeb {
|
|
|
55
61
|
static using(browserInstance) {
|
|
56
62
|
return new BrowseTheWebWithWebdriverIO(browserInstance);
|
|
57
63
|
}
|
|
58
|
-
/**
|
|
59
|
-
* @desc
|
|
60
|
-
* Used to access the Actor's ability to {@link BrowseTheWebWithWebdriverIO}
|
|
61
|
-
* from within the {@link @serenity-js/core/lib/screenplay~Interaction} classes,
|
|
62
|
-
* such as {@link @serenity-js/web/lib/screenplay/interactions~Navigate}.
|
|
63
|
-
*
|
|
64
|
-
* @param {@serenity-js/core/lib/screenplay/actor~UsesAbilities} actor
|
|
65
|
-
* @return {BrowseTheWebWithWebdriverIO}
|
|
66
|
-
*/
|
|
67
|
-
static as(actor) {
|
|
68
|
-
return actor.abilityTo(BrowseTheWebWithWebdriverIO);
|
|
69
|
-
}
|
|
70
64
|
browserCapabilities() {
|
|
71
65
|
return Promise.resolve(this.browser.capabilities);
|
|
72
66
|
}
|
|
@@ -90,17 +84,6 @@ class BrowseTheWebWithWebdriverIO extends web_1.BrowseTheWeb {
|
|
|
90
84
|
deleteAllCookies() {
|
|
91
85
|
return this.browser.deleteCookies();
|
|
92
86
|
}
|
|
93
|
-
locate(selector, locator) {
|
|
94
|
-
return new models_1.WebdriverIOPageElement(selector, locator !== null && locator !== void 0 ? locator : this.nativeElementLocator());
|
|
95
|
-
}
|
|
96
|
-
async locateAll(selector, locator) {
|
|
97
|
-
const l = locator !== null && locator !== void 0 ? locator : this.nativeElementLocator();
|
|
98
|
-
const elements = await l.locateAll(selector);
|
|
99
|
-
return elements.map(element => new models_1.WebdriverIOPageElement(selector, new web_1.PassThroughNativeElementLocator(locator, element)));
|
|
100
|
-
}
|
|
101
|
-
nativeElementLocator() {
|
|
102
|
-
return new models_1.WebdriverIONativeElementLocator(() => this.browser);
|
|
103
|
-
}
|
|
104
87
|
/**
|
|
105
88
|
* @desc
|
|
106
89
|
* Navigate to a given destination, specified as an absolute URL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowseTheWebWithWebdriverIO.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/BrowseTheWebWithWebdriverIO.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"BrowseTheWebWithWebdriverIO.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/BrowseTheWebWithWebdriverIO.ts"],"names":[],"mappings":";;;AAAA,4CAAyD;AACzD,0CAAoL;AAGpL,sCAA+G;AAC/G,iDAAsF;AAEtF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAa,2BAA4B,SAAQ,kBAAiE;IAe9G;;OAEG;IACH,YAA4B,OAA8B;QACtD,KAAK,CAAC,IAAI,GAAG,EAAE;aACV,GAAG,CAAC,WAAK,EAAkB,CAAC,QAAe,EAAgB,EAAE,CAAC,6BAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;aAC3I,GAAG,CAAC,yBAAmB,EAAI,CAAC,QAA6B,EAAE,EAAE,CAAC,6BAAkB,CAAC,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,GAAI,QAAQ,CAAC,KAAM,KAAM,QAAQ,CAAC,IAAK,EAAE,CAAC,CAAC;aACtK,GAAG,CAAC,UAAI,EAAmB,CAAC,QAAc,EAAiB,EAAE,CAAC,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O,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,EAAE;YACrC,OAAO,EAAK,OAAO,CAAC,cAAc,EAAE;YACpC,UAAU,EAAE,wBAAyB,OAAQ,EAAE;SAClD,CAAkB,CAAC;IACxB,CAAC;CACJ;AA1TD,kEA0TC;AAED;;GAEG;AACH,MAAM,0BAA0B;IAC5B,YAA4B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;CACjD"}
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WebdriverIOPageElement = void 0;
|
|
4
4
|
const web_1 = require("@serenity-js/web");
|
|
5
|
-
const WebdriverIONativeElementLocator_1 = require("./WebdriverIONativeElementLocator");
|
|
6
5
|
class WebdriverIOPageElement extends web_1.PageElement {
|
|
7
6
|
of(parent) {
|
|
8
|
-
return new WebdriverIOPageElement(this.
|
|
7
|
+
return new WebdriverIOPageElement(this.locator.of(parent.locator));
|
|
9
8
|
}
|
|
10
9
|
async clearValue() {
|
|
11
10
|
const element = await this.nativeElement();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebdriverIOPageElement.js","sourceRoot":"","sources":["../../../src/screenplay/models/WebdriverIOPageElement.ts"],"names":[],"mappings":";;;AAAA,0CAA+C;AAG/C,
|
|
1
|
+
{"version":3,"file":"WebdriverIOPageElement.js","sourceRoot":"","sources":["../../../src/screenplay/models/WebdriverIOPageElement.ts"],"names":[],"mappings":";;;AAAA,0CAA+C;AAG/C,MAAa,sBACT,SAAQ,iBAAkC;IAE1C,EAAE,CAAC,MAA8B;QAC7B,OAAO,IAAI,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;IACtE,CAAC;IAED,KAAK,CAAC,UAAU;QACZ,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QAC3C,OAAO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AC,OAAO;QAClB,0BAA0B;QAC1B,SAAS,SAAS,CAAC,OAAY;YAC3B,IAAI,CAAE,OAAO,CAAC,qBAAqB,EAAE;gBACjC,OAAO,KAAK,CAAC;aAChB;YAED,IACI,GAAG,GAAG,OAAO,CAAC,qBAAqB,EAAE,EACrC,EAAE,GAAG,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,GAAG,CAAC,EAC7B,EAAE,GAAG,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,EAC7B,CAAC,GAAG,QAAQ,CAAC,gBAAgB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAE1C,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE;gBAC3B,IAAI,CAAC,KAAK,OAAO;oBACb,OAAO,IAAI,CAAC;aACnB;YACD,OAAO,KAAK,CAAC;QACjB,CAAC,EACD,OAAO,CACV,CAAC;QAEF,0BAA0B;IAC9B,CAAC;IAED,gJAAgJ;IACxI,KAAK,CAAC,UAAU,CAAC,aAA4D;QACjF,MAAM,OAAO,GAAG,aAAsC,CAAC;QACvD,OAAO,OAAO,CAAC,MAAM;YACjB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC;YACjC,CAAC,CAAC,aAAa,CAAA;IACvB,CAAC;CACJ;AA3ID,wDA2IC"}
|
|
@@ -12,8 +12,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./WebdriverIOCookie"), exports);
|
|
14
14
|
__exportStar(require("./WebdriverIOModalDialog"), exports);
|
|
15
|
-
__exportStar(require("./WebdriverIONativeElementLocator"), exports);
|
|
16
|
-
__exportStar(require("./WebdriverIONativeElementRoot"), exports);
|
|
17
15
|
__exportStar(require("./WebdriverIOPage"), exports);
|
|
18
16
|
__exportStar(require("./WebdriverIOPageElement"), exports);
|
|
19
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAAoC;AACpC,2DAAyC;AACzC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sDAAoC;AACpC,2DAAyC;AACzC,oDAAkC;AAClC,2DAAyC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Locator, PageElement, Selector } from '@serenity-js/web';
|
|
2
|
+
import * as wdio from 'webdriverio';
|
|
3
|
+
import { WebdriverIONativeElementRoot } from './WebdriverIONativeElementRoot';
|
|
4
|
+
export declare class WebdriverIOLocator<Selector_Type extends Selector> extends Locator<wdio.Element<'async'>, WebdriverIONativeElementRoot, Selector_Type> {
|
|
5
|
+
static createRootLocator<ST extends Selector>(browser: WebdriverIONativeElementRoot, selector: ST, webdriverioSelector: string): WebdriverIOLocator<ST>;
|
|
6
|
+
of(parent: WebdriverIOLocator<unknown>): Locator<wdio.Element<'async'>, WebdriverIONativeElementRoot, Selector_Type>;
|
|
7
|
+
element(): PageElement<wdio.Element<'async'>>;
|
|
8
|
+
allElements(): Promise<Array<PageElement<wdio.Element<'async'>>>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WebdriverIOLocator = void 0;
|
|
4
|
+
const web_1 = require("@serenity-js/web");
|
|
5
|
+
const WebdriverIOPageElement_1 = require("../WebdriverIOPageElement");
|
|
6
|
+
class WebdriverIOLocator extends web_1.Locator {
|
|
7
|
+
static createRootLocator(browser, selector, webdriverioSelector) {
|
|
8
|
+
return new WebdriverIOLocator(() => browser, selector, (root) => root.$(webdriverioSelector), (root) => root.$$(webdriverioSelector));
|
|
9
|
+
}
|
|
10
|
+
of(parent) {
|
|
11
|
+
return new WebdriverIOLocator(() => parent.nativeElement(), this.selector, (parentRoot) => this.locateElement(parentRoot), (parentRoot) => this.locateAllElements(parentRoot));
|
|
12
|
+
}
|
|
13
|
+
element() {
|
|
14
|
+
return new WebdriverIOPageElement_1.WebdriverIOPageElement(this);
|
|
15
|
+
}
|
|
16
|
+
async allElements() {
|
|
17
|
+
const elements = await this.locateAllElements(await this.parentRoot());
|
|
18
|
+
return elements.map(childElement => new WebdriverIOPageElement_1.WebdriverIOPageElement(new WebdriverIOLocator(() => this.parentRoot(), this.selector, () => childElement, () => [childElement])));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.WebdriverIOLocator = WebdriverIOLocator;
|
|
22
|
+
//# sourceMappingURL=WebdriverIOLocator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebdriverIOLocator.js","sourceRoot":"","sources":["../../../../src/screenplay/models/locators/WebdriverIOLocator.ts"],"names":[],"mappings":";;;AAAA,0CAAkE;AAGlE,sEAAmE;AAGnE,MAAa,kBAAmD,SAAQ,aAA2E;IAE/I,MAAM,CAAC,iBAAiB,CAAsB,OAAqC,EAAE,QAAY,EAAE,mBAA2B;QAC1H,OAAO,IAAI,kBAAkB,CACzB,GAAG,EAAE,CAAC,OAAO,EACb,QAAQ,EACR,CAAC,IAAkC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAqC,EACvG,CAAC,IAAkC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,mBAAmB,CAAC,CACvE,CAAC;IACN,CAAC;IAED,EAAE,CAAC,MAAmC;QAClC,OAAO,IAAI,kBAAkB,CACzB,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,EAC5B,IAAI,CAAC,QAAQ,EACb,CAAC,UAAwC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,EAC5E,CAAC,UAAwC,EAAE,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CACnF,CAAC;IACN,CAAC;IAED,OAAO;QACH,OAAO,IAAI,+CAAsB,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,WAAW;QACb,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QAEvE,OAAO,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAC/B,IAAI,+CAAsB,CAAC,IAAI,kBAAkB,CAC7C,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,EACvB,IAAI,CAAC,QAAQ,EACb,GAAG,EAAE,CAAC,YAAY,EAClB,GAAG,EAAE,CAAC,CAAE,YAAY,CAAE,CACzB,CAAC,CACL,CAAC;IACN,CAAC;CACJ;AApCD,gDAoCC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebdriverIONativeElementRoot.js","sourceRoot":"","sources":["../../../../src/screenplay/models/locators/WebdriverIONativeElementRoot.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./WebdriverIOLocator"), exports);
|
|
14
|
+
__exportStar(require("./WebdriverIONativeElementRoot"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/screenplay/models/locators/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAqC;AACrC,iEAA+C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-js/webdriverio",
|
|
3
|
-
"version": "3.0.0-rc.
|
|
3
|
+
"version": "3.0.0-rc.7",
|
|
4
4
|
"description": "Serenity/JS reporter and Screenplay Pattern library for WebdriverIO",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jan Molak",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"npm": "^6 || ^7 || ^8"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@serenity-js/core": "3.0.0-rc.
|
|
53
|
-
"@serenity-js/web": "3.0.0-rc.
|
|
54
|
-
"@wdio/reporter": "^7.16.
|
|
55
|
-
"@wdio/types": "^7.16.
|
|
52
|
+
"@serenity-js/core": "3.0.0-rc.7",
|
|
53
|
+
"@serenity-js/web": "3.0.0-rc.7",
|
|
54
|
+
"@wdio/reporter": "^7.16.13",
|
|
55
|
+
"@wdio/types": "^7.16.13",
|
|
56
56
|
"deepmerge": "^4.2.2",
|
|
57
57
|
"is-plain-object": "^5.0.0",
|
|
58
58
|
"tiny-types": "^1.17.0"
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"@serenity-js/cucumber": "^3.0.0-rc",
|
|
62
62
|
"@serenity-js/jasmine": "^3.0.0-rc",
|
|
63
63
|
"@serenity-js/mocha": "^3.0.0-rc",
|
|
64
|
-
"@wdio/cli": "^7.16.
|
|
65
|
-
"webdriverio": "^7.16.
|
|
64
|
+
"@wdio/cli": "^7.16.13",
|
|
65
|
+
"webdriverio": "^7.16.13"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|
|
68
68
|
"@serenity-js/cucumber": {
|
|
@@ -79,18 +79,18 @@
|
|
|
79
79
|
"@documentation/esdoc-template": "3.0.0",
|
|
80
80
|
"@integration/testing-tools": "3.0.0",
|
|
81
81
|
"@types/mocha": "^9.0.0",
|
|
82
|
-
"@wdio/cli": "^7.16.
|
|
83
|
-
"@wdio/devtools-service": "^7.16.
|
|
84
|
-
"@wdio/dot-reporter": "^7.16.
|
|
85
|
-
"@wdio/local-runner": "^7.16.
|
|
86
|
-
"@wdio/mocha-framework": "^7.16.
|
|
87
|
-
"@wdio/spec-reporter": "^7.16.
|
|
82
|
+
"@wdio/cli": "^7.16.13",
|
|
83
|
+
"@wdio/devtools-service": "^7.16.13",
|
|
84
|
+
"@wdio/dot-reporter": "^7.16.13",
|
|
85
|
+
"@wdio/local-runner": "^7.16.13",
|
|
86
|
+
"@wdio/mocha-framework": "^7.16.13",
|
|
87
|
+
"@wdio/spec-reporter": "^7.16.13",
|
|
88
88
|
"axios": "^0.21.4",
|
|
89
89
|
"cross-env": "^7.0.3",
|
|
90
90
|
"mocha": "^9.1.3",
|
|
91
91
|
"mocha-testdata": "^1.2.0",
|
|
92
92
|
"start-server-and-test": "^1.14.0",
|
|
93
|
-
"webdriverio": "^7.16.
|
|
93
|
+
"webdriverio": "^7.16.13"
|
|
94
94
|
},
|
|
95
95
|
"nyc": {
|
|
96
96
|
"include": [
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"cache": true,
|
|
113
113
|
"all": false
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "74f603a7a8e0c685a0ea5e4198aad6cc30aea91c"
|
|
116
116
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Duration, LogicError
|
|
2
|
-
import { BrowserCapabilities, BrowseTheWeb, Cookie, CookieData, Key, ModalDialog,
|
|
1
|
+
import { Duration, LogicError } from '@serenity-js/core';
|
|
2
|
+
import { BrowserCapabilities, BrowseTheWeb, ByCss, ByCssContainingText, ById, ByTagName, ByXPath, Cookie, CookieData, Key, ModalDialog, Page, PageElement } from '@serenity-js/web';
|
|
3
3
|
import type * as wdio from 'webdriverio';
|
|
4
4
|
|
|
5
|
-
import { WebdriverIOCookie, WebdriverIOModalDialog,
|
|
5
|
+
import { WebdriverIOCookie, WebdriverIOModalDialog, WebdriverIOPage, WebdriverIOPageElement } from '../models';
|
|
6
|
+
import { WebdriverIOLocator, WebdriverIONativeElementRoot } from '../models/locators';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* @desc
|
|
@@ -37,7 +38,7 @@ import { WebdriverIOCookie, WebdriverIOModalDialog, WebdriverIONativeElementLoca
|
|
|
37
38
|
* @implements {@serenity-js/core/lib/screenplay~Ability}
|
|
38
39
|
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
39
40
|
*/
|
|
40
|
-
export class BrowseTheWebWithWebdriverIO extends BrowseTheWeb<wdio.Element<'async'
|
|
41
|
+
export class BrowseTheWebWithWebdriverIO extends BrowseTheWeb<wdio.Element<'async'>, WebdriverIONativeElementRoot> {
|
|
41
42
|
|
|
42
43
|
/**
|
|
43
44
|
* @param {@wdio/types~Browser} browserInstance
|
|
@@ -47,19 +48,6 @@ export class BrowseTheWebWithWebdriverIO extends BrowseTheWeb<wdio.Element<'asyn
|
|
|
47
48
|
return new BrowseTheWebWithWebdriverIO(browserInstance);
|
|
48
49
|
}
|
|
49
50
|
|
|
50
|
-
/**
|
|
51
|
-
* @desc
|
|
52
|
-
* Used to access the Actor's ability to {@link BrowseTheWebWithWebdriverIO}
|
|
53
|
-
* from within the {@link @serenity-js/core/lib/screenplay~Interaction} classes,
|
|
54
|
-
* such as {@link @serenity-js/web/lib/screenplay/interactions~Navigate}.
|
|
55
|
-
*
|
|
56
|
-
* @param {@serenity-js/core/lib/screenplay/actor~UsesAbilities} actor
|
|
57
|
-
* @return {BrowseTheWebWithWebdriverIO}
|
|
58
|
-
*/
|
|
59
|
-
static as(actor: UsesAbilities): BrowseTheWebWithWebdriverIO {
|
|
60
|
-
return actor.abilityTo(BrowseTheWebWithWebdriverIO);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
51
|
/**
|
|
64
52
|
* @private
|
|
65
53
|
*/
|
|
@@ -69,7 +57,13 @@ export class BrowseTheWebWithWebdriverIO extends BrowseTheWeb<wdio.Element<'asyn
|
|
|
69
57
|
* @param {@wdio/types~Browser} browser
|
|
70
58
|
*/
|
|
71
59
|
constructor(public readonly browser: wdio.Browser<'async'>) {
|
|
72
|
-
super()
|
|
60
|
+
super(new Map()
|
|
61
|
+
.set(ByCss, (selector: ByCss) => WebdriverIOLocator.createRootLocator(this.browser, selector, selector.value))
|
|
62
|
+
.set(ByCssContainingText, (selector: ByCssContainingText) => WebdriverIOLocator.createRootLocator(this.browser, selector, `${ selector.value }*=${ selector.text }`))
|
|
63
|
+
.set(ById, (selector: ById) => WebdriverIOLocator.createRootLocator(this.browser, selector, `#${ selector.value }`))
|
|
64
|
+
.set(ByTagName, (selector: ByTagName) => WebdriverIOLocator.createRootLocator(this.browser, selector, `<${ selector.value } />`))
|
|
65
|
+
.set(ByXPath, (selector: ByXPath) => WebdriverIOLocator.createRootLocator(this.browser, selector, selector.value))
|
|
66
|
+
);
|
|
73
67
|
|
|
74
68
|
if (! this.browser.$ || ! this.browser.$$) {
|
|
75
69
|
throw new LogicError(`WebdriverIO browser object is not initialised yet, so can't be assigned to an actor. Are you trying to instantiate an actor outside of a test or a test hook?`)
|
|
@@ -103,23 +97,6 @@ export class BrowseTheWebWithWebdriverIO extends BrowseTheWeb<wdio.Element<'asyn
|
|
|
103
97
|
return this.browser.deleteCookies() as Promise<void>;
|
|
104
98
|
}
|
|
105
99
|
|
|
106
|
-
locate<T>(selector: Selector<T>, locator?: NativeElementLocator<wdio.Element<'async'>>): WebdriverIOPageElement {
|
|
107
|
-
return new WebdriverIOPageElement(selector, locator ?? this.nativeElementLocator());
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async locateAll<T>(selector: Selector<T>, locator?: NativeElementLocator<wdio.Element<'async'>>): Promise<WebdriverIOPageElement[]> {
|
|
111
|
-
const l = locator ?? this.nativeElementLocator();
|
|
112
|
-
const elements = await l.locateAll(selector);
|
|
113
|
-
|
|
114
|
-
return elements.map(element =>
|
|
115
|
-
new WebdriverIOPageElement(selector, new PassThroughNativeElementLocator<wdio.Element<'async'>>(locator, element)),
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
nativeElementLocator(): NativeElementLocator<wdio.Element<'async'>> {
|
|
120
|
-
return new WebdriverIONativeElementLocator(() => this.browser);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
100
|
/**
|
|
124
101
|
* @desc
|
|
125
102
|
* Navigate to a given destination, specified as an absolute URL
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { PageElement } from '@serenity-js/web';
|
|
2
2
|
import * as wdio from 'webdriverio';
|
|
3
3
|
|
|
4
|
-
import { WebdriverIONativeElementLocator } from './WebdriverIONativeElementLocator';
|
|
5
|
-
|
|
6
4
|
export class WebdriverIOPageElement
|
|
7
5
|
extends PageElement<wdio.Element<'async'>>
|
|
8
6
|
{
|
|
9
7
|
of(parent: WebdriverIOPageElement): WebdriverIOPageElement {
|
|
10
|
-
return new WebdriverIOPageElement(this.
|
|
8
|
+
return new WebdriverIOPageElement(this.locator.of(parent.locator))
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
async clearValue(): Promise<void> {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Locator, PageElement, Selector } from '@serenity-js/web';
|
|
2
|
+
import * as wdio from 'webdriverio';
|
|
3
|
+
|
|
4
|
+
import { WebdriverIOPageElement } from '../WebdriverIOPageElement';
|
|
5
|
+
import { WebdriverIONativeElementRoot } from './WebdriverIONativeElementRoot';
|
|
6
|
+
|
|
7
|
+
export class WebdriverIOLocator<Selector_Type extends Selector> extends Locator<wdio.Element<'async'>, WebdriverIONativeElementRoot, Selector_Type> {
|
|
8
|
+
|
|
9
|
+
static createRootLocator<ST extends Selector>(browser: WebdriverIONativeElementRoot, selector: ST, webdriverioSelector: string): WebdriverIOLocator<ST> {
|
|
10
|
+
return new WebdriverIOLocator(
|
|
11
|
+
() => browser,
|
|
12
|
+
selector,
|
|
13
|
+
(root: WebdriverIONativeElementRoot) => root.$(webdriverioSelector) as unknown as wdio.Element<'async'>,
|
|
14
|
+
(root: WebdriverIONativeElementRoot) => root.$$(webdriverioSelector)
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
of(parent: WebdriverIOLocator<unknown>): Locator<wdio.Element<'async'>, WebdriverIONativeElementRoot, Selector_Type> {
|
|
19
|
+
return new WebdriverIOLocator(
|
|
20
|
+
() => parent.nativeElement(),
|
|
21
|
+
this.selector,
|
|
22
|
+
(parentRoot: WebdriverIONativeElementRoot) => this.locateElement(parentRoot),
|
|
23
|
+
(parentRoot: WebdriverIONativeElementRoot) => this.locateAllElements(parentRoot),
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
element(): PageElement<wdio.Element<'async'>> {
|
|
28
|
+
return new WebdriverIOPageElement(this);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async allElements(): Promise<Array<PageElement<wdio.Element<'async'>>>> {
|
|
32
|
+
const elements = await this.locateAllElements(await this.parentRoot());
|
|
33
|
+
|
|
34
|
+
return elements.map(childElement =>
|
|
35
|
+
new WebdriverIOPageElement(new WebdriverIOLocator(
|
|
36
|
+
() => this.parentRoot(),
|
|
37
|
+
this.selector,
|
|
38
|
+
() => childElement,
|
|
39
|
+
() => [ childElement ],
|
|
40
|
+
))
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
File without changes
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { NativeElementLocator, Selector } from '@serenity-js/web';
|
|
2
|
-
import * as wdio from 'webdriverio';
|
|
3
|
-
import { WebdriverIONativeElementRoot } from './WebdriverIONativeElementRoot';
|
|
4
|
-
export declare class WebdriverIONativeElementLocator implements NativeElementLocator<wdio.Element<'async'>> {
|
|
5
|
-
private readonly resolver;
|
|
6
|
-
constructor(resolver: () => Promise<WebdriverIONativeElementRoot> | WebdriverIONativeElementRoot);
|
|
7
|
-
/**
|
|
8
|
-
* @desc
|
|
9
|
-
* Retrieves a {@link @serenity-js/web/lib/screenplay/models~PageElement} which text includes `text`
|
|
10
|
-
* and which can be located using the CSS `selector`.
|
|
11
|
-
*
|
|
12
|
-
* Under the hood, this command uses https://webdriver.io/docs/selectors#element-with-certain-text
|
|
13
|
-
*
|
|
14
|
-
* This means that only some selectors are supported. For example:
|
|
15
|
-
* - 'h1'
|
|
16
|
-
* - 'h1.some-class'
|
|
17
|
-
* - '#someId'
|
|
18
|
-
* - 'h1[attribute-name="attribute-selector"]
|
|
19
|
-
*
|
|
20
|
-
* Notably, complex CSS selectors such as 'header h1' or 'header > h1' **WON'T WORK**.
|
|
21
|
-
*
|
|
22
|
-
* @param {Selector<T>} selector
|
|
23
|
-
* @returns {Promise<wdio.Element<'async'>>}
|
|
24
|
-
*/
|
|
25
|
-
locate<T>(selector: Selector<T>): Promise<wdio.Element<'async'>>;
|
|
26
|
-
locateAll<T>(selector: Selector<T>): Promise<Array<wdio.Element<'async'>>>;
|
|
27
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebdriverIONativeElementLocator = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const web_1 = require("@serenity-js/web");
|
|
6
|
-
const tiny_types_1 = require("tiny-types");
|
|
7
|
-
const f = (0, core_1.format)({ markQuestions: false });
|
|
8
|
-
class WebdriverIONativeElementLocator {
|
|
9
|
-
constructor(resolver) {
|
|
10
|
-
this.resolver = resolver;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* @desc
|
|
14
|
-
* Retrieves a {@link @serenity-js/web/lib/screenplay/models~PageElement} which text includes `text`
|
|
15
|
-
* and which can be located using the CSS `selector`.
|
|
16
|
-
*
|
|
17
|
-
* Under the hood, this command uses https://webdriver.io/docs/selectors#element-with-certain-text
|
|
18
|
-
*
|
|
19
|
-
* This means that only some selectors are supported. For example:
|
|
20
|
-
* - 'h1'
|
|
21
|
-
* - 'h1.some-class'
|
|
22
|
-
* - '#someId'
|
|
23
|
-
* - 'h1[attribute-name="attribute-selector"]
|
|
24
|
-
*
|
|
25
|
-
* Notably, complex CSS selectors such as 'header h1' or 'header > h1' **WON'T WORK**.
|
|
26
|
-
*
|
|
27
|
-
* @param {Selector<T>} selector
|
|
28
|
-
* @returns {Promise<wdio.Element<'async'>>}
|
|
29
|
-
*/
|
|
30
|
-
async locate(selector) {
|
|
31
|
-
const resolver = await this.resolver();
|
|
32
|
-
const byLocator = (0, tiny_types_1.match)(selector)
|
|
33
|
-
.when(web_1.ByCss, (s) => s.value)
|
|
34
|
-
.when(web_1.ByCssContainingText, (s) => `${s.value}*=${s.text}`)
|
|
35
|
-
.when(web_1.ById, (s) => `#${s.value}`)
|
|
36
|
-
.when(web_1.ByTagName, (s) => `<${s.value} />`)
|
|
37
|
-
.when(web_1.ByXPath, (s) => s.value)
|
|
38
|
-
.else(() => {
|
|
39
|
-
throw new core_1.LogicError(f `Selector ${selector} not supported`);
|
|
40
|
-
});
|
|
41
|
-
return resolver.$(byLocator);
|
|
42
|
-
}
|
|
43
|
-
async locateAll(selector) {
|
|
44
|
-
const resolver = await this.resolver();
|
|
45
|
-
const byLocator = (0, tiny_types_1.match)(selector)
|
|
46
|
-
.when(web_1.ByCss, (s) => s.value)
|
|
47
|
-
.when(web_1.ByTagName, (s) => `<${s.value} />`)
|
|
48
|
-
.when(web_1.ByXPath, (s) => s.value)
|
|
49
|
-
.else(() => {
|
|
50
|
-
throw new core_1.LogicError(f `Selector ${selector} not supported`);
|
|
51
|
-
});
|
|
52
|
-
return resolver.$$(byLocator);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.WebdriverIONativeElementLocator = WebdriverIONativeElementLocator;
|
|
56
|
-
//# sourceMappingURL=WebdriverIONativeElementLocator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebdriverIONativeElementLocator.js","sourceRoot":"","sources":["../../../src/screenplay/models/WebdriverIONativeElementLocator.ts"],"names":[],"mappings":";;;AAAA,4CAAuD;AACvD,0CAAwH;AACxH,2CAAmC;AAKnC,MAAM,CAAC,GAAG,IAAA,aAAM,EAAC,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;AAE3C,MAAa,+BAA+B;IACxC,YAA6B,QAAoF;QAApF,aAAQ,GAAR,QAAQ,CAA4E;IACjH,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,MAAM,CAAI,QAAqB;QACjC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QAEvC,MAAM,SAAS,GAAG,IAAA,kBAAK,EAA4B,QAAQ,CAAC;aACvD,IAAI,CAAC,WAAK,EAAE,CAAC,CAAQ,EAAE,EAAE,CACtB,CAAC,CAAC,KAAK,CACV;aACA,IAAI,CAAC,yBAAmB,EAAE,CAAC,CAAsB,EAAE,EAAE,CAClD,GAAI,CAAC,CAAC,KAAM,KAAM,CAAC,CAAC,IAAK,EAAE,CAC9B;aACA,IAAI,CAAC,UAAI,EAAE,CAAC,CAAO,EAAE,EAAE,CACpB,IAAK,CAAC,CAAC,KAAM,EAAE,CAClB;aACA,IAAI,CAAC,eAAS,EAAE,CAAC,CAAY,EAAE,EAAE,CAC9B,IAAK,CAAC,CAAC,KAAM,KAAK,CACrB;aACA,IAAI,CAAC,aAAO,EAAE,CAAC,CAAU,EAAE,EAAE,CAC1B,CAAC,CAAC,KAAK,CACV;aACA,IAAI,CAAC,GAAG,EAAE;YACP,MAAM,IAAI,iBAAU,CAAC,CAAC,CAAA,YAAa,QAAS,gBAAgB,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEP,OAAO,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,SAAS,CAAI,QAAqB;QACpC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QAEvC,MAAM,SAAS,GAAG,IAAA,kBAAK,EAA4B,QAAQ,CAAC;aACvD,IAAI,CAAC,WAAK,EAAE,CAAC,CAAQ,EAAE,EAAE,CACtB,CAAC,CAAC,KAAK,CACV;aACA,IAAI,CAAC,eAAS,EAAE,CAAC,CAAY,EAAE,EAAE,CAC9B,IAAK,CAAC,CAAC,KAAM,KAAK,CACrB;aACA,IAAI,CAAC,aAAO,EAAE,CAAC,CAAU,EAAE,EAAE,CAC1B,CAAC,CAAC,KAAK,CACV;aACA,IAAI,CAAC,GAAG,EAAE;YACP,MAAM,IAAI,iBAAU,CAAC,CAAC,CAAA,YAAa,QAAS,gBAAgB,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;QAEP,OAAO,QAAQ,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;CACJ;AAnED,0EAmEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebdriverIONativeElementRoot.js","sourceRoot":"","sources":["../../../src/screenplay/models/WebdriverIONativeElementRoot.ts"],"names":[],"mappings":""}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { format, LogicError } from '@serenity-js/core';
|
|
2
|
-
import { ByCss, ByCssContainingText, ById, ByTagName, ByXPath, NativeElementLocator, Selector } from '@serenity-js/web';
|
|
3
|
-
import { match } from 'tiny-types';
|
|
4
|
-
import * as wdio from 'webdriverio';
|
|
5
|
-
|
|
6
|
-
import { WebdriverIONativeElementRoot } from './WebdriverIONativeElementRoot';
|
|
7
|
-
|
|
8
|
-
const f = format({ markQuestions: false });
|
|
9
|
-
|
|
10
|
-
export class WebdriverIONativeElementLocator implements NativeElementLocator<wdio.Element<'async'>> {
|
|
11
|
-
constructor(private readonly resolver: () => Promise<WebdriverIONativeElementRoot> | WebdriverIONativeElementRoot) {
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @desc
|
|
16
|
-
* Retrieves a {@link @serenity-js/web/lib/screenplay/models~PageElement} which text includes `text`
|
|
17
|
-
* and which can be located using the CSS `selector`.
|
|
18
|
-
*
|
|
19
|
-
* Under the hood, this command uses https://webdriver.io/docs/selectors#element-with-certain-text
|
|
20
|
-
*
|
|
21
|
-
* This means that only some selectors are supported. For example:
|
|
22
|
-
* - 'h1'
|
|
23
|
-
* - 'h1.some-class'
|
|
24
|
-
* - '#someId'
|
|
25
|
-
* - 'h1[attribute-name="attribute-selector"]
|
|
26
|
-
*
|
|
27
|
-
* Notably, complex CSS selectors such as 'header h1' or 'header > h1' **WON'T WORK**.
|
|
28
|
-
*
|
|
29
|
-
* @param {Selector<T>} selector
|
|
30
|
-
* @returns {Promise<wdio.Element<'async'>>}
|
|
31
|
-
*/
|
|
32
|
-
async locate<T>(selector: Selector<T>): Promise<wdio.Element<'async'>> {
|
|
33
|
-
const resolver = await this.resolver();
|
|
34
|
-
|
|
35
|
-
const byLocator = match<Selector<unknown>, string>(selector)
|
|
36
|
-
.when(ByCss, (s: ByCss) =>
|
|
37
|
-
s.value,
|
|
38
|
-
)
|
|
39
|
-
.when(ByCssContainingText, (s: ByCssContainingText) =>
|
|
40
|
-
`${ s.value }*=${ s.text }`,
|
|
41
|
-
)
|
|
42
|
-
.when(ById, (s: ById) =>
|
|
43
|
-
`#${ s.value }`,
|
|
44
|
-
)
|
|
45
|
-
.when(ByTagName, (s: ByTagName) =>
|
|
46
|
-
`<${ s.value } />`,
|
|
47
|
-
)
|
|
48
|
-
.when(ByXPath, (s: ByXPath) =>
|
|
49
|
-
s.value,
|
|
50
|
-
)
|
|
51
|
-
.else(() => {
|
|
52
|
-
throw new LogicError(f`Selector ${ selector } not supported`);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
return resolver.$(byLocator);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
async locateAll<T>(selector: Selector<T>): Promise<Array<wdio.Element<'async'>>> {
|
|
59
|
-
const resolver = await this.resolver();
|
|
60
|
-
|
|
61
|
-
const byLocator = match<Selector<unknown>, string>(selector)
|
|
62
|
-
.when(ByCss, (s: ByCss) =>
|
|
63
|
-
s.value,
|
|
64
|
-
)
|
|
65
|
-
.when(ByTagName, (s: ByTagName) =>
|
|
66
|
-
`<${ s.value } />`,
|
|
67
|
-
)
|
|
68
|
-
.when(ByXPath, (s: ByXPath) =>
|
|
69
|
-
s.value,
|
|
70
|
-
)
|
|
71
|
-
.else(() => {
|
|
72
|
-
throw new LogicError(f`Selector ${ selector } not supported`);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
return resolver.$$(byLocator);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|