@serenity-js/webdriverio 2.33.1 → 3.0.0-rc.11
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 +455 -0
- package/lib/adapter/WebdriverIOFrameworkAdapter.js +1 -1
- package/lib/adapter/WebdriverIOFrameworkAdapter.js.map +1 -1
- package/lib/adapter/WebdriverIONotifier.d.ts +35 -1
- package/lib/adapter/WebdriverIONotifier.js +174 -13
- package/lib/adapter/WebdriverIONotifier.js.map +1 -1
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -3
- package/lib/index.js.map +1 -1
- package/lib/screenplay/abilities/{BrowseTheWeb.d.ts → BrowseTheWebWithWebdriverIO.d.ts} +42 -27
- package/lib/screenplay/abilities/{BrowseTheWeb.js → BrowseTheWebWithWebdriverIO.js} +104 -32
- package/lib/screenplay/abilities/BrowseTheWebWithWebdriverIO.js.map +1 -0
- package/lib/screenplay/abilities/index.d.ts +1 -1
- package/lib/screenplay/abilities/index.js +1 -1
- package/lib/screenplay/abilities/index.js.map +1 -1
- package/lib/screenplay/index.d.ts +1 -2
- package/lib/screenplay/index.js +1 -2
- package/lib/screenplay/index.js.map +1 -1
- package/lib/screenplay/models/WebdriverIOCookie.d.ts +8 -0
- package/lib/screenplay/models/WebdriverIOCookie.js +39 -0
- package/lib/screenplay/models/WebdriverIOCookie.js.map +1 -0
- package/lib/screenplay/models/WebdriverIOFrame.d.ts +10 -0
- package/lib/screenplay/models/WebdriverIOFrame.js +34 -0
- package/lib/screenplay/models/WebdriverIOFrame.js.map +1 -0
- package/lib/screenplay/models/WebdriverIOModalDialog.d.ts +11 -0
- package/lib/screenplay/models/WebdriverIOModalDialog.js +40 -0
- package/lib/screenplay/models/WebdriverIOModalDialog.js.map +1 -0
- package/lib/screenplay/models/WebdriverIOPage.d.ts +26 -0
- package/lib/screenplay/models/WebdriverIOPage.js +104 -0
- package/lib/screenplay/models/WebdriverIOPage.js.map +1 -0
- package/lib/screenplay/models/WebdriverIOPageElement.d.ts +31 -0
- package/lib/screenplay/models/WebdriverIOPageElement.js +185 -0
- package/lib/screenplay/models/WebdriverIOPageElement.js.map +1 -0
- package/lib/screenplay/models/index.d.ts +5 -0
- package/lib/{stage/crew/photographer/strategies → screenplay/models}/index.js +5 -4
- package/lib/screenplay/models/index.js.map +1 -0
- 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/locators/WebdriverIONativeElementRoot.d.ts +2 -0
- package/lib/screenplay/{interactions/EnterBuilder.js → models/locators/WebdriverIONativeElementRoot.js} +1 -1
- package/lib/screenplay/models/locators/WebdriverIONativeElementRoot.js.map +1 -0
- package/lib/screenplay/models/locators/index.d.ts +2 -0
- package/lib/{stage/crew/photographer → screenplay/models/locators}/index.js +2 -2
- package/lib/screenplay/models/locators/index.js.map +1 -0
- package/package.json +14 -24
- package/src/adapter/WebdriverIOFrameworkAdapter.ts +2 -0
- package/src/adapter/WebdriverIONotifier.ts +225 -23
- package/src/index.ts +0 -3
- package/src/screenplay/abilities/{BrowseTheWeb.ts → BrowseTheWebWithWebdriverIO.ts} +125 -35
- package/src/screenplay/abilities/index.ts +1 -1
- package/src/screenplay/index.ts +1 -2
- package/src/screenplay/models/WebdriverIOCookie.ts +44 -0
- package/src/screenplay/models/WebdriverIOFrame.ts +38 -0
- package/src/screenplay/models/WebdriverIOModalDialog.ts +45 -0
- package/src/screenplay/models/WebdriverIOPage.ts +128 -0
- package/src/screenplay/models/WebdriverIOPageElement.ts +227 -0
- package/src/screenplay/models/index.ts +5 -0
- package/src/screenplay/models/locators/WebdriverIOLocator.ts +43 -0
- package/src/screenplay/models/locators/WebdriverIONativeElementRoot.ts +3 -0
- package/src/screenplay/models/locators/index.ts +2 -0
- package/lib/expectations/ElementExpectation.d.ts +0 -11
- package/lib/expectations/ElementExpectation.js +0 -27
- package/lib/expectations/ElementExpectation.js.map +0 -1
- package/lib/expectations/index.d.ts +0 -6
- package/lib/expectations/index.js +0 -19
- package/lib/expectations/index.js.map +0 -1
- package/lib/expectations/isActive.d.ts +0 -15
- package/lib/expectations/isActive.js +0 -21
- package/lib/expectations/isActive.js.map +0 -1
- package/lib/expectations/isClickable.d.ts +0 -20
- package/lib/expectations/isClickable.js +0 -26
- package/lib/expectations/isClickable.js.map +0 -1
- package/lib/expectations/isEnabled.d.ts +0 -14
- package/lib/expectations/isEnabled.js +0 -20
- package/lib/expectations/isEnabled.js.map +0 -1
- package/lib/expectations/isPresent.d.ts +0 -15
- package/lib/expectations/isPresent.js +0 -21
- package/lib/expectations/isPresent.js.map +0 -1
- package/lib/expectations/isSelected.d.ts +0 -14
- package/lib/expectations/isSelected.js +0 -20
- package/lib/expectations/isSelected.js.map +0 -1
- package/lib/expectations/isVisible.d.ts +0 -14
- package/lib/expectations/isVisible.js +0 -20
- package/lib/expectations/isVisible.js.map +0 -1
- package/lib/input/Key.d.ts +0 -73
- package/lib/input/Key.js +0 -84
- package/lib/input/Key.js.map +0 -1
- package/lib/input/index.d.ts +0 -1
- package/lib/input/index.js +0 -14
- package/lib/input/index.js.map +0 -1
- package/lib/screenplay/abilities/BrowseTheWeb.js.map +0 -1
- package/lib/screenplay/interactions/Clear.d.ts +0 -79
- package/lib/screenplay/interactions/Clear.js +0 -97
- package/lib/screenplay/interactions/Clear.js.map +0 -1
- package/lib/screenplay/interactions/Click.d.ts +0 -73
- package/lib/screenplay/interactions/Click.js +0 -84
- package/lib/screenplay/interactions/Click.js.map +0 -1
- package/lib/screenplay/interactions/DoubleClick.d.ts +0 -90
- package/lib/screenplay/interactions/DoubleClick.js +0 -101
- package/lib/screenplay/interactions/DoubleClick.js.map +0 -1
- package/lib/screenplay/interactions/Enter.d.ts +0 -73
- package/lib/screenplay/interactions/Enter.js +0 -87
- package/lib/screenplay/interactions/Enter.js.map +0 -1
- package/lib/screenplay/interactions/EnterBuilder.d.ts +0 -25
- package/lib/screenplay/interactions/EnterBuilder.js.map +0 -1
- package/lib/screenplay/interactions/ExecuteScript.d.ts +0 -206
- package/lib/screenplay/interactions/ExecuteScript.js +0 -311
- package/lib/screenplay/interactions/ExecuteScript.js.map +0 -1
- package/lib/screenplay/interactions/Hover.d.ts +0 -78
- package/lib/screenplay/interactions/Hover.js +0 -89
- package/lib/screenplay/interactions/Hover.js.map +0 -1
- package/lib/screenplay/interactions/Navigate.d.ts +0 -141
- package/lib/screenplay/interactions/Navigate.js +0 -197
- package/lib/screenplay/interactions/Navigate.js.map +0 -1
- package/lib/screenplay/interactions/Press.d.ts +0 -84
- package/lib/screenplay/interactions/Press.js +0 -152
- package/lib/screenplay/interactions/Press.js.map +0 -1
- package/lib/screenplay/interactions/PressBuilder.d.ts +0 -26
- package/lib/screenplay/interactions/PressBuilder.js +0 -3
- package/lib/screenplay/interactions/PressBuilder.js.map +0 -1
- package/lib/screenplay/interactions/RightClick.d.ts +0 -89
- package/lib/screenplay/interactions/RightClick.js +0 -100
- package/lib/screenplay/interactions/RightClick.js.map +0 -1
- package/lib/screenplay/interactions/Scroll.d.ts +0 -75
- package/lib/screenplay/interactions/Scroll.js +0 -86
- package/lib/screenplay/interactions/Scroll.js.map +0 -1
- package/lib/screenplay/interactions/Wait.d.ts +0 -143
- package/lib/screenplay/interactions/Wait.js +0 -247
- package/lib/screenplay/interactions/Wait.js.map +0 -1
- package/lib/screenplay/interactions/WaitBuilder.d.ts +0 -32
- package/lib/screenplay/interactions/WaitBuilder.js +0 -3
- package/lib/screenplay/interactions/WaitBuilder.js.map +0 -1
- package/lib/screenplay/interactions/WebElementInteraction.d.ts +0 -37
- package/lib/screenplay/interactions/WebElementInteraction.js +0 -52
- package/lib/screenplay/interactions/WebElementInteraction.js.map +0 -1
- package/lib/screenplay/interactions/index.d.ts +0 -13
- package/lib/screenplay/interactions/index.js +0 -26
- package/lib/screenplay/interactions/index.js.map +0 -1
- package/lib/screenplay/questions/Attribute.d.ts +0 -82
- package/lib/screenplay/questions/Attribute.js +0 -102
- package/lib/screenplay/questions/Attribute.js.map +0 -1
- package/lib/screenplay/questions/CSSClasses.d.ts +0 -92
- package/lib/screenplay/questions/CSSClasses.js +0 -112
- package/lib/screenplay/questions/CSSClasses.js.map +0 -1
- package/lib/screenplay/questions/LastScriptExecution.d.ts +0 -14
- package/lib/screenplay/questions/LastScriptExecution.js +0 -22
- package/lib/screenplay/questions/LastScriptExecution.js.map +0 -1
- package/lib/screenplay/questions/NestedTargetBuilder.d.ts +0 -27
- package/lib/screenplay/questions/NestedTargetBuilder.js +0 -3
- package/lib/screenplay/questions/NestedTargetBuilder.js.map +0 -1
- package/lib/screenplay/questions/TargetBuilder.d.ts +0 -25
- package/lib/screenplay/questions/TargetBuilder.js +0 -3
- package/lib/screenplay/questions/TargetBuilder.js.map +0 -1
- package/lib/screenplay/questions/Text.d.ts +0 -95
- package/lib/screenplay/questions/Text.js +0 -130
- package/lib/screenplay/questions/Text.js.map +0 -1
- package/lib/screenplay/questions/Value.d.ts +0 -63
- package/lib/screenplay/questions/Value.js +0 -78
- package/lib/screenplay/questions/Value.js.map +0 -1
- package/lib/screenplay/questions/Website.d.ts +0 -21
- package/lib/screenplay/questions/Website.js +0 -31
- package/lib/screenplay/questions/Website.js.map +0 -1
- package/lib/screenplay/questions/index.d.ts +0 -10
- package/lib/screenplay/questions/index.js +0 -23
- package/lib/screenplay/questions/index.js.map +0 -1
- package/lib/screenplay/questions/lists.d.ts +0 -86
- package/lib/screenplay/questions/lists.js +0 -137
- package/lib/screenplay/questions/lists.js.map +0 -1
- package/lib/screenplay/questions/locators.d.ts +0 -196
- package/lib/screenplay/questions/locators.js +0 -219
- package/lib/screenplay/questions/locators.js.map +0 -1
- package/lib/screenplay/questions/targets.d.ts +0 -254
- package/lib/screenplay/questions/targets.js +0 -334
- package/lib/screenplay/questions/targets.js.map +0 -1
- package/lib/stage/crew/index.d.ts +0 -1
- package/lib/stage/crew/index.js +0 -14
- package/lib/stage/crew/index.js.map +0 -1
- package/lib/stage/crew/photographer/Photographer.d.ts +0 -83
- package/lib/stage/crew/photographer/Photographer.js +0 -102
- package/lib/stage/crew/photographer/Photographer.js.map +0 -1
- package/lib/stage/crew/photographer/index.d.ts +0 -2
- package/lib/stage/crew/photographer/index.js.map +0 -1
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +0 -28
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +0 -65
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js.map +0 -1
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +0 -18
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +0 -30
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js.map +0 -1
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +0 -17
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +0 -28
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js.map +0 -1
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +0 -19
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +0 -28
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js.map +0 -1
- package/lib/stage/crew/photographer/strategies/index.d.ts +0 -4
- package/lib/stage/crew/photographer/strategies/index.js.map +0 -1
- package/lib/stage/index.d.ts +0 -1
- package/lib/stage/index.js +0 -14
- package/lib/stage/index.js.map +0 -1
- package/src/expectations/ElementExpectation.ts +0 -31
- package/src/expectations/index.ts +0 -6
- package/src/expectations/isActive.ts +0 -21
- package/src/expectations/isClickable.ts +0 -26
- package/src/expectations/isEnabled.ts +0 -19
- package/src/expectations/isPresent.ts +0 -20
- package/src/expectations/isSelected.ts +0 -19
- package/src/expectations/isVisible.ts +0 -19
- package/src/input/Key.ts +0 -83
- package/src/input/index.ts +0 -1
- package/src/screenplay/interactions/Clear.ts +0 -102
- package/src/screenplay/interactions/Click.ts +0 -85
- package/src/screenplay/interactions/DoubleClick.ts +0 -102
- package/src/screenplay/interactions/Enter.ts +0 -93
- package/src/screenplay/interactions/EnterBuilder.ts +0 -27
- package/src/screenplay/interactions/ExecuteScript.ts +0 -344
- package/src/screenplay/interactions/Hover.ts +0 -90
- package/src/screenplay/interactions/Navigate.ts +0 -208
- package/src/screenplay/interactions/Press.ts +0 -172
- package/src/screenplay/interactions/PressBuilder.ts +0 -28
- package/src/screenplay/interactions/RightClick.ts +0 -100
- package/src/screenplay/interactions/Scroll.ts +0 -87
- package/src/screenplay/interactions/Wait.ts +0 -267
- package/src/screenplay/interactions/WaitBuilder.ts +0 -34
- package/src/screenplay/interactions/WebElementInteraction.ts +0 -56
- package/src/screenplay/interactions/index.ts +0 -13
- package/src/screenplay/questions/Attribute.ts +0 -112
- package/src/screenplay/questions/CSSClasses.ts +0 -116
- package/src/screenplay/questions/LastScriptExecution.ts +0 -21
- package/src/screenplay/questions/NestedTargetBuilder.ts +0 -30
- package/src/screenplay/questions/TargetBuilder.ts +0 -27
- package/src/screenplay/questions/Text.ts +0 -140
- package/src/screenplay/questions/Value.ts +0 -82
- package/src/screenplay/questions/Website.ts +0 -34
- package/src/screenplay/questions/index.ts +0 -10
- package/src/screenplay/questions/lists.ts +0 -161
- package/src/screenplay/questions/locators.ts +0 -254
- package/src/screenplay/questions/targets.ts +0 -401
- package/src/stage/crew/index.ts +0 -1
- package/src/stage/crew/photographer/Photographer.ts +0 -108
- package/src/stage/crew/photographer/index.ts +0 -2
- package/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +0 -103
- package/src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts +0 -28
- package/src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts +0 -26
- package/src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts +0 -26
- package/src/stage/crew/photographer/strategies/index.ts +0 -4
- package/src/stage/index.ts +0 -1
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Wait = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
const abilities_1 = require("../abilities");
|
|
7
|
-
/**
|
|
8
|
-
* @desc
|
|
9
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
10
|
-
* wait before proceeding either for a set {@link @serenity-js/core/lib/model~Duration}
|
|
11
|
-
* or until a given {@link @serenity-js/core/lib/screenplay/questions~Expectation} is met.
|
|
12
|
-
*
|
|
13
|
-
* Under the hood, `Wait` uses WebdriverIO ["explicit waiting"](https://webdriver.io/docs/autowait/)
|
|
14
|
-
* mechanism.
|
|
15
|
-
*
|
|
16
|
-
* @example <caption>Example widget</caption>
|
|
17
|
-
* <!--
|
|
18
|
-
* After about 1 second, the text will change from 'Loading...' to 'Ready!'
|
|
19
|
-
* -->
|
|
20
|
-
* <h1 id="status">Loading...</h1>
|
|
21
|
-
* <script>
|
|
22
|
-
* (function () {
|
|
23
|
-
* setTimeout(function () {
|
|
24
|
-
* document.getElementById('status').textContent = 'Ready!'
|
|
25
|
-
* }, 1000);
|
|
26
|
-
* })();
|
|
27
|
-
* </script>
|
|
28
|
-
*
|
|
29
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
30
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
31
|
-
*
|
|
32
|
-
* class App {
|
|
33
|
-
* static status = Target.the('status widget')
|
|
34
|
-
* .located(by.id('status'));
|
|
35
|
-
* }
|
|
36
|
-
*
|
|
37
|
-
* @example <caption>Waiting for a set amount of time</caption>
|
|
38
|
-
* import { actorCalled, Duration } from '@serenity-js/core';
|
|
39
|
-
* import { BrowseTheWeb, Wait } from '@serenity-js/webdriverio';
|
|
40
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
41
|
-
*
|
|
42
|
-
* actorCalled('Wendy')
|
|
43
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
44
|
-
* .attemptsTo(
|
|
45
|
-
* Wait.for(Duration.ofSeconds(1.5)),
|
|
46
|
-
* Ensure.that(App.status, equals('Ready!')),
|
|
47
|
-
* );
|
|
48
|
-
*
|
|
49
|
-
* // Please note that while the above implementation works,
|
|
50
|
-
* // this approach is inefficient because at best
|
|
51
|
-
* // the actor might wait too long and at worst the test
|
|
52
|
-
* // might become "flaky" if any external interference
|
|
53
|
-
* // (like network glitches, animations taking a bit too long etc.)
|
|
54
|
-
* // makes the actor wait not long enough.
|
|
55
|
-
*
|
|
56
|
-
* @example <caption>Waiting until a condition is met</caption>
|
|
57
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
58
|
-
* import { BrowseTheWeb, Wait, Text } from '@serenity-js/webdriverio';
|
|
59
|
-
* import { equals } from '@serenity-js/assertions';
|
|
60
|
-
*
|
|
61
|
-
* actorCalled('Wendy')
|
|
62
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
63
|
-
* .attemptsTo(
|
|
64
|
-
* Wait.until(Text.of(App.status), equals('Ready!')),
|
|
65
|
-
* // app is ready, proceed with the scenario
|
|
66
|
-
* );
|
|
67
|
-
*
|
|
68
|
-
* // Wait.until makes the Actor keep asking a Question,
|
|
69
|
-
* // in this case Text.of(App.status), until the answer meets
|
|
70
|
-
* // the expectation, or a timeout expires (default: 5s).
|
|
71
|
-
* //
|
|
72
|
-
* // Please note that both Ensure and Wait can be used with
|
|
73
|
-
* // the same expectations, like `equals`.
|
|
74
|
-
*
|
|
75
|
-
* @example <caption>Changing the default timeout</caption>
|
|
76
|
-
* import { actorCalled, Duration } from '@serenity-js/core';
|
|
77
|
-
* import { BrowseTheWeb, Wait, Text } from '@serenity-js/webdriverio';
|
|
78
|
-
* import { equals } from '@serenity-js/assertions';
|
|
79
|
-
*
|
|
80
|
-
* actorCalled('Wendy')
|
|
81
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
82
|
-
* .attemptsTo(
|
|
83
|
-
* Wait.upTo(Duration.ofSeconds(3))
|
|
84
|
-
* .until(Text.of(App.status), equals('Ready!')),
|
|
85
|
-
* // app is ready, proceed with the scenario
|
|
86
|
-
* );
|
|
87
|
-
*
|
|
88
|
-
* @see {@link BrowseTheWeb}
|
|
89
|
-
* @see {@link Target}
|
|
90
|
-
* @see {@link Text}
|
|
91
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
92
|
-
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
93
|
-
* @see {@link @serenity-js/core/lib/model~Duration}
|
|
94
|
-
*
|
|
95
|
-
* @see {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
96
|
-
*/
|
|
97
|
-
class Wait {
|
|
98
|
-
/**
|
|
99
|
-
* @desc
|
|
100
|
-
* Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
101
|
-
* configured to wait for a set duration.
|
|
102
|
-
*
|
|
103
|
-
* @param {Answerable<Duration>} duration
|
|
104
|
-
* A set duration the {@link @serenity-js/core/lib/screenplay/actor~Actor} should wait for
|
|
105
|
-
* before proceeding
|
|
106
|
-
*
|
|
107
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
108
|
-
*/
|
|
109
|
-
static for(duration) {
|
|
110
|
-
return new WaitFor(duration);
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* @desc
|
|
114
|
-
* Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
115
|
-
* configured to wait until the answer to the question (`actual`) meets the `expectation`,
|
|
116
|
-
* or a custom timeout expires.
|
|
117
|
-
*
|
|
118
|
-
* @param {Duration} duration
|
|
119
|
-
* Custom timeout to override {@link Wait.Default_Timeout}
|
|
120
|
-
*
|
|
121
|
-
* @returns {WaitBuilder}
|
|
122
|
-
*/
|
|
123
|
-
static upTo(duration) {
|
|
124
|
-
return {
|
|
125
|
-
until: (actual, expectation) => new WaitUntil(actual, expectation, duration),
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* @desc
|
|
130
|
-
* Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
131
|
-
* configured to wait until the answer to the question (`actual`) meets the `expectation`,
|
|
132
|
-
* or a {@link Wait.Default_Timeout} expires.
|
|
133
|
-
*
|
|
134
|
-
* @param {Answerable<Actual>} actual
|
|
135
|
-
* A {@link @serenity-js/core/lib/screenplay~Question}
|
|
136
|
-
* that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
137
|
-
* will keep asking until the answer meets
|
|
138
|
-
* the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
|
|
139
|
-
*
|
|
140
|
-
* @param {@serenity-js/core/lib/screenplay/questions~<any,Actual>} expectation
|
|
141
|
-
* An {@link @serenity-js/core/lib/screenplay/questions~Expectation} to be met before proceeding
|
|
142
|
-
*
|
|
143
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
144
|
-
*/
|
|
145
|
-
static until(actual, expectation) {
|
|
146
|
-
return new WaitUntil(actual, expectation, Wait.Default_Timeout);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
exports.Wait = Wait;
|
|
150
|
-
/**
|
|
151
|
-
* @desc
|
|
152
|
-
* Default timeout of 5 seconds used with {@link Wait.until}.
|
|
153
|
-
*
|
|
154
|
-
* @type {@serenity-js/core~Duration}
|
|
155
|
-
*/
|
|
156
|
-
Wait.Default_Timeout = core_1.Duration.ofSeconds(5);
|
|
157
|
-
/**
|
|
158
|
-
* @package
|
|
159
|
-
*/
|
|
160
|
-
class WaitFor extends core_1.Interaction {
|
|
161
|
-
constructor(duration) {
|
|
162
|
-
super();
|
|
163
|
-
this.duration = duration;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* @desc
|
|
167
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
168
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
169
|
-
*
|
|
170
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
171
|
-
* @returns {Promise<void>}
|
|
172
|
-
*
|
|
173
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
174
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
175
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
176
|
-
*/
|
|
177
|
-
async performAs(actor) {
|
|
178
|
-
return actor.answer(this.duration)
|
|
179
|
-
.then(duration => abilities_1.BrowseTheWeb.as(actor).browser.pause(duration.inMilliseconds()));
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* @desc
|
|
183
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
184
|
-
*
|
|
185
|
-
* @returns {string}
|
|
186
|
-
*/
|
|
187
|
-
toString() {
|
|
188
|
-
return (0, io_1.formatted) `#actor waits for ${this.duration}`;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* @package
|
|
193
|
-
*/
|
|
194
|
-
class WaitUntil extends core_1.Interaction {
|
|
195
|
-
constructor(actual, expectation, timeout) {
|
|
196
|
-
super();
|
|
197
|
-
this.actual = actual;
|
|
198
|
-
this.expectation = expectation;
|
|
199
|
-
this.timeout = timeout;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* @desc
|
|
203
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
204
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
205
|
-
*
|
|
206
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
207
|
-
* @returns {Promise<void>}
|
|
208
|
-
*
|
|
209
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
210
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
211
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
212
|
-
*/
|
|
213
|
-
performAs(actor) {
|
|
214
|
-
const actual = this.actual, expectation = this.expectation.answeredBy(actor);
|
|
215
|
-
let expectationOutcome;
|
|
216
|
-
return abilities_1.BrowseTheWeb.as(actor)
|
|
217
|
-
.browser
|
|
218
|
-
.waitUntil(function () {
|
|
219
|
-
return actor.answer(actual)
|
|
220
|
-
.then(act => expectation(act))
|
|
221
|
-
.then(outcome => {
|
|
222
|
-
expectationOutcome = outcome;
|
|
223
|
-
return outcome instanceof core_1.ExpectationMet;
|
|
224
|
-
});
|
|
225
|
-
}, {
|
|
226
|
-
timeout: this.timeout.inMilliseconds(),
|
|
227
|
-
timeoutMsg: `Wait timed out after ${this.timeout}`,
|
|
228
|
-
})
|
|
229
|
-
.then(_ => void 0)
|
|
230
|
-
.catch(error => {
|
|
231
|
-
if (expectationOutcome) {
|
|
232
|
-
throw new core_1.AssertionError(`Waited ${this.timeout.toString()} for ${(0, io_1.formatted) `${this.actual}`} to ${this.expectation.toString()}`, expectationOutcome.expected, expectationOutcome.actual, error);
|
|
233
|
-
}
|
|
234
|
-
throw error;
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* @desc
|
|
239
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
240
|
-
*
|
|
241
|
-
* @returns {string}
|
|
242
|
-
*/
|
|
243
|
-
toString() {
|
|
244
|
-
return (0, io_1.formatted) `#actor waits up to ${this.timeout} until ${this.actual} does ${this.expectation}`;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
//# sourceMappingURL=Wait.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Wait.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Wait.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @desc
|
|
3
|
-
* Fluent interface to make the instantiation of
|
|
4
|
-
* the {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
5
|
-
* to {@link Wait} more readable.
|
|
6
|
-
*
|
|
7
|
-
* @see {@link Wait}
|
|
8
|
-
*
|
|
9
|
-
* @interface
|
|
10
|
-
*/
|
|
11
|
-
import { Answerable, Expectation, Interaction } from '@serenity-js/core';
|
|
12
|
-
export interface WaitBuilder {
|
|
13
|
-
/**
|
|
14
|
-
* @desc
|
|
15
|
-
* Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
16
|
-
* to {@link Wait}.
|
|
17
|
-
*
|
|
18
|
-
* @param {Answerable<Actual>} actual
|
|
19
|
-
* A {@link @serenity-js/core/lib/screenplay~Question}
|
|
20
|
-
* that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
21
|
-
* will keep asking until the answer meets
|
|
22
|
-
* the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
|
|
23
|
-
*
|
|
24
|
-
* @param {@serenity-js/core/lib/screenplay/questions~Expectation<any,Actual>} expectation
|
|
25
|
-
* An {@link @serenity-js/assertions~Expectation} to be met before proceeding
|
|
26
|
-
*
|
|
27
|
-
* @returns {Interaction}
|
|
28
|
-
*
|
|
29
|
-
* @see {@link Target}
|
|
30
|
-
*/
|
|
31
|
-
until: <Actual>(actual: Answerable<Actual>, expectation: Expectation<any, Actual>) => Interaction;
|
|
32
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WaitBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/WaitBuilder.ts"],"names":[],"mappings":""}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, Interaction } from '@serenity-js/core';
|
|
2
|
-
import { Element } from 'webdriverio';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* A base class for WebdriverIO-specific interactions
|
|
6
|
-
*
|
|
7
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
8
|
-
*/
|
|
9
|
-
export declare abstract class WebElementInteraction extends Interaction {
|
|
10
|
-
private readonly description;
|
|
11
|
-
/**
|
|
12
|
-
* @param {string} description
|
|
13
|
-
* A human-readable description to be used when reporting
|
|
14
|
-
* this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
15
|
-
*/
|
|
16
|
-
constructor(description: string);
|
|
17
|
-
/**
|
|
18
|
-
* @desc
|
|
19
|
-
* Returns the resolved {@link @wdio/types~Element}, or throws a {@link @serenity-js/core/lib/errors~LogicError}
|
|
20
|
-
* if the element is `undefined`.
|
|
21
|
-
*
|
|
22
|
-
* @param {@serenity-js/core/lib/screenplay/actor~AnswersQuestions} actor
|
|
23
|
-
* @param {@serenity-js/core/lib/screenplay~Answerable<Element<'async'>>} element
|
|
24
|
-
*
|
|
25
|
-
* @returns {Promise<Element<'async'>>}
|
|
26
|
-
*
|
|
27
|
-
* @protected
|
|
28
|
-
*/
|
|
29
|
-
protected resolve(actor: AnswersQuestions, element: Answerable<Element<'async'>>): Promise<Element<'async'>>;
|
|
30
|
-
/**
|
|
31
|
-
* @desc
|
|
32
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
33
|
-
*
|
|
34
|
-
* @returns {string}
|
|
35
|
-
*/
|
|
36
|
-
toString(): string;
|
|
37
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WebElementInteraction = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* A base class for WebdriverIO-specific interactions
|
|
9
|
-
*
|
|
10
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
11
|
-
*/
|
|
12
|
-
class WebElementInteraction extends core_1.Interaction {
|
|
13
|
-
/**
|
|
14
|
-
* @param {string} description
|
|
15
|
-
* A human-readable description to be used when reporting
|
|
16
|
-
* this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
17
|
-
*/
|
|
18
|
-
constructor(description) {
|
|
19
|
-
super();
|
|
20
|
-
this.description = description;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @desc
|
|
24
|
-
* Returns the resolved {@link @wdio/types~Element}, or throws a {@link @serenity-js/core/lib/errors~LogicError}
|
|
25
|
-
* if the element is `undefined`.
|
|
26
|
-
*
|
|
27
|
-
* @param {@serenity-js/core/lib/screenplay/actor~AnswersQuestions} actor
|
|
28
|
-
* @param {@serenity-js/core/lib/screenplay~Answerable<Element<'async'>>} element
|
|
29
|
-
*
|
|
30
|
-
* @returns {Promise<Element<'async'>>}
|
|
31
|
-
*
|
|
32
|
-
* @protected
|
|
33
|
-
*/
|
|
34
|
-
async resolve(actor, element) {
|
|
35
|
-
const resolved = await actor.answer(element);
|
|
36
|
-
if (!resolved) {
|
|
37
|
-
throw new core_1.LogicError((0, io_1.formatted) `Couldn't find ${element}`);
|
|
38
|
-
}
|
|
39
|
-
return resolved;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* @desc
|
|
43
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
44
|
-
*
|
|
45
|
-
* @returns {string}
|
|
46
|
-
*/
|
|
47
|
-
toString() {
|
|
48
|
-
return this.description;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
exports.WebElementInteraction = WebElementInteraction;
|
|
52
|
-
//# sourceMappingURL=WebElementInteraction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WebElementInteraction.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/WebElementInteraction.ts"],"names":[],"mappings":";;;AAAA,4CAA0F;AAC1F,iDAAqD;AAGrD;;;;;GAKG;AACH,MAAsB,qBAAsB,SAAQ,kBAAW;IAE3D;;;;OAIG;IACH,YAA6B,WAAmB;QAC5C,KAAK,EAAE,CAAC;QADiB,gBAAW,GAAX,WAAW,CAAQ;IAEhD,CAAC;IAED;;;;;;;;;;;OAWG;IACO,KAAK,CAAC,OAAO,CACnB,KAAuB,EACvB,OAAqC;QAErC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAE7C,IAAI,CAAE,QAAQ,EAAE;YACZ,MAAM,IAAI,iBAAU,CAAC,IAAA,cAAS,EAAC,iBAAkB,OAAQ,EAAE,CAAC,CAAC;SAChE;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACJ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;CACJ;AA7CD,sDA6CC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from './Clear';
|
|
2
|
-
export * from './Click';
|
|
3
|
-
export * from './DoubleClick';
|
|
4
|
-
export * from './Enter';
|
|
5
|
-
export * from './ExecuteScript';
|
|
6
|
-
export * from './Hover';
|
|
7
|
-
export * from './Navigate';
|
|
8
|
-
export * from './Press';
|
|
9
|
-
export * from './PressBuilder';
|
|
10
|
-
export * from './RightClick';
|
|
11
|
-
export * from './Scroll';
|
|
12
|
-
export * from './Wait';
|
|
13
|
-
export * from './WebElementInteraction';
|
|
@@ -1,26 +0,0 @@
|
|
|
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("./Clear"), exports);
|
|
14
|
-
__exportStar(require("./Click"), exports);
|
|
15
|
-
__exportStar(require("./DoubleClick"), exports);
|
|
16
|
-
__exportStar(require("./Enter"), exports);
|
|
17
|
-
__exportStar(require("./ExecuteScript"), exports);
|
|
18
|
-
__exportStar(require("./Hover"), exports);
|
|
19
|
-
__exportStar(require("./Navigate"), exports);
|
|
20
|
-
__exportStar(require("./Press"), exports);
|
|
21
|
-
__exportStar(require("./PressBuilder"), exports);
|
|
22
|
-
__exportStar(require("./RightClick"), exports);
|
|
23
|
-
__exportStar(require("./Scroll"), exports);
|
|
24
|
-
__exportStar(require("./Wait"), exports);
|
|
25
|
-
__exportStar(require("./WebElementInteraction"), exports);
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,yCAAuB;AACvB,0DAAwC"}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, MetaQuestion, Question, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { Element } from 'webdriverio';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Returns the value of the given HTML attribute of a given {@link WebElement},
|
|
6
|
-
* represented by Answerable<{@link @wdio/types~Element}>
|
|
7
|
-
*
|
|
8
|
-
* @example <caption>Example widget</caption>
|
|
9
|
-
* <ul id="shopping-list" data-items-left="2">
|
|
10
|
-
* <li data-state="bought">Coffee<li>
|
|
11
|
-
* <li data-state="buy">Honey<li>
|
|
12
|
-
* <li data-state="buy">Chocolate<li>
|
|
13
|
-
* </ul>
|
|
14
|
-
*
|
|
15
|
-
* @example <caption>Retrieve a HTML attribute of a given WebElement</caption>
|
|
16
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
17
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
18
|
-
* import { Attribute, by, BrowseTheWeb, Target } from '@serenity-js/webdriverio';
|
|
19
|
-
*
|
|
20
|
-
* const shoppingList = () =>
|
|
21
|
-
* Target.the('shopping list').located(by.id('shopping-list'))
|
|
22
|
-
*
|
|
23
|
-
* actorCalled('Lisa')
|
|
24
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
25
|
-
* .attemptsTo(
|
|
26
|
-
* Ensure.that(Attribute.called('data-items-left').of(shoppingList()), equals('2')),
|
|
27
|
-
* )
|
|
28
|
-
*
|
|
29
|
-
* @example <caption>Find WebElements with a given attribute</caption>
|
|
30
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
31
|
-
* import { Ensure, includes } from '@serenity-js/assertions';
|
|
32
|
-
* import { Attribute, BrowseTheWeb, by, Target } from '@serenity-js/webdriverio';
|
|
33
|
-
*
|
|
34
|
-
* class ShoppingList {
|
|
35
|
-
* static items = () =>
|
|
36
|
-
* Target.all('items')
|
|
37
|
-
* .located(by.css('#shopping-list li'))
|
|
38
|
-
*
|
|
39
|
-
* static outstandingItems = () =>
|
|
40
|
-
* ShoppingList.items
|
|
41
|
-
* .where(Attribute.called('data-state'), includes('buy'))
|
|
42
|
-
* }
|
|
43
|
-
*
|
|
44
|
-
* actorCalled('Lisa')
|
|
45
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
46
|
-
* .attemptsTo(
|
|
47
|
-
* Ensure.that(
|
|
48
|
-
* Text.ofAll(ShoppingList.outstandingItems()),
|
|
49
|
-
* equals([ 'Honey', 'Chocolate' ])
|
|
50
|
-
* ),
|
|
51
|
-
* )
|
|
52
|
-
*
|
|
53
|
-
* @extends {@serenity-js/core/lib/screenplay~Question}
|
|
54
|
-
* @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
55
|
-
*/
|
|
56
|
-
export declare class Attribute extends Question<Promise<string>> implements MetaQuestion<Answerable<Element<'async'>>, Promise<string>> {
|
|
57
|
-
private readonly name;
|
|
58
|
-
private readonly element?;
|
|
59
|
-
/**
|
|
60
|
-
* @param {Answerable<string>} name
|
|
61
|
-
* @returns {Attribute}
|
|
62
|
-
*/
|
|
63
|
-
static called(name: Answerable<string>): Attribute;
|
|
64
|
-
/**
|
|
65
|
-
* @param {Answerable<string>} name
|
|
66
|
-
* @param {@serenity-js/core/lib/screenplay~Answerable<Element<'async'>>} [element]
|
|
67
|
-
*/
|
|
68
|
-
constructor(name: Answerable<string>, element?: Answerable<Element<'async'>>);
|
|
69
|
-
/**
|
|
70
|
-
* @desc
|
|
71
|
-
* Resolves to the value of a HTML attribute of the `target` element,
|
|
72
|
-
* located in the context of a `parent` element.
|
|
73
|
-
*
|
|
74
|
-
* @param {Answerable<Element<'async'>>} parent
|
|
75
|
-
* @returns {Question<Promise<string[]>>}
|
|
76
|
-
*
|
|
77
|
-
* @see {@link Target.all}
|
|
78
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
79
|
-
*/
|
|
80
|
-
of(parent: Answerable<Element<'async'>>): Question<Promise<string>>;
|
|
81
|
-
answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<string>;
|
|
82
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Attribute = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const targets_1 = require("./targets");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Returns the value of the given HTML attribute of a given {@link WebElement},
|
|
9
|
-
* represented by Answerable<{@link @wdio/types~Element}>
|
|
10
|
-
*
|
|
11
|
-
* @example <caption>Example widget</caption>
|
|
12
|
-
* <ul id="shopping-list" data-items-left="2">
|
|
13
|
-
* <li data-state="bought">Coffee<li>
|
|
14
|
-
* <li data-state="buy">Honey<li>
|
|
15
|
-
* <li data-state="buy">Chocolate<li>
|
|
16
|
-
* </ul>
|
|
17
|
-
*
|
|
18
|
-
* @example <caption>Retrieve a HTML attribute of a given WebElement</caption>
|
|
19
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
20
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
21
|
-
* import { Attribute, by, BrowseTheWeb, Target } from '@serenity-js/webdriverio';
|
|
22
|
-
*
|
|
23
|
-
* const shoppingList = () =>
|
|
24
|
-
* Target.the('shopping list').located(by.id('shopping-list'))
|
|
25
|
-
*
|
|
26
|
-
* actorCalled('Lisa')
|
|
27
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
28
|
-
* .attemptsTo(
|
|
29
|
-
* Ensure.that(Attribute.called('data-items-left').of(shoppingList()), equals('2')),
|
|
30
|
-
* )
|
|
31
|
-
*
|
|
32
|
-
* @example <caption>Find WebElements with a given attribute</caption>
|
|
33
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
34
|
-
* import { Ensure, includes } from '@serenity-js/assertions';
|
|
35
|
-
* import { Attribute, BrowseTheWeb, by, Target } from '@serenity-js/webdriverio';
|
|
36
|
-
*
|
|
37
|
-
* class ShoppingList {
|
|
38
|
-
* static items = () =>
|
|
39
|
-
* Target.all('items')
|
|
40
|
-
* .located(by.css('#shopping-list li'))
|
|
41
|
-
*
|
|
42
|
-
* static outstandingItems = () =>
|
|
43
|
-
* ShoppingList.items
|
|
44
|
-
* .where(Attribute.called('data-state'), includes('buy'))
|
|
45
|
-
* }
|
|
46
|
-
*
|
|
47
|
-
* actorCalled('Lisa')
|
|
48
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
49
|
-
* .attemptsTo(
|
|
50
|
-
* Ensure.that(
|
|
51
|
-
* Text.ofAll(ShoppingList.outstandingItems()),
|
|
52
|
-
* equals([ 'Honey', 'Chocolate' ])
|
|
53
|
-
* ),
|
|
54
|
-
* )
|
|
55
|
-
*
|
|
56
|
-
* @extends {@serenity-js/core/lib/screenplay~Question}
|
|
57
|
-
* @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
58
|
-
*/
|
|
59
|
-
class Attribute extends core_1.Question {
|
|
60
|
-
/**
|
|
61
|
-
* @param {Answerable<string>} name
|
|
62
|
-
* @param {@serenity-js/core/lib/screenplay~Answerable<Element<'async'>>} [element]
|
|
63
|
-
*/
|
|
64
|
-
constructor(name, element) {
|
|
65
|
-
super(`"${name}" attribute of ${element}`);
|
|
66
|
-
this.name = name;
|
|
67
|
-
this.element = element;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* @param {Answerable<string>} name
|
|
71
|
-
* @returns {Attribute}
|
|
72
|
-
*/
|
|
73
|
-
static called(name) {
|
|
74
|
-
return new Attribute(name);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* @desc
|
|
78
|
-
* Resolves to the value of a HTML attribute of the `target` element,
|
|
79
|
-
* located in the context of a `parent` element.
|
|
80
|
-
*
|
|
81
|
-
* @param {Answerable<Element<'async'>>} parent
|
|
82
|
-
* @returns {Question<Promise<string[]>>}
|
|
83
|
-
*
|
|
84
|
-
* @see {@link Target.all}
|
|
85
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
86
|
-
*/
|
|
87
|
-
of(parent) {
|
|
88
|
-
return new Attribute(this.name, this.element
|
|
89
|
-
? new targets_1.TargetNestedElement(parent, this.element)
|
|
90
|
-
: parent);
|
|
91
|
-
}
|
|
92
|
-
async answeredBy(actor) {
|
|
93
|
-
if (!this.element) {
|
|
94
|
-
throw new core_1.LogicError(`Target not specified`); // todo: better error message?
|
|
95
|
-
}
|
|
96
|
-
const element = await actor.answer(this.element);
|
|
97
|
-
const name = await actor.answer(this.name);
|
|
98
|
-
return element.getAttribute(name);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.Attribute = Attribute;
|
|
102
|
-
//# sourceMappingURL=Attribute.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Attribute.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Attribute.ts"],"names":[],"mappings":";;;AAAA,4CAAoH;AAGpH,uCAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAa,SACT,SAAQ,eAAyB;IAWjC;;;OAGG;IACH,YACqB,IAAwB,EACxB,OAAsC;QAEvD,KAAK,CAAC,IAAK,IAAK,kBAAmB,OAAQ,EAAE,CAAC,CAAC;QAH9B,SAAI,GAAJ,IAAI,CAAoB;QACxB,YAAO,GAAP,OAAO,CAA+B;IAG3D,CAAC;IAjBD;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,IAAwB;QAClC,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAaD;;;;;;;;;;OAUG;IACH,EAAE,CAAC,MAAoC;QACnC,OAAO,IAAI,SAAS,CAChB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,OAAO;YACR,CAAC,CAAC,IAAI,6BAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;YAC/C,CAAC,CAAC,MAAM,CACf,CAAC;IACN,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAuC;QACpD,IAAI,CAAE,IAAI,CAAC,OAAO,EAAE;YAChB,MAAM,IAAI,iBAAU,CAAC,sBAAsB,CAAC,CAAC,CAAG,8BAA8B;SACjF;QAED,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACjD,MAAM,IAAI,GAAM,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE9C,OAAO,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CACJ;AArDD,8BAqDC"}
|