@serenity-js/protractor 2.33.1 → 3.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +481 -0
- package/lib/adapter/ProtractorFrameworkAdapter.js +5 -0
- package/lib/adapter/ProtractorFrameworkAdapter.js.map +1 -1
- 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} +38 -191
- package/lib/screenplay/abilities/{BrowseTheWeb.js → BrowseTheWebWithProtractor.js} +129 -251
- 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/ProtractorFrame.d.ts +10 -0
- package/lib/screenplay/models/ProtractorFrame.js +39 -0
- package/lib/screenplay/models/ProtractorFrame.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/ProtractorPage.d.ts +26 -0
- package/lib/screenplay/models/ProtractorPage.js +98 -0
- package/lib/screenplay/models/ProtractorPage.js.map +1 -0
- package/lib/screenplay/models/ProtractorPageElement.d.ts +21 -0
- package/lib/screenplay/models/ProtractorPageElement.js +230 -0
- package/lib/screenplay/models/ProtractorPageElement.js.map +1 -0
- package/lib/screenplay/models/index.d.ts +5 -0
- package/lib/screenplay/{questions/lists → models}/index.js +5 -1
- package/lib/screenplay/models/index.js.map +1 -0
- package/lib/screenplay/models/locators/ProtractorLocator.d.ts +9 -0
- package/lib/screenplay/models/locators/ProtractorLocator.js +28 -0
- package/lib/screenplay/models/locators/ProtractorLocator.js.map +1 -0
- package/lib/screenplay/models/locators/ProtractorNativeElementRoot.d.ts +5 -0
- package/lib/screenplay/{interactions/EnterBuilder.js → models/locators/ProtractorNativeElementRoot.js} +1 -1
- package/lib/screenplay/models/locators/ProtractorNativeElementRoot.js.map +1 -0
- package/lib/screenplay/models/locators/index.d.ts +2 -0
- package/lib/{stage/crew → screenplay/models/locators}/index.js +2 -1
- package/lib/screenplay/models/locators/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/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/lib/screenplay/unpromisedWebElement.d.ts +11 -0
- package/lib/screenplay/unpromisedWebElement.js +24 -0
- package/lib/screenplay/unpromisedWebElement.js.map +1 -0
- package/package.json +19 -20
- package/src/adapter/ProtractorFrameworkAdapter.ts +5 -0
- package/src/index.ts +0 -2
- package/src/screenplay/abilities/{BrowseTheWeb.ts → BrowseTheWebWithProtractor.ts} +148 -263
- 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/ProtractorFrame.ts +44 -0
- package/src/screenplay/models/ProtractorModalDialog.ts +49 -0
- package/src/screenplay/models/ProtractorPage.ts +124 -0
- package/src/screenplay/models/ProtractorPageElement.ts +285 -0
- package/src/screenplay/models/index.ts +6 -0
- package/src/screenplay/models/locators/ProtractorLocator.ts +50 -0
- package/src/screenplay/models/locators/ProtractorNativeElementRoot.ts +6 -0
- package/src/screenplay/models/locators/index.ts +2 -0
- package/src/{promiseOf.ts → screenplay/promised.ts} +1 -1
- package/src/screenplay/questions/ProtractorParam.ts +29 -38
- package/src/screenplay/questions/index.ts +0 -13
- package/src/screenplay/unpromisedWebElement.ts +25 -0
- 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 +0 -19
- 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.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.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,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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"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { AnswersQuestions, Interaction, Question, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { ElementFinder } from 'protractor';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
6
|
-
* hover the mouse pointer over a given Web element.
|
|
7
|
-
*
|
|
8
|
-
* @example <caption>Example widget</caption>
|
|
9
|
-
* <a data-test="example-link"
|
|
10
|
-
* class="off"
|
|
11
|
-
* onmouseover="this.className='on';"
|
|
12
|
-
* onmouseout="this.className='off';"
|
|
13
|
-
* href="/">hover over me</a>
|
|
14
|
-
*
|
|
15
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
16
|
-
* import { Target } from '@serenity-js/protractor';
|
|
17
|
-
* import { by } from 'protractor';
|
|
18
|
-
*
|
|
19
|
-
* class Example {
|
|
20
|
-
* static link = Target.the('example link')
|
|
21
|
-
* .located(by.css('[data-test="example-link"]'));
|
|
22
|
-
* }
|
|
23
|
-
*
|
|
24
|
-
* @example <caption>Hovering over an element</caption>
|
|
25
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
26
|
-
* import { BrowseTheWeb, Hover, CSSClasses } from '@serenity-js/protractor';
|
|
27
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
28
|
-
* import { protractor } from 'protractor';
|
|
29
|
-
*
|
|
30
|
-
* actorCalled('Hank')
|
|
31
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
32
|
-
* .attemptsTo(
|
|
33
|
-
* Ensure.that(CSSClasses.of(Example.link), equals([ 'off' ])),
|
|
34
|
-
*
|
|
35
|
-
* Hover.over(Example.link),
|
|
36
|
-
* Ensure.that(CSSClasses.of(Example.link), equals([ 'on' ])),
|
|
37
|
-
* );
|
|
38
|
-
*
|
|
39
|
-
* @see {@link BrowseTheWeb}
|
|
40
|
-
* @see {@link Target}
|
|
41
|
-
* @see {@link CSSClasses}
|
|
42
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
43
|
-
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
44
|
-
*
|
|
45
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
46
|
-
*/
|
|
47
|
-
export declare class Hover extends Interaction {
|
|
48
|
-
private readonly target;
|
|
49
|
-
/**
|
|
50
|
-
* @desc
|
|
51
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
52
|
-
*
|
|
53
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
54
|
-
* The element to be hovered over
|
|
55
|
-
*
|
|
56
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
57
|
-
*/
|
|
58
|
-
static over(target: Question<ElementFinder> | ElementFinder): Interaction;
|
|
59
|
-
/**
|
|
60
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
61
|
-
* The element to be hovered over
|
|
62
|
-
*/
|
|
63
|
-
constructor(target: Question<ElementFinder> | ElementFinder);
|
|
64
|
-
/**
|
|
65
|
-
* @desc
|
|
66
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
67
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
68
|
-
*
|
|
69
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
70
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
71
|
-
*
|
|
72
|
-
* @returns {PromiseLike<void>}
|
|
73
|
-
*
|
|
74
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
75
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
76
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
77
|
-
*/
|
|
78
|
-
performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void>;
|
|
79
|
-
/**
|
|
80
|
-
* @desc
|
|
81
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
82
|
-
*
|
|
83
|
-
* @returns {string}
|
|
84
|
-
*/
|
|
85
|
-
toString(): string;
|
|
86
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Hover = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
const abilities_1 = require("../abilities");
|
|
7
|
-
const withAnswerOf_1 = require("../withAnswerOf");
|
|
8
|
-
/**
|
|
9
|
-
* @desc
|
|
10
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
11
|
-
* hover the mouse pointer over a given Web element.
|
|
12
|
-
*
|
|
13
|
-
* @example <caption>Example widget</caption>
|
|
14
|
-
* <a data-test="example-link"
|
|
15
|
-
* class="off"
|
|
16
|
-
* onmouseover="this.className='on';"
|
|
17
|
-
* onmouseout="this.className='off';"
|
|
18
|
-
* href="/">hover over me</a>
|
|
19
|
-
*
|
|
20
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
21
|
-
* import { Target } from '@serenity-js/protractor';
|
|
22
|
-
* import { by } from 'protractor';
|
|
23
|
-
*
|
|
24
|
-
* class Example {
|
|
25
|
-
* static link = Target.the('example link')
|
|
26
|
-
* .located(by.css('[data-test="example-link"]'));
|
|
27
|
-
* }
|
|
28
|
-
*
|
|
29
|
-
* @example <caption>Hovering over an element</caption>
|
|
30
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
31
|
-
* import { BrowseTheWeb, Hover, CSSClasses } from '@serenity-js/protractor';
|
|
32
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
33
|
-
* import { protractor } from 'protractor';
|
|
34
|
-
*
|
|
35
|
-
* actorCalled('Hank')
|
|
36
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
37
|
-
* .attemptsTo(
|
|
38
|
-
* Ensure.that(CSSClasses.of(Example.link), equals([ 'off' ])),
|
|
39
|
-
*
|
|
40
|
-
* Hover.over(Example.link),
|
|
41
|
-
* Ensure.that(CSSClasses.of(Example.link), equals([ 'on' ])),
|
|
42
|
-
* );
|
|
43
|
-
*
|
|
44
|
-
* @see {@link BrowseTheWeb}
|
|
45
|
-
* @see {@link Target}
|
|
46
|
-
* @see {@link CSSClasses}
|
|
47
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
48
|
-
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
49
|
-
*
|
|
50
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
51
|
-
*/
|
|
52
|
-
class Hover extends core_1.Interaction {
|
|
53
|
-
/**
|
|
54
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
55
|
-
* The element to be hovered over
|
|
56
|
-
*/
|
|
57
|
-
constructor(target) {
|
|
58
|
-
super();
|
|
59
|
-
this.target = target;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* @desc
|
|
63
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
64
|
-
*
|
|
65
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
66
|
-
* The element to be hovered over
|
|
67
|
-
*
|
|
68
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
69
|
-
*/
|
|
70
|
-
static over(target) {
|
|
71
|
-
return new Hover(target);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* @desc
|
|
75
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
76
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
77
|
-
*
|
|
78
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
79
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
80
|
-
*
|
|
81
|
-
* @returns {PromiseLike<void>}
|
|
82
|
-
*
|
|
83
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
84
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
85
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
86
|
-
*/
|
|
87
|
-
performAs(actor) {
|
|
88
|
-
return (0, withAnswerOf_1.withAnswerOf)(actor, this.target, (elf) => abilities_1.BrowseTheWeb.as(actor).actions()
|
|
89
|
-
.mouseMove(elf)
|
|
90
|
-
.perform());
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* @desc
|
|
94
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
95
|
-
*
|
|
96
|
-
* @returns {string}
|
|
97
|
-
*/
|
|
98
|
-
toString() {
|
|
99
|
-
return (0, io_1.formatted) `#actor hovers the mouse over ${this.target}`;
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
exports.Hover = Hover;
|
|
103
|
-
//# sourceMappingURL=Hover.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Hover.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Hover.ts"],"names":[],"mappings":";;;AAAA,4CAA2F;AAC3F,iDAAqD;AAGrD,4CAA4C;AAC5C,kDAA+C;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAa,KAAM,SAAQ,kBAAW;IAelC;;;OAGG;IACH,YAA6B,MAA+C;QACxE,KAAK,EAAE,CAAC;QADiB,WAAM,GAAN,MAAM,CAAyC;IAE5E,CAAC;IAnBD;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAI,CAAC,MAA+C;QACvD,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;IAUD;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,KAAuC;QAC7C,OAAO,IAAA,2BAAY,EAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,GAAkB,EAAE,EAAE,CAC3D,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE;aAC3B,SAAS,CAAC,GAAqB,CAAC;aAChC,OAAO,EAAE,CACjB,CAAC;IACN,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACJ,OAAO,IAAA,cAAS,EAAC,gCAAgC,IAAI,CAAC,MAAM,EAAE,CAAC;IACnE,CAAC;CACJ;AAtDD,sBAsDC"}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { Answerable, Duration, Interaction } from '@serenity-js/core';
|
|
2
|
-
/**
|
|
3
|
-
* @desc
|
|
4
|
-
* Allows the {@link @serenity-js/core/lib/screenplay/actor~Actor} to navigate to a specific destination,
|
|
5
|
-
* as well as back and forth in the browser history, or reload the current page.
|
|
6
|
-
*/
|
|
7
|
-
export declare class Navigate {
|
|
8
|
-
/**
|
|
9
|
-
* @desc
|
|
10
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
11
|
-
* navigate to a given URL.
|
|
12
|
-
*
|
|
13
|
-
* The URL can be:
|
|
14
|
-
* - absolute, i.e. `https://example.org/search`
|
|
15
|
-
* - relative, i.e. `/search`
|
|
16
|
-
*
|
|
17
|
-
* If the URL is relative, Protractor will append it to `baseUrl` configured in [`protractor.conf.js`](https://github.com/angular/protractor/blob/master/lib/config.ts).
|
|
18
|
-
*
|
|
19
|
-
* @example <caption>protractor.conf.js</caption>
|
|
20
|
-
* exports.config = {
|
|
21
|
-
* baseUrl: 'https://example.org',
|
|
22
|
-
* // ...
|
|
23
|
-
* }
|
|
24
|
-
*
|
|
25
|
-
* @example <caption>Navigate to path relative to baseUrl</caption>
|
|
26
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
27
|
-
* import { BrowseTheWeb, Navigate } from '@serenity-js/protractor';
|
|
28
|
-
*
|
|
29
|
-
* actorCalled('Hannu')
|
|
30
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
31
|
-
* .attemptsTo(
|
|
32
|
-
* Navigate.to('/search'),
|
|
33
|
-
* );
|
|
34
|
-
*
|
|
35
|
-
* @example <caption>Navigate to an absolute URL (overrides baseUrl)</caption>
|
|
36
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
37
|
-
* import { BrowseTheWeb, Navigate } from '@serenity-js/protractor';
|
|
38
|
-
*
|
|
39
|
-
* actorCalled('Hannu')
|
|
40
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
41
|
-
* .attemptsTo(
|
|
42
|
-
* Navigate.to('https://mycompany.org/login'),
|
|
43
|
-
* );
|
|
44
|
-
*
|
|
45
|
-
* @example <caption>Navigate to URL with timeout</caption>
|
|
46
|
-
* import { actorCalled, Duration } from '@serenity-js/core';
|
|
47
|
-
* import { BrowseTheWeb, Navigate } from '@serenity-js/protractor';
|
|
48
|
-
*
|
|
49
|
-
* actorCalled('Hannu')
|
|
50
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
51
|
-
* .attemptsTo(
|
|
52
|
-
* Navigate.to('/search').withTimeout(Duration.ofSeconds(2)),
|
|
53
|
-
* );
|
|
54
|
-
*
|
|
55
|
-
* @param {Answerable<string>} url
|
|
56
|
-
* An absolute URL or path an {@link @serenity-js/core/lib/screenplay/actor~Actor} should navigate to
|
|
57
|
-
*
|
|
58
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction & { withTimeout: (duration: Answerable<Duration>) => Interaction }}
|
|
59
|
-
*
|
|
60
|
-
* @see {@link BrowseTheWeb}
|
|
61
|
-
* @see {@link @serenity-js/core~Duration}
|
|
62
|
-
*/
|
|
63
|
-
static to(url: Answerable<string>): Interaction & {
|
|
64
|
-
withTimeout: (duration: Answerable<Duration>) => Interaction;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* @desc
|
|
68
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
69
|
-
* navigate back one page in the session history.
|
|
70
|
-
*
|
|
71
|
-
* @example <caption>Navigate to path relative to baseUrl</caption>
|
|
72
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
73
|
-
* import { Ensure, endsWith } from '@serenity-js/assertions';
|
|
74
|
-
* import { BrowseTheWeb, Navigate } from '@serenity-js/protractor';
|
|
75
|
-
*
|
|
76
|
-
* actorCalled('Hannu')
|
|
77
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
78
|
-
* .attemptsTo(
|
|
79
|
-
* Navigate.to('/first'),
|
|
80
|
-
* Navigate.to('/second'),
|
|
81
|
-
*
|
|
82
|
-
* Navigate.back(),
|
|
83
|
-
*
|
|
84
|
-
* Ensure.that(Website.url(), endsWith('/first')),
|
|
85
|
-
* );
|
|
86
|
-
*
|
|
87
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
88
|
-
*
|
|
89
|
-
* @see {@link BrowseTheWeb}
|
|
90
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
91
|
-
* @see {@link @serenity-js/assertions/lib/expectations~endsWith}
|
|
92
|
-
*/
|
|
93
|
-
static back(): Interaction;
|
|
94
|
-
/**
|
|
95
|
-
* @desc
|
|
96
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
97
|
-
* navigate forward one page in the session history.
|
|
98
|
-
*
|
|
99
|
-
* @example <caption>Navigate to path relative to baseUrl</caption>
|
|
100
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
101
|
-
* import { Ensure, endsWith } from '@serenity-js/assertions';
|
|
102
|
-
* import { BrowseTheWeb, Navigate } from '@serenity-js/protractor';
|
|
103
|
-
*
|
|
104
|
-
* actorCalled('Hannu')
|
|
105
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
106
|
-
* .attemptsTo(
|
|
107
|
-
* Navigate.to('/first'),
|
|
108
|
-
* Navigate.to('/second'),
|
|
109
|
-
*
|
|
110
|
-
* Navigate.back(),
|
|
111
|
-
* Navigate.forward(),
|
|
112
|
-
*
|
|
113
|
-
* Ensure.that(Website.url(), endsWith('/second')),
|
|
114
|
-
* );
|
|
115
|
-
*
|
|
116
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
117
|
-
*
|
|
118
|
-
* @see {@link BrowseTheWeb}
|
|
119
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
120
|
-
* @see {@link @serenity-js/assertions/lib/expectations~endsWith}
|
|
121
|
-
*/
|
|
122
|
-
static forward(): Interaction;
|
|
123
|
-
/**
|
|
124
|
-
* @desc
|
|
125
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
126
|
-
* reload the current page.
|
|
127
|
-
*
|
|
128
|
-
* @example <caption>Navigate to path relative to baseUrl</caption>
|
|
129
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
130
|
-
* import { Ensure, endsWith } from '@serenity-js/assertions';
|
|
131
|
-
* import { Navigate, BrowseTheWeb, DeleteCookies } from '@serenity-js/protractor';
|
|
132
|
-
*
|
|
133
|
-
* actorCalled('Hannu')
|
|
134
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
135
|
-
* .attemptsTo(
|
|
136
|
-
* Navigate.to('/login'),
|
|
137
|
-
* DeleteCookies.called('session_id'),
|
|
138
|
-
* Navigate.reloadPage(),
|
|
139
|
-
* );
|
|
140
|
-
*
|
|
141
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
142
|
-
*
|
|
143
|
-
* @see {@link BrowseTheWeb}
|
|
144
|
-
* @see {@link DeleteCookies}
|
|
145
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
146
|
-
* @see {@link @serenity-js/assertions/lib/expectations~endsWith}
|
|
147
|
-
*/
|
|
148
|
-
static reloadPage(): Interaction;
|
|
149
|
-
}
|