@serenity-js/web 3.25.0 → 3.25.1
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 +11 -0
- package/README.md +1 -1
- package/lib/errors/BrowserWindowClosedError.d.ts +2 -2
- package/lib/errors/BrowserWindowClosedError.js +2 -2
- package/lib/errors/CookieMissingError.d.ts +2 -2
- package/lib/errors/CookieMissingError.js +2 -2
- package/lib/errors/ModalDialogObstructsScreenshotError.d.ts +3 -3
- package/lib/errors/ModalDialogObstructsScreenshotError.js +3 -3
- package/lib/expectations/isActive.d.ts +8 -8
- package/lib/expectations/isActive.js +8 -8
- package/lib/expectations/isClickable.d.ts +8 -8
- package/lib/expectations/isClickable.js +8 -8
- package/lib/expectations/isEnabled.d.ts +8 -8
- package/lib/expectations/isEnabled.js +8 -8
- package/lib/expectations/isSelected.d.ts +8 -8
- package/lib/expectations/isSelected.js +8 -8
- package/lib/expectations/isVisible.d.ts +8 -8
- package/lib/expectations/isVisible.js +8 -8
- package/lib/screenplay/abilities/BrowseTheWeb.d.ts +25 -23
- package/lib/screenplay/abilities/BrowseTheWeb.d.ts.map +1 -1
- package/lib/screenplay/abilities/BrowseTheWeb.js +25 -23
- package/lib/screenplay/abilities/BrowseTheWeb.js.map +1 -1
- package/lib/screenplay/interactions/Clear.d.ts +7 -7
- package/lib/screenplay/interactions/Clear.js +7 -7
- package/lib/screenplay/interactions/Click.d.ts +5 -5
- package/lib/screenplay/interactions/Click.js +5 -5
- package/lib/screenplay/interactions/DoubleClick.d.ts +5 -5
- package/lib/screenplay/interactions/DoubleClick.js +5 -5
- package/lib/screenplay/interactions/Enter.d.ts +5 -5
- package/lib/screenplay/interactions/Enter.js +5 -5
- package/lib/screenplay/interactions/ExecuteScript.d.ts +19 -19
- package/lib/screenplay/interactions/ExecuteScript.js +18 -18
- package/lib/screenplay/interactions/Hover.d.ts +5 -5
- package/lib/screenplay/interactions/Hover.js +5 -5
- package/lib/screenplay/interactions/Navigate.d.ts +8 -8
- package/lib/screenplay/interactions/Navigate.js +8 -8
- package/lib/screenplay/interactions/PageElementInteraction.d.ts +3 -3
- package/lib/screenplay/interactions/PageElementInteraction.js +3 -3
- package/lib/screenplay/interactions/Press.d.ts +10 -10
- package/lib/screenplay/interactions/Press.js +10 -10
- package/lib/screenplay/interactions/RightClick.d.ts +5 -5
- package/lib/screenplay/interactions/RightClick.js +5 -5
- package/lib/screenplay/interactions/Scroll.d.ts +5 -5
- package/lib/screenplay/interactions/Scroll.js +5 -5
- package/lib/screenplay/interactions/Select.d.ts +22 -22
- package/lib/screenplay/interactions/Select.js +22 -22
- package/lib/screenplay/interactions/Switch.d.ts +16 -16
- package/lib/screenplay/interactions/Switch.js +16 -16
- package/lib/screenplay/interactions/TakeScreenshot.d.ts +11 -10
- package/lib/screenplay/interactions/TakeScreenshot.d.ts.map +1 -1
- package/lib/screenplay/interactions/TakeScreenshot.js +11 -10
- package/lib/screenplay/interactions/TakeScreenshot.js.map +1 -1
- package/lib/screenplay/models/BrowserCapabilities.d.ts +1 -1
- package/lib/screenplay/models/BrowsingSession.d.ts +8 -8
- package/lib/screenplay/models/BrowsingSession.js +6 -6
- package/lib/screenplay/models/Cookie.d.ts +10 -10
- package/lib/screenplay/models/Cookie.js +9 -9
- package/lib/screenplay/models/CookieData.d.ts +4 -4
- package/lib/screenplay/models/Key.d.ts +4 -4
- package/lib/screenplay/models/Key.js +4 -4
- package/lib/screenplay/models/Locator.d.ts +8 -8
- package/lib/screenplay/models/Locator.js +8 -8
- package/lib/screenplay/models/Page.d.ts +32 -32
- package/lib/screenplay/models/Page.js +14 -14
- package/lib/screenplay/models/PageElement.d.ts +13 -13
- package/lib/screenplay/models/PageElement.js +7 -7
- package/lib/screenplay/models/PageElements.d.ts +6 -6
- package/lib/screenplay/models/PageElements.js +6 -6
- package/lib/screenplay/models/RootLocator.d.ts +5 -5
- package/lib/screenplay/models/RootLocator.js +5 -5
- package/lib/screenplay/models/SelectOption.d.ts +4 -4
- package/lib/screenplay/models/SelectOption.js +4 -4
- package/lib/screenplay/models/Switchable.d.ts +6 -6
- package/lib/screenplay/models/SwitchableOrigin.d.ts +4 -4
- package/lib/screenplay/models/dialogs/AbsentModalDialog.d.ts +2 -2
- package/lib/screenplay/models/dialogs/AbsentModalDialog.js +2 -2
- package/lib/screenplay/models/dialogs/AcceptedModalDialog.d.ts +3 -3
- package/lib/screenplay/models/dialogs/AcceptedModalDialog.js +3 -3
- package/lib/screenplay/models/dialogs/DismissedModalDialog.d.ts +3 -3
- package/lib/screenplay/models/dialogs/DismissedModalDialog.js +3 -3
- package/lib/screenplay/models/dialogs/ModalDialog.d.ts +12 -9
- package/lib/screenplay/models/dialogs/ModalDialog.d.ts.map +1 -1
- package/lib/screenplay/models/dialogs/ModalDialog.js +10 -7
- package/lib/screenplay/models/dialogs/ModalDialog.js.map +1 -1
- package/lib/screenplay/models/dialogs/ModalDialogHandler.d.ts +5 -5
- package/lib/screenplay/models/dialogs/ModalDialogHandler.js +5 -5
- package/lib/screenplay/models/selectors/By.d.ts +14 -14
- package/lib/screenplay/models/selectors/By.js +14 -14
- package/lib/screenplay/models/selectors/ByCss.d.ts +2 -2
- package/lib/screenplay/models/selectors/ByCss.js +2 -2
- package/lib/screenplay/models/selectors/ByCssContainingText.d.ts +2 -2
- package/lib/screenplay/models/selectors/ByCssContainingText.js +2 -2
- package/lib/screenplay/models/selectors/ByDeepCss.d.ts +2 -2
- package/lib/screenplay/models/selectors/ByDeepCss.js +2 -2
- package/lib/screenplay/models/selectors/ById.d.ts +2 -2
- package/lib/screenplay/models/selectors/ById.js +2 -2
- package/lib/screenplay/models/selectors/ByTagName.d.ts +2 -2
- package/lib/screenplay/models/selectors/ByTagName.js +2 -2
- package/lib/screenplay/models/selectors/ByXPath.d.ts +2 -2
- package/lib/screenplay/models/selectors/ByXPath.js +2 -2
- package/lib/screenplay/models/selectors/Selector.d.ts +1 -1
- package/lib/screenplay/models/selectors/Selector.js +1 -1
- package/lib/screenplay/questions/Attribute.d.ts +13 -13
- package/lib/screenplay/questions/Attribute.js +13 -13
- package/lib/screenplay/questions/ComputedStyle.d.ts +16 -16
- package/lib/screenplay/questions/ComputedStyle.js +16 -16
- package/lib/screenplay/questions/CssClasses.d.ts +13 -13
- package/lib/screenplay/questions/CssClasses.js +13 -13
- package/lib/screenplay/questions/LastScriptExecution.d.ts +7 -7
- package/lib/screenplay/questions/LastScriptExecution.js +7 -7
- package/lib/screenplay/questions/Selected.d.ts +17 -17
- package/lib/screenplay/questions/Selected.js +17 -17
- package/lib/screenplay/questions/Text.d.ts +18 -18
- package/lib/screenplay/questions/Text.js +14 -14
- package/lib/screenplay/questions/Value.d.ts +12 -12
- package/lib/screenplay/questions/Value.js +12 -12
- package/lib/stage/crew/photographer/Photographer.d.ts +18 -17
- package/lib/stage/crew/photographer/Photographer.d.ts.map +1 -1
- package/lib/stage/crew/photographer/Photographer.js +18 -17
- package/lib/stage/crew/photographer/Photographer.js.map +1 -1
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +6 -6
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +6 -6
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +3 -3
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +3 -3
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +3 -3
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +3 -3
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +3 -3
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +3 -3
- package/package.json +4 -4
- package/src/errors/BrowserWindowClosedError.ts +2 -2
- package/src/errors/CookieMissingError.ts +2 -2
- package/src/errors/ModalDialogObstructsScreenshotError.ts +3 -3
- package/src/expectations/isActive.ts +8 -8
- package/src/expectations/isClickable.ts +8 -8
- package/src/expectations/isEnabled.ts +8 -8
- package/src/expectations/isSelected.ts +8 -8
- package/src/expectations/isVisible.ts +8 -8
- package/src/screenplay/abilities/BrowseTheWeb.ts +25 -23
- package/src/screenplay/interactions/Clear.ts +7 -7
- package/src/screenplay/interactions/Click.ts +5 -5
- package/src/screenplay/interactions/DoubleClick.ts +5 -5
- package/src/screenplay/interactions/Enter.ts +5 -5
- package/src/screenplay/interactions/ExecuteScript.ts +19 -19
- package/src/screenplay/interactions/Hover.ts +5 -5
- package/src/screenplay/interactions/Navigate.ts +8 -8
- package/src/screenplay/interactions/PageElementInteraction.ts +3 -3
- package/src/screenplay/interactions/Press.ts +10 -10
- package/src/screenplay/interactions/RightClick.ts +5 -5
- package/src/screenplay/interactions/Scroll.ts +5 -5
- package/src/screenplay/interactions/Select.ts +22 -22
- package/src/screenplay/interactions/Switch.ts +16 -16
- package/src/screenplay/interactions/TakeScreenshot.ts +11 -10
- package/src/screenplay/models/BrowserCapabilities.ts +1 -1
- package/src/screenplay/models/BrowsingSession.ts +8 -8
- package/src/screenplay/models/Cookie.ts +10 -10
- package/src/screenplay/models/CookieData.ts +4 -4
- package/src/screenplay/models/Key.ts +4 -4
- package/src/screenplay/models/Locator.ts +8 -8
- package/src/screenplay/models/Page.ts +32 -32
- package/src/screenplay/models/PageElement.ts +13 -13
- package/src/screenplay/models/PageElements.ts +6 -6
- package/src/screenplay/models/RootLocator.ts +5 -5
- package/src/screenplay/models/SelectOption.ts +4 -4
- package/src/screenplay/models/Switchable.ts +6 -6
- package/src/screenplay/models/SwitchableOrigin.ts +4 -4
- package/src/screenplay/models/dialogs/AbsentModalDialog.ts +2 -2
- package/src/screenplay/models/dialogs/AcceptedModalDialog.ts +3 -3
- package/src/screenplay/models/dialogs/DismissedModalDialog.ts +3 -3
- package/src/screenplay/models/dialogs/ModalDialog.ts +12 -9
- package/src/screenplay/models/dialogs/ModalDialogHandler.ts +5 -5
- package/src/screenplay/models/selectors/By.ts +14 -14
- package/src/screenplay/models/selectors/ByCss.ts +2 -2
- package/src/screenplay/models/selectors/ByCssContainingText.ts +2 -2
- package/src/screenplay/models/selectors/ByDeepCss.ts +2 -2
- package/src/screenplay/models/selectors/ById.ts +2 -2
- package/src/screenplay/models/selectors/ByTagName.ts +2 -2
- package/src/screenplay/models/selectors/ByXPath.ts +2 -2
- package/src/screenplay/models/selectors/Selector.ts +1 -1
- package/src/screenplay/questions/Attribute.ts +13 -13
- package/src/screenplay/questions/ComputedStyle.ts +16 -16
- package/src/screenplay/questions/CssClasses.ts +13 -13
- package/src/screenplay/questions/LastScriptExecution.ts +7 -7
- package/src/screenplay/questions/Selected.ts +17 -17
- package/src/screenplay/questions/Text.ts +18 -18
- package/src/screenplay/questions/Value.ts +12 -12
- package/src/stage/crew/photographer/Photographer.ts +18 -17
- package/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +6 -6
- package/src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts +3 -3
- package/src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts +3 -3
- package/src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts +3 -3
|
@@ -6,19 +6,19 @@ const io_1 = require("@serenity-js/core/lib/io");
|
|
|
6
6
|
const stringified_1 = require("@serenity-js/core/lib/io/stringified");
|
|
7
7
|
const models_1 = require("../models");
|
|
8
8
|
/**
|
|
9
|
-
* Instructs an
|
|
9
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
10
10
|
* to select an option from a [HTML `<select>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/select),
|
|
11
11
|
* either by its display name, or by value.
|
|
12
12
|
*
|
|
13
13
|
* ## Learn more
|
|
14
|
-
* -
|
|
14
|
+
* - [`Selected`](https://serenity-js.org/api/web/class/Selected/)
|
|
15
15
|
*
|
|
16
16
|
* @group Activities
|
|
17
17
|
*/
|
|
18
18
|
class Select {
|
|
19
19
|
/**
|
|
20
|
-
* Instantiates an
|
|
21
|
-
* that instructs the
|
|
20
|
+
* Instantiates an [interaction](https://serenity-js.org/api/core/class/Interaction/)
|
|
21
|
+
* that instructs the [actor](https://serenity-js.org/api/core/class/Actor/)
|
|
22
22
|
* to select a single [`<option>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
23
23
|
* with a given [`value`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option#attr-value).,
|
|
24
24
|
*
|
|
@@ -59,12 +59,12 @@ class Select {
|
|
|
59
59
|
* ```
|
|
60
60
|
*
|
|
61
61
|
* #### Learn more
|
|
62
|
-
* -
|
|
63
|
-
* -
|
|
62
|
+
* - [`Selected.valueOf`](https://serenity-js.org/api/web/class/Selected/#valueOf)
|
|
63
|
+
* - [`PageElement`](https://serenity-js.org/api/web/class/PageElement/)
|
|
64
64
|
*
|
|
65
65
|
* @param value
|
|
66
66
|
* A value of the [`option` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
67
|
-
* for the
|
|
67
|
+
* for the [`Actor`](https://serenity-js.org/api/core/class/Actor/) to select
|
|
68
68
|
*/
|
|
69
69
|
static value(value) {
|
|
70
70
|
return {
|
|
@@ -76,8 +76,8 @@ class Select {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
* Instantiates an
|
|
80
|
-
* that instructs the
|
|
79
|
+
* Instantiates an [interaction](https://serenity-js.org/api/core/class/Interaction/)
|
|
80
|
+
* that instructs the [actor](https://serenity-js.org/api/core/class/Actor/)
|
|
81
81
|
* to select multiple [`<option>` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
82
82
|
* identified by their [`value`s](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option#attr-value).
|
|
83
83
|
*
|
|
@@ -119,12 +119,12 @@ class Select {
|
|
|
119
119
|
*
|
|
120
120
|
* #### Learn more
|
|
121
121
|
*
|
|
122
|
-
* -
|
|
123
|
-
* -
|
|
122
|
+
* - [`Selected.valuesOf`](https://serenity-js.org/api/web/class/Selected/#valuesOf)
|
|
123
|
+
* - [`PageElement`](https://serenity-js.org/api/web/class/PageElement/)
|
|
124
124
|
*
|
|
125
125
|
* @param values
|
|
126
126
|
* Values of the [`option` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
127
|
-
* for the
|
|
127
|
+
* for the [`Actor`](https://serenity-js.org/api/core/class/Actor/) to select
|
|
128
128
|
*/
|
|
129
129
|
static values(...values) {
|
|
130
130
|
return {
|
|
@@ -137,8 +137,8 @@ class Select {
|
|
|
137
137
|
};
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
|
-
* Instantiates an
|
|
141
|
-
* that instructs the
|
|
140
|
+
* Instantiates an [interaction](https://serenity-js.org/api/core/class/Interaction/)
|
|
141
|
+
* that instructs the [actor](https://serenity-js.org/api/core/class/Actor/)
|
|
142
142
|
* to select a single [`<option>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
143
143
|
* with a given description.
|
|
144
144
|
*
|
|
@@ -182,12 +182,12 @@ class Select {
|
|
|
182
182
|
* ```
|
|
183
183
|
*
|
|
184
184
|
* #### Learn more
|
|
185
|
-
* -
|
|
186
|
-
* -
|
|
185
|
+
* - [`Selected.optionIn`](https://serenity-js.org/api/web/class/Selected/#optionIn)
|
|
186
|
+
* - [`PageElement`](https://serenity-js.org/api/web/class/PageElement/)
|
|
187
187
|
*
|
|
188
188
|
* @param value
|
|
189
189
|
* Text of the [`option` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
190
|
-
* for the
|
|
190
|
+
* for the [`Actor`](https://serenity-js.org/api/core/class/Actor/) to select
|
|
191
191
|
*/
|
|
192
192
|
static option(value) {
|
|
193
193
|
return {
|
|
@@ -199,8 +199,8 @@ class Select {
|
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
|
-
* Instantiates an
|
|
203
|
-
* that instructs the
|
|
202
|
+
* Instantiates an [interaction](https://serenity-js.org/api/core/class/Interaction/)
|
|
203
|
+
* that instructs the [actor](https://serenity-js.org/api/core/class/Actor/)
|
|
204
204
|
* to select multiple [`<option>` elements](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
205
205
|
* identified by their descriptions.
|
|
206
206
|
*
|
|
@@ -245,12 +245,12 @@ class Select {
|
|
|
245
245
|
* ```
|
|
246
246
|
*
|
|
247
247
|
* #### Learn more
|
|
248
|
-
* -
|
|
249
|
-
* -
|
|
248
|
+
* - [`Selected.optionsIn`](https://serenity-js.org/api/web/class/Selected/#optionsIn)
|
|
249
|
+
* - [`PageElement`](https://serenity-js.org/api/web/class/PageElement/)
|
|
250
250
|
*
|
|
251
251
|
* @param values
|
|
252
252
|
* Text of the [`option` elements ](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/option)
|
|
253
|
-
* for the
|
|
253
|
+
* for the [`Actor`](https://serenity-js.org/api/core/class/Actor/) to select
|
|
254
254
|
*/
|
|
255
255
|
static options(...values) {
|
|
256
256
|
return {
|
|
@@ -2,17 +2,17 @@ import type { Activity, Answerable, AnswersQuestions, UsesAbilities } from '@ser
|
|
|
2
2
|
import { Interaction, Task } from '@serenity-js/core';
|
|
3
3
|
import type { Switchable } from '../models';
|
|
4
4
|
/**
|
|
5
|
-
* Instructs an
|
|
6
|
-
* to switch the context for future activities to a
|
|
5
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
6
|
+
* to switch the context for future activities to a [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/), such as a [`Page`](https://serenity-js.org/api/web/class/Page/) or a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
7
7
|
*
|
|
8
|
-
* Please note that when the
|
|
9
|
-
* using
|
|
8
|
+
* Please note that when the [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) implementing [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/) represents an [`iframe`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe),
|
|
9
|
+
* using [`Switch`](https://serenity-js.org/api/web/class/Switch/) will result in switching the top-level browsing context to that [`iframe`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe).
|
|
10
10
|
*
|
|
11
|
-
* When the
|
|
12
|
-
* using
|
|
11
|
+
* When the [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) represents any other [HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement),
|
|
12
|
+
* using [`Switch`](https://serenity-js.org/api/web/class/Switch/) sets [`HTMLElement#focus`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus)
|
|
13
13
|
* on the specified element. Assuming it can be focused.
|
|
14
14
|
*
|
|
15
|
-
* **Note:** The focused element is the element which will receive keyboard
|
|
15
|
+
* **Note:** The focused element is the element which will receive keyboard [press](https://serenity-js.org/api/web/class/Press/) events by default.
|
|
16
16
|
*
|
|
17
17
|
* ## Perform activities in the context of an iframe
|
|
18
18
|
*
|
|
@@ -95,27 +95,27 @@ import type { Switchable } from '../models';
|
|
|
95
95
|
*
|
|
96
96
|
* ## Learn more
|
|
97
97
|
*
|
|
98
|
-
* -
|
|
99
|
-
* -
|
|
100
|
-
* -
|
|
98
|
+
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
99
|
+
* - [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/)
|
|
100
|
+
* - [`SwitchableOrigin`](https://serenity-js.org/api/web/interface/SwitchableOrigin/)
|
|
101
101
|
*
|
|
102
102
|
* @group Activities
|
|
103
103
|
*/
|
|
104
104
|
export declare class Switch extends Interaction {
|
|
105
105
|
private readonly switchable;
|
|
106
106
|
/**
|
|
107
|
-
* Instructs the
|
|
108
|
-
* to switch the context for future activities to a
|
|
109
|
-
* such as a
|
|
107
|
+
* Instructs the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
108
|
+
* to switch the context for future activities to a [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/),
|
|
109
|
+
* such as a [`Page`](https://serenity-js.org/api/web/class/Page/) or a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
110
110
|
*
|
|
111
111
|
* @param switchable
|
|
112
112
|
*/
|
|
113
113
|
static to(switchable: Answerable<Switchable>): Switch;
|
|
114
114
|
protected constructor(switchable: Answerable<Switchable>);
|
|
115
115
|
/**
|
|
116
|
-
* Instructs the
|
|
117
|
-
* to switch the context for future activities to a
|
|
118
|
-
* such as a
|
|
116
|
+
* Instructs the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
117
|
+
* to switch the context for future activities to a [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/),
|
|
118
|
+
* such as a [`Page`](https://serenity-js.org/api/web/class/Page/) or a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/),
|
|
119
119
|
* perform a sequence of `activities`, and then switch the context back.
|
|
120
120
|
*
|
|
121
121
|
* @param activities
|
|
@@ -3,17 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Switch = void 0;
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
/**
|
|
6
|
-
* Instructs an
|
|
7
|
-
* to switch the context for future activities to a
|
|
6
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/) who has the [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
7
|
+
* to switch the context for future activities to a [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/), such as a [`Page`](https://serenity-js.org/api/web/class/Page/) or a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
8
8
|
*
|
|
9
|
-
* Please note that when the
|
|
10
|
-
* using
|
|
9
|
+
* Please note that when the [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) implementing [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/) represents an [`iframe`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe),
|
|
10
|
+
* using [`Switch`](https://serenity-js.org/api/web/class/Switch/) will result in switching the top-level browsing context to that [`iframe`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe).
|
|
11
11
|
*
|
|
12
|
-
* When the
|
|
13
|
-
* using
|
|
12
|
+
* When the [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) represents any other [HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement),
|
|
13
|
+
* using [`Switch`](https://serenity-js.org/api/web/class/Switch/) sets [`HTMLElement#focus`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus)
|
|
14
14
|
* on the specified element. Assuming it can be focused.
|
|
15
15
|
*
|
|
16
|
-
* **Note:** The focused element is the element which will receive keyboard
|
|
16
|
+
* **Note:** The focused element is the element which will receive keyboard [press](https://serenity-js.org/api/web/class/Press/) events by default.
|
|
17
17
|
*
|
|
18
18
|
* ## Perform activities in the context of an iframe
|
|
19
19
|
*
|
|
@@ -96,18 +96,18 @@ const core_1 = require("@serenity-js/core");
|
|
|
96
96
|
*
|
|
97
97
|
* ## Learn more
|
|
98
98
|
*
|
|
99
|
-
* -
|
|
100
|
-
* -
|
|
101
|
-
* -
|
|
99
|
+
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
100
|
+
* - [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/)
|
|
101
|
+
* - [`SwitchableOrigin`](https://serenity-js.org/api/web/interface/SwitchableOrigin/)
|
|
102
102
|
*
|
|
103
103
|
* @group Activities
|
|
104
104
|
*/
|
|
105
105
|
class Switch extends core_1.Interaction {
|
|
106
106
|
switchable;
|
|
107
107
|
/**
|
|
108
|
-
* Instructs the
|
|
109
|
-
* to switch the context for future activities to a
|
|
110
|
-
* such as a
|
|
108
|
+
* Instructs the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
109
|
+
* to switch the context for future activities to a [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/),
|
|
110
|
+
* such as a [`Page`](https://serenity-js.org/api/web/class/Page/) or a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
111
111
|
*
|
|
112
112
|
* @param switchable
|
|
113
113
|
*/
|
|
@@ -119,9 +119,9 @@ class Switch extends core_1.Interaction {
|
|
|
119
119
|
this.switchable = switchable;
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
|
-
* Instructs the
|
|
123
|
-
* to switch the context for future activities to a
|
|
124
|
-
* such as a
|
|
122
|
+
* Instructs the [`Actor`](https://serenity-js.org/api/core/class/Actor/)
|
|
123
|
+
* to switch the context for future activities to a [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/),
|
|
124
|
+
* such as a [`Page`](https://serenity-js.org/api/web/class/Page/) or a [`PageElement`](https://serenity-js.org/api/web/class/PageElement/),
|
|
125
125
|
* perform a sequence of `activities`, and then switch the context back.
|
|
126
126
|
*
|
|
127
127
|
* @param activities
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { Answerable, AnswersQuestions, CollectsArtifacts, UsesAbilities } from '@serenity-js/core';
|
|
2
2
|
import { Interaction } from '@serenity-js/core';
|
|
3
3
|
/**
|
|
4
|
-
* Instructs an
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/)
|
|
5
|
+
* who has the [ability](https://serenity-js.org/api/core/class/Ability/)
|
|
6
|
+
* to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
7
|
+
* to take a screenshot and emit an artifact,
|
|
8
|
+
* which can then be persisted by [`ArtifactArchiver`](https://serenity-js.org/api/core/class/ArtifactArchiver/)
|
|
9
|
+
* and reported by [Serenity BDD reporter](https://serenity-js.org/api/serenity-bdd).
|
|
8
10
|
*
|
|
9
11
|
* #### Taking a screenshot
|
|
10
12
|
*
|
|
@@ -21,20 +23,19 @@ import { Interaction } from '@serenity-js/core';
|
|
|
21
23
|
*
|
|
22
24
|
* ## Learn more
|
|
23
25
|
*
|
|
24
|
-
* -
|
|
25
|
-
* -
|
|
26
|
-
* -
|
|
27
|
-
* - {@apilink ArtifactArchiver}
|
|
26
|
+
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
27
|
+
* - [`CollectsArtifacts`](https://serenity-js.org/api/core/interface/CollectsArtifacts/)
|
|
28
|
+
* - [`ArtifactArchiver`](https://serenity-js.org/api/core/class/ArtifactArchiver/)
|
|
28
29
|
*
|
|
29
30
|
* @group Activities
|
|
30
31
|
*/
|
|
31
32
|
export declare class TakeScreenshot extends Interaction {
|
|
32
33
|
private readonly name;
|
|
33
34
|
/**
|
|
34
|
-
* Instantiates this
|
|
35
|
+
* Instantiates this [`Interaction`](https://serenity-js.org/api/core/class/Interaction/).
|
|
35
36
|
*
|
|
36
37
|
* @param name
|
|
37
|
-
* The name to give the emitted
|
|
38
|
+
* The name to give the emitted artifact
|
|
38
39
|
*/
|
|
39
40
|
static of(name: Answerable<string>): Interaction;
|
|
40
41
|
protected constructor(name: Answerable<string>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TakeScreenshot.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/TakeScreenshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACxG,OAAO,EAAE,WAAW,EAAO,MAAM,mBAAmB,CAAC;AAKrD
|
|
1
|
+
{"version":3,"file":"TakeScreenshot.d.ts","sourceRoot":"","sources":["../../../src/screenplay/interactions/TakeScreenshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACxG,OAAO,EAAE,WAAW,EAAO,MAAM,mBAAmB,CAAC;AAKrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,cAAe,SAAQ,WAAW;IAYrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAV3C;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,WAAW;IAIhD,SAAS,aAA8B,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;IAI/D;;OAEG;IACG,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAU9F"}
|
|
@@ -5,10 +5,12 @@ const core_1 = require("@serenity-js/core");
|
|
|
5
5
|
const model_1 = require("@serenity-js/core/lib/model");
|
|
6
6
|
const abilities_1 = require("../abilities");
|
|
7
7
|
/**
|
|
8
|
-
* Instructs an
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Instructs an [actor](https://serenity-js.org/api/core/class/Actor/)
|
|
9
|
+
* who has the [ability](https://serenity-js.org/api/core/class/Ability/)
|
|
10
|
+
* to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
11
|
+
* to take a screenshot and emit an artifact,
|
|
12
|
+
* which can then be persisted by [`ArtifactArchiver`](https://serenity-js.org/api/core/class/ArtifactArchiver/)
|
|
13
|
+
* and reported by [Serenity BDD reporter](https://serenity-js.org/api/serenity-bdd).
|
|
12
14
|
*
|
|
13
15
|
* #### Taking a screenshot
|
|
14
16
|
*
|
|
@@ -25,20 +27,19 @@ const abilities_1 = require("../abilities");
|
|
|
25
27
|
*
|
|
26
28
|
* ## Learn more
|
|
27
29
|
*
|
|
28
|
-
* -
|
|
29
|
-
* -
|
|
30
|
-
* -
|
|
31
|
-
* - {@apilink ArtifactArchiver}
|
|
30
|
+
* - [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/)
|
|
31
|
+
* - [`CollectsArtifacts`](https://serenity-js.org/api/core/interface/CollectsArtifacts/)
|
|
32
|
+
* - [`ArtifactArchiver`](https://serenity-js.org/api/core/class/ArtifactArchiver/)
|
|
32
33
|
*
|
|
33
34
|
* @group Activities
|
|
34
35
|
*/
|
|
35
36
|
class TakeScreenshot extends core_1.Interaction {
|
|
36
37
|
name;
|
|
37
38
|
/**
|
|
38
|
-
* Instantiates this
|
|
39
|
+
* Instantiates this [`Interaction`](https://serenity-js.org/api/core/class/Interaction/).
|
|
39
40
|
*
|
|
40
41
|
* @param name
|
|
41
|
-
* The name to give the emitted
|
|
42
|
+
* The name to give the emitted artifact
|
|
42
43
|
*/
|
|
43
44
|
static of(name) {
|
|
44
45
|
return new TakeScreenshot(name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TakeScreenshot.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/TakeScreenshot.ts"],"names":[],"mappings":";;;AACA,4CAAqD;AACrD,uDAA0D;AAE1D,4CAA4C;AAE5C
|
|
1
|
+
{"version":3,"file":"TakeScreenshot.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/TakeScreenshot.ts"],"names":[],"mappings":";;;AACA,4CAAqD;AACrD,uDAA0D;AAE1D,4CAA4C;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAa,cAAe,SAAQ,kBAAW;IAYJ;IAVvC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,CAAC,IAAwB;QAC9B,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,YAAuC,IAAwB;QAC3D,KAAK,CAAC,IAAA,UAAG,EAAA,gCAAiC,IAAK,EAAE,CAAC,CAAC;QADhB,SAAI,GAAJ,IAAI,CAAoB;IAE/D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,KAA2D;QACvE,MAAM,IAAI,GAAY,MAAM,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QACjE,MAAM,UAAU,GAAM,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAClD,MAAM,IAAI,GAAY,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEpD,KAAK,CAAC,OAAO,CACT,aAAK,CAAC,UAAU,CAAC,UAAU,CAAC,EAC5B,IAAI,YAAI,CAAC,IAAI,CAAC,CACjB,CAAC;IACN,CAAC;CACJ;AA7BD,wCA6BC"}
|
|
@@ -14,41 +14,41 @@ export declare abstract class BrowsingSession<Page_Type extends Page> {
|
|
|
14
14
|
protected readonly pages: Map<CorrelationId, Page_Type>;
|
|
15
15
|
closePagesOtherThan(pageOfInterest: Page_Type): Promise<void>;
|
|
16
16
|
/**
|
|
17
|
-
* Opens a new browser page and associates it with a
|
|
17
|
+
* Opens a new browser page and associates it with a [`Page`](https://serenity-js.org/api/web/class/Page/) object.
|
|
18
18
|
*/
|
|
19
19
|
protected abstract registerCurrentPage(): Promise<Page_Type>;
|
|
20
20
|
/**
|
|
21
|
-
* Returns
|
|
21
|
+
* Returns [basic meta-data](https://serenity-js.org/api/web/interface/BrowserCapabilities/) about the browser associated with this browsing session.
|
|
22
22
|
*/
|
|
23
23
|
abstract browserCapabilities(): Promise<BrowserCapabilities>;
|
|
24
24
|
/**
|
|
25
|
-
* Returns a
|
|
25
|
+
* Returns a [`Page`](https://serenity-js.org/api/web/class/Page/) representing the currently active top-level browsing context.
|
|
26
26
|
*/
|
|
27
27
|
currentPage(): Promise<Page_Type>;
|
|
28
28
|
/**
|
|
29
|
-
* Registers specified
|
|
29
|
+
* Registers specified [pages](https://serenity-js.org/api/web/class/Page/) to be managed by this [`BrowsingSession`](https://serenity-js.org/api/web/class/BrowsingSession/).
|
|
30
30
|
*
|
|
31
31
|
* @param pages
|
|
32
32
|
*/
|
|
33
33
|
register(...pages: Page_Type[]): void;
|
|
34
34
|
/**
|
|
35
|
-
* Informs this
|
|
35
|
+
* Informs this [`BrowsingSession`](https://serenity-js.org/api/web/class/BrowsingSession/) that it should no longer manage [pages](https://serenity-js.org/api/web/class/Page/)
|
|
36
36
|
* identified by the given `pageIds`.
|
|
37
37
|
*
|
|
38
38
|
* @param pageIds
|
|
39
39
|
*/
|
|
40
40
|
deregister(...pageIds: CorrelationId[]): void;
|
|
41
41
|
/**
|
|
42
|
-
* Returns a
|
|
42
|
+
* Returns a [pages](https://serenity-js.org/api/web/class/Page/) representing all the available
|
|
43
43
|
* top-level browsing context, e.g. all the open browser tabs.
|
|
44
44
|
*/
|
|
45
45
|
allPages(): Promise<Array<Page_Type>>;
|
|
46
46
|
/**
|
|
47
|
-
* Returns the ids of any
|
|
47
|
+
* Returns the ids of any [pages](https://serenity-js.org/api/web/class/Page/) this [`BrowsingSession`](https://serenity-js.org/api/web/class/BrowsingSession/) is aware of.
|
|
48
48
|
*/
|
|
49
49
|
registeredPageIds(): Array<CorrelationId>;
|
|
50
50
|
/**
|
|
51
|
-
* Informs the
|
|
51
|
+
* Informs the [`BrowsingSession`](https://serenity-js.org/api/web/class/BrowsingSession/) that the "current page" has changed to `page`.
|
|
52
52
|
*
|
|
53
53
|
* Please note that different Web integration tools have a different definition of what a "current page" is.
|
|
54
54
|
* For example, Selenium or WebdriverIO use a single "focused" window that a developer
|
|
@@ -22,7 +22,7 @@ class BrowsingSession {
|
|
|
22
22
|
await this.changeCurrentPageTo(pageOfInterest);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Returns a
|
|
25
|
+
* Returns a [`Page`](https://serenity-js.org/api/web/class/Page/) representing the currently active top-level browsing context.
|
|
26
26
|
*/
|
|
27
27
|
async currentPage() {
|
|
28
28
|
if (!this.currentBrowserPage || !await this.currentBrowserPage.isPresent()) {
|
|
@@ -31,7 +31,7 @@ class BrowsingSession {
|
|
|
31
31
|
return this.currentBrowserPage;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Registers specified
|
|
34
|
+
* Registers specified [pages](https://serenity-js.org/api/web/class/Page/) to be managed by this [`BrowsingSession`](https://serenity-js.org/api/web/class/BrowsingSession/).
|
|
35
35
|
*
|
|
36
36
|
* @param pages
|
|
37
37
|
*/
|
|
@@ -41,7 +41,7 @@ class BrowsingSession {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
|
-
* Informs this
|
|
44
|
+
* Informs this [`BrowsingSession`](https://serenity-js.org/api/web/class/BrowsingSession/) that it should no longer manage [pages](https://serenity-js.org/api/web/class/Page/)
|
|
45
45
|
* identified by the given `pageIds`.
|
|
46
46
|
*
|
|
47
47
|
* @param pageIds
|
|
@@ -52,20 +52,20 @@ class BrowsingSession {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* Returns a
|
|
55
|
+
* Returns a [pages](https://serenity-js.org/api/web/class/Page/) representing all the available
|
|
56
56
|
* top-level browsing context, e.g. all the open browser tabs.
|
|
57
57
|
*/
|
|
58
58
|
async allPages() {
|
|
59
59
|
return Array.from(this.pages.values());
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* Returns the ids of any
|
|
62
|
+
* Returns the ids of any [pages](https://serenity-js.org/api/web/class/Page/) this [`BrowsingSession`](https://serenity-js.org/api/web/class/BrowsingSession/) is aware of.
|
|
63
63
|
*/
|
|
64
64
|
registeredPageIds() {
|
|
65
65
|
return Array.from(this.pages.keys());
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
* Informs the
|
|
68
|
+
* Informs the [`BrowsingSession`](https://serenity-js.org/api/web/class/BrowsingSession/) that the "current page" has changed to `page`.
|
|
69
69
|
*
|
|
70
70
|
* Please note that different Web integration tools have a different definition of what a "current page" is.
|
|
71
71
|
* For example, Selenium or WebdriverIO use a single "focused" window that a developer
|
|
@@ -2,7 +2,7 @@ import type { Answerable, Optional, QuestionAdapter, WithAnswerableProperties }
|
|
|
2
2
|
import { Interaction, Timestamp } from '@serenity-js/core';
|
|
3
3
|
import type { CookieData } from './CookieData';
|
|
4
4
|
/**
|
|
5
|
-
* A Screenplay Pattern-style model responsible for managing cookies available to the current
|
|
5
|
+
* A Screenplay Pattern-style model responsible for managing cookies available to the current [`Page`](https://serenity-js.org/api/web/class/Page/).
|
|
6
6
|
*
|
|
7
7
|
* ## Checking if a cookie exists
|
|
8
8
|
*
|
|
@@ -63,21 +63,21 @@ import type { CookieData } from './CookieData';
|
|
|
63
63
|
* ```
|
|
64
64
|
*
|
|
65
65
|
* ## Learn more
|
|
66
|
-
* -
|
|
67
|
-
* -
|
|
66
|
+
* - [`CookieData`](https://serenity-js.org/api/web/interface/CookieData/)
|
|
67
|
+
* - [`Page.cookie`](https://serenity-js.org/api/web/class/Page/#cookie)
|
|
68
68
|
*
|
|
69
69
|
* @group Models
|
|
70
70
|
*/
|
|
71
71
|
export declare abstract class Cookie implements Optional {
|
|
72
72
|
protected readonly cookieName: string;
|
|
73
73
|
/**
|
|
74
|
-
* Creates a
|
|
74
|
+
* Creates a [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) that resolves to [`Cookie`](https://serenity-js.org/api/web/class/Cookie/) identified by `name`.
|
|
75
75
|
*
|
|
76
76
|
* @param name
|
|
77
77
|
*/
|
|
78
78
|
static called(name: Answerable<string>): QuestionAdapter<Cookie>;
|
|
79
79
|
/**
|
|
80
|
-
* Sets a cookie for the current
|
|
80
|
+
* Sets a cookie for the current [`Page`](https://serenity-js.org/api/web/class/Page/). Note that [`CookieData`](https://serenity-js.org/api/web/interface/CookieData/) can be either a plain-old JavaScript object, or an [`Answerable`](https://serenity-js.org/api/core/#Answerable) [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties).
|
|
81
81
|
*
|
|
82
82
|
* :::info
|
|
83
83
|
* Make sure that the actor performing this interaction is on the page that should receive the cookie.
|
|
@@ -88,7 +88,7 @@ export declare abstract class Cookie implements Optional {
|
|
|
88
88
|
*/
|
|
89
89
|
static set(cookieData: Answerable<WithAnswerableProperties<CookieData>>): Interaction;
|
|
90
90
|
/**
|
|
91
|
-
* Creates an
|
|
91
|
+
* Creates an [interaction](https://serenity-js.org/api/core/class/Interaction/) to delete all cookies available to the current [`Page`](https://serenity-js.org/api/web/class/Page/)..
|
|
92
92
|
*/
|
|
93
93
|
static deleteAll(): Interaction;
|
|
94
94
|
private cookie;
|
|
@@ -101,7 +101,7 @@ export declare abstract class Cookie implements Optional {
|
|
|
101
101
|
* Checks if a given cookie is set.
|
|
102
102
|
*
|
|
103
103
|
* #### Learn more
|
|
104
|
-
* -
|
|
104
|
+
* - [`Optional`](https://serenity-js.org/api/core/interface/Optional/)
|
|
105
105
|
*/
|
|
106
106
|
isPresent(): Promise<boolean>;
|
|
107
107
|
/**
|
|
@@ -134,7 +134,7 @@ export declare abstract class Cookie implements Optional {
|
|
|
134
134
|
* Returns the expiry date of a given cookie
|
|
135
135
|
*
|
|
136
136
|
* #### Learn more
|
|
137
|
-
* -
|
|
137
|
+
* - [`Timestamp`](https://serenity-js.org/api/core/class/Timestamp/)
|
|
138
138
|
*/
|
|
139
139
|
expiry(): Promise<Timestamp>;
|
|
140
140
|
/**
|
|
@@ -147,11 +147,11 @@ export declare abstract class Cookie implements Optional {
|
|
|
147
147
|
* This method is to be implemented by test integration tool-specific adapters.
|
|
148
148
|
*
|
|
149
149
|
* **Please note**: you don't need to implement any response caching here
|
|
150
|
-
* since it is covered by
|
|
150
|
+
* since it is covered by [`Cookie`](https://serenity-js.org/api/web/class/Cookie/).lazyLoadCookie} method.
|
|
151
151
|
*/
|
|
152
152
|
protected abstract read(): Promise<CookieData>;
|
|
153
153
|
/**
|
|
154
|
-
* Invokes
|
|
154
|
+
* Invokes `Cookie.read` and caches the result in memory.
|
|
155
155
|
*/
|
|
156
156
|
private lazyLoadCookie;
|
|
157
157
|
}
|
|
@@ -6,7 +6,7 @@ const tiny_types_1 = require("tiny-types");
|
|
|
6
6
|
const errors_1 = require("../../errors");
|
|
7
7
|
const abilities_1 = require("../abilities");
|
|
8
8
|
/**
|
|
9
|
-
* A Screenplay Pattern-style model responsible for managing cookies available to the current
|
|
9
|
+
* A Screenplay Pattern-style model responsible for managing cookies available to the current [`Page`](https://serenity-js.org/api/web/class/Page/).
|
|
10
10
|
*
|
|
11
11
|
* ## Checking if a cookie exists
|
|
12
12
|
*
|
|
@@ -67,15 +67,15 @@ const abilities_1 = require("../abilities");
|
|
|
67
67
|
* ```
|
|
68
68
|
*
|
|
69
69
|
* ## Learn more
|
|
70
|
-
* -
|
|
71
|
-
* -
|
|
70
|
+
* - [`CookieData`](https://serenity-js.org/api/web/interface/CookieData/)
|
|
71
|
+
* - [`Page.cookie`](https://serenity-js.org/api/web/class/Page/#cookie)
|
|
72
72
|
*
|
|
73
73
|
* @group Models
|
|
74
74
|
*/
|
|
75
75
|
class Cookie {
|
|
76
76
|
cookieName;
|
|
77
77
|
/**
|
|
78
|
-
* Creates a
|
|
78
|
+
* Creates a [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) that resolves to [`Cookie`](https://serenity-js.org/api/web/class/Cookie/) identified by `name`.
|
|
79
79
|
*
|
|
80
80
|
* @param name
|
|
81
81
|
*/
|
|
@@ -87,7 +87,7 @@ class Cookie {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
|
-
* Sets a cookie for the current
|
|
90
|
+
* Sets a cookie for the current [`Page`](https://serenity-js.org/api/web/class/Page/). Note that [`CookieData`](https://serenity-js.org/api/web/interface/CookieData/) can be either a plain-old JavaScript object, or an [`Answerable`](https://serenity-js.org/api/core/#Answerable) [`WithAnswerableProperties`](https://serenity-js.org/api/core/#WithAnswerableProperties).
|
|
91
91
|
*
|
|
92
92
|
* :::info
|
|
93
93
|
* Make sure that the actor performing this interaction is on the page that should receive the cookie.
|
|
@@ -114,7 +114,7 @@ class Cookie {
|
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
|
-
* Creates an
|
|
117
|
+
* Creates an [interaction](https://serenity-js.org/api/core/class/Interaction/) to delete all cookies available to the current [`Page`](https://serenity-js.org/api/web/class/Page/)..
|
|
118
118
|
*/
|
|
119
119
|
static deleteAll() {
|
|
120
120
|
return core_1.Interaction.where(`#actor deletes all cookies`, async (actor) => {
|
|
@@ -137,7 +137,7 @@ class Cookie {
|
|
|
137
137
|
* Checks if a given cookie is set.
|
|
138
138
|
*
|
|
139
139
|
* #### Learn more
|
|
140
|
-
* -
|
|
140
|
+
* - [`Optional`](https://serenity-js.org/api/core/interface/Optional/)
|
|
141
141
|
*/
|
|
142
142
|
async isPresent() {
|
|
143
143
|
try {
|
|
@@ -196,14 +196,14 @@ class Cookie {
|
|
|
196
196
|
* Returns the expiry date of a given cookie
|
|
197
197
|
*
|
|
198
198
|
* #### Learn more
|
|
199
|
-
* -
|
|
199
|
+
* - [`Timestamp`](https://serenity-js.org/api/core/class/Timestamp/)
|
|
200
200
|
*/
|
|
201
201
|
async expiry() {
|
|
202
202
|
const cookie = await this.lazyLoadCookie();
|
|
203
203
|
return cookie.expiry;
|
|
204
204
|
}
|
|
205
205
|
/**
|
|
206
|
-
* Invokes
|
|
206
|
+
* Invokes `Cookie.read` and caches the result in memory.
|
|
207
207
|
*/
|
|
208
208
|
async lazyLoadCookie() {
|
|
209
209
|
if (!this.cookie) {
|