@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,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Enter = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
const withAnswerOf_1 = require("../withAnswerOf");
|
|
7
|
-
/**
|
|
8
|
-
* @desc
|
|
9
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
10
|
-
* enter a value into a [form `input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input) field.
|
|
11
|
-
*
|
|
12
|
-
* @example <caption>Example widget</caption>
|
|
13
|
-
* <form>
|
|
14
|
-
* <input type="text" name="example" id="example" />
|
|
15
|
-
* </form>
|
|
16
|
-
*
|
|
17
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
18
|
-
* import { Target } from '@serenity-js/protractor';
|
|
19
|
-
* import { by } from 'protractor';
|
|
20
|
-
*
|
|
21
|
-
* class Form {
|
|
22
|
-
* static exampleInput = Target.the('example input')
|
|
23
|
-
* .located(by.id('example'));
|
|
24
|
-
* }
|
|
25
|
-
*
|
|
26
|
-
* @example <caption>Entering the value into a form field</caption>
|
|
27
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
28
|
-
* import { BrowseTheWeb, Enter } from '@serenity-js/webdriverio';
|
|
29
|
-
*
|
|
30
|
-
* actorCalled('Esme')
|
|
31
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
32
|
-
* .attemptsTo(
|
|
33
|
-
* Enter.theValue('Hello world!').into(Form.exampleInput),
|
|
34
|
-
* );
|
|
35
|
-
*
|
|
36
|
-
* @see {@link Target}
|
|
37
|
-
*
|
|
38
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
39
|
-
*/
|
|
40
|
-
class Enter extends core_1.Interaction {
|
|
41
|
-
/**
|
|
42
|
-
* @param {@serenity-js/core/lib/screenplay~Answerable<string | number>} value
|
|
43
|
-
* The value to be entered
|
|
44
|
-
*
|
|
45
|
-
* @param {Question<ElementFinder> | ElementFinder | Question<AlertPromise> | AlertPromise} field
|
|
46
|
-
* The field to enter the value into
|
|
47
|
-
*/
|
|
48
|
-
constructor(value, field) {
|
|
49
|
-
super();
|
|
50
|
-
this.value = value;
|
|
51
|
-
this.field = field;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* @desc
|
|
55
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
56
|
-
*
|
|
57
|
-
* @param {Answerable<string | number>} value
|
|
58
|
-
* The value to be entered
|
|
59
|
-
*
|
|
60
|
-
* @returns {EnterBuilder}
|
|
61
|
-
*/
|
|
62
|
-
static theValue(value) {
|
|
63
|
-
return {
|
|
64
|
-
into: (field) => new Enter(value, field),
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* @desc
|
|
69
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
70
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
71
|
-
*
|
|
72
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
73
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
74
|
-
*
|
|
75
|
-
* @returns {PromiseLike<void>}
|
|
76
|
-
*
|
|
77
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
78
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
79
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
80
|
-
*/
|
|
81
|
-
performAs(actor) {
|
|
82
|
-
return actor.answer(this.value)
|
|
83
|
-
.then(value => (0, withAnswerOf_1.withAnswerOf)(actor, this.field, (elf) => elf.sendKeys(`${value}`)));
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* @desc
|
|
87
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
88
|
-
*
|
|
89
|
-
* @returns {string}
|
|
90
|
-
*/
|
|
91
|
-
toString() {
|
|
92
|
-
return (0, io_1.formatted) `#actor enters ${this.value} into ${this.field}`;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
exports.Enter = Enter;
|
|
96
|
-
//# sourceMappingURL=Enter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Enter.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Enter.ts"],"names":[],"mappings":";;;AAAA,4CAAuG;AACvG,iDAAqD;AAIrD,kDAA+C;AAG/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAa,KAAM,SAAQ,kBAAW;IAkBlC;;;;;;OAMG;IACH,YACqB,KAAkC,EAClC,KAAsF;QAEvG,KAAK,EAAE,CAAC;QAHS,UAAK,GAAL,KAAK,CAA6B;QAClC,UAAK,GAAL,KAAK,CAAiF;IAG3G,CAAC;IA5BD;;;;;;;;OAQG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAkC;QAC9C,OAAO;YACH,IAAI,EAAE,CAAC,KAAsF,EAAE,EAAE,CAC7F,IAAI,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC;SAC9B,CAAC;IACN,CAAC;IAgBD;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,KAAuC;QAC7C,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;aAC1B,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,IAAA,2BAAY,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,GAAiC,EAAE,EAAE,CACjF,GAAG,CAAC,QAAQ,CAAC,GAAI,KAAM,EAAE,CAAC,CAAC,CAC9B,CAAC;IACV,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACJ,OAAO,IAAA,cAAS,EAAC,iBAAkB,IAAI,CAAC,KAAM,SAAU,IAAI,CAAC,KAAM,EAAE,CAAC;IAC1E,CAAC;CACJ;AA9DD,sBA8DC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Question } from '@serenity-js/core';
|
|
2
|
-
import { Interaction } from '@serenity-js/core/lib/screenplay';
|
|
3
|
-
import { ElementFinder } from 'protractor';
|
|
4
|
-
import { AlertPromise } from 'selenium-webdriver';
|
|
5
|
-
/**
|
|
6
|
-
* @desc
|
|
7
|
-
* Fluent interface to make the instantiation of
|
|
8
|
-
* the {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
9
|
-
* to {@link Enter} more readable.
|
|
10
|
-
*
|
|
11
|
-
* @see {@link Enter}
|
|
12
|
-
*
|
|
13
|
-
* @interface
|
|
14
|
-
*/
|
|
15
|
-
export interface EnterBuilder {
|
|
16
|
-
/**
|
|
17
|
-
* @desc
|
|
18
|
-
* Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
19
|
-
* to {@link Enter}.
|
|
20
|
-
*
|
|
21
|
-
* @param {Question<ElementFinder> | ElementFinder} field
|
|
22
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
23
|
-
*
|
|
24
|
-
* @see {@link Target}
|
|
25
|
-
*/
|
|
26
|
-
into: (field: Question<ElementFinder> | ElementFinder | Question<AlertPromise> | AlertPromise) => Interaction;
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EnterBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/EnterBuilder.ts"],"names":[],"mappings":""}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, CollectsArtifacts, Interaction, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
/**
|
|
3
|
-
* @desc
|
|
4
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
5
|
-
* execute a script within the context of the current browser window.
|
|
6
|
-
*
|
|
7
|
-
* Please see the tests below for usage examples.
|
|
8
|
-
*
|
|
9
|
-
* @see {@link LastScriptExecution.result}
|
|
10
|
-
*/
|
|
11
|
-
export declare class ExecuteScript {
|
|
12
|
-
/**
|
|
13
|
-
* @desc
|
|
14
|
-
* Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
15
|
-
* configured to load a script from `sourceUrl`.
|
|
16
|
-
*
|
|
17
|
-
* @param {string} sourceUrl
|
|
18
|
-
* The URL to load the script from
|
|
19
|
-
*
|
|
20
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
21
|
-
*/
|
|
22
|
-
static from(sourceUrl: string): Interaction;
|
|
23
|
-
/**
|
|
24
|
-
* @desc
|
|
25
|
-
* Schedules a command to execute asynchronous JavaScript in the context of the currently selected frame or window.
|
|
26
|
-
* The script fragment will be executed as the body of an anonymous function.
|
|
27
|
-
* If the script is provided as a function object, that function will be converted to a string for injection
|
|
28
|
-
* into the target window.
|
|
29
|
-
*
|
|
30
|
-
* Any arguments provided in addition to the script will be included as script arguments and may be referenced
|
|
31
|
-
* using the `arguments` object. Arguments may be a `boolean`, `number`, `string`
|
|
32
|
-
* or `Target` (`Question<ElementFinder>`).
|
|
33
|
-
* Arrays and objects may also be used as script arguments as long as each item adheres
|
|
34
|
-
* to the types previously mentioned.
|
|
35
|
-
*
|
|
36
|
-
* Unlike executing synchronous JavaScript with {@link ExecuteScript#sync},
|
|
37
|
-
* scripts executed with this function must explicitly signal they are finished by invoking the provided callback.
|
|
38
|
-
*
|
|
39
|
-
* This callback will always be injected into the executed function as the last argument,
|
|
40
|
-
* and thus may be referenced with `arguments[arguments.length - 1]`.
|
|
41
|
-
*
|
|
42
|
-
* If the script invokes the `callback` with a return value, this will be made available
|
|
43
|
-
* via the {@link LastScriptExecution.result}.
|
|
44
|
-
*
|
|
45
|
-
* **Please note** that in order to signal an error in the `script` you need to throw an {@link Error}
|
|
46
|
-
* instead of passing it to the callback function.
|
|
47
|
-
*
|
|
48
|
-
* @example <caption>Executing an async script</caption>
|
|
49
|
-
* actor.attemptsTo(ExecuteScript.async(
|
|
50
|
-
* var callback = arguments[arguments.length - 1];
|
|
51
|
-
*
|
|
52
|
-
* // do stuff
|
|
53
|
-
*
|
|
54
|
-
* callback(result)
|
|
55
|
-
* ));
|
|
56
|
-
*
|
|
57
|
-
* @example <caption>Passing arguments to an async script</caption>
|
|
58
|
-
* actor.attemptsTo(ExecuteScript.async(
|
|
59
|
-
* var name = arguments[0];
|
|
60
|
-
* var age = arguments[1];
|
|
61
|
-
* var callback = arguments[arguments.length - 1];
|
|
62
|
-
*
|
|
63
|
-
* // do stuff
|
|
64
|
-
*
|
|
65
|
-
* callback(result)
|
|
66
|
-
* ).withArguments('Bob', 24));
|
|
67
|
-
*
|
|
68
|
-
* @example <caption>Passing Target arguments to an async script</caption>
|
|
69
|
-
* actor.attemptsTo(ExecuteScript.async(
|
|
70
|
-
* var header = arguments[0]; // Target gets converted to a WebElement
|
|
71
|
-
* var callback = arguments[arguments.length - 1];
|
|
72
|
-
*
|
|
73
|
-
* callback(header.innerText)
|
|
74
|
-
* ).withArguments(Target.the('header').located(by.css('h1'))));
|
|
75
|
-
*
|
|
76
|
-
* @param {string | Function} script
|
|
77
|
-
* The script to be executed
|
|
78
|
-
*
|
|
79
|
-
* @returns {ExecuteScriptWithArguments}
|
|
80
|
-
*
|
|
81
|
-
* @see {@link LastScriptExecution.result}
|
|
82
|
-
*/
|
|
83
|
-
static async(script: string | Function): ExecuteScriptWithArguments;
|
|
84
|
-
/**
|
|
85
|
-
* @desc
|
|
86
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
87
|
-
* execute a synchronous script in the context of the currently selected frame or window.
|
|
88
|
-
*
|
|
89
|
-
* If the script returns a value, it will be made available via {@link LastScriptExecution.result}.
|
|
90
|
-
*
|
|
91
|
-
* @example <caption>Executing a sync script and reading the result</caption>
|
|
92
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
93
|
-
* import { BrowseTheWeb, ExecuteScript, LastScriptExecution } from '@serenity-js/protractor';
|
|
94
|
-
* import { Ensure, includes } from '@serenity-js/assertions';
|
|
95
|
-
* import { protractor } from 'protractor';
|
|
96
|
-
*
|
|
97
|
-
* actorCalled('Joseph')
|
|
98
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
99
|
-
* .attemptsTo(
|
|
100
|
-
* ExecuteScript.sync('return navigator.userAgent'),
|
|
101
|
-
* Ensure.that(LastScriptExecution.result<string>(), includes('Chrome')),
|
|
102
|
-
* );
|
|
103
|
-
*
|
|
104
|
-
* @param {string | Function} script
|
|
105
|
-
* The script to be executed
|
|
106
|
-
*
|
|
107
|
-
* @returns {ExecuteScriptWithArguments}
|
|
108
|
-
*
|
|
109
|
-
* @see {@link LastScriptExecution.result}
|
|
110
|
-
*/
|
|
111
|
-
static sync(script: string | Function): ExecuteScriptWithArguments;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* @desc
|
|
115
|
-
* Allows for a script to be executed to be parametrised.
|
|
116
|
-
*
|
|
117
|
-
* **Please note** that the arguments can be both synchronous and asynchronous {@link @serenity-js/core/lib/screenplay~Question}s
|
|
118
|
-
* as well as regular static values.
|
|
119
|
-
*
|
|
120
|
-
* @abstract
|
|
121
|
-
*
|
|
122
|
-
* @see {@link ExecuteScript}
|
|
123
|
-
*
|
|
124
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
125
|
-
*/
|
|
126
|
-
export declare abstract class ExecuteScriptWithArguments extends Interaction {
|
|
127
|
-
protected readonly script: string | Function;
|
|
128
|
-
protected readonly args: Array<Answerable<any>>;
|
|
129
|
-
/**
|
|
130
|
-
* @param {string | Function} script
|
|
131
|
-
* The script to be executed
|
|
132
|
-
*
|
|
133
|
-
* @param {Array<Answerable<any>>} args
|
|
134
|
-
* Arguments to parametrise the script with
|
|
135
|
-
*/
|
|
136
|
-
constructor(script: string | Function, // eslint-disable-line @typescript-eslint/ban-types
|
|
137
|
-
args?: Array<Answerable<any>>);
|
|
138
|
-
/**
|
|
139
|
-
* @desc
|
|
140
|
-
* Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
141
|
-
* to {@link Enter}.
|
|
142
|
-
*
|
|
143
|
-
* @param {...Array<Answerable<any>>} args
|
|
144
|
-
* Arguments to parametrise the script with
|
|
145
|
-
*
|
|
146
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
147
|
-
*/
|
|
148
|
-
abstract withArguments(...args: Array<Answerable<any>>): Interaction;
|
|
149
|
-
/**
|
|
150
|
-
* @desc
|
|
151
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
152
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
153
|
-
*
|
|
154
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
155
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
156
|
-
*
|
|
157
|
-
* @returns {PromiseLike<void>}
|
|
158
|
-
*
|
|
159
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
160
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
161
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
162
|
-
*/
|
|
163
|
-
performAs(actor: UsesAbilities & CollectsArtifacts & AnswersQuestions): PromiseLike<void>;
|
|
164
|
-
protected abstract executeAs(actor: UsesAbilities & AnswersQuestions, args: any[]): Promise<any>;
|
|
165
|
-
/**
|
|
166
|
-
* @private
|
|
167
|
-
*
|
|
168
|
-
* @param {Array<Answerable<any>>} args
|
|
169
|
-
*/
|
|
170
|
-
private answerAll;
|
|
171
|
-
}
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExecuteScriptWithArguments = exports.ExecuteScript = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
const model_1 = require("@serenity-js/core/lib/model");
|
|
7
|
-
const abilities_1 = require("../abilities");
|
|
8
|
-
/**
|
|
9
|
-
* @desc
|
|
10
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
11
|
-
* execute a script within the context of the current browser window.
|
|
12
|
-
*
|
|
13
|
-
* Please see the tests below for usage examples.
|
|
14
|
-
*
|
|
15
|
-
* @see {@link LastScriptExecution.result}
|
|
16
|
-
*/
|
|
17
|
-
class ExecuteScript {
|
|
18
|
-
/**
|
|
19
|
-
* @desc
|
|
20
|
-
* Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
21
|
-
* configured to load a script from `sourceUrl`.
|
|
22
|
-
*
|
|
23
|
-
* @param {string} sourceUrl
|
|
24
|
-
* The URL to load the script from
|
|
25
|
-
*
|
|
26
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
27
|
-
*/
|
|
28
|
-
static from(sourceUrl) {
|
|
29
|
-
return new ExecuteScriptFromUrl(sourceUrl);
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* @desc
|
|
33
|
-
* Schedules a command to execute asynchronous JavaScript in the context of the currently selected frame or window.
|
|
34
|
-
* The script fragment will be executed as the body of an anonymous function.
|
|
35
|
-
* If the script is provided as a function object, that function will be converted to a string for injection
|
|
36
|
-
* into the target window.
|
|
37
|
-
*
|
|
38
|
-
* Any arguments provided in addition to the script will be included as script arguments and may be referenced
|
|
39
|
-
* using the `arguments` object. Arguments may be a `boolean`, `number`, `string`
|
|
40
|
-
* or `Target` (`Question<ElementFinder>`).
|
|
41
|
-
* Arrays and objects may also be used as script arguments as long as each item adheres
|
|
42
|
-
* to the types previously mentioned.
|
|
43
|
-
*
|
|
44
|
-
* Unlike executing synchronous JavaScript with {@link ExecuteScript#sync},
|
|
45
|
-
* scripts executed with this function must explicitly signal they are finished by invoking the provided callback.
|
|
46
|
-
*
|
|
47
|
-
* This callback will always be injected into the executed function as the last argument,
|
|
48
|
-
* and thus may be referenced with `arguments[arguments.length - 1]`.
|
|
49
|
-
*
|
|
50
|
-
* If the script invokes the `callback` with a return value, this will be made available
|
|
51
|
-
* via the {@link LastScriptExecution.result}.
|
|
52
|
-
*
|
|
53
|
-
* **Please note** that in order to signal an error in the `script` you need to throw an {@link Error}
|
|
54
|
-
* instead of passing it to the callback function.
|
|
55
|
-
*
|
|
56
|
-
* @example <caption>Executing an async script</caption>
|
|
57
|
-
* actor.attemptsTo(ExecuteScript.async(
|
|
58
|
-
* var callback = arguments[arguments.length - 1];
|
|
59
|
-
*
|
|
60
|
-
* // do stuff
|
|
61
|
-
*
|
|
62
|
-
* callback(result)
|
|
63
|
-
* ));
|
|
64
|
-
*
|
|
65
|
-
* @example <caption>Passing arguments to an async script</caption>
|
|
66
|
-
* actor.attemptsTo(ExecuteScript.async(
|
|
67
|
-
* var name = arguments[0];
|
|
68
|
-
* var age = arguments[1];
|
|
69
|
-
* var callback = arguments[arguments.length - 1];
|
|
70
|
-
*
|
|
71
|
-
* // do stuff
|
|
72
|
-
*
|
|
73
|
-
* callback(result)
|
|
74
|
-
* ).withArguments('Bob', 24));
|
|
75
|
-
*
|
|
76
|
-
* @example <caption>Passing Target arguments to an async script</caption>
|
|
77
|
-
* actor.attemptsTo(ExecuteScript.async(
|
|
78
|
-
* var header = arguments[0]; // Target gets converted to a WebElement
|
|
79
|
-
* var callback = arguments[arguments.length - 1];
|
|
80
|
-
*
|
|
81
|
-
* callback(header.innerText)
|
|
82
|
-
* ).withArguments(Target.the('header').located(by.css('h1'))));
|
|
83
|
-
*
|
|
84
|
-
* @param {string | Function} script
|
|
85
|
-
* The script to be executed
|
|
86
|
-
*
|
|
87
|
-
* @returns {ExecuteScriptWithArguments}
|
|
88
|
-
*
|
|
89
|
-
* @see {@link LastScriptExecution.result}
|
|
90
|
-
*/
|
|
91
|
-
static async(script) {
|
|
92
|
-
return new ExecuteAsynchronousScript(script);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* @desc
|
|
96
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
97
|
-
* execute a synchronous script in the context of the currently selected frame or window.
|
|
98
|
-
*
|
|
99
|
-
* If the script returns a value, it will be made available via {@link LastScriptExecution.result}.
|
|
100
|
-
*
|
|
101
|
-
* @example <caption>Executing a sync script and reading the result</caption>
|
|
102
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
103
|
-
* import { BrowseTheWeb, ExecuteScript, LastScriptExecution } from '@serenity-js/protractor';
|
|
104
|
-
* import { Ensure, includes } from '@serenity-js/assertions';
|
|
105
|
-
* import { protractor } from 'protractor';
|
|
106
|
-
*
|
|
107
|
-
* actorCalled('Joseph')
|
|
108
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
109
|
-
* .attemptsTo(
|
|
110
|
-
* ExecuteScript.sync('return navigator.userAgent'),
|
|
111
|
-
* Ensure.that(LastScriptExecution.result<string>(), includes('Chrome')),
|
|
112
|
-
* );
|
|
113
|
-
*
|
|
114
|
-
* @param {string | Function} script
|
|
115
|
-
* The script to be executed
|
|
116
|
-
*
|
|
117
|
-
* @returns {ExecuteScriptWithArguments}
|
|
118
|
-
*
|
|
119
|
-
* @see {@link LastScriptExecution.result}
|
|
120
|
-
*/
|
|
121
|
-
static sync(script) {
|
|
122
|
-
return new ExecuteSynchronousScript(script);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
exports.ExecuteScript = ExecuteScript;
|
|
126
|
-
/**
|
|
127
|
-
* @desc
|
|
128
|
-
* Allows for a script to be executed to be parametrised.
|
|
129
|
-
*
|
|
130
|
-
* **Please note** that the arguments can be both synchronous and asynchronous {@link @serenity-js/core/lib/screenplay~Question}s
|
|
131
|
-
* as well as regular static values.
|
|
132
|
-
*
|
|
133
|
-
* @abstract
|
|
134
|
-
*
|
|
135
|
-
* @see {@link ExecuteScript}
|
|
136
|
-
*
|
|
137
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
138
|
-
*/
|
|
139
|
-
class ExecuteScriptWithArguments extends core_1.Interaction {
|
|
140
|
-
/**
|
|
141
|
-
* @param {string | Function} script
|
|
142
|
-
* The script to be executed
|
|
143
|
-
*
|
|
144
|
-
* @param {Array<Answerable<any>>} args
|
|
145
|
-
* Arguments to parametrise the script with
|
|
146
|
-
*/
|
|
147
|
-
constructor(script, // eslint-disable-line @typescript-eslint/ban-types
|
|
148
|
-
args = []) {
|
|
149
|
-
super();
|
|
150
|
-
this.script = script;
|
|
151
|
-
this.args = args;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* @desc
|
|
155
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
156
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
157
|
-
*
|
|
158
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
159
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
160
|
-
*
|
|
161
|
-
* @returns {PromiseLike<void>}
|
|
162
|
-
*
|
|
163
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
164
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
165
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
166
|
-
*/
|
|
167
|
-
performAs(actor) {
|
|
168
|
-
return this.answerAll(this.args).as(actor)
|
|
169
|
-
.then(args => this.executeAs(actor, args))
|
|
170
|
-
.then(() => actor.collect(model_1.TextData.fromJSON({
|
|
171
|
-
contentType: 'text/javascript;charset=UTF-8',
|
|
172
|
-
data: this.script.toString(),
|
|
173
|
-
}), new model_1.Name('Script source')));
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* @private
|
|
177
|
-
*
|
|
178
|
-
* @param {Array<Answerable<any>>} args
|
|
179
|
-
*/
|
|
180
|
-
answerAll(args) {
|
|
181
|
-
return {
|
|
182
|
-
as: (actor) => Promise.all(args.map(arg => {
|
|
183
|
-
const maybeElementFinder = core_1.Question.isAQuestion(arg)
|
|
184
|
-
? arg.answeredBy(actor)
|
|
185
|
-
: arg;
|
|
186
|
-
const maybePromise = maybeElementFinder.getWebElement
|
|
187
|
-
? maybeElementFinder.getWebElement()
|
|
188
|
-
: maybeElementFinder;
|
|
189
|
-
return actor.answer(maybePromise);
|
|
190
|
-
})),
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
exports.ExecuteScriptWithArguments = ExecuteScriptWithArguments;
|
|
195
|
-
/**
|
|
196
|
-
* @package
|
|
197
|
-
*/
|
|
198
|
-
class ExecuteAsynchronousScript extends ExecuteScriptWithArguments {
|
|
199
|
-
withArguments(...args) {
|
|
200
|
-
return new ExecuteAsynchronousScript(this.script, args);
|
|
201
|
-
}
|
|
202
|
-
executeAs(actor, args) {
|
|
203
|
-
return abilities_1.BrowseTheWeb.as(actor).executeAsyncScript(this.script, ...args);
|
|
204
|
-
}
|
|
205
|
-
toString() {
|
|
206
|
-
return this.args.length > 0
|
|
207
|
-
? (0, io_1.formatted) `#actor executes an asynchronous script with arguments: ${this.args}`
|
|
208
|
-
: `#actor executes an asynchronous script`;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* @package
|
|
213
|
-
*
|
|
214
|
-
* https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/JavascriptExecutor.html
|
|
215
|
-
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLScriptElement
|
|
216
|
-
*/
|
|
217
|
-
class ExecuteScriptFromUrl extends core_1.Interaction {
|
|
218
|
-
constructor(sourceUrl) {
|
|
219
|
-
super();
|
|
220
|
-
this.sourceUrl = sourceUrl;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* @desc
|
|
224
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
225
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
226
|
-
*
|
|
227
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
228
|
-
* @returns {Promise<void>}
|
|
229
|
-
*
|
|
230
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
231
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
232
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
233
|
-
*/
|
|
234
|
-
performAs(actor) {
|
|
235
|
-
return abilities_1.BrowseTheWeb.as(actor)
|
|
236
|
-
.executeAsyncScript(` var src = arguments[0];
|
|
237
|
-
var callback = arguments[arguments.length - 1];
|
|
238
|
-
|
|
239
|
-
var alreadyLoadedScripts = Array.prototype.slice
|
|
240
|
-
.call(document.getElementsByTagName('script'))
|
|
241
|
-
.map(script => script.src);
|
|
242
|
-
|
|
243
|
-
if (!! ~ alreadyLoadedScripts.indexOf(src)) {
|
|
244
|
-
return callback("Script from " + src + " has already been loaded");
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
var script = document.createElement('script');
|
|
248
|
-
script.onload = function () {
|
|
249
|
-
return callback();
|
|
250
|
-
};
|
|
251
|
-
script.onerror = function () {
|
|
252
|
-
return callback("Couldn't load script from " + src);
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
script.src = src;
|
|
256
|
-
script.async = true;
|
|
257
|
-
document.head.appendChild(script);
|
|
258
|
-
`, this.sourceUrl)
|
|
259
|
-
.then(errorMessage => {
|
|
260
|
-
if (errorMessage) {
|
|
261
|
-
throw new core_1.LogicError(errorMessage);
|
|
262
|
-
}
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* @desc
|
|
267
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
268
|
-
*
|
|
269
|
-
* @returns {string}
|
|
270
|
-
*/
|
|
271
|
-
toString() {
|
|
272
|
-
return `#actor executes a script from ${this.sourceUrl}`;
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* @package
|
|
277
|
-
*/
|
|
278
|
-
class ExecuteSynchronousScript extends ExecuteScriptWithArguments {
|
|
279
|
-
withArguments(...args) {
|
|
280
|
-
return new ExecuteSynchronousScript(this.script, args);
|
|
281
|
-
}
|
|
282
|
-
executeAs(actor, args) {
|
|
283
|
-
return abilities_1.BrowseTheWeb.as(actor).executeScript(this.toString(), this.script, ...args);
|
|
284
|
-
}
|
|
285
|
-
toString() {
|
|
286
|
-
return this.args.length > 0
|
|
287
|
-
? (0, io_1.formatted) `#actor executes a synchronous script with arguments: ${this.args}`
|
|
288
|
-
: `#actor executes a synchronous script`;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
//# sourceMappingURL=ExecuteScript.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExecuteScript.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/ExecuteScript.ts"],"names":[],"mappings":"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"}
|