@serenity-js/web 3.24.1 → 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 +27 -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 +56 -13
- package/lib/screenplay/models/PageElement.d.ts.map +1 -1
- package/lib/screenplay/models/PageElement.js +36 -6
- package/lib/screenplay/models/PageElement.js.map +1 -1
- 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 +5 -5
- 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 +66 -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
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { Answerable, MetaQuestionAdapter, Optional } from '@serenity-js/core';
|
|
1
|
+
import type { Answerable, MetaQuestion, MetaQuestionAdapter, Optional, QuestionAdapter } from '@serenity-js/core';
|
|
2
2
|
import type { Locator } from './Locator';
|
|
3
3
|
import type { SelectOption } from './SelectOption';
|
|
4
4
|
import type { Selector } from './selectors';
|
|
5
5
|
import type { Switchable } from './Switchable';
|
|
6
6
|
import type { SwitchableOrigin } from './SwitchableOrigin';
|
|
7
7
|
/**
|
|
8
|
-
* Uses the
|
|
9
|
-
* a single Web element located by
|
|
8
|
+
* Uses the [actor's](https://serenity-js.org/api/core/class/Actor/) [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/) to identify
|
|
9
|
+
* a single Web element located by [`Selector`](https://serenity-js.org/api/web/class/Selector/).
|
|
10
10
|
*
|
|
11
11
|
* ## Learn more
|
|
12
|
-
* - [Page Element Query Language](/handbook/web-testing/page-element-query-language)
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
12
|
+
* - [Page Element Query Language](https://serenity-js.org/handbook/web-testing/page-element-query-language)
|
|
13
|
+
* - [`Optional`](https://serenity-js.org/api/core/interface/Optional/)
|
|
14
|
+
* - [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/)
|
|
15
15
|
*
|
|
16
16
|
* @group Models
|
|
17
17
|
*/
|
|
@@ -20,6 +20,29 @@ export declare abstract class PageElement<Native_Element_Type = any> implements
|
|
|
20
20
|
static from<NET>(nativeElement: NET): MetaQuestionAdapter<PageElement<NET>, PageElement<NET>>;
|
|
21
21
|
static located<NET>(selector: Answerable<Selector>): MetaQuestionAdapter<PageElement<NET>, PageElement<NET>>;
|
|
22
22
|
static of<NET>(childElement: MetaQuestionAdapter<PageElement<NET>, PageElement<NET>> | PageElement<NET>, parentElement: Answerable<PageElement<NET>>): MetaQuestionAdapter<PageElement<NET>, PageElement<NET>>;
|
|
23
|
+
/**
|
|
24
|
+
* A static method producing a [`MetaQuestion`](https://serenity-js.org/api/core/interface/MetaQuestion/) that can be used with [`PageElements.eachMappedTo`](https://serenity-js.org/api/web/class/PageElements/#eachMappedTo) method
|
|
25
|
+
* to extract the HTML of each element in a collection.
|
|
26
|
+
*
|
|
27
|
+
* #### Example
|
|
28
|
+
*
|
|
29
|
+
* ```typescript
|
|
30
|
+
* import { actorCalled, Log } from '@serenity-js/core'
|
|
31
|
+
* import { Navigate, PageElement, By, Text } from '@serenity-js/web'
|
|
32
|
+
* import { includes } from '@serenity-js/assertions'
|
|
33
|
+
*
|
|
34
|
+
* await actorCalled('Debbie').attemptsTo(
|
|
35
|
+
* Navigate.to('https://serenity-js.org'),
|
|
36
|
+
*
|
|
37
|
+
* Log.the(
|
|
38
|
+
* PageElements.located(By.css('a'))
|
|
39
|
+
* .where(Text, includes('modular'))
|
|
40
|
+
* .eachMappedTo(PageElement.html())
|
|
41
|
+
* ),
|
|
42
|
+
* )
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
static html<NET>(): MetaQuestion<PageElement<NET>, QuestionAdapter<string>>;
|
|
23
46
|
constructor(locator: Locator<Native_Element_Type>);
|
|
24
47
|
/**
|
|
25
48
|
* Locates a child element that:
|
|
@@ -31,7 +54,7 @@ export declare abstract class PageElement<Native_Element_Type = any> implements
|
|
|
31
54
|
abstract of(parentElement: PageElement<Native_Element_Type>): PageElement<Native_Element_Type>;
|
|
32
55
|
/**
|
|
33
56
|
* Traverses the element and its parents, heading toward the document root,
|
|
34
|
-
* until it finds a parent
|
|
57
|
+
* until it finds a parent [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) that matches its associated CSS selector.
|
|
35
58
|
*
|
|
36
59
|
* #### Example
|
|
37
60
|
*
|
|
@@ -66,9 +89,9 @@ export declare abstract class PageElement<Native_Element_Type = any> implements
|
|
|
66
89
|
* :::info
|
|
67
90
|
* This method relies on [Element: closest() API](https://developer.mozilla.org/en-US/docs/Web/API/Element/closest),
|
|
68
91
|
* and so is only compatible with locating parent elements specified using the following CSS selectors:
|
|
69
|
-
* -
|
|
70
|
-
* -
|
|
71
|
-
* -
|
|
92
|
+
* - [`ByCss`](https://serenity-js.org/api/web/class/ByCss/)
|
|
93
|
+
* - [`ById`](https://serenity-js.org/api/web/class/ById/)
|
|
94
|
+
* - [`ByTagName`](https://serenity-js.org/api/web/class/ByTagName/)
|
|
72
95
|
* :::
|
|
73
96
|
*
|
|
74
97
|
* @param childElement
|
|
@@ -95,6 +118,26 @@ export declare abstract class PageElement<Native_Element_Type = any> implements
|
|
|
95
118
|
abstract attribute(name: string): Promise<string>;
|
|
96
119
|
abstract text(): Promise<string>;
|
|
97
120
|
abstract value(): Promise<string>;
|
|
121
|
+
/**
|
|
122
|
+
* An instance method that resolves to the value of the [`outerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML) property
|
|
123
|
+
* of the underlying element.
|
|
124
|
+
*
|
|
125
|
+
* #### Example
|
|
126
|
+
*
|
|
127
|
+
* ```typescript
|
|
128
|
+
* import { actorCalled, Log } from '@serenity-js/core'
|
|
129
|
+
* import { Navigate, PageElement, By } from '@serenity-js/web'
|
|
130
|
+
*
|
|
131
|
+
* await actorCalled('Debbie').attemptsTo(
|
|
132
|
+
* Navigate.to('https://serenity-js.org'),
|
|
133
|
+
*
|
|
134
|
+
* Log.the(
|
|
135
|
+
* PageElement.located(By.css('h1')).html()
|
|
136
|
+
* ),
|
|
137
|
+
* )
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
abstract html(): Promise<string>;
|
|
98
141
|
/**
|
|
99
142
|
* When the element represents an [`iframe`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe),
|
|
100
143
|
* calling this method switches the current browsing context to the given `iframe` context.
|
|
@@ -107,8 +150,8 @@ export declare abstract class PageElement<Native_Element_Type = any> implements
|
|
|
107
150
|
* to the previous context if needed.
|
|
108
151
|
*
|
|
109
152
|
* #### Learn more
|
|
110
|
-
* -
|
|
111
|
-
* -
|
|
153
|
+
* - [`Switch`](https://serenity-js.org/api/web/class/Switch/)
|
|
154
|
+
* - [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/)
|
|
112
155
|
*/
|
|
113
156
|
abstract switchTo(): Promise<SwitchableOrigin>;
|
|
114
157
|
/**
|
|
@@ -131,7 +174,7 @@ export declare abstract class PageElement<Native_Element_Type = any> implements
|
|
|
131
174
|
*/
|
|
132
175
|
abstract isEnabled(): Promise<boolean>;
|
|
133
176
|
/**
|
|
134
|
-
* Returns a
|
|
177
|
+
* Returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that resolves to `true` when the element
|
|
135
178
|
* is present in the [Document Object Model (DOM)](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model),
|
|
136
179
|
* `false` otherwise.
|
|
137
180
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageElement.d.ts","sourceRoot":"","sources":["../../../src/screenplay/models/PageElement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,mBAAmB,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"PageElement.d.ts","sourceRoot":"","sources":["../../../src/screenplay/models/PageElement.ts"],"names":[],"mappings":"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"}
|
|
@@ -5,13 +5,13 @@ const core_1 = require("@serenity-js/core");
|
|
|
5
5
|
const tiny_types_1 = require("tiny-types");
|
|
6
6
|
const abilities_1 = require("../abilities");
|
|
7
7
|
/**
|
|
8
|
-
* Uses the
|
|
9
|
-
* a single Web element located by
|
|
8
|
+
* Uses the [actor's](https://serenity-js.org/api/core/class/Actor/) [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/) to identify
|
|
9
|
+
* a single Web element located by [`Selector`](https://serenity-js.org/api/web/class/Selector/).
|
|
10
10
|
*
|
|
11
11
|
* ## Learn more
|
|
12
|
-
* - [Page Element Query Language](/handbook/web-testing/page-element-query-language)
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
12
|
+
* - [Page Element Query Language](https://serenity-js.org/handbook/web-testing/page-element-query-language)
|
|
13
|
+
* - [`Optional`](https://serenity-js.org/api/core/interface/Optional/)
|
|
14
|
+
* - [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/)
|
|
15
15
|
*
|
|
16
16
|
* @group Models
|
|
17
17
|
*/
|
|
@@ -37,6 +37,36 @@ class PageElement {
|
|
|
37
37
|
return actor.answer(child);
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* A static method producing a [`MetaQuestion`](https://serenity-js.org/api/core/interface/MetaQuestion/) that can be used with [`PageElements.eachMappedTo`](https://serenity-js.org/api/web/class/PageElements/#eachMappedTo) method
|
|
42
|
+
* to extract the HTML of each element in a collection.
|
|
43
|
+
*
|
|
44
|
+
* #### Example
|
|
45
|
+
*
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { actorCalled, Log } from '@serenity-js/core'
|
|
48
|
+
* import { Navigate, PageElement, By, Text } from '@serenity-js/web'
|
|
49
|
+
* import { includes } from '@serenity-js/assertions'
|
|
50
|
+
*
|
|
51
|
+
* await actorCalled('Debbie').attemptsTo(
|
|
52
|
+
* Navigate.to('https://serenity-js.org'),
|
|
53
|
+
*
|
|
54
|
+
* Log.the(
|
|
55
|
+
* PageElements.located(By.css('a'))
|
|
56
|
+
* .where(Text, includes('modular'))
|
|
57
|
+
* .eachMappedTo(PageElement.html())
|
|
58
|
+
* ),
|
|
59
|
+
* )
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
static html() {
|
|
63
|
+
return {
|
|
64
|
+
of: (pageElement) => core_1.Question.about(`outer HTML of ${pageElement}`, async (actor) => {
|
|
65
|
+
const element = await actor.answer(pageElement);
|
|
66
|
+
return element.html();
|
|
67
|
+
})
|
|
68
|
+
};
|
|
69
|
+
}
|
|
40
70
|
constructor(locator) {
|
|
41
71
|
this.locator = locator;
|
|
42
72
|
(0, tiny_types_1.ensure)('native element locator', locator, (0, tiny_types_1.isDefined)());
|
|
@@ -51,7 +81,7 @@ class PageElement {
|
|
|
51
81
|
return `PageElement located ${this.locator.toString()}`;
|
|
52
82
|
}
|
|
53
83
|
/**
|
|
54
|
-
* Returns a
|
|
84
|
+
* Returns a [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that resolves to `true` when the element
|
|
55
85
|
* is present in the [Document Object Model (DOM)](https://developer.mozilla.org/en-US/docs/Web/API/Document_Object_Model),
|
|
56
86
|
* `false` otherwise.
|
|
57
87
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageElement.js","sourceRoot":"","sources":["../../../src/screenplay/models/PageElement.ts"],"names":[],"mappings":";;;AACA,4CAAkD;AAClD,2CAA+C;AAE/C,4CAA4C;AAO5C;;;;;;;;;;GAUG;AACH,MAAsB,WAAW;IA+
|
|
1
|
+
{"version":3,"file":"PageElement.js","sourceRoot":"","sources":["../../../src/screenplay/models/PageElement.ts"],"names":[],"mappings":";;;AACA,4CAAkD;AAClD,2CAA+C;AAE/C,4CAA4C;AAO5C;;;;;;;;;;GAUG;AACH,MAAsB,WAAW;IA+DD;IA7D5B,MAAM,CAAC,IAAI,CAAM,aAAkB;QAC/B,OAAO,eAAQ,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YACvD,MAAM,WAAW,GAAG,MAAM,wBAAY,CAAC,EAAE,CAAoB,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YAElF,OAAO,WAAW,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,OAAO,CAAM,QAA8B;QAC9C,OAAO,eAAQ,CAAC,KAAK,CAAC,IAAA,UAAG,EAAA,wBAAyB,QAAS,EAAE,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YACzE,MAAM,UAAU,GAAI,MAAM,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACjD,MAAM,WAAW,GAAG,MAAM,wBAAY,CAAC,EAAE,CAAoB,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YAElF,OAAO,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC;IAED,MAAM,CAAC,EAAE,CACL,YAAwF,EACxF,aAA2C;QAE3C,OAAO,eAAQ,CAAC,KAAK,CAAC,IAAA,UAAG,EAAA,GAAI,YAAa,OAAQ,aAAc,EAAE,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;YAC9E,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;YACjD,MAAM,KAAK,GAAG,YAAY,CAAC,EAAE,CAAC,MAAM,CAAC,CAAA;YAErC,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,IAAI;QACP,OAAO;YACH,EAAE,EAAE,CAAC,WAAyC,EAAE,EAAE,CAC9C,eAAQ,CAAC,KAAK,CAAC,iBAAiB,WAAW,EAAE,EAAE,KAAK,EAAC,KAAK,EAAC,EAAE;gBACzD,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;gBAChD,OAAO,OAAO,CAAC,IAAI,EAAE,CAAC;YAC1B,CAAC,CAAC;SACT,CAAA;IACL,CAAC;IAED,YAA4B,OAAqC;QAArC,YAAO,GAAP,OAAO,CAA8B;QAC7D,IAAA,mBAAM,EAAC,wBAAwB,EAAE,OAAO,EAAE,IAAA,sBAAS,GAAE,CAAC,CAAC;IAC3D,CAAC;IA6DD;;OAEG;IACH,KAAK,CAAC,aAAa;QACf,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;IACxC,CAAC;IAED,QAAQ;QACJ,OAAO,uBAAwB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAG,EAAE,CAAC;IAC9D,CAAC;IA4ED;;;;OAIG;IACH,KAAK,CAAC,SAAS;QACX,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC;IACpC,CAAC;CAoBJ;AA9OD,kCA8OC"}
|
|
@@ -3,15 +3,15 @@ import { MetaList } from '@serenity-js/core';
|
|
|
3
3
|
import type { PageElement } from './PageElement';
|
|
4
4
|
import type { Selector } from './selectors';
|
|
5
5
|
/**
|
|
6
|
-
* Uses the
|
|
7
|
-
* a group of Web elements located by
|
|
6
|
+
* Uses the [actor's](https://serenity-js.org/api/core/class/Actor/) [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/) to identify
|
|
7
|
+
* a group of Web elements located by [`Selector`](https://serenity-js.org/api/web/class/Selector/).
|
|
8
8
|
*
|
|
9
9
|
* ## Learn more
|
|
10
10
|
*
|
|
11
|
-
* - [Page Element Query Language](/handbook/web-testing/page-element-query-language)
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
11
|
+
* - [Page Element Query Language](https://serenity-js.org/handbook/web-testing/page-element-query-language)
|
|
12
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)}
|
|
13
|
+
* - [`List`](https://serenity-js.org/api/core/class/List/)
|
|
14
|
+
* - [`ChainableMetaQuestion`](https://serenity-js.org/api/core/interface/ChainableMetaQuestion/)
|
|
15
15
|
*
|
|
16
16
|
* @group Models
|
|
17
17
|
*/
|
|
@@ -4,15 +4,15 @@ exports.PageElements = void 0;
|
|
|
4
4
|
const core_1 = require("@serenity-js/core");
|
|
5
5
|
const PageElementsLocator_1 = require("./PageElementsLocator");
|
|
6
6
|
/**
|
|
7
|
-
* Uses the
|
|
8
|
-
* a group of Web elements located by
|
|
7
|
+
* Uses the [actor's](https://serenity-js.org/api/core/class/Actor/) [ability](https://serenity-js.org/api/core/class/Ability/) to [`BrowseTheWeb`](https://serenity-js.org/api/web/class/BrowseTheWeb/) to identify
|
|
8
|
+
* a group of Web elements located by [`Selector`](https://serenity-js.org/api/web/class/Selector/).
|
|
9
9
|
*
|
|
10
10
|
* ## Learn more
|
|
11
11
|
*
|
|
12
|
-
* - [Page Element Query Language](/handbook/web-testing/page-element-query-language)
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
15
|
-
* -
|
|
12
|
+
* - [Page Element Query Language](https://serenity-js.org/handbook/web-testing/page-element-query-language)
|
|
13
|
+
* - [`Actor`](https://serenity-js.org/api/core/class/Actor/)}
|
|
14
|
+
* - [`List`](https://serenity-js.org/api/core/class/List/)
|
|
15
|
+
* - [`ChainableMetaQuestion`](https://serenity-js.org/api/core/interface/ChainableMetaQuestion/)
|
|
16
16
|
*
|
|
17
17
|
* @group Models
|
|
18
18
|
*/
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import type { Optional } from '@serenity-js/core';
|
|
3
3
|
import * as util from 'util';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* [`RootLocator`](https://serenity-js.org/api/web/class/RootLocator/) represents the context in which [`Locator`](https://serenity-js.org/api/web/class/Locator/) looks for [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) or [`PageElement`](https://serenity-js.org/api/web/class/PageElements/).
|
|
6
6
|
* This context is either a parent element, or some representation of the top-level browsing context.
|
|
7
7
|
*
|
|
8
8
|
* ## Learn more
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
9
|
+
* - [`Locator`](https://serenity-js.org/api/web/class/Locator/)
|
|
10
|
+
* - [`Page.locate`](https://serenity-js.org/api/web/class/Page/#locate)
|
|
11
|
+
* - [`PageElement`](https://serenity-js.org/api/web/class/PageElement/)
|
|
12
|
+
* - [`PageElement`](https://serenity-js.org/api/web/class/PageElements/)
|
|
13
13
|
*
|
|
14
14
|
* @group Models
|
|
15
15
|
*/
|
|
@@ -27,14 +27,14 @@ exports.RootLocator = void 0;
|
|
|
27
27
|
const io_1 = require("@serenity-js/core/lib/io");
|
|
28
28
|
const util = __importStar(require("util")); // eslint-disable-line unicorn/import-style
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* [`RootLocator`](https://serenity-js.org/api/web/class/RootLocator/) represents the context in which [`Locator`](https://serenity-js.org/api/web/class/Locator/) looks for [`PageElement`](https://serenity-js.org/api/web/class/PageElement/) or [`PageElement`](https://serenity-js.org/api/web/class/PageElements/).
|
|
31
31
|
* This context is either a parent element, or some representation of the top-level browsing context.
|
|
32
32
|
*
|
|
33
33
|
* ## Learn more
|
|
34
|
-
* -
|
|
35
|
-
* -
|
|
36
|
-
* -
|
|
37
|
-
* -
|
|
34
|
+
* - [`Locator`](https://serenity-js.org/api/web/class/Locator/)
|
|
35
|
+
* - [`Page.locate`](https://serenity-js.org/api/web/class/Page/#locate)
|
|
36
|
+
* - [`PageElement`](https://serenity-js.org/api/web/class/PageElement/)
|
|
37
|
+
* - [`PageElement`](https://serenity-js.org/api/web/class/PageElements/)
|
|
38
38
|
*
|
|
39
39
|
* @group Models
|
|
40
40
|
*/
|
|
@@ -5,10 +5,10 @@ import { TinyType } from 'tiny-types';
|
|
|
5
5
|
*
|
|
6
6
|
* ## Learn more
|
|
7
7
|
*
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
8
|
+
* - [`Select`](https://serenity-js.org/api/web/class/Select/)
|
|
9
|
+
* - [`Selected`](https://serenity-js.org/api/web/class/Selected/)
|
|
10
|
+
* - [`PageElement.selectOptions`](https://serenity-js.org/api/web/class/PageElement/#selectOptions)
|
|
11
|
+
* - [`PageElement.selectedOptions`](https://serenity-js.org/api/web/class/PageElement/#selectedOptions)
|
|
12
12
|
*
|
|
13
13
|
* @group Models
|
|
14
14
|
*/
|
|
@@ -8,10 +8,10 @@ const tiny_types_1 = require("tiny-types");
|
|
|
8
8
|
*
|
|
9
9
|
* ## Learn more
|
|
10
10
|
*
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
14
|
-
* -
|
|
11
|
+
* - [`Select`](https://serenity-js.org/api/web/class/Select/)
|
|
12
|
+
* - [`Selected`](https://serenity-js.org/api/web/class/Selected/)
|
|
13
|
+
* - [`PageElement.selectOptions`](https://serenity-js.org/api/web/class/PageElement/#selectOptions)
|
|
14
|
+
* - [`PageElement.selectedOptions`](https://serenity-js.org/api/web/class/PageElement/#selectedOptions)
|
|
15
15
|
*
|
|
16
16
|
* @group Models
|
|
17
17
|
*/
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { SwitchableOrigin } from './SwitchableOrigin';
|
|
2
2
|
/**
|
|
3
3
|
* Describes a Serenity/JS model object that can be switched _to_ and switched back _from_
|
|
4
|
-
* using the
|
|
4
|
+
* using the [task](https://serenity-js.org/api/core/class/Task/) to [`Switch`](https://serenity-js.org/api/web/class/Switch/).
|
|
5
5
|
*
|
|
6
|
-
* Examples of switchable models include a
|
|
6
|
+
* Examples of switchable models include a [`Page`](https://serenity-js.org/api/web/class/Page/) and [`PageElement`](https://serenity-js.org/api/web/class/PageElement/).
|
|
7
7
|
*
|
|
8
8
|
* ## Learn more
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
9
|
+
* - [`Page`](https://serenity-js.org/api/web/class/Page/)
|
|
10
|
+
* - [`PageElement`](https://serenity-js.org/api/web/class/PageElement/)
|
|
11
|
+
* - [`Switch`](https://serenity-js.org/api/web/class/Switch/)
|
|
12
12
|
*
|
|
13
13
|
* @group Models
|
|
14
14
|
*/
|
|
15
15
|
export interface Switchable {
|
|
16
16
|
/**
|
|
17
17
|
* Switches the context to the object implementing this interface
|
|
18
|
-
* and returns
|
|
18
|
+
* and returns [`SwitchableOrigin`](https://serenity-js.org/api/web/interface/SwitchableOrigin/) that allows for the context to be switched
|
|
19
19
|
* back when needed.
|
|
20
20
|
*/
|
|
21
21
|
switchTo(): Promise<SwitchableOrigin>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Enables the
|
|
2
|
+
* Enables the [`Task`](https://serenity-js.org/api/core/class/Task/) to [`Switch`](https://serenity-js.org/api/web/class/Switch/) to perform a sequence of activities
|
|
3
3
|
* and switch back to the original context afterwards.
|
|
4
4
|
*
|
|
5
5
|
* ## Learn more
|
|
6
6
|
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
7
|
+
* - [`Switch`](https://serenity-js.org/api/web/class/Switch/)
|
|
8
|
+
* - [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/)
|
|
9
9
|
*
|
|
10
10
|
* @group Models
|
|
11
11
|
*/
|
|
12
12
|
export interface SwitchableOrigin {
|
|
13
13
|
/**
|
|
14
|
-
* Switches the context back to the original
|
|
14
|
+
* Switches the context back to the original [`Switchable`](https://serenity-js.org/api/web/interface/Switchable/)
|
|
15
15
|
*/
|
|
16
16
|
switchBack(): Promise<void>;
|
|
17
17
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ModalDialog } from './ModalDialog';
|
|
2
2
|
/**
|
|
3
3
|
* `AbsentModalDialog` is a [null object](https://en.wikipedia.org/wiki/Null_object_pattern)
|
|
4
|
-
* representing a
|
|
4
|
+
* representing a [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/) that hasn't appeared yet.
|
|
5
5
|
*
|
|
6
6
|
* ## Learn more
|
|
7
|
-
* -
|
|
7
|
+
* - [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/)
|
|
8
8
|
*
|
|
9
9
|
* @group Models
|
|
10
10
|
*/
|
|
@@ -5,10 +5,10 @@ const core_1 = require("@serenity-js/core");
|
|
|
5
5
|
const ModalDialog_1 = require("./ModalDialog");
|
|
6
6
|
/**
|
|
7
7
|
* `AbsentModalDialog` is a [null object](https://en.wikipedia.org/wiki/Null_object_pattern)
|
|
8
|
-
* representing a
|
|
8
|
+
* representing a [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/) that hasn't appeared yet.
|
|
9
9
|
*
|
|
10
10
|
* ## Learn more
|
|
11
|
-
* -
|
|
11
|
+
* - [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/)
|
|
12
12
|
*
|
|
13
13
|
* @group Models
|
|
14
14
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ModalDialog } from './ModalDialog';
|
|
2
2
|
/**
|
|
3
|
-
* `AcceptedModalDialog` represents a
|
|
4
|
-
* via
|
|
3
|
+
* `AcceptedModalDialog` represents a [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/) that has been accepted
|
|
4
|
+
* via [`ModalDialog.acceptNext`](https://serenity-js.org/api/web/class/ModalDialog/#acceptNext).
|
|
5
5
|
*
|
|
6
6
|
* ## Learn more
|
|
7
|
-
* -
|
|
7
|
+
* - [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/)
|
|
8
8
|
*
|
|
9
9
|
* @group Models
|
|
10
10
|
*/
|
|
@@ -4,11 +4,11 @@ exports.AcceptedModalDialog = void 0;
|
|
|
4
4
|
const tiny_types_1 = require("tiny-types");
|
|
5
5
|
const ModalDialog_1 = require("./ModalDialog");
|
|
6
6
|
/**
|
|
7
|
-
* `AcceptedModalDialog` represents a
|
|
8
|
-
* via
|
|
7
|
+
* `AcceptedModalDialog` represents a [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/) that has been accepted
|
|
8
|
+
* via [`ModalDialog.acceptNext`](https://serenity-js.org/api/web/class/ModalDialog/#acceptNext).
|
|
9
9
|
*
|
|
10
10
|
* ## Learn more
|
|
11
|
-
* -
|
|
11
|
+
* - [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/)
|
|
12
12
|
*
|
|
13
13
|
* @group Models
|
|
14
14
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ModalDialog } from './ModalDialog';
|
|
2
2
|
/**
|
|
3
|
-
* `DismissedModalDialog` represents a
|
|
4
|
-
* via
|
|
3
|
+
* `DismissedModalDialog` represents a [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/) that has been dismissed
|
|
4
|
+
* via [`ModalDialog.dismissNext`](https://serenity-js.org/api/web/class/ModalDialog/#dismissNext).
|
|
5
5
|
*
|
|
6
6
|
* ## Learn more
|
|
7
|
-
* -
|
|
7
|
+
* - [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/)
|
|
8
8
|
*
|
|
9
9
|
* @group Models
|
|
10
10
|
*/
|
|
@@ -4,11 +4,11 @@ exports.DismissedModalDialog = void 0;
|
|
|
4
4
|
const tiny_types_1 = require("tiny-types");
|
|
5
5
|
const ModalDialog_1 = require("./ModalDialog");
|
|
6
6
|
/**
|
|
7
|
-
* `DismissedModalDialog` represents a
|
|
8
|
-
* via
|
|
7
|
+
* `DismissedModalDialog` represents a [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/) that has been dismissed
|
|
8
|
+
* via [`ModalDialog.dismissNext`](https://serenity-js.org/api/web/class/ModalDialog/#dismissNext).
|
|
9
9
|
*
|
|
10
10
|
* ## Learn more
|
|
11
|
-
* -
|
|
11
|
+
* - [`ModalDialog`](https://serenity-js.org/api/web/class/ModalDialog/)
|
|
12
12
|
*
|
|
13
13
|
* @group Models
|
|
14
14
|
*/
|
|
@@ -10,7 +10,10 @@ import type { Answerable, Interaction, Optional, Question, QuestionAdapter } fro
|
|
|
10
10
|
* consistent across the various Web integration tools (such as Playwright, Puppeteer,
|
|
11
11
|
* WebdriverIO or Selenium), Serenity/JS works as follows:
|
|
12
12
|
* - Serenity/JS dismisses any modal dialogs by default and stores their message so that it can be asserted on.
|
|
13
|
-
* - This behaviour can be changed by invoking
|
|
13
|
+
* - This behaviour can be changed by invoking [`ModalDialog.acceptNext`](https://serenity-js.org/api/web/class/ModalDialog/#acceptNext),
|
|
14
|
+
* [`ModalDialog.acceptNextWithValue`](https://serenity-js.org/api/web/class/ModalDialog/#acceptNextWithValue),
|
|
15
|
+
* or [`ModalDialog.dismissNext`](https://serenity-js.org/api/web/class/ModalDialog/#dismissNext)
|
|
16
|
+
* before the dialog is triggered, as per the below examples.
|
|
14
17
|
* - Serenity/JS also allows you to `Wait.until(ModalDialog, isPresent())` so that you can synchronise your tests
|
|
15
18
|
* with modal dialogs that appear after a delay.
|
|
16
19
|
*
|
|
@@ -89,7 +92,7 @@ import type { Answerable, Interaction, Optional, Question, QuestionAdapter } fro
|
|
|
89
92
|
* ```
|
|
90
93
|
*
|
|
91
94
|
* ## Learn more
|
|
92
|
-
* -
|
|
95
|
+
* - [`Optional`](https://serenity-js.org/api/core/interface/Optional/)
|
|
93
96
|
*
|
|
94
97
|
* @group Models
|
|
95
98
|
*/
|
|
@@ -118,35 +121,35 @@ export declare abstract class ModalDialog implements Optional {
|
|
|
118
121
|
*/
|
|
119
122
|
static isPresent(): Question<Promise<boolean>>;
|
|
120
123
|
/**
|
|
121
|
-
* Produces an
|
|
124
|
+
* Produces an [interaction](https://serenity-js.org/api/core/class/Interaction/) that invokes [`ModalDialog.acceptNext`](https://serenity-js.org/api/web/class/ModalDialog/#acceptNext).
|
|
122
125
|
*/
|
|
123
126
|
static acceptNext(): Interaction;
|
|
124
127
|
/**
|
|
125
|
-
* Produces an
|
|
128
|
+
* Produces an [interaction](https://serenity-js.org/api/core/class/Interaction/) that invokes [`ModalDialog.acceptNextWithValue`](https://serenity-js.org/api/web/class/ModalDialog/#acceptNextWithValue).
|
|
126
129
|
*
|
|
127
130
|
* @param value
|
|
128
131
|
*/
|
|
129
132
|
static acceptNextWithValue(value: Answerable<string | number>): Interaction;
|
|
130
133
|
/**
|
|
131
|
-
* Produces an
|
|
134
|
+
* Produces an [interaction](https://serenity-js.org/api/core/class/Interaction/) that invokes [`ModalDialog.dismissNext`](https://serenity-js.org/api/web/class/ModalDialog/#dismissNext).
|
|
132
135
|
*/
|
|
133
136
|
static dismissNext(): Interaction;
|
|
134
137
|
/**
|
|
135
|
-
*
|
|
138
|
+
* [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) that resolves to [`ModalDialog.message`](https://serenity-js.org/api/web/class/ModalDialog/#message) for the current [`Page`](https://serenity-js.org/api/web/class/Page/).
|
|
136
139
|
*/
|
|
137
140
|
static lastDialogMessage(): QuestionAdapter<string>;
|
|
138
141
|
/**
|
|
139
|
-
*
|
|
142
|
+
* [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) that resolves to [`ModalDialog.state`](https://serenity-js.org/api/web/class/ModalDialog/#state) for the current [`Page`](https://serenity-js.org/api/web/class/Page/).
|
|
140
143
|
*/
|
|
141
144
|
static lastDialogState(): QuestionAdapter<string>;
|
|
142
145
|
/**
|
|
143
146
|
* Returns the message of the last modal dialog handled,
|
|
144
|
-
* or rejects the promise with a
|
|
147
|
+
* or rejects the promise with a [`LogicError`](https://serenity-js.org/api/core/class/LogicError/)
|
|
145
148
|
* when no modal dialogs have been observed yet.
|
|
146
149
|
*
|
|
147
150
|
* @returns
|
|
148
151
|
* Message of the last handled dialog, or a `Promise`
|
|
149
|
-
* rejected with a
|
|
152
|
+
* rejected with a [`LogicError`](https://serenity-js.org/api/core/class/LogicError/)
|
|
150
153
|
* when no dialog has been handled yet.
|
|
151
154
|
*/
|
|
152
155
|
abstract message(): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModalDialog.d.ts","sourceRoot":"","sources":["../../../../src/screenplay/models/dialogs/ModalDialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKtG
|
|
1
|
+
{"version":3,"file":"ModalDialog.d.ts","sourceRoot":"","sources":["../../../../src/screenplay/models/dialogs/ModalDialog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAKtG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgGG;AACH,8BAAsB,WAAY,YAAW,QAAQ;IAEjD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,SAAS,IAAI,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAI9C;;OAEG;IACH,MAAM,CAAC,UAAU,IAAI,WAAW;IAKhC;;;;OAIG;IACH,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,WAAW;IAK3E;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,WAAW;IAKjC;;OAEG;IACH,MAAM,CAAC,iBAAiB,IAAI,eAAe,CAAC,MAAM,CAAC;IAKnD;;OAEG;IACH,MAAM,CAAC,eAAe,IAAI,eAAe,CAAC,MAAM,CAAC;IAKjD;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC;IAEnC;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAEtC;;;OAGG;IACH,KAAK,IAAI,MAAM;CAKlB"}
|
|
@@ -14,7 +14,10 @@ const Page_1 = require("../Page");
|
|
|
14
14
|
* consistent across the various Web integration tools (such as Playwright, Puppeteer,
|
|
15
15
|
* WebdriverIO or Selenium), Serenity/JS works as follows:
|
|
16
16
|
* - Serenity/JS dismisses any modal dialogs by default and stores their message so that it can be asserted on.
|
|
17
|
-
* - This behaviour can be changed by invoking
|
|
17
|
+
* - This behaviour can be changed by invoking [`ModalDialog.acceptNext`](https://serenity-js.org/api/web/class/ModalDialog/#acceptNext),
|
|
18
|
+
* [`ModalDialog.acceptNextWithValue`](https://serenity-js.org/api/web/class/ModalDialog/#acceptNextWithValue),
|
|
19
|
+
* or [`ModalDialog.dismissNext`](https://serenity-js.org/api/web/class/ModalDialog/#dismissNext)
|
|
20
|
+
* before the dialog is triggered, as per the below examples.
|
|
18
21
|
* - Serenity/JS also allows you to `Wait.until(ModalDialog, isPresent())` so that you can synchronise your tests
|
|
19
22
|
* with modal dialogs that appear after a delay.
|
|
20
23
|
*
|
|
@@ -93,7 +96,7 @@ const Page_1 = require("../Page");
|
|
|
93
96
|
* ```
|
|
94
97
|
*
|
|
95
98
|
* ## Learn more
|
|
96
|
-
* -
|
|
99
|
+
* - [`Optional`](https://serenity-js.org/api/core/interface/Optional/)
|
|
97
100
|
*
|
|
98
101
|
* @group Models
|
|
99
102
|
*/
|
|
@@ -124,14 +127,14 @@ class ModalDialog {
|
|
|
124
127
|
return Page_1.Page.current().modalDialog().last().isPresent();
|
|
125
128
|
}
|
|
126
129
|
/**
|
|
127
|
-
* Produces an
|
|
130
|
+
* Produces an [interaction](https://serenity-js.org/api/core/class/Interaction/) that invokes [`ModalDialog.acceptNext`](https://serenity-js.org/api/web/class/ModalDialog/#acceptNext).
|
|
128
131
|
*/
|
|
129
132
|
static acceptNext() {
|
|
130
133
|
return Page_1.Page.current().modalDialog().acceptNext()
|
|
131
134
|
.describedAs('#actor accepts next modal dialog window');
|
|
132
135
|
}
|
|
133
136
|
/**
|
|
134
|
-
* Produces an
|
|
137
|
+
* Produces an [interaction](https://serenity-js.org/api/core/class/Interaction/) that invokes [`ModalDialog.acceptNextWithValue`](https://serenity-js.org/api/web/class/ModalDialog/#acceptNextWithValue).
|
|
135
138
|
*
|
|
136
139
|
* @param value
|
|
137
140
|
*/
|
|
@@ -140,21 +143,21 @@ class ModalDialog {
|
|
|
140
143
|
.describedAs((0, core_1.the) `#actor accepts next modal dialog window with value ${value}`);
|
|
141
144
|
}
|
|
142
145
|
/**
|
|
143
|
-
* Produces an
|
|
146
|
+
* Produces an [interaction](https://serenity-js.org/api/core/class/Interaction/) that invokes [`ModalDialog.dismissNext`](https://serenity-js.org/api/web/class/ModalDialog/#dismissNext).
|
|
144
147
|
*/
|
|
145
148
|
static dismissNext() {
|
|
146
149
|
return Page_1.Page.current().modalDialog().dismissNext()
|
|
147
150
|
.describedAs((0, core_1.the) `#actor dismisses next modal dialog window`);
|
|
148
151
|
}
|
|
149
152
|
/**
|
|
150
|
-
*
|
|
153
|
+
* [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) that resolves to [`ModalDialog.message`](https://serenity-js.org/api/web/class/ModalDialog/#message) for the current [`Page`](https://serenity-js.org/api/web/class/Page/).
|
|
151
154
|
*/
|
|
152
155
|
static lastDialogMessage() {
|
|
153
156
|
return Page_1.Page.current().modalDialog().last().message()
|
|
154
157
|
.describedAs(`last dialog message`);
|
|
155
158
|
}
|
|
156
159
|
/**
|
|
157
|
-
*
|
|
160
|
+
* [`QuestionAdapter`](https://serenity-js.org/api/core/#QuestionAdapter) that resolves to [`ModalDialog.state`](https://serenity-js.org/api/web/class/ModalDialog/#state) for the current [`Page`](https://serenity-js.org/api/web/class/Page/).
|
|
158
161
|
*/
|
|
159
162
|
static lastDialogState() {
|
|
160
163
|
return Page_1.Page.current().modalDialog().last().state()
|