@serenity-js/web 3.0.0-rc.13 → 3.0.0-rc.14
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 +171 -0
- package/lib/errors/index.js +5 -1
- package/lib/errors/index.js.map +1 -1
- package/lib/expectations/index.js +5 -1
- package/lib/expectations/index.js.map +1 -1
- package/lib/expectations/isVisible.d.ts +4 -1
- package/lib/expectations/isVisible.js +4 -1
- package/lib/expectations/isVisible.js.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/input/index.js +5 -1
- package/lib/input/index.js.map +1 -1
- package/lib/screenplay/abilities/index.js +5 -1
- package/lib/screenplay/abilities/index.js.map +1 -1
- package/lib/screenplay/index.js +5 -1
- package/lib/screenplay/index.js.map +1 -1
- package/lib/screenplay/interactions/index.js +5 -1
- package/lib/screenplay/interactions/index.js.map +1 -1
- package/lib/screenplay/models/PageElement.d.ts +9 -0
- package/lib/screenplay/models/PageElement.js +1 -2
- package/lib/screenplay/models/PageElement.js.map +1 -1
- package/lib/screenplay/models/PageElements.js +2 -2
- package/lib/screenplay/models/PageElements.js.map +1 -1
- package/lib/screenplay/models/index.js +5 -1
- package/lib/screenplay/models/index.js.map +1 -1
- package/lib/screenplay/models/selectors/index.js +5 -1
- package/lib/screenplay/models/selectors/index.js.map +1 -1
- package/lib/screenplay/questions/Attribute.d.ts +62 -25
- package/lib/screenplay/questions/Attribute.js +68 -27
- package/lib/screenplay/questions/Attribute.js.map +1 -1
- package/lib/screenplay/questions/CssClasses.d.ts +70 -26
- package/lib/screenplay/questions/CssClasses.js +76 -30
- package/lib/screenplay/questions/CssClasses.js.map +1 -1
- package/lib/screenplay/questions/Selected.d.ts +5 -5
- package/lib/screenplay/questions/Selected.js +2 -2
- package/lib/screenplay/questions/Selected.js.map +1 -1
- package/lib/screenplay/questions/Text.d.ts +22 -18
- package/lib/screenplay/questions/Text.js +61 -19
- package/lib/screenplay/questions/Text.js.map +1 -1
- package/lib/screenplay/questions/Value.d.ts +55 -16
- package/lib/screenplay/questions/Value.js +59 -18
- package/lib/screenplay/questions/Value.js.map +1 -1
- package/lib/screenplay/questions/index.js +5 -1
- package/lib/screenplay/questions/index.js.map +1 -1
- package/lib/stage/crew/index.js +5 -1
- package/lib/stage/crew/index.js.map +1 -1
- package/lib/stage/crew/photographer/index.js +5 -1
- package/lib/stage/crew/photographer/index.js.map +1 -1
- package/lib/stage/crew/photographer/strategies/index.js +5 -1
- package/lib/stage/crew/photographer/strategies/index.js.map +1 -1
- package/lib/stage/index.js +5 -1
- package/lib/stage/index.js.map +1 -1
- package/package.json +6 -6
- package/src/expectations/isVisible.ts +4 -1
- package/src/screenplay/models/PageElement.ts +11 -2
- package/src/screenplay/models/PageElements.ts +3 -3
- package/src/screenplay/questions/Attribute.ts +85 -34
- package/src/screenplay/questions/CssClasses.ts +82 -30
- package/src/screenplay/questions/Selected.ts +7 -7
- package/src/screenplay/questions/Text.ts +80 -25
- package/src/screenplay/questions/Value.ts +67 -20
- package/lib/screenplay/questions/ElementQuestion.d.ts +0 -33
- package/lib/screenplay/questions/ElementQuestion.js +0 -53
- package/lib/screenplay/questions/ElementQuestion.js.map +0 -1
- package/src/screenplay/questions/ElementQuestion.ts +0 -58
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,177 @@
|
|
|
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.14](https://github.com/serenity-js/serenity-js/compare/v2.33.3...v3.0.0-rc.14) (2022-03-28)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **web:** auto-generated descriptions of nested PageElements are easier to read ([5a51d91](https://github.com/serenity-js/serenity-js/commit/5a51d91f0abb1c32814c219a44da51d52df77f87))
|
|
12
|
+
* **web:** corrected return types of question about Selected page elements ([b32f280](https://github.com/serenity-js/serenity-js/commit/b32f2809b018d6791a37fd80a226ca16a822b9b6))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **web:** Attribute.called(name).of(pageElement) returns a QuestionAdapter ([e220665](https://github.com/serenity-js/serenity-js/commit/e220665de37f15d4cfc8ad570bfa7b804d71335b))
|
|
18
|
+
* **web:** CssClasses.of(pageElement) returns a QuestionAdapter ([0942887](https://github.com/serenity-js/serenity-js/commit/0942887eb8e726dce3b8d64a7f9162ec782e61b7))
|
|
19
|
+
* **web:** Value.of(pageElement) returns a QuestionAdapter ([c45b483](https://github.com/serenity-js/serenity-js/commit/c45b483be071d297dc41e6b098a03f5697d53050))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# [3.0.0-rc.13](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.12...v3.0.0-rc.13) (2022-03-02)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
### Features
|
|
27
|
+
|
|
28
|
+
* **web:** combined Frame and PageElement so they can be Switch-ed to ([1b7ab7c](https://github.com/serenity-js/serenity-js/commit/1b7ab7c828034a14ba801cbfa97acc203fd55adf)), closes [#82](https://github.com/serenity-js/serenity-js/issues/82) [#227](https://github.com/serenity-js/serenity-js/issues/227) [#233](https://github.com/serenity-js/serenity-js/issues/233) [#365](https://github.com/serenity-js/serenity-js/issues/365)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# [3.0.0-rc.12](https://github.com/serenity-js/serenity-js/compare/v2.33.2...v3.0.0-rc.12) (2022-02-23)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# [3.0.0-rc.11](https://github.com/serenity-js/serenity-js/compare/v2.33.1...v3.0.0-rc.11) (2022-02-13)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* **web:** made the constructor of BrowseTheWeb protected, since it's an abstract class ([dbfbed0](https://github.com/serenity-js/serenity-js/commit/dbfbed02923bc1c589e588429c163ffbc7b13a34))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### Features
|
|
45
|
+
|
|
46
|
+
* **web:** support for working with frames and an interaction to Switch.to(frameOrPage) ([ef73ef2](https://github.com/serenity-js/serenity-js/commit/ef73ef273f8a17e48d396d5ef03f6b761b136c9a)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# [3.0.0-rc.10](https://github.com/serenity-js/serenity-js/compare/v2.33.0...v3.0.0-rc.10) (2022-02-03)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# [3.0.0-rc.9](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.8...v3.0.0-rc.9) (2022-02-01)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# [3.0.0-rc.8](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.7...v3.0.0-rc.8) (2022-01-28)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
# [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)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Features
|
|
66
|
+
|
|
67
|
+
* **assertions:** isPresent works with any Optional ([cea75dc](https://github.com/serenity-js/serenity-js/commit/cea75dc1c728e45e06a87aaf9c1573a237334285)), closes [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
68
|
+
* **core:** `f` and `d` question description formatters ([c9f3fad](https://github.com/serenity-js/serenity-js/commit/c9f3fadd86ec0196f2cdbf76d9628bbef0a3fcba))
|
|
69
|
+
* **core:** replaced `Adapter` with `QuestionAdapter` and introduced `Optional` ([8d84ad3](https://github.com/serenity-js/serenity-js/commit/8d84ad3863e3c726533d0f21934fb1e2fa8b3022)), closes [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
70
|
+
* **core:** support for Optional chaining, expectation isPresent, refactored Expectations ([1841ee5](https://github.com/serenity-js/serenity-js/commit/1841ee5fc48cfa403ddc53358f75764d9a010c21)), closes [#1099](https://github.com/serenity-js/serenity-js/issues/1099) [#1099](https://github.com/serenity-js/serenity-js/issues/1099) [#1103](https://github.com/serenity-js/serenity-js/issues/1103)
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
# [3.0.0-rc.6](https://github.com/serenity-js/serenity-js/compare/v2.32.7...v3.0.0-rc.6) (2022-01-10)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# [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)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Features
|
|
82
|
+
|
|
83
|
+
* **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)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# [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)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### Features
|
|
91
|
+
|
|
92
|
+
* **web:** ElementExpectation makes it easier to define custom PageElement-related Expectations ([92ebf7d](https://github.com/serenity-js/serenity-js/commit/92ebf7db720d0fe88ddbe17b9958fa993b1fd02e))
|
|
93
|
+
* **web:** Text.ofAll accepts mapped PageElements ([5314246](https://github.com/serenity-js/serenity-js/commit/5314246305fa3f62446d5ec718f36354152be68d))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# [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)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
### Bug Fixes
|
|
101
|
+
|
|
102
|
+
* **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)
|
|
103
|
+
* **deps:** updated tiny-types to 1.17.0 ([3187051](https://github.com/serenity-js/serenity-js/commit/3187051594158b4b450c82e851e417fd2ed21652))
|
|
104
|
+
* **web:** corrected synchronisation in Web questions and interactions ([c3a0ad1](https://github.com/serenity-js/serenity-js/commit/c3a0ad16de311e71d7e82e4f463baa0ca6b18863))
|
|
105
|
+
* **web:** Photographer skips taking a screenshot if the Window is closed (DevTools protocol) ([b682577](https://github.com/serenity-js/serenity-js/commit/b682577ad649046fc1a4cd61a7315e11d60dcf32))
|
|
106
|
+
* **web:** refactored Selector and NativeElementLocator classes to simplify the implementation ([f0c8f11](https://github.com/serenity-js/serenity-js/commit/f0c8f113433958877d36f13d0bc7f355ea68d280))
|
|
107
|
+
* **web:** simplified the selectors ([b167e42](https://github.com/serenity-js/serenity-js/commit/b167e422eb66556845c31d5847b9fd33b707c764)), closes [#1074](https://github.com/serenity-js/serenity-js/issues/1074)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
### Features
|
|
111
|
+
|
|
112
|
+
* **core:** new implementation of List.where filters ([45b3c80](https://github.com/serenity-js/serenity-js/commit/45b3c8080ca467ac6362e5217e7899ca36a04cdc)), closes [#1074](https://github.com/serenity-js/serenity-js/issues/1074)
|
|
113
|
+
* **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))
|
|
114
|
+
* **web:** new PageElement retrieval model based on Selectors ([48bd94f](https://github.com/serenity-js/serenity-js/commit/48bd94f3c29707b66dcf81a7522f7529b6f9fcfb))
|
|
115
|
+
* **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)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
# [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)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# [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)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# [3.0.0-rc.0](https://github.com/serenity-js/serenity-js/compare/v2.32.5...v3.0.0-rc.0) (2021-12-08)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### Bug Fixes
|
|
131
|
+
|
|
132
|
+
* **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)
|
|
133
|
+
* **core:** renamed "Model" type to "Adapter" to better reflect its purpose ([b4ea7a1](https://github.com/serenity-js/serenity-js/commit/b4ea7a100fac2c896990bf15cbc906de641196b8)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
134
|
+
* **web:** added missing export ([c5ffc0a](https://github.com/serenity-js/serenity-js/commit/c5ffc0a83905c99ea0020577503170c427fdb9f2)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
135
|
+
* **webdriverio:** separated UIElement.hoverOver from UIElement.scrollIntoView ([cf4ca2c](https://github.com/serenity-js/serenity-js/commit/cf4ca2c531e0f90f9a27917e322359c13bfbc6e6))
|
|
136
|
+
* **web:** ensure all Web interactions extend the same base class ([b358c0b](https://github.com/serenity-js/serenity-js/commit/b358c0b67c1de11af63e1e2142d3613692769cd6))
|
|
137
|
+
* **web:** fixed the interaction to Select ([10b7b74](https://github.com/serenity-js/serenity-js/commit/10b7b7446743b5866a1b458577ea7d2e11bf5a8f))
|
|
138
|
+
* **web:** optimised PhotoTakingStrategy ([085b7f7](https://github.com/serenity-js/serenity-js/commit/085b7f716033b22207af47edac58c896f46af62d))
|
|
139
|
+
* **web:** removed incorrect export ([ebf80c0](https://github.com/serenity-js/serenity-js/commit/ebf80c019af4db2a847e4b98599bce02b8acef23))
|
|
140
|
+
* **web:** removed incorrect import ([90cb025](https://github.com/serenity-js/serenity-js/commit/90cb0251a00a7bff098376110dcec2f9f2c5d5c0))
|
|
141
|
+
* **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)
|
|
142
|
+
* **web:** renamed Element and associated classes to PageElement to avoid name conflicts ([1e4204b](https://github.com/serenity-js/serenity-js/commit/1e4204b5507469e6574c87a6d84454e39e8a813e))
|
|
143
|
+
* **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)
|
|
144
|
+
* **web:** standardised getters across PageElement implementations ([336472b](https://github.com/serenity-js/serenity-js/commit/336472b1a6882412f6a88483e51266909a1d51d0))
|
|
145
|
+
* **web:** wordsmithing of interface names ([5a1e76a](https://github.com/serenity-js/serenity-js/commit/5a1e76a9c162370e17238fcccc9f08e109d543c3))
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
### Features
|
|
149
|
+
|
|
150
|
+
* **core:** question.about produces "props" that proxy the methods of the underlying model ([f771872](https://github.com/serenity-js/serenity-js/commit/f771872c56b487e404002c3800fc8f3baaed804f))
|
|
151
|
+
* **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)
|
|
152
|
+
* **web:** a common way to run the tests for all the web adapters ([c7e584a](https://github.com/serenity-js/serenity-js/commit/c7e584a9bf288ebc7781affdb720097527e8ed3a))
|
|
153
|
+
* **web:** added Page.viewportSize and Page.setViewportSize methods ([4cabbe2](https://github.com/serenity-js/serenity-js/commit/4cabbe21a7fbac3457c6a6ea3d4442a62c3f1f3c))
|
|
154
|
+
* **web:** all Screenplay APIs migrated from @serenity-js/webdriverio to @serenity-js/web ([7b6b95d](https://github.com/serenity-js/serenity-js/commit/7b6b95dc255446c29ae213ba2a1d142d426d16c8))
|
|
155
|
+
* **webdriverio:** support for native WebdriverIO services ([8d5ad22](https://github.com/serenity-js/serenity-js/commit/8d5ad22594cdb2ebddedc58a30259ca8430e360c))
|
|
156
|
+
* **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)
|
|
157
|
+
* **web:** introduced UIElementQuestion to help ensure no NPEs in UI-related questions ([fe29121](https://github.com/serenity-js/serenity-js/commit/fe29121118d630e9fbd73dca85496e20948e26e0))
|
|
158
|
+
* **web:** migrated Photographer from @serenity-js/protractor to @serenity-js/web ([4506dac](https://github.com/serenity-js/serenity-js/commit/4506dacebdf955c32c4eff17bf9982c8e45e2925)), closes [#805](https://github.com/serenity-js/serenity-js/issues/805)
|
|
159
|
+
* **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)
|
|
160
|
+
* **web:** new module @serenity-js/web to provide Web-related Screenplay Pattern APIs ([bead861](https://github.com/serenity-js/serenity-js/commit/bead8612af1a5c99b775e680a3904f44d0281cf9))
|
|
161
|
+
* **web:** page provides an abstraction around browser window ([2e70a3b](https://github.com/serenity-js/serenity-js/commit/2e70a3b6af2e8cc49255820e8a1aaffcc71b76a8))
|
|
162
|
+
* **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)
|
|
163
|
+
* **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)
|
|
164
|
+
* **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)
|
|
165
|
+
* **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)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
### BREAKING CHANGES
|
|
169
|
+
|
|
170
|
+
* **core:** Introduced @serenity-js/web - a shared library for Serenity/JS Web integration
|
|
171
|
+
modules such as @serenity-js/protractor and @serenity-js/webdriverio. Dropped support for Node 12.
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
6
177
|
# [3.0.0-rc.13](https://github.com/serenity-js/serenity-js/compare/v3.0.0-rc.12...v3.0.0-rc.13) (2022-03-02)
|
|
7
178
|
|
|
8
179
|
|
package/lib/errors/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/errors/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/expectations/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/expectations/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,6CAA2B;AAC3B,gDAA8B;AAC9B,8CAA4B;AAC5B,+CAA6B;AAC7B,8CAA4B"}
|
|
@@ -2,7 +2,10 @@ import { Expectation } from '@serenity-js/core';
|
|
|
2
2
|
import { PageElement } from '../screenplay';
|
|
3
3
|
/**
|
|
4
4
|
* @desc
|
|
5
|
-
* Expectation that the element is present in the DOM of the page and
|
|
5
|
+
* Expectation that the element is present in the DOM of the page and:
|
|
6
|
+
* - is not hidden, so doesn't have `display: none`, `visibility: hidden` or `opacity: 0`
|
|
7
|
+
* - is within the browser viewport
|
|
8
|
+
* - doesn't have its centre covered by other elements
|
|
6
9
|
*
|
|
7
10
|
* @returns {@serenity-js/core/lib/screenplay/questions~Expectation<boolean, Element<'async'>>}
|
|
8
11
|
*
|
|
@@ -4,7 +4,10 @@ exports.isVisible = void 0;
|
|
|
4
4
|
const ElementExpectation_1 = require("./ElementExpectation");
|
|
5
5
|
/**
|
|
6
6
|
* @desc
|
|
7
|
-
* Expectation that the element is present in the DOM of the page and
|
|
7
|
+
* Expectation that the element is present in the DOM of the page and:
|
|
8
|
+
* - is not hidden, so doesn't have `display: none`, `visibility: hidden` or `opacity: 0`
|
|
9
|
+
* - is within the browser viewport
|
|
10
|
+
* - doesn't have its centre covered by other elements
|
|
8
11
|
*
|
|
9
12
|
* @returns {@serenity-js/core/lib/screenplay/questions~Expectation<boolean, Element<'async'>>}
|
|
10
13
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isVisible.js","sourceRoot":"","sources":["../../src/expectations/isVisible.ts"],"names":[],"mappings":";;;AAGA,6DAA0D;AAE1D
|
|
1
|
+
{"version":3,"file":"isVisible.js","sourceRoot":"","sources":["../../src/expectations/isVisible.ts"],"names":[],"mappings":";;;AAGA,6DAA0D;AAE1D;;;;;;;;;;;;;GAaG;AACH,SAAgB,SAAS;IACrB,OAAO,uCAAkB,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC;AAC3F,CAAC;AAFD,8BAEC"}
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,iDAA+B;AAC/B,0CAAwB;AACxB,+CAA6B;AAC7B,0CAAwB"}
|
package/lib/input/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/input/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/input/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/input/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,iDAA+B"}
|
package/lib/screenplay/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/screenplay/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/screenplay/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,iDAA+B;AAC/B,2CAAyB;AACzB,8CAA4B"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,gDAA8B;AAC9B,0CAAwB;AACxB,kDAAgC;AAChC,0CAAwB;AACxB,6CAA2B;AAC3B,0CAAwB;AACxB,iDAA+B;AAC/B,+CAA6B;AAC7B,2CAAyB;AACzB,2CAAyB;AACzB,kDAAgC;AAChC,2CAAyB;AACzB,mDAAiC;AACjC,yCAAuB"}
|
|
@@ -49,5 +49,14 @@ export declare abstract class PageElement<Native_Element_Type = any> implements
|
|
|
49
49
|
*/
|
|
50
50
|
abstract isPresent(): Promise<boolean>;
|
|
51
51
|
abstract isSelected(): Promise<boolean>;
|
|
52
|
+
/**
|
|
53
|
+
* @desc
|
|
54
|
+
* Checks if the PageElement:
|
|
55
|
+
* - is not hidden, so doesn't have CSS style like `display: none`, `visibility: hidden` or `opacity: 0`
|
|
56
|
+
* - is within the browser viewport
|
|
57
|
+
* - doesn't have its centre covered by other elements
|
|
58
|
+
*
|
|
59
|
+
* @returns {Promise<boolean>}
|
|
60
|
+
*/
|
|
52
61
|
abstract isVisible(): Promise<boolean>;
|
|
53
62
|
}
|
|
@@ -15,9 +15,8 @@ class PageElement {
|
|
|
15
15
|
return abilities_1.BrowseTheWeb.as(actor).locate(bySelector).element();
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
|
-
// todo: review usages and consider removing if not used
|
|
19
18
|
static of(childElement, parentElement) {
|
|
20
|
-
return core_1.Question.about((0, core_1.d) `${childElement} of ${parentElement}
|
|
19
|
+
return core_1.Question.about((0, core_1.d) `${childElement} of ${parentElement}`, async (actor) => {
|
|
21
20
|
const child = await actor.answer(childElement);
|
|
22
21
|
const parent = await actor.answer(parentElement);
|
|
23
22
|
return child.of(parent);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageElement.js","sourceRoot":"","sources":["../../../src/screenplay/models/PageElement.ts"],"names":[],"mappings":";;;AAAA,4CAAuF;AACvF,2CAA+C;AAE/C,4CAA4C;AAM5C,MAAsB,WAAW;
|
|
1
|
+
{"version":3,"file":"PageElement.js","sourceRoot":"","sources":["../../../src/screenplay/models/PageElement.ts"],"names":[],"mappings":";;;AAAA,4CAAuF;AACvF,2CAA+C;AAE/C,4CAA4C;AAM5C,MAAsB,WAAW;IAkB7B,YAA4B,OAAqC;QAArC,YAAO,GAAP,OAAO,CAA8B;QAC7D,IAAA,mBAAM,EAAC,wBAAwB,EAAE,OAAO,EAAE,IAAA,sBAAS,GAAE,CAAC,CAAC;IAC3D,CAAC;IAlBD,MAAM,CAAC,OAAO,CAAM,QAA8B;QAC9C,OAAO,eAAQ,CAAC,KAAK,CAAC,IAAA,QAAC,EAAA,wBAAyB,QAAS,EAAE,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YACvE,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAChD,OAAO,wBAAY,CAAC,EAAE,CAAM,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,OAAO,EAAE,CAAC;QACpE,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,EAAE,CAAM,YAA0C,EAAE,aAA2C;QAClG,OAAO,eAAQ,CAAC,KAAK,CAAC,IAAA,QAAC,EAAA,GAAI,YAAa,OAAQ,aAAc,EAAE,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YAC5E,MAAM,KAAK,GAAO,MAAM,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACnD,MAAM,MAAM,GAAM,MAAM,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YAEpD,OAAO,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC;IAQD,KAAK,CAAC,aAAa;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACxC,CAAC;IAED,QAAQ;QACJ,OAAO,uBAAwB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAG,EAAE,CAAC;IAC9D,CAAC;CAwDJ;AAtFD,kCAsFC"}
|
|
@@ -16,7 +16,7 @@ class PageElements extends core_1.List {
|
|
|
16
16
|
}
|
|
17
17
|
of(parent) {
|
|
18
18
|
return new PageElements(relativeToParent(this.locator, parent))
|
|
19
|
-
.describedAs(
|
|
19
|
+
.describedAs(`${this.toString()} of ${parent}`);
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.PageElements = PageElements;
|
|
@@ -33,7 +33,7 @@ function relativeToDocumentRoot(selector) {
|
|
|
33
33
|
* @package
|
|
34
34
|
*/
|
|
35
35
|
function relativeToParent(relativeLocator, parent) {
|
|
36
|
-
return core_1.Question.about(relativeLocator.toString()
|
|
36
|
+
return core_1.Question.about(`${relativeLocator.toString()} of ${parent}`, async (actor) => {
|
|
37
37
|
const locator = await actor.answer(relativeLocator);
|
|
38
38
|
const parentElement = await actor.answer(parent);
|
|
39
39
|
return locator.of(parentElement.locator);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageElements.js","sourceRoot":"","sources":["../../../src/screenplay/models/PageElements.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"PageElements.js","sourceRoot":"","sources":["../../../src/screenplay/models/PageElements.ts"],"names":[],"mappings":";;;AAAA,4CAA6E;AAE7E,4CAA4C;AAK5C,MAAa,YACT,SAAQ,WAAsC;IAO9C;;OAEG;IACH,YAA+B,OAAwD;QACnF,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;QADH,YAAO,GAAP,OAAO,CAAiD;IAEvF,CAAC;IATD,MAAM,CAAC,OAAO,CAAM,QAA8B;QAC9C,OAAO,IAAI,YAAY,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9D,CAAC;IASD,EAAE,CAAC,MAAoD;QACnD,OAAO,IAAI,YAAY,CAAsB,gBAAgB,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;aAC/E,WAAW,CAAC,GAAI,IAAI,CAAC,QAAQ,EAAG,OAAQ,MAAO,EAAE,CAAC,CAAC;IAC5D,CAAC;CACJ;AAnBD,oCAmBC;AAED;;GAEG;AACH,SAAS,sBAAsB,CAAsB,QAA8B;IAC/E,OAAO,eAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;QACrD,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChD,OAAO,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CAAsB,eAAyD,EAAE,MAAoD;IAC1J,OAAO,eAAQ,CAAC,KAAK,CAAC,GAAI,eAAe,CAAC,QAAQ,EAAG,OAAQ,MAAO,EAAE,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;QAClF,MAAM,OAAO,GAA6C,MAAM,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;QAC9F,MAAM,aAAa,GAAuC,MAAM,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAErF,OAAO,OAAO,CAAC,EAAE,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,SAAS,aAAa,CAAsB,OAAwD;IAChG,OAAO,eAAQ,CAAC,KAAK,CAAC,yBAA0B,OAAO,CAAC,QAAQ,EAAG,EAAE,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;QACjF,MAAM,QAAQ,GAAiC,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC3E,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/models/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,+CAA6B;AAC7B,4CAA0B;AAC1B,gDAA8B;AAC9B,yCAAuB;AACvB,gDAA8B;AAC9B,iDAA+B;AAC/B,8CAA4B;AAC5B,+CAA6B;AAC7B,qDAAmC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/screenplay/models/selectors/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/screenplay/models/selectors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uCAAqB;AACrB,0CAAwB;AACxB,wDAAsC;AACtC,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,6CAA2B"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, MetaQuestion, Question, UsesAbilities } from '@serenity-js/core';
|
|
1
|
+
import { Answerable, AnswersQuestions, MetaQuestion, Question, QuestionAdapter, UsesAbilities } from '@serenity-js/core';
|
|
2
2
|
import { PageElement } from '../models';
|
|
3
|
-
import { ElementQuestion } from './ElementQuestion';
|
|
4
3
|
/**
|
|
5
4
|
* @desc
|
|
6
|
-
* Returns the value of the
|
|
7
|
-
* represented by Answerable<{@link @wdio/types~Element}>
|
|
5
|
+
* Returns the value of the specified HTML attribute of a given {@link PageElement}.
|
|
8
6
|
*
|
|
9
7
|
* @example <caption>Example widget</caption>
|
|
10
8
|
* <ul id="shopping-list" data-items-left="2">
|
|
@@ -13,37 +11,60 @@ import { ElementQuestion } from './ElementQuestion';
|
|
|
13
11
|
* <li data-state="buy">Chocolate<li>
|
|
14
12
|
* </ul>
|
|
15
13
|
*
|
|
16
|
-
* @example <caption>Retrieve
|
|
14
|
+
* @example <caption>Retrieve an HTML attribute of a given PageElement</caption>
|
|
17
15
|
* import { actorCalled } from '@serenity-js/core';
|
|
18
16
|
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
19
|
-
* import { Attribute,
|
|
17
|
+
* import { Attribute, By, PageElement } from '@serenity-js/web';
|
|
18
|
+
* import { BrowseTheWebWithWebdriverIO } from '@serenity-js/webdriverio';
|
|
20
19
|
*
|
|
21
20
|
* const shoppingList = () =>
|
|
22
|
-
*
|
|
21
|
+
* PageElement.located(By.id('shopping-list')).describedAs('shopping list');
|
|
23
22
|
*
|
|
24
23
|
* actorCalled('Lisa')
|
|
25
|
-
* .whoCan(
|
|
24
|
+
* .whoCan(BrowseTheWebWithWebdriverIO.using(browser))
|
|
26
25
|
* .attemptsTo(
|
|
27
|
-
* Ensure.that(
|
|
26
|
+
* Ensure.that(
|
|
27
|
+
* Attribute.called('data-items-left').of(shoppingList()),
|
|
28
|
+
* equals('2')
|
|
29
|
+
* ),
|
|
28
30
|
* )
|
|
29
31
|
*
|
|
30
|
-
* @example <caption>
|
|
32
|
+
* @example <caption>Using Attribute as QuestionAdapter</caption>
|
|
33
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
34
|
+
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
35
|
+
* import { Attribute, By, PageElement } from '@serenity-js/web';
|
|
36
|
+
* import { BrowseTheWebWithWebdriverIO } from '@serenity-js/webdriverio';
|
|
37
|
+
*
|
|
38
|
+
* const shoppingList = () =>
|
|
39
|
+
* PageElement.located(By.css('#shopping-list')).describedAs('shopping list')
|
|
40
|
+
*
|
|
41
|
+
* actorCalled('Lisa')
|
|
42
|
+
* .whoCan(BrowseTheWebWithWebdriverIO.using(browser))
|
|
43
|
+
* .attemptsTo(
|
|
44
|
+
* Ensure.that(
|
|
45
|
+
* Attribute.called('id').of(shoppingList()).toLocaleUpperCase(),
|
|
46
|
+
* equals('SHOPPING-LIST')
|
|
47
|
+
* ),
|
|
48
|
+
* )
|
|
49
|
+
*
|
|
50
|
+
* @example <caption>Find PageElements with a given attribute</caption>
|
|
31
51
|
* import { actorCalled } from '@serenity-js/core';
|
|
32
52
|
* import { Ensure, includes } from '@serenity-js/assertions';
|
|
33
|
-
* import { Attribute,
|
|
53
|
+
* import { Attribute, By, PageElements } from '@serenity-js/web';
|
|
54
|
+
* import { BrowseTheWebWithWebdriverIO } from '@serenity-js/webdriverio';
|
|
34
55
|
*
|
|
35
56
|
* class ShoppingList {
|
|
36
57
|
* static items = () =>
|
|
37
|
-
*
|
|
38
|
-
* .
|
|
58
|
+
* PageElements.located(By.css('#shopping-list li'))
|
|
59
|
+
* .describedAs('items');
|
|
39
60
|
*
|
|
40
61
|
* static outstandingItems = () =>
|
|
41
|
-
* ShoppingList.items
|
|
42
|
-
* .where(Attribute.called('data-state'), includes('buy'))
|
|
62
|
+
* ShoppingList.items()
|
|
63
|
+
* .where(Attribute.called('data-state'), includes('buy'));
|
|
43
64
|
* }
|
|
44
65
|
*
|
|
45
66
|
* actorCalled('Lisa')
|
|
46
|
-
* .whoCan(
|
|
67
|
+
* .whoCan(BrowseTheWebWithWebdriverIO.using(browser))
|
|
47
68
|
* .attemptsTo(
|
|
48
69
|
* Ensure.that(
|
|
49
70
|
* Text.ofAll(ShoppingList.outstandingItems()),
|
|
@@ -51,12 +72,16 @@ import { ElementQuestion } from './ElementQuestion';
|
|
|
51
72
|
* ),
|
|
52
73
|
* )
|
|
53
74
|
*
|
|
54
|
-
* @extends {
|
|
75
|
+
* @extends {@serenity-js/core/lib/screenplay~Question}
|
|
55
76
|
* @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
56
77
|
*/
|
|
57
|
-
export declare class Attribute extends
|
|
78
|
+
export declare class Attribute extends Question<Promise<string>> implements MetaQuestion<Answerable<PageElement>, Promise<string>> {
|
|
58
79
|
private readonly name;
|
|
59
80
|
private readonly element?;
|
|
81
|
+
/**
|
|
82
|
+
* @private
|
|
83
|
+
*/
|
|
84
|
+
private subject;
|
|
60
85
|
/**
|
|
61
86
|
* @param {Answerable<string>} name
|
|
62
87
|
* @returns {Attribute}
|
|
@@ -66,18 +91,30 @@ export declare class Attribute extends ElementQuestion<Promise<string>> implemen
|
|
|
66
91
|
* @param {Answerable<string>} name
|
|
67
92
|
* @param {@serenity-js/core/lib/screenplay~Answerable<Element>} [element]
|
|
68
93
|
*/
|
|
69
|
-
constructor(name: Answerable<string>, element?: Answerable<PageElement>);
|
|
94
|
+
protected constructor(name: Answerable<string>, element?: Answerable<PageElement>);
|
|
70
95
|
/**
|
|
71
96
|
* @desc
|
|
72
|
-
* Resolves to the value of
|
|
73
|
-
* located
|
|
97
|
+
* Resolves to the value of an HTML attribute of the `target` element,
|
|
98
|
+
* located within the `parent` element.
|
|
74
99
|
*
|
|
75
|
-
* @param {Answerable<PageElement>} parent
|
|
76
|
-
* @returns {
|
|
100
|
+
* @param {@serenity-js/core/lib/screenplay~Answerable<PageElement>} parent
|
|
101
|
+
* @returns {@serenity-js/core/lib/screenplay~QuestionAdapter<string>}
|
|
77
102
|
*
|
|
78
|
-
* @see {@link Target.all}
|
|
79
103
|
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
80
104
|
*/
|
|
81
|
-
of(parent: Answerable<PageElement>):
|
|
105
|
+
of(parent: Answerable<PageElement>): QuestionAdapter<string> & MetaQuestion<Answerable<PageElement>, Promise<string>>;
|
|
82
106
|
answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<string>;
|
|
107
|
+
/**
|
|
108
|
+
* @desc
|
|
109
|
+
* Changes the description of this question's subject.
|
|
110
|
+
*
|
|
111
|
+
* @param {string} subject
|
|
112
|
+
* @returns {Question<T>}
|
|
113
|
+
*/
|
|
114
|
+
describedAs(subject: string): this;
|
|
115
|
+
/**
|
|
116
|
+
* @returns {string}
|
|
117
|
+
* Returns a human-readable representation of this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
118
|
+
*/
|
|
119
|
+
toString(): string;
|
|
83
120
|
}
|