@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,247 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Wait = 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
|
-
/**
|
|
8
|
-
* @desc
|
|
9
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
10
|
-
* wait before proceeding either for a set {@link @serenity-js/core/lib/model~Duration}
|
|
11
|
-
* or until a given {@link @serenity-js/core/lib/screenplay/questions~Expectation} is met.
|
|
12
|
-
*
|
|
13
|
-
* Useful when a test scenario can't take advantage of automatic synchronisation between
|
|
14
|
-
* Protractor and Angular (see {@link UseAngular}), or when the application under test is animation-heavy.
|
|
15
|
-
*
|
|
16
|
-
* @example <caption>Example widget</caption>
|
|
17
|
-
* <!--
|
|
18
|
-
* After about 1 second, the text will change from 'Loading...' to 'Ready!'
|
|
19
|
-
* -->
|
|
20
|
-
* <h1 id="status">Loading...</h1>
|
|
21
|
-
* <script>
|
|
22
|
-
* (function () {
|
|
23
|
-
* setTimeout(function () {
|
|
24
|
-
* document.getElementById('status').textContent = 'Ready!'
|
|
25
|
-
* }, 1000);
|
|
26
|
-
* })();
|
|
27
|
-
* </script>
|
|
28
|
-
*
|
|
29
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
30
|
-
* import { Target } from '@serenity-js/protractor';
|
|
31
|
-
* import { by } from 'protractor';
|
|
32
|
-
*
|
|
33
|
-
* class App {
|
|
34
|
-
* static status = Target.the('status widget')
|
|
35
|
-
* .located(by.id('status'));
|
|
36
|
-
* }
|
|
37
|
-
*
|
|
38
|
-
* @example <caption>Waiting for a set amount of time</caption>
|
|
39
|
-
* import { actorCalled, Duration } from '@serenity-js/core';
|
|
40
|
-
* import { BrowseTheWeb, Wait } from '@serenity-js/protractor';
|
|
41
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
42
|
-
* import { protractor } from 'protractor';
|
|
43
|
-
*
|
|
44
|
-
* actorCalled('Aurora')
|
|
45
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
46
|
-
* .attemptsTo(
|
|
47
|
-
* Wait.for(Duration.ofSeconds(1.5)),
|
|
48
|
-
* Ensure.that(App.status, equals('Ready!')),
|
|
49
|
-
* );
|
|
50
|
-
*
|
|
51
|
-
* // Please note that while the above implementation works,
|
|
52
|
-
* // this approach is inefficient because at best
|
|
53
|
-
* // the actor might wait too long and at worst the test
|
|
54
|
-
* // might become "flaky" if any external interference
|
|
55
|
-
* // (like network glitches, animations taking a bit too long etc.)
|
|
56
|
-
* // makes the actor wait not long enough.
|
|
57
|
-
*
|
|
58
|
-
* @example <caption>Waiting until a condition is met</caption>
|
|
59
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
60
|
-
* import { BrowseTheWeb, Wait, Text } from '@serenity-js/protractor';
|
|
61
|
-
* import { equals } from '@serenity-js/assertions';
|
|
62
|
-
* import { protractor } from 'protractor';
|
|
63
|
-
*
|
|
64
|
-
* actorCalled('Aurora')
|
|
65
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
66
|
-
* .attemptsTo(
|
|
67
|
-
* Wait.until(Text.of(App.status), equals('Ready!')),
|
|
68
|
-
* // app is ready, proceed with the scenario
|
|
69
|
-
* );
|
|
70
|
-
*
|
|
71
|
-
* // Wait.until makes the Actor keep asking a Question,
|
|
72
|
-
* // in this case Text.of(App.status), until the answer meets
|
|
73
|
-
* // the expectation, or a timeout expires (default: 5s).
|
|
74
|
-
* //
|
|
75
|
-
* // Please note that both Ensure and Wait can be used with
|
|
76
|
-
* // the same expectations, like `equals`.
|
|
77
|
-
*
|
|
78
|
-
* @example <caption>Changing the default timeout</caption>
|
|
79
|
-
* import { actorCalled, Duration } from '@serenity-js/core';
|
|
80
|
-
* import { BrowseTheWeb, Wait, Text } from '@serenity-js/protractor';
|
|
81
|
-
* import { equals } from '@serenity-js/assertions';
|
|
82
|
-
* import { protractor } from 'protractor';
|
|
83
|
-
*
|
|
84
|
-
* actorCalled('Aurora')
|
|
85
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
86
|
-
* .attemptsTo(
|
|
87
|
-
* Wait.upTo(Duration.ofSeconds(3))
|
|
88
|
-
* .until(Text.of(App.status), equals('Ready!')),
|
|
89
|
-
* // app is ready, proceed with the scenario
|
|
90
|
-
* );
|
|
91
|
-
*
|
|
92
|
-
* @see {@link BrowseTheWeb}
|
|
93
|
-
* @see {@link Target}
|
|
94
|
-
* @see {@link Text}
|
|
95
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
96
|
-
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
97
|
-
* @see {@link @serenity-js/core/lib/model~Duration}
|
|
98
|
-
*
|
|
99
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
100
|
-
*/
|
|
101
|
-
class Wait {
|
|
102
|
-
/**
|
|
103
|
-
* @desc
|
|
104
|
-
* Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
105
|
-
* configured to wait for a set duration.
|
|
106
|
-
*
|
|
107
|
-
* @param {Answerable<Duration>} duration
|
|
108
|
-
* A set duration the {@link @serenity-js/core/lib/screenplay/actor~Actor} should wait for
|
|
109
|
-
* before proceeding
|
|
110
|
-
*
|
|
111
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
112
|
-
*/
|
|
113
|
-
static for(duration) {
|
|
114
|
-
return new WaitFor(duration);
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* @desc
|
|
118
|
-
* Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
119
|
-
* configured to wait until the answer to the question (`actual`) meets the `expectation`,
|
|
120
|
-
* or a custom timeout expires.
|
|
121
|
-
*
|
|
122
|
-
* @param {Duration} duration
|
|
123
|
-
* Custom timeout to override {@link Wait.Default_Timeout}
|
|
124
|
-
*
|
|
125
|
-
* @returns {WaitBuilder}
|
|
126
|
-
*/
|
|
127
|
-
static upTo(duration) {
|
|
128
|
-
return {
|
|
129
|
-
until: (actual, expectation) => new WaitUntil(actual, expectation, duration),
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* @desc
|
|
134
|
-
* Instantiates a version of this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
135
|
-
* configured to wait until the answer to the question (`actual`) meets the `expectation`,
|
|
136
|
-
* or a {@link Wait.Default_Timeout} expires.
|
|
137
|
-
*
|
|
138
|
-
* @param {Answerable<Actual>} actual
|
|
139
|
-
* A {@link @serenity-js/core/lib/screenplay~Question}
|
|
140
|
-
* that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
141
|
-
* will keep asking until the answer meets
|
|
142
|
-
* the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
|
|
143
|
-
*
|
|
144
|
-
* @param {@serenity-js/core/lib/screenplay/questions~<any,Actual>} expectation
|
|
145
|
-
* An {@link @serenity-js/core/lib/screenplay/questions~Expectation} to be met before proceeding
|
|
146
|
-
*
|
|
147
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
148
|
-
*/
|
|
149
|
-
static until(actual, expectation) {
|
|
150
|
-
return new WaitUntil(actual, expectation, Wait.Default_Timeout);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
exports.Wait = Wait;
|
|
154
|
-
/**
|
|
155
|
-
* @desc
|
|
156
|
-
* Default timeout of 5 seconds used with {@link Wait.until}.
|
|
157
|
-
*
|
|
158
|
-
* @type {@serenity-js/core~Duration}
|
|
159
|
-
*/
|
|
160
|
-
Wait.Default_Timeout = core_1.Duration.ofSeconds(5);
|
|
161
|
-
/**
|
|
162
|
-
* @package
|
|
163
|
-
*/
|
|
164
|
-
class WaitFor extends core_1.Interaction {
|
|
165
|
-
constructor(duration) {
|
|
166
|
-
super();
|
|
167
|
-
this.duration = duration;
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* @desc
|
|
171
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
172
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
173
|
-
*
|
|
174
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
175
|
-
* @returns {Promise<void>}
|
|
176
|
-
*
|
|
177
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
178
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
179
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
180
|
-
*/
|
|
181
|
-
performAs(actor) {
|
|
182
|
-
return actor.answer(this.duration)
|
|
183
|
-
.then(duration => abilities_1.BrowseTheWeb.as(actor).sleep(duration.inMilliseconds()));
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* @desc
|
|
187
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
188
|
-
*
|
|
189
|
-
* @returns {string}
|
|
190
|
-
*/
|
|
191
|
-
toString() {
|
|
192
|
-
return (0, io_1.formatted) `#actor waits for ${this.duration}`;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* @package
|
|
197
|
-
*/
|
|
198
|
-
class WaitUntil extends core_1.Interaction {
|
|
199
|
-
constructor(actual, expectation, timeout) {
|
|
200
|
-
super();
|
|
201
|
-
this.actual = actual;
|
|
202
|
-
this.expectation = expectation;
|
|
203
|
-
this.timeout = timeout;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* @desc
|
|
207
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
208
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
209
|
-
*
|
|
210
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
211
|
-
* @returns {Promise<void>}
|
|
212
|
-
*
|
|
213
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
214
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
215
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
216
|
-
*/
|
|
217
|
-
performAs(actor) {
|
|
218
|
-
const actual = this.actual, expectation = this.expectation.answeredBy(actor);
|
|
219
|
-
let expectationOutcome;
|
|
220
|
-
return abilities_1.BrowseTheWeb.as(actor)
|
|
221
|
-
.wait(function () {
|
|
222
|
-
return actor.answer(actual)
|
|
223
|
-
.then(act => expectation(act))
|
|
224
|
-
.then(outcome => {
|
|
225
|
-
expectationOutcome = outcome;
|
|
226
|
-
return outcome instanceof core_1.ExpectationMet;
|
|
227
|
-
});
|
|
228
|
-
}, this.timeout.inMilliseconds())
|
|
229
|
-
.then(_ => void 0)
|
|
230
|
-
.catch(error => {
|
|
231
|
-
if (expectationOutcome) {
|
|
232
|
-
throw new core_1.AssertionError(`Waited ${this.timeout.toString()} for ${(0, io_1.formatted) `${this.actual}`} to ${this.expectation.toString()}`, expectationOutcome.expected, expectationOutcome.actual, error);
|
|
233
|
-
}
|
|
234
|
-
throw error;
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* @desc
|
|
239
|
-
* Generates a description to be used when reporting this {@link @serenity-js/core/lib/screenplay~Activity}.
|
|
240
|
-
*
|
|
241
|
-
* @returns {string}
|
|
242
|
-
*/
|
|
243
|
-
toString() {
|
|
244
|
-
return (0, io_1.formatted) `#actor waits up to ${this.timeout} until ${this.actual} does ${this.expectation}`;
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
//# sourceMappingURL=Wait.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Wait.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Wait.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Answerable, Expectation } from '@serenity-js/core';
|
|
2
|
-
import { Interaction } from '@serenity-js/core/lib/screenplay';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Fluent interface to make the instantiation of
|
|
6
|
-
* the {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
7
|
-
* to {@link Wait} more readable.
|
|
8
|
-
*
|
|
9
|
-
* @see {@link Wait}
|
|
10
|
-
*
|
|
11
|
-
* @interface
|
|
12
|
-
*/
|
|
13
|
-
export interface WaitBuilder {
|
|
14
|
-
/**
|
|
15
|
-
* @desc
|
|
16
|
-
* Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
17
|
-
* to {@link Wait}.
|
|
18
|
-
*
|
|
19
|
-
* @param {Answerable<Actual>} actual
|
|
20
|
-
* A {@link @serenity-js/core/lib/screenplay~Question}
|
|
21
|
-
* that the {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
22
|
-
* will keep asking until the answer meets
|
|
23
|
-
* the {@link @serenity-js/core/lib/screenplay/questions~Expectation} provided
|
|
24
|
-
*
|
|
25
|
-
* @param {@serenity-js/core/lib/screenplay/questions~Expectation<any,Actual>} expectation
|
|
26
|
-
* An {@link @serenity-js/assertions~Expectation} to be met before proceeding
|
|
27
|
-
*
|
|
28
|
-
* @returns {Interaction}
|
|
29
|
-
*
|
|
30
|
-
* @see {@link Target}
|
|
31
|
-
*/
|
|
32
|
-
until: <Actual>(actual: Answerable<Actual>, expectation: Expectation<any, Actual>) => Interaction;
|
|
33
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WaitBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/WaitBuilder.ts"],"names":[],"mappings":""}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, Question, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { ElementFinder } from 'protractor';
|
|
3
|
-
export declare class Attribute extends Question<Promise<string>> {
|
|
4
|
-
private readonly target;
|
|
5
|
-
private readonly name;
|
|
6
|
-
/**
|
|
7
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
8
|
-
* @returns {AttributeBuilder}
|
|
9
|
-
*/
|
|
10
|
-
static of(target: Question<ElementFinder> | ElementFinder): AttributeBuilder;
|
|
11
|
-
constructor(target: Question<ElementFinder> | ElementFinder, name: Answerable<string>);
|
|
12
|
-
/**
|
|
13
|
-
* @desc
|
|
14
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
15
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
16
|
-
*
|
|
17
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
18
|
-
* @returns {Promise<void>}
|
|
19
|
-
*
|
|
20
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
21
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
22
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
23
|
-
*/
|
|
24
|
-
answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<string>;
|
|
25
|
-
}
|
|
26
|
-
interface AttributeBuilder {
|
|
27
|
-
called(name: Answerable<string>): Attribute;
|
|
28
|
-
}
|
|
29
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Attribute = 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
|
-
// todo: it might be better to swap the order of arguments
|
|
9
|
-
// - Attribute.called('href').of(link) to make it work with ArrayListFilter
|
|
10
|
-
class Attribute extends core_1.Question {
|
|
11
|
-
constructor(target, name) {
|
|
12
|
-
super((0, io_1.formatted) `the value of the ${name} attribute of ${target}`);
|
|
13
|
-
this.target = target;
|
|
14
|
-
this.name = name;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
18
|
-
* @returns {AttributeBuilder}
|
|
19
|
-
*/
|
|
20
|
-
static of(target) {
|
|
21
|
-
return {
|
|
22
|
-
called: (name) => new Attribute(target, name),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* @desc
|
|
27
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
28
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
29
|
-
*
|
|
30
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
31
|
-
* @returns {Promise<void>}
|
|
32
|
-
*
|
|
33
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
34
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
35
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
36
|
-
*/
|
|
37
|
-
answeredBy(actor) {
|
|
38
|
-
return actor.answer(this.name)
|
|
39
|
-
.then(name => (0, withAnswerOf_1.withAnswerOf)(actor, this.target, (elf) => elf.getAttribute(name).then(value => {
|
|
40
|
-
return value !== null // workaround for bug in Chromium 91 - https://bugs.chromium.org/p/chromium/issues/detail?id=1205107&start=300
|
|
41
|
-
? value
|
|
42
|
-
: abilities_1.BrowseTheWeb.as(actor).executeFunction(
|
|
43
|
-
/* istanbul ignore next */
|
|
44
|
-
function getAttribute(webElement, attributeName) {
|
|
45
|
-
// eslint-disable-next-line no-var
|
|
46
|
-
var value = (webElement[attributeName] || webElement.getAttribute(attributeName));
|
|
47
|
-
if (value !== null && value !== undefined) {
|
|
48
|
-
return '' + value;
|
|
49
|
-
}
|
|
50
|
-
return value;
|
|
51
|
-
}, elf.getWebElement(), name);
|
|
52
|
-
})));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
exports.Attribute = Attribute;
|
|
56
|
-
//# sourceMappingURL=Attribute.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Attribute.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Attribute.ts"],"names":[],"mappings":";;;AAAA,4CAA0F;AAC1F,iDAAqD;AAGrD,4CAA4C;AAC5C,kDAA+C;AAE/C,0DAA0D;AAC1D,4EAA4E;AAE5E,MAAa,SAAU,SAAQ,eAAyB;IAWpD,YACqB,MAA+C,EAC/C,IAAwB;QAEzC,KAAK,CAAC,IAAA,cAAS,EAAC,oBAAqB,IAAK,iBAAkB,MAAM,EAAE,CAAC,CAAC;QAHrD,WAAM,GAAN,MAAM,CAAyC;QAC/C,SAAI,GAAJ,IAAI,CAAoB;IAG7C,CAAC;IAfD;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,MAA+C;QACrD,OAAO;YACH,MAAM,EAAE,CAAC,IAAwB,EAAE,EAAE,CAAC,IAAI,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC;SACpE,CAAC;IACN,CAAC;IASD;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,KAAuC;QAC9C,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;aACzB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAA,2BAAY,EAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,GAAkB,EAAE,EAAE,CAClE,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAChC,OAAO,KAAK,KAAK,IAAI,CAAe,8GAA8G;gBAC9I,CAAC,CAAC,KAAK;gBACP,CAAC,CAAC,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,eAAe;gBACpC,0BAA0B;gBAC1B,SAAS,YAAY,CAAC,UAAU,EAAE,aAAqB;oBACnD,kCAAkC;oBAClC,IAAI,KAAK,GAAG,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC;oBAClF,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;wBACvC,OAAO,EAAE,GAAG,KAAK,CAAC;qBACrB;oBACD,OAAO,KAAK,CAAC;gBACjB,CAAC,EACD,GAAG,CAAC,aAAa,EAAE,EACnB,IAAI,CACP,CAAC;QACV,CAAC,CAAC,CACL,CAAC,CAAC;IACX,CAAC;CACJ;AApDD,8BAoDC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Question } from '@serenity-js/core';
|
|
2
|
-
import { logging } from 'selenium-webdriver';
|
|
3
|
-
export declare class Browser {
|
|
4
|
-
/**
|
|
5
|
-
* @desc
|
|
6
|
-
* Creates a {@link Question} that reads the entries of the browser log
|
|
7
|
-
* so that they can be asserted on.
|
|
8
|
-
*
|
|
9
|
-
* Please note that in order to ensure that the automated test has access to the browser log,
|
|
10
|
-
* Protractor needs to be configured with the desired logging level, as per the example below.
|
|
11
|
-
*
|
|
12
|
-
* @example <caption>Enabling Protractor browser logging</caption>
|
|
13
|
-
* // protractor.conf.js
|
|
14
|
-
* exports.config = {
|
|
15
|
-
* capabilities: {
|
|
16
|
-
* loggingPrefs: {
|
|
17
|
-
* // available options: OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL
|
|
18
|
-
* browser: 'SEVERE'
|
|
19
|
-
* },
|
|
20
|
-
* }
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* @example <caption>Ensure the app didn't log anything to the console during the test</caption>
|
|
24
|
-
* import { Actor, BrowseTheWeb, Browser } from '@serenity-js/core';
|
|
25
|
-
* import { Ensure, property, equals } from '@serenity-js/assertions';
|
|
26
|
-
*
|
|
27
|
-
* actor.attemptsTo(
|
|
28
|
-
* Ensure.that(Browser.log(), property('length', equals(0))),
|
|
29
|
-
* );
|
|
30
|
-
*
|
|
31
|
-
* @example <caption>Mark the test as "compromised" if the server responds with a 500 to any AJAX request during the test</caption>
|
|
32
|
-
* import { Actor, BrowseTheWeb, Browser, TestCompromisedError } from '@serenity-js/core';
|
|
33
|
-
* import { Ensure, property, equals, not, contrainAtLeastOneItemThat } from '@serenity-js/assertions'
|
|
34
|
-
*
|
|
35
|
-
* actor.attemptsTo(
|
|
36
|
-
* Ensure.that(Browser.log(),
|
|
37
|
-
* not(contrainAtLeastOneItemThat(
|
|
38
|
-
* property('message', includes('the server responded with a status of 500'))
|
|
39
|
-
* ))
|
|
40
|
-
* ).otherwiseFailWith(TestCompromisedError, 'The server is down'),
|
|
41
|
-
* );
|
|
42
|
-
*
|
|
43
|
-
* @see https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#loggingpreferences-json-object
|
|
44
|
-
* @returns {Question<Promise<logging.Entry[]>>}
|
|
45
|
-
*/
|
|
46
|
-
static log(): Question<Promise<logging.Entry[]>>;
|
|
47
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Browser = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const promiseOf_1 = require("../../promiseOf");
|
|
6
|
-
const abilities_1 = require("../abilities");
|
|
7
|
-
class Browser {
|
|
8
|
-
/**
|
|
9
|
-
* @desc
|
|
10
|
-
* Creates a {@link Question} that reads the entries of the browser log
|
|
11
|
-
* so that they can be asserted on.
|
|
12
|
-
*
|
|
13
|
-
* Please note that in order to ensure that the automated test has access to the browser log,
|
|
14
|
-
* Protractor needs to be configured with the desired logging level, as per the example below.
|
|
15
|
-
*
|
|
16
|
-
* @example <caption>Enabling Protractor browser logging</caption>
|
|
17
|
-
* // protractor.conf.js
|
|
18
|
-
* exports.config = {
|
|
19
|
-
* capabilities: {
|
|
20
|
-
* loggingPrefs: {
|
|
21
|
-
* // available options: OFF, SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST, ALL
|
|
22
|
-
* browser: 'SEVERE'
|
|
23
|
-
* },
|
|
24
|
-
* }
|
|
25
|
-
* }
|
|
26
|
-
*
|
|
27
|
-
* @example <caption>Ensure the app didn't log anything to the console during the test</caption>
|
|
28
|
-
* import { Actor, BrowseTheWeb, Browser } from '@serenity-js/core';
|
|
29
|
-
* import { Ensure, property, equals } from '@serenity-js/assertions';
|
|
30
|
-
*
|
|
31
|
-
* actor.attemptsTo(
|
|
32
|
-
* Ensure.that(Browser.log(), property('length', equals(0))),
|
|
33
|
-
* );
|
|
34
|
-
*
|
|
35
|
-
* @example <caption>Mark the test as "compromised" if the server responds with a 500 to any AJAX request during the test</caption>
|
|
36
|
-
* import { Actor, BrowseTheWeb, Browser, TestCompromisedError } from '@serenity-js/core';
|
|
37
|
-
* import { Ensure, property, equals, not, contrainAtLeastOneItemThat } from '@serenity-js/assertions'
|
|
38
|
-
*
|
|
39
|
-
* actor.attemptsTo(
|
|
40
|
-
* Ensure.that(Browser.log(),
|
|
41
|
-
* not(contrainAtLeastOneItemThat(
|
|
42
|
-
* property('message', includes('the server responded with a status of 500'))
|
|
43
|
-
* ))
|
|
44
|
-
* ).otherwiseFailWith(TestCompromisedError, 'The server is down'),
|
|
45
|
-
* );
|
|
46
|
-
*
|
|
47
|
-
* @see https://github.com/SeleniumHQ/selenium/wiki/DesiredCapabilities#loggingpreferences-json-object
|
|
48
|
-
* @returns {Question<Promise<logging.Entry[]>>}
|
|
49
|
-
*/
|
|
50
|
-
static log() {
|
|
51
|
-
return core_1.Question.about(`browser log`, actor => (0, promiseOf_1.promiseOf)(abilities_1.BrowseTheWeb.as(actor).manage().logs().get('browser')));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.Browser = Browser;
|
|
55
|
-
//# sourceMappingURL=Browser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Browser.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Browser.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAG7C,+CAA4C;AAC5C,4CAA4C;AAE5C,MAAa,OAAO;IAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,MAAM,CAAC,GAAG;QACN,OAAO,eAAQ,CAAC,KAAK,CAA2B,aAAa,EAAE,KAAK,CAAC,EAAE,CACnE,IAAA,qBAAS,EAAC,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;CACJ;AAhDD,0BAgDC"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { AnswersQuestions, MetaQuestion, Question, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { ElementFinder } from 'protractor';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Resolves to an array of [CSS classes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-class)
|
|
6
|
-
* of a given {@link WebElement}, represented by {@link ElementFinder} or `Question<ElementFinder>`.
|
|
7
|
-
*
|
|
8
|
-
* @example <caption>Example widget</caption>
|
|
9
|
-
* <ul id="shopping-list" class="active favourite">
|
|
10
|
-
* <li class="bought">Coffee<li>
|
|
11
|
-
* <li class="buy">Honey<li>
|
|
12
|
-
* <li class="buy">Chocolate<li>
|
|
13
|
-
* </ul>
|
|
14
|
-
*
|
|
15
|
-
* @example <caption>Retrieve CSS classes of a given WebElement</caption>
|
|
16
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
17
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
18
|
-
* import { BrowseTheWeb, CSSClasses, Target } from '@serenity-js/protractor';
|
|
19
|
-
* import { by } from 'protractor';
|
|
20
|
-
*
|
|
21
|
-
* const shoppingList = () =>
|
|
22
|
-
* Target.the('shopping list').located(by.id('shopping-list'))
|
|
23
|
-
*
|
|
24
|
-
* actorCalled('Lisa')
|
|
25
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
26
|
-
* .attemptsTo(
|
|
27
|
-
* Ensure.that(CSSClasses.of(shoppingList()), equals([ 'active', 'favourite' ])),
|
|
28
|
-
* )
|
|
29
|
-
*
|
|
30
|
-
* @example <caption>Find WebElements with a given class</caption>
|
|
31
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
32
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
33
|
-
* import { BrowseTheWeb, CSSClasses, Target } from '@serenity-js/protractor';
|
|
34
|
-
* import { by } from 'protractor';
|
|
35
|
-
*
|
|
36
|
-
* class ShoppingList {
|
|
37
|
-
* static items = () =>
|
|
38
|
-
* Target.all('items')
|
|
39
|
-
* .located(by.css('#shopping-list li'))
|
|
40
|
-
*
|
|
41
|
-
* static outstandingItems = () =>
|
|
42
|
-
* ShoppingList.items
|
|
43
|
-
* .where(CSSClasses, contain('buy'))
|
|
44
|
-
* }
|
|
45
|
-
*
|
|
46
|
-
* actorCalled('Lisa')
|
|
47
|
-
* .whoCan(BrowseTheWeb.using(protractor.browser))
|
|
48
|
-
* .attemptsTo(
|
|
49
|
-
* Ensure.that(
|
|
50
|
-
* Text.ofAll(ShoppingList.outstandingItems()),
|
|
51
|
-
* equals([ 'Honey', 'Chocolate' ])
|
|
52
|
-
* ),
|
|
53
|
-
* )
|
|
54
|
-
*
|
|
55
|
-
* @extends {@serenity-js/core/lib/screenplay~Question}
|
|
56
|
-
* @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
57
|
-
*/
|
|
58
|
-
export declare class CSSClasses extends Question<Promise<string[]>> implements MetaQuestion<Question<ElementFinder> | ElementFinder, Promise<string[]>> {
|
|
59
|
-
private readonly target;
|
|
60
|
-
/**
|
|
61
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
62
|
-
* @returns {CSSClasses}
|
|
63
|
-
*/
|
|
64
|
-
static of(target: Question<ElementFinder> | ElementFinder): CSSClasses;
|
|
65
|
-
/**
|
|
66
|
-
* @param {Question<ElementFinder> | ElementFinder} target
|
|
67
|
-
*/
|
|
68
|
-
constructor(target: Question<ElementFinder> | ElementFinder);
|
|
69
|
-
/**
|
|
70
|
-
* @desc
|
|
71
|
-
* Resolves to an array of CSS classes of the `target` element,
|
|
72
|
-
* located in the context of a `parent` element.
|
|
73
|
-
*
|
|
74
|
-
* @param {Question<ElementFinder> | ElementFinder} parent
|
|
75
|
-
* @returns {Question<Promise<string[]>>}
|
|
76
|
-
*
|
|
77
|
-
* @see {@link Target.all}
|
|
78
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
79
|
-
*/
|
|
80
|
-
of(parent: Question<ElementFinder> | ElementFinder): Question<Promise<string[]>>;
|
|
81
|
-
/**
|
|
82
|
-
* @desc
|
|
83
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
84
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
85
|
-
*
|
|
86
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
87
|
-
* @returns {Promise<void>}
|
|
88
|
-
*
|
|
89
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
90
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
91
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
92
|
-
*/
|
|
93
|
-
answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<string[]>;
|
|
94
|
-
}
|