@serenity-js/protractor 2.32.4 → 3.0.0-rc.2
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 +75 -0
- package/lib/index.d.ts +0 -2
- package/lib/index.js +0 -2
- package/lib/index.js.map +1 -1
- package/lib/screenplay/abilities/{BrowseTheWeb.d.ts → BrowseTheWebWithProtractor.d.ts} +52 -160
- package/lib/screenplay/abilities/{BrowseTheWeb.js → BrowseTheWebWithProtractor.js} +169 -218
- package/lib/screenplay/abilities/BrowseTheWebWithProtractor.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 -0
- package/lib/screenplay/index.js +1 -0
- package/lib/screenplay/index.js.map +1 -1
- package/lib/screenplay/interactions/UseAngular.js +2 -2
- package/lib/screenplay/interactions/UseAngular.js.map +1 -1
- package/lib/screenplay/interactions/index.d.ts +0 -19
- package/lib/screenplay/interactions/index.js +0 -19
- package/lib/screenplay/interactions/index.js.map +1 -1
- package/lib/screenplay/models/ProtractorCookie.d.ts +11 -0
- package/lib/screenplay/models/ProtractorCookie.js +39 -0
- package/lib/screenplay/models/ProtractorCookie.js.map +1 -0
- package/lib/screenplay/models/ProtractorModalDialog.d.ts +11 -0
- package/lib/screenplay/models/ProtractorModalDialog.js +43 -0
- package/lib/screenplay/models/ProtractorModalDialog.js.map +1 -0
- package/lib/screenplay/models/ProtractorNativeElementRoot.d.ts +5 -0
- package/lib/screenplay/{interactions/EnterBuilder.js → models/ProtractorNativeElementRoot.js} +1 -1
- package/lib/screenplay/models/ProtractorNativeElementRoot.js.map +1 -0
- package/lib/screenplay/models/ProtractorPage.d.ts +24 -0
- package/lib/screenplay/models/ProtractorPage.js +92 -0
- package/lib/screenplay/models/ProtractorPage.js.map +1 -0
- package/lib/screenplay/models/ProtractorPageElement.d.ts +23 -0
- package/lib/screenplay/models/ProtractorPageElement.js +112 -0
- package/lib/screenplay/models/ProtractorPageElement.js.map +1 -0
- package/lib/screenplay/models/ProtractorPageElements.d.ts +16 -0
- package/lib/screenplay/models/ProtractorPageElements.js +62 -0
- package/lib/screenplay/models/ProtractorPageElements.js.map +1 -0
- package/lib/screenplay/models/index.d.ts +6 -0
- package/lib/{expectations → screenplay/models}/index.js +6 -6
- package/lib/screenplay/models/index.js.map +1 -0
- package/lib/{promiseOf.d.ts → screenplay/promised.d.ts} +1 -1
- package/lib/{promiseOf.js → screenplay/promised.js} +4 -4
- package/lib/screenplay/promised.js.map +1 -0
- package/lib/screenplay/promisedWebElement.d.ts +11 -0
- package/lib/screenplay/promisedWebElement.js +27 -0
- package/lib/screenplay/promisedWebElement.js.map +1 -0
- package/lib/screenplay/questions/ProtractorParam.d.ts +24 -29
- package/lib/screenplay/questions/ProtractorParam.js +26 -33
- package/lib/screenplay/questions/ProtractorParam.js.map +1 -1
- package/lib/screenplay/questions/index.d.ts +0 -13
- package/lib/screenplay/questions/index.js +0 -16
- package/lib/screenplay/questions/index.js.map +1 -1
- package/package.json +19 -21
- package/src/index.ts +0 -2
- package/src/screenplay/abilities/{BrowseTheWeb.ts → BrowseTheWebWithProtractor.ts} +216 -241
- package/src/screenplay/abilities/index.ts +1 -1
- package/src/screenplay/index.ts +1 -0
- package/src/screenplay/interactions/UseAngular.ts +3 -3
- package/src/screenplay/interactions/index.ts +0 -19
- package/src/screenplay/models/ProtractorCookie.ts +41 -0
- package/src/screenplay/models/ProtractorModalDialog.ts +49 -0
- package/src/screenplay/models/ProtractorNativeElementRoot.ts +6 -0
- package/src/screenplay/models/ProtractorPage.ts +116 -0
- package/src/screenplay/models/ProtractorPageElement.ts +167 -0
- package/src/screenplay/models/ProtractorPageElements.ts +86 -0
- package/src/screenplay/models/index.ts +7 -0
- package/src/{promiseOf.ts → screenplay/promised.ts} +1 -1
- package/src/screenplay/promisedWebElement.ts +28 -0
- package/src/screenplay/questions/ProtractorParam.ts +29 -38
- package/src/screenplay/questions/index.ts +0 -13
- package/lib/expectations/ElementFinderExpectation.d.ts +0 -11
- package/lib/expectations/ElementFinderExpectation.js +0 -24
- package/lib/expectations/ElementFinderExpectation.js.map +0 -1
- package/lib/expectations/index.d.ts +0 -6
- package/lib/expectations/index.js.map +0 -1
- package/lib/expectations/isActive.d.ts +0 -13
- package/lib/expectations/isActive.js +0 -19
- package/lib/expectations/isActive.js.map +0 -1
- package/lib/expectations/isClickable.d.ts +0 -13
- package/lib/expectations/isClickable.js +0 -22
- package/lib/expectations/isClickable.js.map +0 -1
- package/lib/expectations/isEnabled.d.ts +0 -13
- package/lib/expectations/isEnabled.js +0 -19
- package/lib/expectations/isEnabled.js.map +0 -1
- package/lib/expectations/isPresent.d.ts +0 -14
- package/lib/expectations/isPresent.js +0 -20
- package/lib/expectations/isPresent.js.map +0 -1
- package/lib/expectations/isSelected.d.ts +0 -13
- package/lib/expectations/isSelected.js +0 -22
- package/lib/expectations/isSelected.js.map +0 -1
- package/lib/expectations/isVisible.d.ts +0 -13
- package/lib/expectations/isVisible.js +0 -25
- package/lib/expectations/isVisible.js.map +0 -1
- package/lib/promiseOf.js.map +0 -1
- package/lib/screenplay/abilities/BrowseTheWeb.js.map +0 -1
- package/lib/screenplay/interactions/Accept.d.ts +0 -81
- package/lib/screenplay/interactions/Accept.js +0 -95
- package/lib/screenplay/interactions/Accept.js.map +0 -1
- package/lib/screenplay/interactions/Clear.d.ts +0 -88
- package/lib/screenplay/interactions/Clear.js +0 -121
- package/lib/screenplay/interactions/Clear.js.map +0 -1
- package/lib/screenplay/interactions/Click.d.ts +0 -81
- package/lib/screenplay/interactions/Click.js +0 -95
- package/lib/screenplay/interactions/Click.js.map +0 -1
- package/lib/screenplay/interactions/Close.d.ts +0 -89
- package/lib/screenplay/interactions/Close.js +0 -169
- package/lib/screenplay/interactions/Close.js.map +0 -1
- package/lib/screenplay/interactions/DeleteCookies.d.ts +0 -72
- package/lib/screenplay/interactions/DeleteCookies.js +0 -149
- package/lib/screenplay/interactions/DeleteCookies.js.map +0 -1
- package/lib/screenplay/interactions/Dismiss.d.ts +0 -85
- package/lib/screenplay/interactions/Dismiss.js +0 -99
- package/lib/screenplay/interactions/Dismiss.js.map +0 -1
- package/lib/screenplay/interactions/DoubleClick.d.ts +0 -99
- package/lib/screenplay/interactions/DoubleClick.js +0 -121
- package/lib/screenplay/interactions/DoubleClick.js.map +0 -1
- package/lib/screenplay/interactions/Enter.d.ts +0 -81
- package/lib/screenplay/interactions/Enter.js +0 -96
- package/lib/screenplay/interactions/Enter.js.map +0 -1
- package/lib/screenplay/interactions/EnterBuilder.d.ts +0 -27
- package/lib/screenplay/interactions/EnterBuilder.js.map +0 -1
- package/lib/screenplay/interactions/ExecuteScript.d.ts +0 -171
- package/lib/screenplay/interactions/ExecuteScript.js +0 -291
- package/lib/screenplay/interactions/ExecuteScript.js.map +0 -1
- package/lib/screenplay/interactions/Hover.d.ts +0 -86
- package/lib/screenplay/interactions/Hover.js +0 -103
- package/lib/screenplay/interactions/Hover.js.map +0 -1
- package/lib/screenplay/interactions/Navigate.d.ts +0 -149
- package/lib/screenplay/interactions/Navigate.js +0 -345
- package/lib/screenplay/interactions/Navigate.js.map +0 -1
- package/lib/screenplay/interactions/Press.d.ts +0 -90
- package/lib/screenplay/interactions/Press.js +0 -127
- package/lib/screenplay/interactions/Press.js.map +0 -1
- package/lib/screenplay/interactions/PressBuilder.d.ts +0 -27
- package/lib/screenplay/interactions/PressBuilder.js +0 -3
- package/lib/screenplay/interactions/PressBuilder.js.map +0 -1
- package/lib/screenplay/interactions/ResizeBrowserWindow.d.ts +0 -69
- package/lib/screenplay/interactions/ResizeBrowserWindow.js +0 -144
- package/lib/screenplay/interactions/ResizeBrowserWindow.js.map +0 -1
- package/lib/screenplay/interactions/RightClick.d.ts +0 -97
- package/lib/screenplay/interactions/RightClick.js +0 -113
- package/lib/screenplay/interactions/RightClick.js.map +0 -1
- package/lib/screenplay/interactions/Scroll.d.ts +0 -83
- package/lib/screenplay/interactions/Scroll.js +0 -98
- package/lib/screenplay/interactions/Scroll.js.map +0 -1
- package/lib/screenplay/interactions/Select.d.ts +0 -212
- package/lib/screenplay/interactions/Select.js +0 -342
- package/lib/screenplay/interactions/Select.js.map +0 -1
- package/lib/screenplay/interactions/SelectBuilder.d.ts +0 -33
- package/lib/screenplay/interactions/SelectBuilder.js +0 -3
- package/lib/screenplay/interactions/SelectBuilder.js.map +0 -1
- package/lib/screenplay/interactions/Switch.d.ts +0 -210
- package/lib/screenplay/interactions/Switch.js +0 -345
- package/lib/screenplay/interactions/Switch.js.map +0 -1
- package/lib/screenplay/interactions/TakeScreenshot.d.ts +0 -67
- package/lib/screenplay/interactions/TakeScreenshot.js +0 -86
- package/lib/screenplay/interactions/TakeScreenshot.js.map +0 -1
- package/lib/screenplay/interactions/Wait.d.ts +0 -147
- 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 -33
- package/lib/screenplay/interactions/WaitBuilder.js +0 -3
- package/lib/screenplay/interactions/WaitBuilder.js.map +0 -1
- package/lib/screenplay/questions/Attribute.d.ts +0 -29
- package/lib/screenplay/questions/Attribute.js +0 -56
- package/lib/screenplay/questions/Attribute.js.map +0 -1
- package/lib/screenplay/questions/Browser.d.ts +0 -47
- package/lib/screenplay/questions/Browser.js +0 -55
- package/lib/screenplay/questions/Browser.js.map +0 -1
- package/lib/screenplay/questions/CSSClasses.d.ts +0 -94
- package/lib/screenplay/questions/CSSClasses.js +0 -118
- package/lib/screenplay/questions/CSSClasses.js.map +0 -1
- package/lib/screenplay/questions/Cookie.d.ts +0 -9
- package/lib/screenplay/questions/Cookie.js +0 -65
- package/lib/screenplay/questions/Cookie.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/ModalDialog.d.ts +0 -120
- package/lib/screenplay/questions/ModalDialog.js +0 -142
- package/lib/screenplay/questions/ModalDialog.js.map +0 -1
- package/lib/screenplay/questions/Pick.d.ts +0 -72
- package/lib/screenplay/questions/Pick.js +0 -254
- package/lib/screenplay/questions/Pick.js.map +0 -1
- package/lib/screenplay/questions/Selected.d.ts +0 -185
- package/lib/screenplay/questions/Selected.js +0 -254
- package/lib/screenplay/questions/Selected.js.map +0 -1
- package/lib/screenplay/questions/Value.d.ts +0 -47
- package/lib/screenplay/questions/Value.js +0 -67
- package/lib/screenplay/questions/Value.js.map +0 -1
- package/lib/screenplay/questions/Website.d.ts +0 -15
- package/lib/screenplay/questions/Website.js +0 -25
- package/lib/screenplay/questions/Website.js.map +0 -1
- package/lib/screenplay/questions/Window.d.ts +0 -23
- package/lib/screenplay/questions/Window.js +0 -28
- package/lib/screenplay/questions/Window.js.map +0 -1
- package/lib/screenplay/questions/lists/ElementArrayFinderListAdapter.d.ts +0 -89
- package/lib/screenplay/questions/lists/ElementArrayFinderListAdapter.js +0 -138
- package/lib/screenplay/questions/lists/ElementArrayFinderListAdapter.js.map +0 -1
- package/lib/screenplay/questions/lists/index.d.ts +0 -1
- package/lib/screenplay/questions/lists/index.js +0 -14
- package/lib/screenplay/questions/lists/index.js.map +0 -1
- package/lib/screenplay/questions/targets/Target.d.ts +0 -168
- package/lib/screenplay/questions/targets/Target.js +0 -190
- package/lib/screenplay/questions/targets/Target.js.map +0 -1
- package/lib/screenplay/questions/targets/TargetElement.d.ts +0 -50
- package/lib/screenplay/questions/targets/TargetElement.js +0 -62
- package/lib/screenplay/questions/targets/TargetElement.js.map +0 -1
- package/lib/screenplay/questions/targets/TargetElements.d.ts +0 -102
- package/lib/screenplay/questions/targets/TargetElements.js +0 -124
- package/lib/screenplay/questions/targets/TargetElements.js.map +0 -1
- package/lib/screenplay/questions/targets/TargetNestedElement.d.ts +0 -49
- package/lib/screenplay/questions/targets/TargetNestedElement.js +0 -61
- package/lib/screenplay/questions/targets/TargetNestedElement.js.map +0 -1
- package/lib/screenplay/questions/targets/TargetNestedElements.d.ts +0 -101
- package/lib/screenplay/questions/targets/TargetNestedElements.js +0 -123
- package/lib/screenplay/questions/targets/TargetNestedElements.js.map +0 -1
- package/lib/screenplay/questions/targets/builders.d.ts +0 -8
- package/lib/screenplay/questions/targets/builders.js +0 -3
- package/lib/screenplay/questions/targets/builders.js.map +0 -1
- package/lib/screenplay/questions/targets/index.d.ts +0 -5
- package/lib/screenplay/questions/targets/index.js +0 -18
- package/lib/screenplay/questions/targets/index.js.map +0 -1
- package/lib/screenplay/questions/targets/override.d.ts +0 -7
- package/lib/screenplay/questions/targets/override.js +0 -21
- package/lib/screenplay/questions/targets/override.js.map +0 -1
- package/lib/screenplay/questions/text/Text.d.ts +0 -41
- package/lib/screenplay/questions/text/Text.js +0 -50
- package/lib/screenplay/questions/text/Text.js.map +0 -1
- package/lib/screenplay/questions/text/TextOfMultipleElements.d.ts +0 -23
- package/lib/screenplay/questions/text/TextOfMultipleElements.js +0 -37
- package/lib/screenplay/questions/text/TextOfMultipleElements.js.map +0 -1
- package/lib/screenplay/questions/text/TextOfSingleElement.d.ts +0 -23
- package/lib/screenplay/questions/text/TextOfSingleElement.js +0 -35
- package/lib/screenplay/questions/text/TextOfSingleElement.js.map +0 -1
- package/lib/screenplay/questions/text/index.d.ts +0 -1
- package/lib/screenplay/questions/text/index.js +0 -14
- package/lib/screenplay/questions/text/index.js.map +0 -1
- package/lib/screenplay/withAnswerOf.d.ts +0 -8
- package/lib/screenplay/withAnswerOf.js +0 -18
- package/lib/screenplay/withAnswerOf.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 +0 -15
- 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 +0 -17
- 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/ElementFinderExpectation.ts +0 -29
- package/src/expectations/index.ts +0 -6
- package/src/expectations/isActive.ts +0 -24
- package/src/expectations/isClickable.ts +0 -20
- package/src/expectations/isEnabled.ts +0 -18
- package/src/expectations/isPresent.ts +0 -19
- package/src/expectations/isSelected.ts +0 -23
- package/src/expectations/isVisible.ts +0 -27
- package/src/screenplay/interactions/Accept.ts +0 -95
- package/src/screenplay/interactions/Clear.ts +0 -130
- package/src/screenplay/interactions/Click.ts +0 -96
- package/src/screenplay/interactions/Close.ts +0 -184
- package/src/screenplay/interactions/DeleteCookies.ts +0 -154
- package/src/screenplay/interactions/Dismiss.ts +0 -99
- package/src/screenplay/interactions/DoubleClick.ts +0 -124
- package/src/screenplay/interactions/Enter.ts +0 -104
- package/src/screenplay/interactions/EnterBuilder.ts +0 -29
- package/src/screenplay/interactions/ExecuteScript.ts +0 -325
- package/src/screenplay/interactions/Hover.ts +0 -106
- package/src/screenplay/interactions/Navigate.ts +0 -363
- package/src/screenplay/interactions/Press.ts +0 -137
- package/src/screenplay/interactions/PressBuilder.ts +0 -29
- package/src/screenplay/interactions/ResizeBrowserWindow.ts +0 -148
- package/src/screenplay/interactions/RightClick.ts +0 -114
- package/src/screenplay/interactions/Scroll.ts +0 -99
- package/src/screenplay/interactions/Select.ts +0 -402
- package/src/screenplay/interactions/SelectBuilder.ts +0 -35
- package/src/screenplay/interactions/Switch.ts +0 -393
- package/src/screenplay/interactions/TakeScreenshot.ts +0 -89
- package/src/screenplay/interactions/Wait.ts +0 -267
- package/src/screenplay/interactions/WaitBuilder.ts +0 -35
- package/src/screenplay/questions/Attribute.ts +0 -67
- package/src/screenplay/questions/Browser.ts +0 -55
- package/src/screenplay/questions/CSSClasses.ts +0 -121
- package/src/screenplay/questions/Cookie.ts +0 -70
- package/src/screenplay/questions/LastScriptExecution.ts +0 -21
- package/src/screenplay/questions/ModalDialog.ts +0 -149
- package/src/screenplay/questions/Pick.ts +0 -334
- package/src/screenplay/questions/Selected.ts +0 -268
- package/src/screenplay/questions/Value.ts +0 -73
- package/src/screenplay/questions/Website.ts +0 -27
- package/src/screenplay/questions/Window.ts +0 -29
- package/src/screenplay/questions/lists/ElementArrayFinderListAdapter.ts +0 -158
- package/src/screenplay/questions/lists/index.ts +0 -1
- package/src/screenplay/questions/targets/Target.ts +0 -198
- package/src/screenplay/questions/targets/TargetElement.ts +0 -70
- package/src/screenplay/questions/targets/TargetElements.ts +0 -142
- package/src/screenplay/questions/targets/TargetNestedElement.ts +0 -71
- package/src/screenplay/questions/targets/TargetNestedElements.ts +0 -142
- package/src/screenplay/questions/targets/builders.ts +0 -10
- package/src/screenplay/questions/targets/index.ts +0 -5
- package/src/screenplay/questions/targets/override.ts +0 -17
- package/src/screenplay/questions/text/Text.ts +0 -55
- package/src/screenplay/questions/text/TextOfMultipleElements.ts +0 -40
- package/src/screenplay/questions/text/TextOfSingleElement.ts +0 -37
- package/src/screenplay/questions/text/index.ts +0 -1
- package/src/screenplay/withAnswerOf.ts +0 -19
- 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 -102
- 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,254 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Pick = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated
|
|
8
|
-
* Please use [Target.all](/modules/protractor/class/src/screenplay/questions/targets/Target.ts~Target.html) instead.
|
|
9
|
-
*
|
|
10
|
-
* @experimental
|
|
11
|
-
*
|
|
12
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~List}
|
|
13
|
-
*/
|
|
14
|
-
class Pick {
|
|
15
|
-
constructor(collection, filters = new Filters()) {
|
|
16
|
-
this.collection = collection;
|
|
17
|
-
this.filters = filters;
|
|
18
|
-
}
|
|
19
|
-
static from(collection) {
|
|
20
|
-
return new Pick(collection);
|
|
21
|
-
}
|
|
22
|
-
count() {
|
|
23
|
-
return new NumberOfMatchingItems(this.collection, this.filters);
|
|
24
|
-
}
|
|
25
|
-
all() {
|
|
26
|
-
return new AllMatchingItems(this.collection, this.filters);
|
|
27
|
-
}
|
|
28
|
-
first() {
|
|
29
|
-
return new FirstMatchingItem(this.collection, this.filters);
|
|
30
|
-
}
|
|
31
|
-
last() {
|
|
32
|
-
return new LastMatchingItem(this.collection, this.filters);
|
|
33
|
-
}
|
|
34
|
-
get(index) {
|
|
35
|
-
return new NthMatchingItem(this.collection, this.filters, index);
|
|
36
|
-
}
|
|
37
|
-
where(question, expectation) {
|
|
38
|
-
return new Pick(this.collection, this.filters.append(new Filter(question, expectation)));
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.Pick = Pick;
|
|
42
|
-
/**
|
|
43
|
-
* @package
|
|
44
|
-
*/
|
|
45
|
-
class Filters extends core_1.Question {
|
|
46
|
-
constructor(filters = []) {
|
|
47
|
-
super('');
|
|
48
|
-
this.filters = filters;
|
|
49
|
-
const fullDescription = this.filters
|
|
50
|
-
.reduce((description, filter) => description.concat(filter.toString()), [])
|
|
51
|
-
.join(' and ');
|
|
52
|
-
this.subject = fullDescription.length > 0
|
|
53
|
-
? `where ${fullDescription}`
|
|
54
|
-
: '';
|
|
55
|
-
}
|
|
56
|
-
append(filter) {
|
|
57
|
-
return new Filters(this.filters.concat(filter));
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* @desc
|
|
61
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
62
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
63
|
-
*
|
|
64
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
65
|
-
* @returns {Promise<void>}
|
|
66
|
-
*
|
|
67
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
68
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
69
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
70
|
-
*/
|
|
71
|
-
answeredBy(actor) {
|
|
72
|
-
return (collection) => this.filters.reduce((filteredCollection, filter) => filter.answeredBy(actor)(filteredCollection), collection);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* @package
|
|
77
|
-
*/
|
|
78
|
-
class Filter extends core_1.Question {
|
|
79
|
-
constructor(question, expectation) {
|
|
80
|
-
super((0, io_1.formatted) `${question} does ${expectation}`);
|
|
81
|
-
this.question = question;
|
|
82
|
-
this.expectation = expectation;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* @desc
|
|
86
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
87
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
88
|
-
*
|
|
89
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
90
|
-
* @returns {Promise<void>}
|
|
91
|
-
*
|
|
92
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
93
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
94
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
95
|
-
*/
|
|
96
|
-
answeredBy(actor) {
|
|
97
|
-
return (collection) => collection.filter((item) => {
|
|
98
|
-
const expectation = this.expectation.answeredBy(actor);
|
|
99
|
-
return Promise.resolve(this.question.of(item).answeredBy(actor))
|
|
100
|
-
.then(answer => expectation(answer))
|
|
101
|
-
.then(outcome => outcome instanceof core_1.ExpectationMet);
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* @package
|
|
107
|
-
*/
|
|
108
|
-
class QuestionAboutCollectionItems extends core_1.Question {
|
|
109
|
-
constructor(collection, filters, description) {
|
|
110
|
-
super(`${description} ${(0, io_1.formatted) `${collection}`} ${filters.toString()}`.trim());
|
|
111
|
-
this.collection = collection;
|
|
112
|
-
this.filters = filters;
|
|
113
|
-
this.description = description;
|
|
114
|
-
}
|
|
115
|
-
collectionFilteredBy(actor) {
|
|
116
|
-
const collection = this.isAQuestion(this.collection)
|
|
117
|
-
? this.collection.answeredBy(actor)
|
|
118
|
-
: this.collection;
|
|
119
|
-
return this.filters.answeredBy(actor)(collection);
|
|
120
|
-
}
|
|
121
|
-
isAQuestion(h) {
|
|
122
|
-
return !!h.answeredBy;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* @package
|
|
127
|
-
*/
|
|
128
|
-
class NumberOfMatchingItems extends QuestionAboutCollectionItems {
|
|
129
|
-
constructor(collection, filters) {
|
|
130
|
-
super(collection, filters, 'the number of');
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* @desc
|
|
134
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
135
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
136
|
-
*
|
|
137
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
138
|
-
* @returns {Promise<void>}
|
|
139
|
-
*
|
|
140
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
141
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
142
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
143
|
-
*/
|
|
144
|
-
answeredBy(actor) {
|
|
145
|
-
return Promise.resolve(this.collectionFilteredBy(actor).count());
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* @package
|
|
150
|
-
*/
|
|
151
|
-
class AllMatchingItems extends QuestionAboutCollectionItems {
|
|
152
|
-
constructor(collection, filters) {
|
|
153
|
-
super(collection, filters, '');
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* @desc
|
|
157
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
158
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
159
|
-
*
|
|
160
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
161
|
-
* @returns {Promise<void>}
|
|
162
|
-
*
|
|
163
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
164
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
165
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
166
|
-
*/
|
|
167
|
-
answeredBy(actor) {
|
|
168
|
-
return this.collectionFilteredBy(actor);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* @package
|
|
173
|
-
*/
|
|
174
|
-
class FirstMatchingItem extends QuestionAboutCollectionItems {
|
|
175
|
-
constructor(collection, filters) {
|
|
176
|
-
super(collection, filters, 'the first of');
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* @desc
|
|
180
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
181
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
182
|
-
*
|
|
183
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
184
|
-
* @returns {Promise<void>}
|
|
185
|
-
*
|
|
186
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
187
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
188
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
189
|
-
*/
|
|
190
|
-
answeredBy(actor) {
|
|
191
|
-
return this.collectionFilteredBy(actor).first();
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* @package
|
|
196
|
-
*/
|
|
197
|
-
class LastMatchingItem extends QuestionAboutCollectionItems {
|
|
198
|
-
constructor(collection, filters) {
|
|
199
|
-
super(collection, filters, 'the last of');
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* @desc
|
|
203
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
204
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
205
|
-
*
|
|
206
|
-
* @param {AnswersQuestions & UsesAbilities} 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~AnswersQuestions}
|
|
211
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
212
|
-
*/
|
|
213
|
-
answeredBy(actor) {
|
|
214
|
-
return this.collectionFilteredBy(actor).last();
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* @package
|
|
219
|
-
*/
|
|
220
|
-
class NthMatchingItem extends QuestionAboutCollectionItems {
|
|
221
|
-
constructor(collection, filters, index) {
|
|
222
|
-
super(collection, filters, `the ${NthMatchingItem.ordinalSuffixOf(index + 1)} of`);
|
|
223
|
-
this.index = index;
|
|
224
|
-
}
|
|
225
|
-
static ordinalSuffixOf(index) {
|
|
226
|
-
const lastDigit = index % 10, lastTwoDigits = index % 100;
|
|
227
|
-
switch (true) {
|
|
228
|
-
case (lastDigit === 1 && lastTwoDigits !== 11):
|
|
229
|
-
return index + 'st';
|
|
230
|
-
case (lastDigit === 2 && lastTwoDigits !== 12):
|
|
231
|
-
return index + 'nd';
|
|
232
|
-
case (lastDigit === 3 && lastTwoDigits !== 13):
|
|
233
|
-
return index + 'rd';
|
|
234
|
-
default:
|
|
235
|
-
return index + 'th';
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* @desc
|
|
240
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
241
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
242
|
-
*
|
|
243
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
244
|
-
* @returns {Promise<void>}
|
|
245
|
-
*
|
|
246
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
247
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
248
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
249
|
-
*/
|
|
250
|
-
answeredBy(actor) {
|
|
251
|
-
return this.collectionFilteredBy(actor).get(this.index);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
//# sourceMappingURL=Pick.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Pick.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Pick.ts"],"names":[],"mappings":";;;AAAA,4CAAyH;AACzH,iDAAqD;AAWrD;;;;;;;GAOG;AACH,MAAa,IAAI;IAMb,YACqB,UAAuD,EACvD,UAA+C,IAAI,OAAO,EAA8B;QADxF,eAAU,GAAV,UAAU,CAA6C;QACvD,YAAO,GAAP,OAAO,CAAiF;IAE7G,CAAC;IARD,MAAM,CAAC,IAAI,CAAiD,UAA6B;QACrF,OAAO,IAAI,IAAI,CAAS,UAAU,CAAC,CAAC;IACxC,CAAC;IAQD,KAAK;QACD,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACpE,CAAC;IAED,GAAG;QACC,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED,KAAK;QACD,OAAO,IAAI,iBAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC;IAED,IAAI;QACA,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED,GAAG,CAAC,KAAa;QACb,OAAO,IA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'protractor';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Represents options and values selected in a
|
|
6
|
-
* [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select).
|
|
7
|
-
*
|
|
8
|
-
* @see {@link Select}
|
|
9
|
-
*/
|
|
10
|
-
export declare class Selected {
|
|
11
|
-
/**
|
|
12
|
-
* @desc
|
|
13
|
-
* Represents the value of a single option selected in a
|
|
14
|
-
* [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select).
|
|
15
|
-
*
|
|
16
|
-
* @example <caption>Example widget</caption>
|
|
17
|
-
* <select data-test='countries'>
|
|
18
|
-
* <option value='UK'>United Kingdom</option>
|
|
19
|
-
* <option value='PL'>Poland</option>
|
|
20
|
-
* <option value='US'>United States</option>
|
|
21
|
-
* </select>
|
|
22
|
-
*
|
|
23
|
-
* @example <caption>Lean Page Object</caption>
|
|
24
|
-
* import { Target } from '@serenity-js/protractor';
|
|
25
|
-
* import { browser, by } from 'protractor';
|
|
26
|
-
*
|
|
27
|
-
* class Countries {
|
|
28
|
-
* static dropdown = Target.the('countries dropdown')
|
|
29
|
-
* .located(by.css('[data-test="countries"]'));
|
|
30
|
-
* }
|
|
31
|
-
*
|
|
32
|
-
* @example <caption>Retrieving the selected value</caption>
|
|
33
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
34
|
-
* import { Accept, BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
35
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
36
|
-
* import { protractor } from 'protractor';
|
|
37
|
-
*
|
|
38
|
-
* actorCalled('Nick')
|
|
39
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
40
|
-
* .attemptsTo(
|
|
41
|
-
* Select.value('UK').from(Countries.dropdown),
|
|
42
|
-
* Ensure.that(Selected.valueOf(Countries.dropdown), equals('UK')),
|
|
43
|
-
* );
|
|
44
|
-
*
|
|
45
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
46
|
-
* A {@link Target} identifying the `<select>` element of interest
|
|
47
|
-
*
|
|
48
|
-
* @returns {Question<Promise<string>>}
|
|
49
|
-
*
|
|
50
|
-
* @see {@link Select.value}
|
|
51
|
-
*/
|
|
52
|
-
static valueOf(target: Question<ElementFinder> | ElementFinder): Question<Promise<string>>;
|
|
53
|
-
/**
|
|
54
|
-
* @desc
|
|
55
|
-
* Represents values of options selected in a
|
|
56
|
-
* [HTML `<select multiple>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple)
|
|
57
|
-
*
|
|
58
|
-
* @example <caption>Example widget</caption>
|
|
59
|
-
* <select multiple data-test='countries'>
|
|
60
|
-
* <option value='UK'>United Kingdom</option>
|
|
61
|
-
* <option value='PL'>Poland</option>
|
|
62
|
-
* <option value='US'>United States</option>
|
|
63
|
-
* </select>
|
|
64
|
-
*
|
|
65
|
-
* @example <caption>Lean Page Object</caption>
|
|
66
|
-
* import { Target } from '@serenity-js/protractor';
|
|
67
|
-
* import { browser, by } from 'protractor';
|
|
68
|
-
*
|
|
69
|
-
* class Countries {
|
|
70
|
-
* static dropdown = Target.the('countries dropdown')
|
|
71
|
-
* .located(by.css('[data-test="countries"]'));
|
|
72
|
-
* }
|
|
73
|
-
*
|
|
74
|
-
* @example <caption>Retrieving the selected value</caption>
|
|
75
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
76
|
-
* import { Accept, BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
77
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
78
|
-
* import { protractor } from 'protractor';
|
|
79
|
-
*
|
|
80
|
-
* actorCalled('Nick')
|
|
81
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
82
|
-
* .attemptsTo(
|
|
83
|
-
* Select.values('UK').from(Countries.dropdown),
|
|
84
|
-
* Ensure.that(Selected.valuesOf(Countries.dropdown), equals([ 'UK' ])),
|
|
85
|
-
* );
|
|
86
|
-
*
|
|
87
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
88
|
-
* A {@link Target} identifying the `<select>` element of interest
|
|
89
|
-
*
|
|
90
|
-
* @returns {Question<Promise<string[]>>}
|
|
91
|
-
*
|
|
92
|
-
* @see {@link Select.values}
|
|
93
|
-
*/
|
|
94
|
-
static valuesOf(target: Question<ElementFinder> | ElementFinder): Question<Promise<string[]>>;
|
|
95
|
-
/**
|
|
96
|
-
* @desc
|
|
97
|
-
* Represents a single option selected in a
|
|
98
|
-
* [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple)
|
|
99
|
-
*
|
|
100
|
-
* @example <caption>Example widget</caption>
|
|
101
|
-
* <select data-test='countries'>
|
|
102
|
-
* <option value='UK'>United Kingdom</option>
|
|
103
|
-
* <option value='PL'>Poland</option>
|
|
104
|
-
* <option value='US'>United States</option>
|
|
105
|
-
* </select>
|
|
106
|
-
*
|
|
107
|
-
* @example <caption>Lean Page Object</caption>
|
|
108
|
-
* import { Target } from '@serenity-js/protractor';
|
|
109
|
-
* import { browser, by } from 'protractor';
|
|
110
|
-
*
|
|
111
|
-
* class Countries {
|
|
112
|
-
* static dropdown = Target.the('countries dropdown')
|
|
113
|
-
* .located(by.css('[data-test="countries"]'));
|
|
114
|
-
* }
|
|
115
|
-
*
|
|
116
|
-
* @example <caption>Retrieving the selected value</caption>
|
|
117
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
118
|
-
* import { Accept, BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
119
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
120
|
-
* import { protractor } from 'protractor';
|
|
121
|
-
*
|
|
122
|
-
* actorCalled('Nick')
|
|
123
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
124
|
-
* .attemptsTo(
|
|
125
|
-
* Select.option('Poland').from(Countries.dropdown),
|
|
126
|
-
* Ensure.that(
|
|
127
|
-
* Selected.optionIn(Countries.dropdown),
|
|
128
|
-
* equals('Poland')
|
|
129
|
-
* ),
|
|
130
|
-
* );
|
|
131
|
-
*
|
|
132
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
133
|
-
* A {@link Target} identifying the `<select>` element of interest
|
|
134
|
-
*
|
|
135
|
-
* @returns {Question<Promise<string>>}
|
|
136
|
-
*
|
|
137
|
-
* @see {@link Select.option}
|
|
138
|
-
*/
|
|
139
|
-
static optionIn(target: Question<ElementFinder> | ElementFinder): Question<Promise<string>>;
|
|
140
|
-
/**
|
|
141
|
-
* @desc
|
|
142
|
-
* Represents options selected in a
|
|
143
|
-
* [HTML `<select multiple>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select#attr-multiple)
|
|
144
|
-
*
|
|
145
|
-
* @example <caption>Example widget</caption>
|
|
146
|
-
* <select multiple data-test='countries'>
|
|
147
|
-
* <option value='UK'>United Kingdom</option>
|
|
148
|
-
* <option value='PL'>Poland</option>
|
|
149
|
-
* <option value='US'>United States</option>
|
|
150
|
-
* </select>
|
|
151
|
-
*
|
|
152
|
-
* @example <caption>Lean Page Object</caption>
|
|
153
|
-
* import { Target } from '@serenity-js/protractor';
|
|
154
|
-
* import { browser, by } from 'protractor';
|
|
155
|
-
*
|
|
156
|
-
* class Countries {
|
|
157
|
-
* static dropdown = Target.the('countries dropdown')
|
|
158
|
-
* .located(by.css('[data-test="countries"]'));
|
|
159
|
-
* }
|
|
160
|
-
*
|
|
161
|
-
* @example <caption>Retrieving the selected value</caption>
|
|
162
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
163
|
-
* import { Accept, BrowseTheWeb, Select, Selected } from '@serenity-js/protractor';
|
|
164
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
165
|
-
* import { protractor } from 'protractor';
|
|
166
|
-
*
|
|
167
|
-
* actorCalled('Nick')
|
|
168
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
169
|
-
* .attemptsTo(
|
|
170
|
-
* Select.options('Poland', 'United States').from(Countries.dropdown),
|
|
171
|
-
* Ensure.that(
|
|
172
|
-
* Selected.optionsIn(Countries.dropdown),
|
|
173
|
-
* equals([ 'Poland', 'United States' ])
|
|
174
|
-
* ),
|
|
175
|
-
* );
|
|
176
|
-
*
|
|
177
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
178
|
-
* A {@link Target} identifying the `<select>` element of interest
|
|
179
|
-
*
|
|
180
|
-
* @returns {Question<Promise<string[]>>}
|
|
181
|
-
*
|
|
182
|
-
* @see {@link Select.options}
|
|
183
|
-
*/
|
|
184
|
-
static optionsIn(target: Question<ElementFinder> | ElementFinder): Question<Promise<string[]>>;
|
|
185
|
-
}
|