@serenity-js/protractor 2.32.2 → 3.0.0-rc.0
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 +20 -22
- 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,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Clear = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
const protractor_1 = require("protractor");
|
|
7
|
-
const questions_1 = require("../questions");
|
|
8
|
-
const withAnswerOf_1 = require("../withAnswerOf");
|
|
9
|
-
/**
|
|
10
|
-
* @desc
|
|
11
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
12
|
-
* clear the `value` of a [form `input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
13
|
-
*
|
|
14
|
-
* @example <caption>Example widget</caption>
|
|
15
|
-
* <form>
|
|
16
|
-
* <input type="text" name="example" id="example" />
|
|
17
|
-
* </form>
|
|
18
|
-
*
|
|
19
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
20
|
-
* import { Target } from '@serenity-js/protractor';
|
|
21
|
-
* import { by } from 'protractor';
|
|
22
|
-
*
|
|
23
|
-
* class Form {
|
|
24
|
-
* static exampleInput = Target.the('example input')
|
|
25
|
-
* .located(by.id('example'));
|
|
26
|
-
* }
|
|
27
|
-
*
|
|
28
|
-
* @example <caption>Clearing the value of an input field</caption>
|
|
29
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
30
|
-
* import { BrowseTheWeb, Clear, Enter, Value } from '@serenity-js/protractor';
|
|
31
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
32
|
-
* import { protractor } from 'protractor';
|
|
33
|
-
*
|
|
34
|
-
* actorCalled('Inés')
|
|
35
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
36
|
-
* .attemptsTo(
|
|
37
|
-
* Enter.theValue('Hello world!').into(Form.exampleInput),
|
|
38
|
-
* Ensure.that(Value.of(Form.exampleInput), equals('Hello world!')),
|
|
39
|
-
*
|
|
40
|
-
* Clear.theValueOf(Form.exampleInput),
|
|
41
|
-
* Ensure.that(Value.of(Form.exampleInput), equals('')),
|
|
42
|
-
* );
|
|
43
|
-
*
|
|
44
|
-
* @see {@link BrowseTheWeb}
|
|
45
|
-
* @see {@link Enter}
|
|
46
|
-
* @see {@link Value}
|
|
47
|
-
* @see {@link Target}
|
|
48
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
49
|
-
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
50
|
-
*
|
|
51
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
52
|
-
*/
|
|
53
|
-
class Clear extends core_1.Interaction {
|
|
54
|
-
/**
|
|
55
|
-
* @param {Question<ElementFinder> | ElementFinder} field
|
|
56
|
-
* The field to be cleared
|
|
57
|
-
*/
|
|
58
|
-
constructor(field) {
|
|
59
|
-
super();
|
|
60
|
-
this.field = field;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* @desc
|
|
64
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
65
|
-
*
|
|
66
|
-
* @param {Question<ElementFinder> | ElementFinder} field
|
|
67
|
-
* The field to be cleared
|
|
68
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
69
|
-
*/
|
|
70
|
-
static theValueOf(field) {
|
|
71
|
-
return new Clear(field);
|
|
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 new questions_1.Value(this.field).answeredBy(actor).then(value => {
|
|
89
|
-
if (value === null) {
|
|
90
|
-
throw new core_1.LogicError(`${this.capitaliseFirstLetter(this.field.toString())} doesn't seem to have a 'value' attribute that could be cleared.`);
|
|
91
|
-
}
|
|
92
|
-
if (value !== undefined) {
|
|
93
|
-
return (0, withAnswerOf_1.withAnswerOf)(actor, this.field, (elf) => {
|
|
94
|
-
return this.removeCharactersFrom(elf, value.length);
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* @desc
|
|
101
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
102
|
-
*
|
|
103
|
-
* @returns {string}
|
|
104
|
-
*/
|
|
105
|
-
toString() {
|
|
106
|
-
return (0, io_1.formatted) `#actor clears the value of ${this.field}`;
|
|
107
|
-
}
|
|
108
|
-
capitaliseFirstLetter(text) {
|
|
109
|
-
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
110
|
-
}
|
|
111
|
-
removeCharactersFrom(elf, numberOfCharacters) {
|
|
112
|
-
return numberOfCharacters === 0
|
|
113
|
-
? Promise.resolve(void 0)
|
|
114
|
-
: elf.sendKeys(protractor_1.protractor.Key.END, ...this.times(numberOfCharacters, protractor_1.protractor.Key.BACK_SPACE));
|
|
115
|
-
}
|
|
116
|
-
times(length, key) {
|
|
117
|
-
return Array.from({ length }).map(() => key);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
exports.Clear = Clear;
|
|
121
|
-
//# sourceMappingURL=Clear.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Clear.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Clear.ts"],"names":[],"mappings":";;;AAAA,4CAAuG;AACvG,iDAAqD;AACrD,2CAAuD;AAEvD,4CAAqC;AACrC,kDAA+C;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAa,KAAM,SAAQ,kBAAW;IAclC;;;OAGG;IACH,YAA6B,KAA8C;QACvE,KAAK,EAAE,CAAC;QADiB,UAAK,GAAL,KAAK,CAAyC;IAE3E,CAAC;IAlBD;;;;;;;OAOG;IACH,MAAM,CAAC,UAAU,CAAC,KAA8C;QAC5D,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAUD;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,KAAuC;QAC7C,OAAO,IAAI,iBAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YACxD,IAAI,KAAK,KAAK,IAAI,EAAE;gBAChB,MAAM,IAAI,iBAAU,CAChB,GAAI,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAE,kEAAkE,CAC3H,CAAC;aACL;YAED,IAAI,KAAK,KAAK,SAAS,EAAE;gBACrB,OAAO,IAAA,2BAAY,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,GAAkB,EAAE,EAAE;oBAC1D,OAAO,IAAI,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;gBACxD,CAAC,CAAC,CAAC;aACN;QACL,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACJ,OAAO,IAAA,cAAS,EAAC,8BAA+B,IAAI,CAAC,KAAM,EAAE,CAAC;IAClE,CAAC;IAEO,qBAAqB,CAAC,IAAY;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAEO,oBAAoB,CAAC,GAAkB,EAAE,kBAA0B;QACvE,OAAO,kBAAkB,KAAK,CAAC;YAC3B,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACzB,CAAC,CAAC,GAAG,CAAC,QAAQ,CACV,uBAAU,CAAC,GAAG,CAAC,GAAG,EAClB,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,uBAAU,CAAC,GAAG,CAAC,UAAU,CAAC,CAC/D,CAAC;IACV,CAAC;IAEO,KAAK,CAAC,MAAc,EAAE,GAAW;QACrC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;IACjD,CAAC;CACJ;AA9ED,sBA8EC"}
|
|
@@ -1,81 +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
|
-
* [click](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event) on a given Web element.
|
|
7
|
-
*
|
|
8
|
-
* @example <caption>Example widget</caption>
|
|
9
|
-
* <form>
|
|
10
|
-
* <input type="text" name="example" id="example" />
|
|
11
|
-
* </form>
|
|
12
|
-
*
|
|
13
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
14
|
-
* import { Target } from '@serenity-js/protractor';
|
|
15
|
-
* import { by } from 'protractor';
|
|
16
|
-
*
|
|
17
|
-
* class Form {
|
|
18
|
-
* static exampleInput = Target.the('example input')
|
|
19
|
-
* .located(by.id('example'));
|
|
20
|
-
* }
|
|
21
|
-
*
|
|
22
|
-
* @example <caption>Clicking on an element</caption>
|
|
23
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
24
|
-
* import { BrowseTheWeb, Click, isSelected } from '@serenity-js/protractor';
|
|
25
|
-
* import { Ensure } from '@serenity-js/assertions';
|
|
26
|
-
* import { protractor } from 'protractor';
|
|
27
|
-
*
|
|
28
|
-
* actorCalled('Chloé')
|
|
29
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
30
|
-
* .attemptsTo(
|
|
31
|
-
* Click.on(Form.exampleInput),
|
|
32
|
-
* Ensure.that(Form.exampleInput, isSelected()),
|
|
33
|
-
* );
|
|
34
|
-
*
|
|
35
|
-
* @see {@link BrowseTheWeb}
|
|
36
|
-
* @see {@link Target}
|
|
37
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
38
|
-
* @see {@link isSelected}
|
|
39
|
-
*
|
|
40
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
41
|
-
*/
|
|
42
|
-
export declare class Click extends Interaction {
|
|
43
|
-
private readonly target;
|
|
44
|
-
/**
|
|
45
|
-
* @desc
|
|
46
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
47
|
-
*
|
|
48
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
49
|
-
* The element to be clicked on
|
|
50
|
-
*
|
|
51
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
52
|
-
*/
|
|
53
|
-
static on(target: Question<ElementFinder> | ElementFinder): Interaction;
|
|
54
|
-
/**
|
|
55
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
56
|
-
* The element to be clicked on
|
|
57
|
-
*/
|
|
58
|
-
constructor(target: Question<ElementFinder> | ElementFinder);
|
|
59
|
-
/**
|
|
60
|
-
* @desc
|
|
61
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
62
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
63
|
-
*
|
|
64
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
65
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
66
|
-
*
|
|
67
|
-
* @returns {PromiseLike<void>}
|
|
68
|
-
*
|
|
69
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
70
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
71
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
72
|
-
*/
|
|
73
|
-
performAs(actor: UsesAbilities & AnswersQuestions): PromiseLike<void>;
|
|
74
|
-
/**
|
|
75
|
-
* @desc
|
|
76
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
77
|
-
*
|
|
78
|
-
* @returns {string}
|
|
79
|
-
*/
|
|
80
|
-
toString(): string;
|
|
81
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Click = 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
|
-
* [click](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event) on a given Web element.
|
|
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>Clicking on an element</caption>
|
|
27
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
28
|
-
* import { BrowseTheWeb, Click, isSelected } from '@serenity-js/protractor';
|
|
29
|
-
* import { Ensure } from '@serenity-js/assertions';
|
|
30
|
-
* import { protractor } from 'protractor';
|
|
31
|
-
*
|
|
32
|
-
* actorCalled('Chloé')
|
|
33
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
34
|
-
* .attemptsTo(
|
|
35
|
-
* Click.on(Form.exampleInput),
|
|
36
|
-
* Ensure.that(Form.exampleInput, isSelected()),
|
|
37
|
-
* );
|
|
38
|
-
*
|
|
39
|
-
* @see {@link BrowseTheWeb}
|
|
40
|
-
* @see {@link Target}
|
|
41
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
42
|
-
* @see {@link isSelected}
|
|
43
|
-
*
|
|
44
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
45
|
-
*/
|
|
46
|
-
class Click extends core_1.Interaction {
|
|
47
|
-
/**
|
|
48
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
49
|
-
* The element to be clicked on
|
|
50
|
-
*/
|
|
51
|
-
constructor(target) {
|
|
52
|
-
super();
|
|
53
|
-
this.target = target;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* @desc
|
|
57
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
58
|
-
*
|
|
59
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
60
|
-
* The element to be clicked on
|
|
61
|
-
*
|
|
62
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
63
|
-
*/
|
|
64
|
-
static on(target) {
|
|
65
|
-
return new Click(target);
|
|
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 (0, withAnswerOf_1.withAnswerOf)(actor, this.target, (elf) => elf.click());
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* @desc
|
|
86
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
87
|
-
*
|
|
88
|
-
* @returns {string}
|
|
89
|
-
*/
|
|
90
|
-
toString() {
|
|
91
|
-
return (0, io_1.formatted) `#actor clicks on ${this.target}`;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
exports.Click = Click;
|
|
95
|
-
//# sourceMappingURL=Click.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Click.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Click.ts"],"names":[],"mappings":";;;AAAA,4CAA2F;AAC3F,iDAAqD;AAGrD,kDAA+C;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;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,EAAE,CAAC,MAA+C;QACrD,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,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IACjF,CAAC;IAED;;;;;OAKG;IACH,QAAQ;QACJ,OAAO,IAAA,cAAS,EAAC,oBAAqB,IAAI,CAAC,MAAO,EAAE,CAAC;IACzD,CAAC;CACJ;AAlDD,sBAkDC"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Interaction } from '@serenity-js/core';
|
|
2
|
-
/**
|
|
3
|
-
* @desc
|
|
4
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
5
|
-
* close browser tabs or windows.
|
|
6
|
-
*
|
|
7
|
-
* @example <caption>Closing a browser tab or window</caption>
|
|
8
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
9
|
-
* import { BrowseTheWeb, Click, Close, Switch } from '@serenity-js/protractor';
|
|
10
|
-
* import { protractor } from 'protractor';
|
|
11
|
-
*
|
|
12
|
-
* actorCalled('Caleb')
|
|
13
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
14
|
-
* .attemptsTo(
|
|
15
|
-
* Click.on(someLinkThatOpensANewWindow),
|
|
16
|
-
*
|
|
17
|
-
* Switch.toNewWindow().and(
|
|
18
|
-
* // perform activities in the context of the new window
|
|
19
|
-
* Close.currentWindow(),
|
|
20
|
-
* ),
|
|
21
|
-
* );
|
|
22
|
-
*
|
|
23
|
-
* @example <caption>Closing any new windows after a Jasmine test</caption>
|
|
24
|
-
* import 'jasmine';
|
|
25
|
-
*
|
|
26
|
-
* import { actorInTheSpotlight } from '@serenity-js/core';
|
|
27
|
-
* import { Close } from '@serenity-js/protractor';
|
|
28
|
-
*
|
|
29
|
-
* after(() =>
|
|
30
|
-
* actorInTheSpotlight().attemptsTo(
|
|
31
|
-
* Close.anyNewWindows(),
|
|
32
|
-
* ));
|
|
33
|
-
*
|
|
34
|
-
* @example <caption>Closing any new windows after a Mocha test</caption>
|
|
35
|
-
* import 'mocha';
|
|
36
|
-
*
|
|
37
|
-
* import { actorInTheSpotlight } from '@serenity-js/core';
|
|
38
|
-
* import { Close } from '@serenity-js/protractor';
|
|
39
|
-
*
|
|
40
|
-
* after(() =>
|
|
41
|
-
* actorInTheSpotlight().attemptsTo(
|
|
42
|
-
* Close.anyNewWindows(),
|
|
43
|
-
* ));
|
|
44
|
-
*
|
|
45
|
-
* @example <caption>Closing any new windows after a Cucumber scenario</caption>
|
|
46
|
-
* import { actorInTheSpotlight } from '@serenity-js/core';
|
|
47
|
-
* import { Close } from '@serenity-js/protractor';
|
|
48
|
-
* import { After } from 'cucumber';
|
|
49
|
-
*
|
|
50
|
-
* After(() =>
|
|
51
|
-
* actorInTheSpotlight().attemptsTo(
|
|
52
|
-
* Close.anyNewWindows(),
|
|
53
|
-
* ));
|
|
54
|
-
*
|
|
55
|
-
* @see {@link Switch}
|
|
56
|
-
*/
|
|
57
|
-
export declare class Close {
|
|
58
|
-
/**
|
|
59
|
-
* @desc
|
|
60
|
-
* Closes any windows other than the original one that
|
|
61
|
-
* the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
62
|
-
* has {@link Navigate}d to.
|
|
63
|
-
*
|
|
64
|
-
* When the windows are closed, it switches the context
|
|
65
|
-
* back to the original window.
|
|
66
|
-
*
|
|
67
|
-
* @static
|
|
68
|
-
* @returns {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
69
|
-
*
|
|
70
|
-
* @see {@link Switch}
|
|
71
|
-
*/
|
|
72
|
-
static anyNewWindows(): Interaction;
|
|
73
|
-
/**
|
|
74
|
-
* @desc
|
|
75
|
-
* Closes the currently focused browser window.
|
|
76
|
-
*
|
|
77
|
-
* **Please note** that this interaction should be used to close
|
|
78
|
-
* pop-up windows or any new windows/tabs opened during the test
|
|
79
|
-
* rather than the _main_ window, which is managed by Protractor.
|
|
80
|
-
*
|
|
81
|
-
* See tests for usage examples.
|
|
82
|
-
*
|
|
83
|
-
* @static
|
|
84
|
-
* @returns {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
85
|
-
*
|
|
86
|
-
* @see {@link Switch}
|
|
87
|
-
*/
|
|
88
|
-
static currentWindow(): Interaction;
|
|
89
|
-
}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Close = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const abilities_1 = require("../abilities");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
9
|
-
* close browser tabs or windows.
|
|
10
|
-
*
|
|
11
|
-
* @example <caption>Closing a browser tab or window</caption>
|
|
12
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
13
|
-
* import { BrowseTheWeb, Click, Close, Switch } from '@serenity-js/protractor';
|
|
14
|
-
* import { protractor } from 'protractor';
|
|
15
|
-
*
|
|
16
|
-
* actorCalled('Caleb')
|
|
17
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
18
|
-
* .attemptsTo(
|
|
19
|
-
* Click.on(someLinkThatOpensANewWindow),
|
|
20
|
-
*
|
|
21
|
-
* Switch.toNewWindow().and(
|
|
22
|
-
* // perform activities in the context of the new window
|
|
23
|
-
* Close.currentWindow(),
|
|
24
|
-
* ),
|
|
25
|
-
* );
|
|
26
|
-
*
|
|
27
|
-
* @example <caption>Closing any new windows after a Jasmine test</caption>
|
|
28
|
-
* import 'jasmine';
|
|
29
|
-
*
|
|
30
|
-
* import { actorInTheSpotlight } from '@serenity-js/core';
|
|
31
|
-
* import { Close } from '@serenity-js/protractor';
|
|
32
|
-
*
|
|
33
|
-
* after(() =>
|
|
34
|
-
* actorInTheSpotlight().attemptsTo(
|
|
35
|
-
* Close.anyNewWindows(),
|
|
36
|
-
* ));
|
|
37
|
-
*
|
|
38
|
-
* @example <caption>Closing any new windows after a Mocha test</caption>
|
|
39
|
-
* import 'mocha';
|
|
40
|
-
*
|
|
41
|
-
* import { actorInTheSpotlight } from '@serenity-js/core';
|
|
42
|
-
* import { Close } from '@serenity-js/protractor';
|
|
43
|
-
*
|
|
44
|
-
* after(() =>
|
|
45
|
-
* actorInTheSpotlight().attemptsTo(
|
|
46
|
-
* Close.anyNewWindows(),
|
|
47
|
-
* ));
|
|
48
|
-
*
|
|
49
|
-
* @example <caption>Closing any new windows after a Cucumber scenario</caption>
|
|
50
|
-
* import { actorInTheSpotlight } from '@serenity-js/core';
|
|
51
|
-
* import { Close } from '@serenity-js/protractor';
|
|
52
|
-
* import { After } from 'cucumber';
|
|
53
|
-
*
|
|
54
|
-
* After(() =>
|
|
55
|
-
* actorInTheSpotlight().attemptsTo(
|
|
56
|
-
* Close.anyNewWindows(),
|
|
57
|
-
* ));
|
|
58
|
-
*
|
|
59
|
-
* @see {@link Switch}
|
|
60
|
-
*/
|
|
61
|
-
class Close {
|
|
62
|
-
/**
|
|
63
|
-
* @desc
|
|
64
|
-
* Closes any windows other than the original one that
|
|
65
|
-
* the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
66
|
-
* has {@link Navigate}d to.
|
|
67
|
-
*
|
|
68
|
-
* When the windows are closed, it switches the context
|
|
69
|
-
* back to the original window.
|
|
70
|
-
*
|
|
71
|
-
* @static
|
|
72
|
-
* @returns {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
73
|
-
*
|
|
74
|
-
* @see {@link Switch}
|
|
75
|
-
*/
|
|
76
|
-
static anyNewWindows() {
|
|
77
|
-
return new CloseWindowsOtherThan(actor => abilities_1.BrowseTheWeb.as(actor).getOriginalWindowHandle(), `#actor closes any new windows`);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* @desc
|
|
81
|
-
* Closes the currently focused browser window.
|
|
82
|
-
*
|
|
83
|
-
* **Please note** that this interaction should be used to close
|
|
84
|
-
* pop-up windows or any new windows/tabs opened during the test
|
|
85
|
-
* rather than the _main_ window, which is managed by Protractor.
|
|
86
|
-
*
|
|
87
|
-
* See tests for usage examples.
|
|
88
|
-
*
|
|
89
|
-
* @static
|
|
90
|
-
* @returns {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
91
|
-
*
|
|
92
|
-
* @see {@link Switch}
|
|
93
|
-
*/
|
|
94
|
-
static currentWindow() {
|
|
95
|
-
return new CloseCurrentWindow();
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
exports.Close = Close;
|
|
99
|
-
/**
|
|
100
|
-
* @package
|
|
101
|
-
*/
|
|
102
|
-
class CloseWindowsOtherThan extends core_1.Interaction {
|
|
103
|
-
constructor(windowToKeepBy, description = `#actor closes several windows`) {
|
|
104
|
-
super();
|
|
105
|
-
this.windowToKeepBy = windowToKeepBy;
|
|
106
|
-
this.description = description;
|
|
107
|
-
}
|
|
108
|
-
performAs(actor) {
|
|
109
|
-
return this.windowToKeepBy(actor)
|
|
110
|
-
.then(windowToKeep => this.windowsOtherThan(windowToKeep, actor)
|
|
111
|
-
.then(windowsToClose => this.closeAll(windowsToClose, actor))
|
|
112
|
-
.then(() => this.switchTo(windowToKeep, actor)));
|
|
113
|
-
}
|
|
114
|
-
toString() {
|
|
115
|
-
return this.description;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* @param {string} windowToKeep
|
|
119
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
120
|
-
* @private
|
|
121
|
-
*/
|
|
122
|
-
windowsOtherThan(windowToKeep, actor) {
|
|
123
|
-
return abilities_1.BrowseTheWeb.as(actor).getAllWindowHandles()
|
|
124
|
-
.then(allWindows => this.isDefined(windowToKeep) && allWindows.length > 1
|
|
125
|
-
? allWindows.filter(handle => handle !== windowToKeep)
|
|
126
|
-
: []);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* @param {string[]} windows
|
|
130
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
131
|
-
* @private
|
|
132
|
-
*/
|
|
133
|
-
closeAll(windows, actor) {
|
|
134
|
-
return windows.reduce((previous, handle) => {
|
|
135
|
-
return previous
|
|
136
|
-
.then(() => abilities_1.BrowseTheWeb.as(actor).switchToWindow(handle))
|
|
137
|
-
.then(() => abilities_1.BrowseTheWeb.as(actor).closeCurrentWindow());
|
|
138
|
-
}, Promise.resolve());
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* @param {string} window
|
|
142
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
143
|
-
* @private
|
|
144
|
-
*/
|
|
145
|
-
switchTo(window, actor) {
|
|
146
|
-
return this.isDefined(window)
|
|
147
|
-
? abilities_1.BrowseTheWeb.as(actor).switchToWindow(window)
|
|
148
|
-
: Promise.resolve();
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* @param {any} value
|
|
152
|
-
* @private
|
|
153
|
-
*/
|
|
154
|
-
isDefined(value) {
|
|
155
|
-
return value !== undefined && value !== null;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* @package
|
|
160
|
-
*/
|
|
161
|
-
class CloseCurrentWindow extends core_1.Interaction {
|
|
162
|
-
performAs(actor) {
|
|
163
|
-
return abilities_1.BrowseTheWeb.as(actor).closeCurrentWindow();
|
|
164
|
-
}
|
|
165
|
-
toString() {
|
|
166
|
-
return `#actor closes current browser window`;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
//# sourceMappingURL=Close.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Close.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Close.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Answerable, Interaction } from '@serenity-js/core';
|
|
2
|
-
/**
|
|
3
|
-
* @desc
|
|
4
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
5
|
-
* remove cookies from the browser.
|
|
6
|
-
*
|
|
7
|
-
* @example <caption>Removing a single cookie</caption>
|
|
8
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
9
|
-
* import { BrowseTheWeb, Navigate, DeleteCookies } from '@serenity-js/protractor';
|
|
10
|
-
* import { protractor } from 'protractor';
|
|
11
|
-
*
|
|
12
|
-
* actorCalled('Sid')
|
|
13
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
14
|
-
* .attemptsTo(
|
|
15
|
-
* Navigate.to('/login'),
|
|
16
|
-
* DeleteCookies.called('jwt_token'),
|
|
17
|
-
* Navigate.reloadPage(),
|
|
18
|
-
* );
|
|
19
|
-
*
|
|
20
|
-
* @example <caption>Removing all cookies before each Jasmine test</caption>
|
|
21
|
-
* import 'jasmine';
|
|
22
|
-
*
|
|
23
|
-
* import { actorInTheSpotlight } from '@serenity-js/core';
|
|
24
|
-
* import { DeleteCookies } from '@serenity-js/protractor';
|
|
25
|
-
*
|
|
26
|
-
* before(() =>
|
|
27
|
-
* actorInTheSpotlight().attemptsTo(
|
|
28
|
-
* DeleteCookies.all(),
|
|
29
|
-
* ));
|
|
30
|
-
*
|
|
31
|
-
* @example <caption>Removing all cookies before each Mocha test</caption>
|
|
32
|
-
* import 'mocha';
|
|
33
|
-
*
|
|
34
|
-
* import { actorInTheSpotlight } from '@serenity-js/core';
|
|
35
|
-
* import { DeleteCookies } from '@serenity-js/protractor';
|
|
36
|
-
*
|
|
37
|
-
* before(() =>
|
|
38
|
-
* actorInTheSpotlight().attemptsTo(
|
|
39
|
-
* DeleteCookies.all(),
|
|
40
|
-
* ));
|
|
41
|
-
*
|
|
42
|
-
* @example <caption>Removing all cookies before each Cucumber scenario</caption>
|
|
43
|
-
* import { actorInTheSpotlight } from '@serenity-js/core';
|
|
44
|
-
* import { DeleteCookies } from '@serenity-js/protractor';
|
|
45
|
-
* import { Before } from 'cucumber';
|
|
46
|
-
*
|
|
47
|
-
* Before(() =>
|
|
48
|
-
* actorInTheSpotlight().attemptsTo(
|
|
49
|
-
* DeleteCookies.all(),
|
|
50
|
-
* ));
|
|
51
|
-
*
|
|
52
|
-
* @see {@link Navigate}
|
|
53
|
-
*/
|
|
54
|
-
export declare class DeleteCookies {
|
|
55
|
-
/**
|
|
56
|
-
* @desc
|
|
57
|
-
* Removes a single cookie identified by `cookieName`.
|
|
58
|
-
*
|
|
59
|
-
* @param {Answerable<string>} cookieName
|
|
60
|
-
* The name of the cookie to be deleted
|
|
61
|
-
*
|
|
62
|
-
* @returns {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
63
|
-
*/
|
|
64
|
-
static called(cookieName: Answerable<string>): Interaction;
|
|
65
|
-
/**
|
|
66
|
-
* @desc
|
|
67
|
-
* Removes any cookies set.
|
|
68
|
-
*
|
|
69
|
-
* @returns {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
70
|
-
*/
|
|
71
|
-
static all(): Interaction;
|
|
72
|
-
}
|