@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,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ElementArrayFinderListAdapter = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Adapts {@link ElementArrayFinder} so that it can be used with {@link @serenity-js/core/lib/screenplay/questions~List}.
|
|
9
|
-
*
|
|
10
|
-
* You most likely won't need to use this class directly. Instead, check out {@link Target} and {@link Target.all}.
|
|
11
|
-
*
|
|
12
|
-
* @see {@link Target}
|
|
13
|
-
*
|
|
14
|
-
* @implements {@serenity-js/core/lib/screenplay/questions/lists~ListAdapter}
|
|
15
|
-
*/
|
|
16
|
-
class ElementArrayFinderListAdapter {
|
|
17
|
-
/**
|
|
18
|
-
* @param {Question<ElementArrayFinder> | ElementArrayFinder} collection
|
|
19
|
-
*/
|
|
20
|
-
constructor(collection) {
|
|
21
|
-
this.collection = collection;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @desc
|
|
25
|
-
* Returns the number of {@link ElementFinder}s that the underlying {@link ElementArrayFinder} contains,
|
|
26
|
-
* left after applying any filters.
|
|
27
|
-
*
|
|
28
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
29
|
-
* @returns {Promise<number>}
|
|
30
|
-
*/
|
|
31
|
-
count(actor) {
|
|
32
|
-
return Promise.resolve(this.elements(actor).count());
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* @desc
|
|
36
|
-
* Returns the first of {@link ElementFinder}s that the underlying {@link ElementArrayFinder} contains,
|
|
37
|
-
* left after applying any filters
|
|
38
|
-
*
|
|
39
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
40
|
-
* @returns {ElementFinder}
|
|
41
|
-
*/
|
|
42
|
-
first(actor) {
|
|
43
|
-
return this.elements(actor).first();
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @desc
|
|
47
|
-
* Returns the last of {@link ElementFinder}s that the underlying {@link ElementArrayFinder} contains,
|
|
48
|
-
* left after applying any filters
|
|
49
|
-
*
|
|
50
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
51
|
-
* @returns {ElementFinder}
|
|
52
|
-
*/
|
|
53
|
-
last(actor) {
|
|
54
|
-
return this.elements(actor).last();
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* @desc
|
|
58
|
-
* Returns the nth of {@link ElementFinder}s that the underlying {@link ElementArrayFinder} contains,
|
|
59
|
-
* left after applying any filters
|
|
60
|
-
*
|
|
61
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
62
|
-
*
|
|
63
|
-
* @param {number} index
|
|
64
|
-
* Zero-based index of the item to return
|
|
65
|
-
*
|
|
66
|
-
* @returns {ElementFinder}
|
|
67
|
-
*/
|
|
68
|
-
get(actor, index) {
|
|
69
|
-
return this.elements(actor).get(index);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* @desc
|
|
73
|
-
* Returns the underlying {@link ElementArrayFinder},
|
|
74
|
-
* with any filters applied.
|
|
75
|
-
*
|
|
76
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
77
|
-
* @returns {ElementFinder}
|
|
78
|
-
*/
|
|
79
|
-
items(actor) {
|
|
80
|
-
return this.elements(actor);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* @desc
|
|
84
|
-
* Filters the underlying {@link ElementArrayFinder} so that the result contains only those {@link ElementFinder}s that meet the {@link Expectation}
|
|
85
|
-
*
|
|
86
|
-
* @param {@serenity-js/core/lib/screenplay/questions~MetaQuestion<ElementFinder, Promise<Answer_Type> | Answer_Type>} question
|
|
87
|
-
* @param {@serenity-js/core/lib/screenplay/questions~Expectation<any, Answer_Type>} expectation
|
|
88
|
-
*
|
|
89
|
-
* @returns {@serenity-js/core/lib/screenplay/questions/lists~ListAdapter<ElementFinder, ElementArrayFinder>}
|
|
90
|
-
*
|
|
91
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
92
|
-
*/
|
|
93
|
-
withFilter(question, expectation) {
|
|
94
|
-
return new ElementArrayFinderListAdapter(new ElementArrayFinderArrayListFilter(this.collection, question, expectation));
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* @desc
|
|
98
|
-
* Returns a human-readable description of the underlying {@link ElementArrayFinder}.
|
|
99
|
-
*
|
|
100
|
-
* @returns {string}
|
|
101
|
-
*/
|
|
102
|
-
toString() {
|
|
103
|
-
return (0, io_1.formatted) `${this.collection}`;
|
|
104
|
-
}
|
|
105
|
-
elements(actor) {
|
|
106
|
-
return core_1.Question.isAQuestion(this.collection)
|
|
107
|
-
? this.collection.answeredBy(actor)
|
|
108
|
-
: this.collection;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.ElementArrayFinderListAdapter = ElementArrayFinderListAdapter;
|
|
112
|
-
/**
|
|
113
|
-
* @private
|
|
114
|
-
*/
|
|
115
|
-
class ElementArrayFinderArrayListFilter extends core_1.Question {
|
|
116
|
-
constructor(collection, question, expectation) {
|
|
117
|
-
super([
|
|
118
|
-
(0, io_1.formatted) `${collection}`,
|
|
119
|
-
collection instanceof ElementArrayFinderArrayListFilter ? 'and' : 'where',
|
|
120
|
-
(0, io_1.formatted) `${question} does ${expectation}`
|
|
121
|
-
].join(' '));
|
|
122
|
-
this.collection = collection;
|
|
123
|
-
this.question = question;
|
|
124
|
-
this.expectation = expectation;
|
|
125
|
-
}
|
|
126
|
-
answeredBy(actor) {
|
|
127
|
-
return this.finderAs(actor)
|
|
128
|
-
.filter((elementFinder) => Promise.resolve(this.question.of(elementFinder).answeredBy(actor))
|
|
129
|
-
.then(answer => this.expectation.answeredBy(actor)(answer))
|
|
130
|
-
.then(outcome => outcome instanceof core_1.ExpectationMet));
|
|
131
|
-
}
|
|
132
|
-
finderAs(actor) {
|
|
133
|
-
return core_1.Question.isAQuestion(this.collection)
|
|
134
|
-
? this.collection.answeredBy(actor)
|
|
135
|
-
: this.collection;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=ElementArrayFinderListAdapter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ElementArrayFinderListAdapter.js","sourceRoot":"","sources":["../../../../src/screenplay/questions/lists/ElementArrayFinderListAdapter.ts"],"names":[],"mappings":";;;AAAA,4CAAyH;AACzH,iDAAqD;AAIrD;;;;;;;;;GASG;AACH,MAAa,6BAA6B;IAEtC;;OAEG;IACH,YAA6B,UAA6D;QAA7D,eAAU,GAAV,UAAU,CAAmD;IAC1F,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,KAAuC;QACzC,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,KAAuC;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC;IACxC,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,KAAuC;QACxC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IACvC,CAAC;IAED;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,KAAuC,EAAE,KAAa;QACtD,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,KAAuC;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAED;;;;;;;;;;OAUG;IACH,UAAU,CACN,QAAyE,EACzE,WAA0C;QAE1C,OAAO,IAAI,6BAA6B,CACpC,IAAI,iCAAiC,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAC,CAChF,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACJ,OAAO,IAAA,cAAS,EAAC,GAAI,IAAI,CAAC,UAAW,EAAE,CAAC;IAC5C,CAAC;IAEO,QAAQ,CAAC,KAAuC;QACpD,OAAO,eAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC;YACxC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC;YACnC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;IAC1B,CAAC;CACJ;AA3GD,sEA2GC;AAED;;GAEG;AACH,MAAM,iCACF,SAAQ,eAA4B;IAEpC,YACqB,UAA6D,EAC7D,QAAyE,EACzE,WAA0C;QAE3D,KAAK,CAAC;YACF,IAAA,cAAS,EAAC,GAAI,UAAW,EAAE;YAC3B,UAAU,YAAY,iCAAiC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO;YACzE,IAAA,cAAS,EAAC,GAAI,QAAS,SAAU,WAAY,EAAE;SAClD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QARI,eAAU,GAAV,UAAU,CAAmD;QAC7D,aAAQ,GAAR,QAAQ,CAAiE;QACzE,gBAAW,GAAX,WAAW,CAA+B;IAO/D,CAAC;IAED,UAAU,CAAC,KAAuC;QAE9C,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;aACtB,MAAM,CAAC,CAAC,aAA4B,EAAE,EAAE,CACrC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;aAC7D,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;aAC1D,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,YAAY,qBAAc,CAAC,CAC1D,CAAC;IACV,CAAC;IAEO,QAAQ,CAAC,KAAuC;QACpD,OAAO,eAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC;YACxC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC;YACnC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;IAC1B,CAAC;CACJ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ElementArrayFinderListAdapter';
|
|
@@ -1,14 +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("./ElementArrayFinderListAdapter"), exports);
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/screenplay/questions/lists/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kEAAgD"}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { NestedTargetBuilder, TargetBuilder } from './builders';
|
|
2
|
-
import { TargetElement } from './TargetElement';
|
|
3
|
-
import { TargetElements } from './TargetElements';
|
|
4
|
-
import { TargetNestedElement } from './TargetNestedElement';
|
|
5
|
-
import { TargetNestedElements } from './TargetNestedElements';
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Provides a convenient way to retrieve a single web element or multiple web elements,
|
|
9
|
-
* so that they can be used with Serenity/JS {@link @serenity-js/core/lib/screenplay~Interaction}s.
|
|
10
|
-
*
|
|
11
|
-
* Check out the examples below, as well as the unit tests demonstrating the usage.
|
|
12
|
-
*
|
|
13
|
-
* @example <caption>Imaginary website under test</caption>
|
|
14
|
-
* <body>
|
|
15
|
-
* <ul id="basket">
|
|
16
|
-
* <li><a href="#">Apple</a></li>
|
|
17
|
-
* <li><a href="#">Banana</a></li>
|
|
18
|
-
* <li><a href="#">Coconut</a></li>
|
|
19
|
-
* <li><a href="#" class="has-discount">Date</a></li>
|
|
20
|
-
* </ul>
|
|
21
|
-
* <div id="summary"><strong class="out-of-stock">Coconut</strong> is not available</div>
|
|
22
|
-
* <button type="submit">Proceed to Checkout</button>
|
|
23
|
-
* </body>
|
|
24
|
-
*
|
|
25
|
-
* @example <caption>Locating a single element</caption>
|
|
26
|
-
* import { Target } from '@serenity-js/protractor';
|
|
27
|
-
* import { by } from 'protractor';
|
|
28
|
-
*
|
|
29
|
-
* const proceedToCheckoutButton =
|
|
30
|
-
* Target.the('Proceed to Checkout button').located(by.css(`button[type='submit']`));
|
|
31
|
-
*
|
|
32
|
-
* @example <caption>Locating multiple elements</caption>
|
|
33
|
-
* import { Target } from '@serenity-js/protractor';
|
|
34
|
-
* import { by } from 'protractor';
|
|
35
|
-
*
|
|
36
|
-
* const basketItems =
|
|
37
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'));
|
|
38
|
-
*
|
|
39
|
-
* @example <caption>Locating element relative to another element</caption>
|
|
40
|
-
* import { Target } from '@serenity-js/protractor';
|
|
41
|
-
* import { by } from 'protractor';
|
|
42
|
-
*
|
|
43
|
-
* const summary =
|
|
44
|
-
* Target.the('summary').located(by.id('message'));
|
|
45
|
-
*
|
|
46
|
-
* const outOfStockItem =
|
|
47
|
-
* Target.the('out of stock item').of(summary).located(by.css('.out-of-stock'))
|
|
48
|
-
*
|
|
49
|
-
* @example <caption>Filtering elements matched by a locator</caption>
|
|
50
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
51
|
-
* import { endsWith } from '@serenity-js/assertions';
|
|
52
|
-
* import { by } from 'protractor';
|
|
53
|
-
*
|
|
54
|
-
* const basketItems =
|
|
55
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'))
|
|
56
|
-
* .where(Text, endsWith('e')); // Apple, Date
|
|
57
|
-
*
|
|
58
|
-
* @example <caption>Counting items matched by a locator</caption>
|
|
59
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
60
|
-
* import { endsWith } from '@serenity-js/assertions';
|
|
61
|
-
* import { Question } from '@serenity-js/core';
|
|
62
|
-
* import { by } from 'protractor';
|
|
63
|
-
*
|
|
64
|
-
* const basketItemsCount: Question<Promise<number>> =
|
|
65
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'))
|
|
66
|
-
* .count() // 4
|
|
67
|
-
*
|
|
68
|
-
* @example <caption>Getting first item matched by a locator</caption>
|
|
69
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
70
|
-
* import { endsWith } from '@serenity-js/assertions';
|
|
71
|
-
* import { by, ElementFinder } from 'protractor';
|
|
72
|
-
*
|
|
73
|
-
* const apple: Question<ElementFinder> =
|
|
74
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'))
|
|
75
|
-
* .first()
|
|
76
|
-
*
|
|
77
|
-
* @example <caption>Getting last item matched by a locator</caption>
|
|
78
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
79
|
-
* import { endsWith } from '@serenity-js/assertions';
|
|
80
|
-
* import { by, ElementFinder } from 'protractor';
|
|
81
|
-
*
|
|
82
|
-
* const date: Question<ElementFinder> =
|
|
83
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'))
|
|
84
|
-
* .last()
|
|
85
|
-
*
|
|
86
|
-
* @example <caption>Getting nth item matched by a locator</caption>
|
|
87
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
88
|
-
* import { endsWith } from '@serenity-js/assertions';
|
|
89
|
-
* import { by, ElementFinder } from 'protractor';
|
|
90
|
-
*
|
|
91
|
-
* const banana: Question<ElementFinder> =
|
|
92
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'))
|
|
93
|
-
* .get(1)
|
|
94
|
-
*
|
|
95
|
-
* @example <caption>Using multiple filters and nested targets</caption>
|
|
96
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
97
|
-
* import { contain, endsWith } from '@serenity-js/assertions';
|
|
98
|
-
* import { by, ElementFinder } from 'protractor';
|
|
99
|
-
*
|
|
100
|
-
* class Basket {
|
|
101
|
-
* static component = Target.the('basket').located(by.id('basket'));
|
|
102
|
-
*
|
|
103
|
-
* static items = Target.all('items').located(by.css('li'))
|
|
104
|
-
* .of(Basket.component);
|
|
105
|
-
*
|
|
106
|
-
* static link = Target.the('link').located(by.css('a'));
|
|
107
|
-
* }
|
|
108
|
-
*
|
|
109
|
-
* const date: Question<ElementFinder> =
|
|
110
|
-
* Basket.items
|
|
111
|
-
* .where(Text, endsWith('e'))
|
|
112
|
-
* .where(CSSClasses.of(Basket.link), contain('has-discount'))
|
|
113
|
-
* .first()
|
|
114
|
-
*
|
|
115
|
-
* @example <caption>Clicking on an element</caption>
|
|
116
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
117
|
-
* import { BrowseTheWeb, Click } from '@serenity-js/protractor';
|
|
118
|
-
* import { protractor } from 'protractor';
|
|
119
|
-
*
|
|
120
|
-
* actorCalled('Jane')
|
|
121
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
122
|
-
* .attemptsTo(
|
|
123
|
-
* Click.on(proceedToCheckoutButton),
|
|
124
|
-
* );
|
|
125
|
-
*
|
|
126
|
-
* @example <caption>Retrieving text of multiple elements and performing an assertion</caption>
|
|
127
|
-
* import { Ensure, contain } from '@serenity-js/assertions';
|
|
128
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
129
|
-
* import { BrowseTheWeb, Click, Text } from '@serenity-js/protractor';
|
|
130
|
-
* import { protractor } from 'protractor';
|
|
131
|
-
*
|
|
132
|
-
* const basketItemNames = Text.ofAll(basketItems);
|
|
133
|
-
*
|
|
134
|
-
* actorCalled('Jane')
|
|
135
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
136
|
-
* .attemptsTo(
|
|
137
|
-
* Ensure.that(basketItemNames, contain('Apple'))
|
|
138
|
-
* );
|
|
139
|
-
*
|
|
140
|
-
* @example <caption>Waiting on an element</caption>
|
|
141
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
142
|
-
* import { BrowseTheWeb, Click, Text, Wait, isClickable } from '@serenity-js/protractor';
|
|
143
|
-
* import { protractor } from 'protractor';
|
|
144
|
-
*
|
|
145
|
-
* actorCalled('Jane')
|
|
146
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
147
|
-
* .attemptsTo(
|
|
148
|
-
* Wait.until(proceedToCheckoutButton, isClickable()),
|
|
149
|
-
* );
|
|
150
|
-
*/
|
|
151
|
-
export declare class Target {
|
|
152
|
-
/**
|
|
153
|
-
* @desc
|
|
154
|
-
* Locates a single web element
|
|
155
|
-
*
|
|
156
|
-
* @param {string} name - A human-readable name of the element to be used in the report
|
|
157
|
-
* @returns {TargetBuilder<TargetElement> & NestedTargetBuilder<TargetNestedElement>}
|
|
158
|
-
*/
|
|
159
|
-
static the(name: string): TargetBuilder<TargetElement> & NestedTargetBuilder<TargetNestedElement>;
|
|
160
|
-
/**
|
|
161
|
-
* @desc
|
|
162
|
-
* Locates a group of web elements
|
|
163
|
-
*
|
|
164
|
-
* @param {string} name - A human-readable name of the elements to be used in the report
|
|
165
|
-
* @returns {TargetBuilder<TargetElements> & NestedTargetBuilder<TargetNestedElements>}
|
|
166
|
-
*/
|
|
167
|
-
static all(name: string): TargetBuilder<TargetElements> & NestedTargetBuilder<TargetNestedElements>;
|
|
168
|
-
}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Target = void 0;
|
|
4
|
-
const TargetElement_1 = require("./TargetElement");
|
|
5
|
-
const TargetElements_1 = require("./TargetElements");
|
|
6
|
-
const TargetNestedElement_1 = require("./TargetNestedElement");
|
|
7
|
-
const TargetNestedElements_1 = require("./TargetNestedElements");
|
|
8
|
-
/**
|
|
9
|
-
* @desc
|
|
10
|
-
* Provides a convenient way to retrieve a single web element or multiple web elements,
|
|
11
|
-
* so that they can be used with Serenity/JS {@link @serenity-js/core/lib/screenplay~Interaction}s.
|
|
12
|
-
*
|
|
13
|
-
* Check out the examples below, as well as the unit tests demonstrating the usage.
|
|
14
|
-
*
|
|
15
|
-
* @example <caption>Imaginary website under test</caption>
|
|
16
|
-
* <body>
|
|
17
|
-
* <ul id="basket">
|
|
18
|
-
* <li><a href="#">Apple</a></li>
|
|
19
|
-
* <li><a href="#">Banana</a></li>
|
|
20
|
-
* <li><a href="#">Coconut</a></li>
|
|
21
|
-
* <li><a href="#" class="has-discount">Date</a></li>
|
|
22
|
-
* </ul>
|
|
23
|
-
* <div id="summary"><strong class="out-of-stock">Coconut</strong> is not available</div>
|
|
24
|
-
* <button type="submit">Proceed to Checkout</button>
|
|
25
|
-
* </body>
|
|
26
|
-
*
|
|
27
|
-
* @example <caption>Locating a single element</caption>
|
|
28
|
-
* import { Target } from '@serenity-js/protractor';
|
|
29
|
-
* import { by } from 'protractor';
|
|
30
|
-
*
|
|
31
|
-
* const proceedToCheckoutButton =
|
|
32
|
-
* Target.the('Proceed to Checkout button').located(by.css(`button[type='submit']`));
|
|
33
|
-
*
|
|
34
|
-
* @example <caption>Locating multiple elements</caption>
|
|
35
|
-
* import { Target } from '@serenity-js/protractor';
|
|
36
|
-
* import { by } from 'protractor';
|
|
37
|
-
*
|
|
38
|
-
* const basketItems =
|
|
39
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'));
|
|
40
|
-
*
|
|
41
|
-
* @example <caption>Locating element relative to another element</caption>
|
|
42
|
-
* import { Target } from '@serenity-js/protractor';
|
|
43
|
-
* import { by } from 'protractor';
|
|
44
|
-
*
|
|
45
|
-
* const summary =
|
|
46
|
-
* Target.the('summary').located(by.id('message'));
|
|
47
|
-
*
|
|
48
|
-
* const outOfStockItem =
|
|
49
|
-
* Target.the('out of stock item').of(summary).located(by.css('.out-of-stock'))
|
|
50
|
-
*
|
|
51
|
-
* @example <caption>Filtering elements matched by a locator</caption>
|
|
52
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
53
|
-
* import { endsWith } from '@serenity-js/assertions';
|
|
54
|
-
* import { by } from 'protractor';
|
|
55
|
-
*
|
|
56
|
-
* const basketItems =
|
|
57
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'))
|
|
58
|
-
* .where(Text, endsWith('e')); // Apple, Date
|
|
59
|
-
*
|
|
60
|
-
* @example <caption>Counting items matched by a locator</caption>
|
|
61
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
62
|
-
* import { endsWith } from '@serenity-js/assertions';
|
|
63
|
-
* import { Question } from '@serenity-js/core';
|
|
64
|
-
* import { by } from 'protractor';
|
|
65
|
-
*
|
|
66
|
-
* const basketItemsCount: Question<Promise<number>> =
|
|
67
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'))
|
|
68
|
-
* .count() // 4
|
|
69
|
-
*
|
|
70
|
-
* @example <caption>Getting first item matched by a locator</caption>
|
|
71
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
72
|
-
* import { endsWith } from '@serenity-js/assertions';
|
|
73
|
-
* import { by, ElementFinder } from 'protractor';
|
|
74
|
-
*
|
|
75
|
-
* const apple: Question<ElementFinder> =
|
|
76
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'))
|
|
77
|
-
* .first()
|
|
78
|
-
*
|
|
79
|
-
* @example <caption>Getting last item matched by a locator</caption>
|
|
80
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
81
|
-
* import { endsWith } from '@serenity-js/assertions';
|
|
82
|
-
* import { by, ElementFinder } from 'protractor';
|
|
83
|
-
*
|
|
84
|
-
* const date: Question<ElementFinder> =
|
|
85
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'))
|
|
86
|
-
* .last()
|
|
87
|
-
*
|
|
88
|
-
* @example <caption>Getting nth item matched by a locator</caption>
|
|
89
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
90
|
-
* import { endsWith } from '@serenity-js/assertions';
|
|
91
|
-
* import { by, ElementFinder } from 'protractor';
|
|
92
|
-
*
|
|
93
|
-
* const banana: Question<ElementFinder> =
|
|
94
|
-
* Target.all('items in the basket').located(by.css('ul#basket li'))
|
|
95
|
-
* .get(1)
|
|
96
|
-
*
|
|
97
|
-
* @example <caption>Using multiple filters and nested targets</caption>
|
|
98
|
-
* import { Target, Text } from '@serenity-js/protractor';
|
|
99
|
-
* import { contain, endsWith } from '@serenity-js/assertions';
|
|
100
|
-
* import { by, ElementFinder } from 'protractor';
|
|
101
|
-
*
|
|
102
|
-
* class Basket {
|
|
103
|
-
* static component = Target.the('basket').located(by.id('basket'));
|
|
104
|
-
*
|
|
105
|
-
* static items = Target.all('items').located(by.css('li'))
|
|
106
|
-
* .of(Basket.component);
|
|
107
|
-
*
|
|
108
|
-
* static link = Target.the('link').located(by.css('a'));
|
|
109
|
-
* }
|
|
110
|
-
*
|
|
111
|
-
* const date: Question<ElementFinder> =
|
|
112
|
-
* Basket.items
|
|
113
|
-
* .where(Text, endsWith('e'))
|
|
114
|
-
* .where(CSSClasses.of(Basket.link), contain('has-discount'))
|
|
115
|
-
* .first()
|
|
116
|
-
*
|
|
117
|
-
* @example <caption>Clicking on an element</caption>
|
|
118
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
119
|
-
* import { BrowseTheWeb, Click } from '@serenity-js/protractor';
|
|
120
|
-
* import { protractor } from 'protractor';
|
|
121
|
-
*
|
|
122
|
-
* actorCalled('Jane')
|
|
123
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
124
|
-
* .attemptsTo(
|
|
125
|
-
* Click.on(proceedToCheckoutButton),
|
|
126
|
-
* );
|
|
127
|
-
*
|
|
128
|
-
* @example <caption>Retrieving text of multiple elements and performing an assertion</caption>
|
|
129
|
-
* import { Ensure, contain } from '@serenity-js/assertions';
|
|
130
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
131
|
-
* import { BrowseTheWeb, Click, Text } from '@serenity-js/protractor';
|
|
132
|
-
* import { protractor } from 'protractor';
|
|
133
|
-
*
|
|
134
|
-
* const basketItemNames = Text.ofAll(basketItems);
|
|
135
|
-
*
|
|
136
|
-
* actorCalled('Jane')
|
|
137
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
138
|
-
* .attemptsTo(
|
|
139
|
-
* Ensure.that(basketItemNames, contain('Apple'))
|
|
140
|
-
* );
|
|
141
|
-
*
|
|
142
|
-
* @example <caption>Waiting on an element</caption>
|
|
143
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
144
|
-
* import { BrowseTheWeb, Click, Text, Wait, isClickable } from '@serenity-js/protractor';
|
|
145
|
-
* import { protractor } from 'protractor';
|
|
146
|
-
*
|
|
147
|
-
* actorCalled('Jane')
|
|
148
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
149
|
-
* .attemptsTo(
|
|
150
|
-
* Wait.until(proceedToCheckoutButton, isClickable()),
|
|
151
|
-
* );
|
|
152
|
-
*/
|
|
153
|
-
class Target {
|
|
154
|
-
/**
|
|
155
|
-
* @desc
|
|
156
|
-
* Locates a single web element
|
|
157
|
-
*
|
|
158
|
-
* @param {string} name - A human-readable name of the element to be used in the report
|
|
159
|
-
* @returns {TargetBuilder<TargetElement> & NestedTargetBuilder<TargetNestedElement>}
|
|
160
|
-
*/
|
|
161
|
-
static the(name) {
|
|
162
|
-
return {
|
|
163
|
-
located: (byLocator) => new TargetElement_1.TargetElement(name, byLocator),
|
|
164
|
-
of: (parent) => {
|
|
165
|
-
return {
|
|
166
|
-
located: (byLocator) => new TargetNestedElement_1.TargetNestedElement(parent, new TargetElement_1.TargetElement(name, byLocator)),
|
|
167
|
-
};
|
|
168
|
-
},
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* @desc
|
|
173
|
-
* Locates a group of web elements
|
|
174
|
-
*
|
|
175
|
-
* @param {string} name - A human-readable name of the elements to be used in the report
|
|
176
|
-
* @returns {TargetBuilder<TargetElements> & NestedTargetBuilder<TargetNestedElements>}
|
|
177
|
-
*/
|
|
178
|
-
static all(name) {
|
|
179
|
-
return {
|
|
180
|
-
located: (byLocator) => new TargetElements_1.TargetElements(name, byLocator),
|
|
181
|
-
of: (parent) => {
|
|
182
|
-
return {
|
|
183
|
-
located: (byLocator) => new TargetNestedElements_1.TargetNestedElements(parent, new TargetElements_1.TargetElements(name, byLocator)),
|
|
184
|
-
};
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
exports.Target = Target;
|
|
190
|
-
//# sourceMappingURL=Target.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Target.js","sourceRoot":"","sources":["../../../../src/screenplay/questions/targets/Target.ts"],"names":[],"mappings":";;;AAIA,mDAAgD;AAChD,qDAAkD;AAClD,+DAA4D;AAC5D,iEAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgJG;AACH,MAAa,MAAM;IAEf;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,CAAC,IAAY;QACnB,OAAO;YACH,OAAO,EAAE,CAAC,SAAkB,EAAiB,EAAE,CAC3C,IAAI,6BAAa,CAAC,IAAI,EAAE,SAAS,CAAC;YAEtC,EAAE,EAAE,CAAC,MAA+C,EAAE,EAAE;gBACpD,OAAO;oBACH,OAAO,EAAE,CAAC,SAAkB,EAAuB,EAAE,CACjD,IAAI,yCAAmB,CAAC,MAAM,EAAE,IAAI,6BAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;iBAC1E,CAAC;YACN,CAAC;SACJ,CAAC;IACN,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,CAAC,IAAY;QACnB,OAAO;YACH,OAAO,EAAE,CAAC,SAAkB,EAAkB,EAAE,CAC5C,IAAI,+BAAc,CAAC,IAAI,EAAE,SAAS,CAAC;YAEvC,EAAE,EAAE,CAAC,MAA+C,EAAE,EAAE;gBACpD,OAAO;oBACH,OAAO,EAAE,CAAC,SAAkB,EAAwB,EAAE,CAClD,IAAI,2CAAoB,CAAC,MAAM,EAAE,IAAI,+BAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;iBAC5E,CAAC;YACN,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AA3CD,wBA2CC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { AnswersQuestions, MetaQuestion, Question, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { ElementFinder, Locator } from 'protractor';
|
|
3
|
-
import { TargetNestedElement } from './TargetNestedElement';
|
|
4
|
-
/**
|
|
5
|
-
* @desc
|
|
6
|
-
* Locates a single {@link WebElement}.
|
|
7
|
-
*
|
|
8
|
-
* Instead of using this class directly, please use {@link Target.the} instead.
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
* @see {@link Target}
|
|
12
|
-
*
|
|
13
|
-
* @extends {@serenity-js/core/lib/screenplay~Question}
|
|
14
|
-
* @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
15
|
-
*/
|
|
16
|
-
export declare class TargetElement extends Question<ElementFinder> implements MetaQuestion<Question<ElementFinder> | ElementFinder, ElementFinder> {
|
|
17
|
-
protected readonly description: string;
|
|
18
|
-
protected readonly locator: Locator;
|
|
19
|
-
/**
|
|
20
|
-
* @desc
|
|
21
|
-
*
|
|
22
|
-
* @param {string} description - A human-readable description to be used in the report
|
|
23
|
-
* @param {protractor~Locator} locator - A locator to be used when locating the element
|
|
24
|
-
*/
|
|
25
|
-
constructor(description: string, locator: Locator);
|
|
26
|
-
/**
|
|
27
|
-
* @desc
|
|
28
|
-
* Retrieves a {@link WebElement} located by `locator`,
|
|
29
|
-
* resolved in the context of a `parent` {@link WebElement}.
|
|
30
|
-
*
|
|
31
|
-
* @param {Question<ElementFinder> | ElementFinder} parent
|
|
32
|
-
* @returns {TargetNestedElement}
|
|
33
|
-
*
|
|
34
|
-
* @see {@link Target}
|
|
35
|
-
*/
|
|
36
|
-
of(parent: Question<ElementFinder> | ElementFinder): TargetNestedElement;
|
|
37
|
-
/**
|
|
38
|
-
* @desc
|
|
39
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
40
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
41
|
-
*
|
|
42
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
43
|
-
* @returns {Promise<void>}
|
|
44
|
-
*
|
|
45
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
46
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
47
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
48
|
-
*/
|
|
49
|
-
answeredBy(actor: AnswersQuestions & UsesAbilities): ElementFinder;
|
|
50
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TargetElement = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const abilities_1 = require("../../abilities");
|
|
6
|
-
const override_1 = require("./override");
|
|
7
|
-
const TargetNestedElement_1 = require("./TargetNestedElement");
|
|
8
|
-
/**
|
|
9
|
-
* @desc
|
|
10
|
-
* Locates a single {@link WebElement}.
|
|
11
|
-
*
|
|
12
|
-
* Instead of using this class directly, please use {@link Target.the} instead.
|
|
13
|
-
*
|
|
14
|
-
* @public
|
|
15
|
-
* @see {@link Target}
|
|
16
|
-
*
|
|
17
|
-
* @extends {@serenity-js/core/lib/screenplay~Question}
|
|
18
|
-
* @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
19
|
-
*/
|
|
20
|
-
class TargetElement extends core_1.Question {
|
|
21
|
-
/**
|
|
22
|
-
* @desc
|
|
23
|
-
*
|
|
24
|
-
* @param {string} description - A human-readable description to be used in the report
|
|
25
|
-
* @param {protractor~Locator} locator - A locator to be used when locating the element
|
|
26
|
-
*/
|
|
27
|
-
constructor(description, locator) {
|
|
28
|
-
super(`the ${description}`);
|
|
29
|
-
this.description = description;
|
|
30
|
-
this.locator = locator;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @desc
|
|
34
|
-
* Retrieves a {@link WebElement} located by `locator`,
|
|
35
|
-
* resolved in the context of a `parent` {@link WebElement}.
|
|
36
|
-
*
|
|
37
|
-
* @param {Question<ElementFinder> | ElementFinder} parent
|
|
38
|
-
* @returns {TargetNestedElement}
|
|
39
|
-
*
|
|
40
|
-
* @see {@link Target}
|
|
41
|
-
*/
|
|
42
|
-
of(parent) {
|
|
43
|
-
return new TargetNestedElement_1.TargetNestedElement(parent, this);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @desc
|
|
47
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
48
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
49
|
-
*
|
|
50
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
51
|
-
* @returns {Promise<void>}
|
|
52
|
-
*
|
|
53
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
54
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
55
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
56
|
-
*/
|
|
57
|
-
answeredBy(actor) {
|
|
58
|
-
return (0, override_1.override)(abilities_1.BrowseTheWeb.as(actor).locate(this.locator), 'toString', TargetElement.prototype.toString.bind(this));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
exports.TargetElement = TargetElement;
|
|
62
|
-
//# sourceMappingURL=TargetElement.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TargetElement.js","sourceRoot":"","sources":["../../../../src/screenplay/questions/targets/TargetElement.ts"],"names":[],"mappings":";;;AAAA,4CAA4F;AAG5F,+CAA+C;AAC/C,yCAAsC;AACtC,+DAA4D;AAE5D;;;;;;;;;;;GAWG;AACH,MAAa,aACT,SAAQ,eAAuB;IAG/B;;;;;OAKG;IACH,YACuB,WAAmB,EACnB,OAAgB;QAEnC,KAAK,CAAC,OAAQ,WAAY,EAAE,CAAC,CAAC;QAHX,gBAAW,GAAX,WAAW,CAAQ;QACnB,YAAO,GAAP,OAAO,CAAS;IAGvC,CAAC;IAED;;;;;;;;;OASG;IACH,EAAE,CAAC,MAA+C;QAC9C,OAAO,IAAI,yCAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,KAAuC;QAC9C,OAAO,IAAA,mBAAQ,EACX,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAC3C,UAAU,EACV,aAAa,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAC9C,CAAC;IACN,CAAC;CACJ;AAlDD,sCAkDC"}
|