@serenity-js/webdriverio 2.33.1 → 3.0.0-rc.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +455 -0
- package/lib/adapter/WebdriverIOFrameworkAdapter.js +1 -1
- package/lib/adapter/WebdriverIOFrameworkAdapter.js.map +1 -1
- package/lib/adapter/WebdriverIONotifier.d.ts +35 -1
- package/lib/adapter/WebdriverIONotifier.js +174 -13
- package/lib/adapter/WebdriverIONotifier.js.map +1 -1
- package/lib/index.d.ts +0 -3
- package/lib/index.js +0 -3
- package/lib/index.js.map +1 -1
- package/lib/screenplay/abilities/{BrowseTheWeb.d.ts → BrowseTheWebWithWebdriverIO.d.ts} +42 -27
- package/lib/screenplay/abilities/{BrowseTheWeb.js → BrowseTheWebWithWebdriverIO.js} +104 -32
- package/lib/screenplay/abilities/BrowseTheWebWithWebdriverIO.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 -2
- package/lib/screenplay/index.js +1 -2
- package/lib/screenplay/index.js.map +1 -1
- package/lib/screenplay/models/WebdriverIOCookie.d.ts +8 -0
- package/lib/screenplay/models/WebdriverIOCookie.js +39 -0
- package/lib/screenplay/models/WebdriverIOCookie.js.map +1 -0
- package/lib/screenplay/models/WebdriverIOFrame.d.ts +10 -0
- package/lib/screenplay/models/WebdriverIOFrame.js +34 -0
- package/lib/screenplay/models/WebdriverIOFrame.js.map +1 -0
- package/lib/screenplay/models/WebdriverIOModalDialog.d.ts +11 -0
- package/lib/screenplay/models/WebdriverIOModalDialog.js +40 -0
- package/lib/screenplay/models/WebdriverIOModalDialog.js.map +1 -0
- package/lib/screenplay/models/WebdriverIOPage.d.ts +26 -0
- package/lib/screenplay/models/WebdriverIOPage.js +104 -0
- package/lib/screenplay/models/WebdriverIOPage.js.map +1 -0
- package/lib/screenplay/models/WebdriverIOPageElement.d.ts +31 -0
- package/lib/screenplay/models/WebdriverIOPageElement.js +185 -0
- package/lib/screenplay/models/WebdriverIOPageElement.js.map +1 -0
- package/lib/screenplay/models/index.d.ts +5 -0
- package/lib/{stage/crew/photographer/strategies → screenplay/models}/index.js +5 -4
- package/lib/screenplay/models/index.js.map +1 -0
- package/lib/screenplay/models/locators/WebdriverIOLocator.d.ts +9 -0
- package/lib/screenplay/models/locators/WebdriverIOLocator.js +22 -0
- package/lib/screenplay/models/locators/WebdriverIOLocator.js.map +1 -0
- package/lib/screenplay/models/locators/WebdriverIONativeElementRoot.d.ts +2 -0
- package/lib/screenplay/{interactions/EnterBuilder.js → models/locators/WebdriverIONativeElementRoot.js} +1 -1
- package/lib/screenplay/models/locators/WebdriverIONativeElementRoot.js.map +1 -0
- package/lib/screenplay/models/locators/index.d.ts +2 -0
- package/lib/{stage/crew/photographer → screenplay/models/locators}/index.js +2 -2
- package/lib/screenplay/models/locators/index.js.map +1 -0
- package/package.json +14 -24
- package/src/adapter/WebdriverIOFrameworkAdapter.ts +2 -0
- package/src/adapter/WebdriverIONotifier.ts +225 -23
- package/src/index.ts +0 -3
- package/src/screenplay/abilities/{BrowseTheWeb.ts → BrowseTheWebWithWebdriverIO.ts} +125 -35
- package/src/screenplay/abilities/index.ts +1 -1
- package/src/screenplay/index.ts +1 -2
- package/src/screenplay/models/WebdriverIOCookie.ts +44 -0
- package/src/screenplay/models/WebdriverIOFrame.ts +38 -0
- package/src/screenplay/models/WebdriverIOModalDialog.ts +45 -0
- package/src/screenplay/models/WebdriverIOPage.ts +128 -0
- package/src/screenplay/models/WebdriverIOPageElement.ts +227 -0
- package/src/screenplay/models/index.ts +5 -0
- package/src/screenplay/models/locators/WebdriverIOLocator.ts +43 -0
- package/src/screenplay/models/locators/WebdriverIONativeElementRoot.ts +3 -0
- package/src/screenplay/models/locators/index.ts +2 -0
- package/lib/expectations/ElementExpectation.d.ts +0 -11
- package/lib/expectations/ElementExpectation.js +0 -27
- package/lib/expectations/ElementExpectation.js.map +0 -1
- package/lib/expectations/index.d.ts +0 -6
- package/lib/expectations/index.js +0 -19
- package/lib/expectations/index.js.map +0 -1
- package/lib/expectations/isActive.d.ts +0 -15
- package/lib/expectations/isActive.js +0 -21
- package/lib/expectations/isActive.js.map +0 -1
- package/lib/expectations/isClickable.d.ts +0 -20
- package/lib/expectations/isClickable.js +0 -26
- package/lib/expectations/isClickable.js.map +0 -1
- package/lib/expectations/isEnabled.d.ts +0 -14
- package/lib/expectations/isEnabled.js +0 -20
- package/lib/expectations/isEnabled.js.map +0 -1
- package/lib/expectations/isPresent.d.ts +0 -15
- package/lib/expectations/isPresent.js +0 -21
- package/lib/expectations/isPresent.js.map +0 -1
- package/lib/expectations/isSelected.d.ts +0 -14
- package/lib/expectations/isSelected.js +0 -20
- package/lib/expectations/isSelected.js.map +0 -1
- package/lib/expectations/isVisible.d.ts +0 -14
- package/lib/expectations/isVisible.js +0 -20
- package/lib/expectations/isVisible.js.map +0 -1
- package/lib/input/Key.d.ts +0 -73
- package/lib/input/Key.js +0 -84
- package/lib/input/Key.js.map +0 -1
- package/lib/input/index.d.ts +0 -1
- package/lib/input/index.js +0 -14
- package/lib/input/index.js.map +0 -1
- package/lib/screenplay/abilities/BrowseTheWeb.js.map +0 -1
- package/lib/screenplay/interactions/Clear.d.ts +0 -79
- package/lib/screenplay/interactions/Clear.js +0 -97
- package/lib/screenplay/interactions/Clear.js.map +0 -1
- package/lib/screenplay/interactions/Click.d.ts +0 -73
- package/lib/screenplay/interactions/Click.js +0 -84
- package/lib/screenplay/interactions/Click.js.map +0 -1
- package/lib/screenplay/interactions/DoubleClick.d.ts +0 -90
- package/lib/screenplay/interactions/DoubleClick.js +0 -101
- package/lib/screenplay/interactions/DoubleClick.js.map +0 -1
- package/lib/screenplay/interactions/Enter.d.ts +0 -73
- package/lib/screenplay/interactions/Enter.js +0 -87
- package/lib/screenplay/interactions/Enter.js.map +0 -1
- package/lib/screenplay/interactions/EnterBuilder.d.ts +0 -25
- package/lib/screenplay/interactions/EnterBuilder.js.map +0 -1
- package/lib/screenplay/interactions/ExecuteScript.d.ts +0 -206
- package/lib/screenplay/interactions/ExecuteScript.js +0 -311
- package/lib/screenplay/interactions/ExecuteScript.js.map +0 -1
- package/lib/screenplay/interactions/Hover.d.ts +0 -78
- package/lib/screenplay/interactions/Hover.js +0 -89
- package/lib/screenplay/interactions/Hover.js.map +0 -1
- package/lib/screenplay/interactions/Navigate.d.ts +0 -141
- package/lib/screenplay/interactions/Navigate.js +0 -197
- package/lib/screenplay/interactions/Navigate.js.map +0 -1
- package/lib/screenplay/interactions/Press.d.ts +0 -84
- package/lib/screenplay/interactions/Press.js +0 -152
- package/lib/screenplay/interactions/Press.js.map +0 -1
- package/lib/screenplay/interactions/PressBuilder.d.ts +0 -26
- package/lib/screenplay/interactions/PressBuilder.js +0 -3
- package/lib/screenplay/interactions/PressBuilder.js.map +0 -1
- package/lib/screenplay/interactions/RightClick.d.ts +0 -89
- package/lib/screenplay/interactions/RightClick.js +0 -100
- package/lib/screenplay/interactions/RightClick.js.map +0 -1
- package/lib/screenplay/interactions/Scroll.d.ts +0 -75
- package/lib/screenplay/interactions/Scroll.js +0 -86
- package/lib/screenplay/interactions/Scroll.js.map +0 -1
- package/lib/screenplay/interactions/Wait.d.ts +0 -143
- 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 -32
- package/lib/screenplay/interactions/WaitBuilder.js +0 -3
- package/lib/screenplay/interactions/WaitBuilder.js.map +0 -1
- package/lib/screenplay/interactions/WebElementInteraction.d.ts +0 -37
- package/lib/screenplay/interactions/WebElementInteraction.js +0 -52
- package/lib/screenplay/interactions/WebElementInteraction.js.map +0 -1
- package/lib/screenplay/interactions/index.d.ts +0 -13
- package/lib/screenplay/interactions/index.js +0 -26
- package/lib/screenplay/interactions/index.js.map +0 -1
- package/lib/screenplay/questions/Attribute.d.ts +0 -82
- package/lib/screenplay/questions/Attribute.js +0 -102
- package/lib/screenplay/questions/Attribute.js.map +0 -1
- package/lib/screenplay/questions/CSSClasses.d.ts +0 -92
- package/lib/screenplay/questions/CSSClasses.js +0 -112
- package/lib/screenplay/questions/CSSClasses.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/NestedTargetBuilder.d.ts +0 -27
- package/lib/screenplay/questions/NestedTargetBuilder.js +0 -3
- package/lib/screenplay/questions/NestedTargetBuilder.js.map +0 -1
- package/lib/screenplay/questions/TargetBuilder.d.ts +0 -25
- package/lib/screenplay/questions/TargetBuilder.js +0 -3
- package/lib/screenplay/questions/TargetBuilder.js.map +0 -1
- package/lib/screenplay/questions/Text.d.ts +0 -95
- package/lib/screenplay/questions/Text.js +0 -130
- package/lib/screenplay/questions/Text.js.map +0 -1
- package/lib/screenplay/questions/Value.d.ts +0 -63
- package/lib/screenplay/questions/Value.js +0 -78
- package/lib/screenplay/questions/Value.js.map +0 -1
- package/lib/screenplay/questions/Website.d.ts +0 -21
- package/lib/screenplay/questions/Website.js +0 -31
- package/lib/screenplay/questions/Website.js.map +0 -1
- package/lib/screenplay/questions/index.d.ts +0 -10
- package/lib/screenplay/questions/index.js +0 -23
- package/lib/screenplay/questions/index.js.map +0 -1
- package/lib/screenplay/questions/lists.d.ts +0 -86
- package/lib/screenplay/questions/lists.js +0 -137
- package/lib/screenplay/questions/lists.js.map +0 -1
- package/lib/screenplay/questions/locators.d.ts +0 -196
- package/lib/screenplay/questions/locators.js +0 -219
- package/lib/screenplay/questions/locators.js.map +0 -1
- package/lib/screenplay/questions/targets.d.ts +0 -254
- package/lib/screenplay/questions/targets.js +0 -334
- package/lib/screenplay/questions/targets.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.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.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/ElementExpectation.ts +0 -31
- package/src/expectations/index.ts +0 -6
- package/src/expectations/isActive.ts +0 -21
- package/src/expectations/isClickable.ts +0 -26
- package/src/expectations/isEnabled.ts +0 -19
- package/src/expectations/isPresent.ts +0 -20
- package/src/expectations/isSelected.ts +0 -19
- package/src/expectations/isVisible.ts +0 -19
- package/src/input/Key.ts +0 -83
- package/src/input/index.ts +0 -1
- package/src/screenplay/interactions/Clear.ts +0 -102
- package/src/screenplay/interactions/Click.ts +0 -85
- package/src/screenplay/interactions/DoubleClick.ts +0 -102
- package/src/screenplay/interactions/Enter.ts +0 -93
- package/src/screenplay/interactions/EnterBuilder.ts +0 -27
- package/src/screenplay/interactions/ExecuteScript.ts +0 -344
- package/src/screenplay/interactions/Hover.ts +0 -90
- package/src/screenplay/interactions/Navigate.ts +0 -208
- package/src/screenplay/interactions/Press.ts +0 -172
- package/src/screenplay/interactions/PressBuilder.ts +0 -28
- package/src/screenplay/interactions/RightClick.ts +0 -100
- package/src/screenplay/interactions/Scroll.ts +0 -87
- package/src/screenplay/interactions/Wait.ts +0 -267
- package/src/screenplay/interactions/WaitBuilder.ts +0 -34
- package/src/screenplay/interactions/WebElementInteraction.ts +0 -56
- package/src/screenplay/interactions/index.ts +0 -13
- package/src/screenplay/questions/Attribute.ts +0 -112
- package/src/screenplay/questions/CSSClasses.ts +0 -116
- package/src/screenplay/questions/LastScriptExecution.ts +0 -21
- package/src/screenplay/questions/NestedTargetBuilder.ts +0 -30
- package/src/screenplay/questions/TargetBuilder.ts +0 -27
- package/src/screenplay/questions/Text.ts +0 -140
- package/src/screenplay/questions/Value.ts +0 -82
- package/src/screenplay/questions/Website.ts +0 -34
- package/src/screenplay/questions/index.ts +0 -10
- package/src/screenplay/questions/lists.ts +0 -161
- package/src/screenplay/questions/locators.ts +0 -254
- package/src/screenplay/questions/targets.ts +0 -401
- 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 -103
- 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,92 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, MetaQuestion, Question, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { Element } from 'webdriverio';
|
|
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 Answerable<{@link @wdio/types~Element}>.
|
|
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, by, CSSClasses, Target } from '@serenity-js/webdriverio';
|
|
19
|
-
*
|
|
20
|
-
* const shoppingList = () =>
|
|
21
|
-
* Target.the('shopping list').located(by.id('shopping-list'))
|
|
22
|
-
*
|
|
23
|
-
* actorCalled('Lisa')
|
|
24
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
25
|
-
* .attemptsTo(
|
|
26
|
-
* Ensure.that(CSSClasses.of(shoppingList()), equals([ 'active', 'favourite' ])),
|
|
27
|
-
* )
|
|
28
|
-
*
|
|
29
|
-
* @example <caption>Find WebElements with a given class</caption>
|
|
30
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
31
|
-
* import { Ensure, contain } from '@serenity-js/assertions';
|
|
32
|
-
* import { BrowseTheWeb, by, CSSClasses, Target } from '@serenity-js/webdriverio';
|
|
33
|
-
*
|
|
34
|
-
* class ShoppingList {
|
|
35
|
-
* static items = () =>
|
|
36
|
-
* Target.all('items')
|
|
37
|
-
* .located(by.css('#shopping-list li'))
|
|
38
|
-
*
|
|
39
|
-
* static outstandingItems = () =>
|
|
40
|
-
* ShoppingList.items
|
|
41
|
-
* .where(CSSClasses, contain('buy'))
|
|
42
|
-
* }
|
|
43
|
-
*
|
|
44
|
-
* actorCalled('Lisa')
|
|
45
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
46
|
-
* .attemptsTo(
|
|
47
|
-
* Ensure.that(
|
|
48
|
-
* Text.ofAll(ShoppingList.outstandingItems()),
|
|
49
|
-
* equals([ 'Honey', 'Chocolate' ])
|
|
50
|
-
* ),
|
|
51
|
-
* )
|
|
52
|
-
*
|
|
53
|
-
* @extends {@serenity-js/core/lib/screenplay~Question}
|
|
54
|
-
* @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
55
|
-
*/
|
|
56
|
-
export declare class CSSClasses extends Question<Promise<string[]>> implements MetaQuestion<Answerable<Element<'async'>>, Promise<string[]>> {
|
|
57
|
-
private readonly target;
|
|
58
|
-
/**
|
|
59
|
-
* @param {Question<Element<'async'>> | Element<'async'>} target
|
|
60
|
-
* @returns {CSSClasses}
|
|
61
|
-
*/
|
|
62
|
-
static of(target: Answerable<Element<'async'>>): CSSClasses;
|
|
63
|
-
/**
|
|
64
|
-
* @param {Question<Element<'async'>> | Element<'async'>} target
|
|
65
|
-
*/
|
|
66
|
-
constructor(target: Answerable<Element<'async'>>);
|
|
67
|
-
/**
|
|
68
|
-
* @desc
|
|
69
|
-
* Resolves to an array of CSS classes of the `target` element,
|
|
70
|
-
* located in the context of a `parent` element.
|
|
71
|
-
*
|
|
72
|
-
* @param {@serenity-js/core/lib/screenplay~Answerable<Element<'async'>>} parent
|
|
73
|
-
* @returns {Question<Promise<string[]>>}
|
|
74
|
-
*
|
|
75
|
-
* @see {@link Target.all}
|
|
76
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
77
|
-
*/
|
|
78
|
-
of(parent: Answerable<Element<'async'>>): Question<Promise<string[]>>;
|
|
79
|
-
/**
|
|
80
|
-
* @desc
|
|
81
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
82
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
83
|
-
*
|
|
84
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
85
|
-
* @returns {Promise<void>}
|
|
86
|
-
*
|
|
87
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
88
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
89
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
90
|
-
*/
|
|
91
|
-
answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<string[]>;
|
|
92
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CSSClasses = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
const Attribute_1 = require("./Attribute");
|
|
7
|
-
const targets_1 = require("./targets");
|
|
8
|
-
/**
|
|
9
|
-
* @desc
|
|
10
|
-
* Resolves to an array of [CSS classes](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes#attr-class)
|
|
11
|
-
* of a given {@link WebElement}, represented by Answerable<{@link @wdio/types~Element}>.
|
|
12
|
-
*
|
|
13
|
-
* @example <caption>Example widget</caption>
|
|
14
|
-
* <ul id="shopping-list" class="active favourite">
|
|
15
|
-
* <li class="bought">Coffee<li>
|
|
16
|
-
* <li class="buy">Honey<li>
|
|
17
|
-
* <li class="buy">Chocolate<li>
|
|
18
|
-
* </ul>
|
|
19
|
-
*
|
|
20
|
-
* @example <caption>Retrieve CSS classes of a given WebElement</caption>
|
|
21
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
22
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
23
|
-
* import { BrowseTheWeb, by, CSSClasses, Target } from '@serenity-js/webdriverio';
|
|
24
|
-
*
|
|
25
|
-
* const shoppingList = () =>
|
|
26
|
-
* Target.the('shopping list').located(by.id('shopping-list'))
|
|
27
|
-
*
|
|
28
|
-
* actorCalled('Lisa')
|
|
29
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
30
|
-
* .attemptsTo(
|
|
31
|
-
* Ensure.that(CSSClasses.of(shoppingList()), equals([ 'active', 'favourite' ])),
|
|
32
|
-
* )
|
|
33
|
-
*
|
|
34
|
-
* @example <caption>Find WebElements with a given class</caption>
|
|
35
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
36
|
-
* import { Ensure, contain } from '@serenity-js/assertions';
|
|
37
|
-
* import { BrowseTheWeb, by, CSSClasses, Target } from '@serenity-js/webdriverio';
|
|
38
|
-
*
|
|
39
|
-
* class ShoppingList {
|
|
40
|
-
* static items = () =>
|
|
41
|
-
* Target.all('items')
|
|
42
|
-
* .located(by.css('#shopping-list li'))
|
|
43
|
-
*
|
|
44
|
-
* static outstandingItems = () =>
|
|
45
|
-
* ShoppingList.items
|
|
46
|
-
* .where(CSSClasses, contain('buy'))
|
|
47
|
-
* }
|
|
48
|
-
*
|
|
49
|
-
* actorCalled('Lisa')
|
|
50
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
51
|
-
* .attemptsTo(
|
|
52
|
-
* Ensure.that(
|
|
53
|
-
* Text.ofAll(ShoppingList.outstandingItems()),
|
|
54
|
-
* equals([ 'Honey', 'Chocolate' ])
|
|
55
|
-
* ),
|
|
56
|
-
* )
|
|
57
|
-
*
|
|
58
|
-
* @extends {@serenity-js/core/lib/screenplay~Question}
|
|
59
|
-
* @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
60
|
-
*/
|
|
61
|
-
class CSSClasses extends core_1.Question {
|
|
62
|
-
/**
|
|
63
|
-
* @param {Question<Element<'async'>> | Element<'async'>} target
|
|
64
|
-
*/
|
|
65
|
-
constructor(target) {
|
|
66
|
-
super((0, io_1.formatted) `CSS classes of ${target}`);
|
|
67
|
-
this.target = target;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* @param {Question<Element<'async'>> | Element<'async'>} target
|
|
71
|
-
* @returns {CSSClasses}
|
|
72
|
-
*/
|
|
73
|
-
static of(target) {
|
|
74
|
-
return new CSSClasses(target);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* @desc
|
|
78
|
-
* Resolves to an array of CSS classes of the `target` element,
|
|
79
|
-
* located in the context of a `parent` element.
|
|
80
|
-
*
|
|
81
|
-
* @param {@serenity-js/core/lib/screenplay~Answerable<Element<'async'>>} parent
|
|
82
|
-
* @returns {Question<Promise<string[]>>}
|
|
83
|
-
*
|
|
84
|
-
* @see {@link Target.all}
|
|
85
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
86
|
-
*/
|
|
87
|
-
of(parent) {
|
|
88
|
-
return new CSSClasses(new targets_1.TargetNestedElement(parent, this.target));
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* @desc
|
|
92
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
93
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
94
|
-
*
|
|
95
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
96
|
-
* @returns {Promise<void>}
|
|
97
|
-
*
|
|
98
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
99
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
100
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
101
|
-
*/
|
|
102
|
-
answeredBy(actor) {
|
|
103
|
-
return Attribute_1.Attribute.called('class').of(this.target).answeredBy(actor)
|
|
104
|
-
.then(attribute => attribute
|
|
105
|
-
.replace(/\s+/, ' ')
|
|
106
|
-
.trim()
|
|
107
|
-
.split(' ')
|
|
108
|
-
.filter(cssClass => !!cssClass));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.CSSClasses = CSSClasses;
|
|
112
|
-
//# sourceMappingURL=CSSClasses.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CSSClasses.js","sourceRoot":"","sources":["../../../src/screenplay/questions/CSSClasses.ts"],"names":[],"mappings":";;;AAAA,4CAAwG;AACxG,iDAAqD;AAGrD,2CAAwC;AACxC,uCAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAa,UACT,SAAQ,eAA2B;IAWnC;;OAEG;IACH,YAA6B,MAAoC;QAC7D,KAAK,CAAC,IAAA,cAAS,EAAC,kBAAmB,MAAM,EAAE,CAAC,CAAC;QADpB,WAAM,GAAN,MAAM,CAA8B;IAEjE,CAAC;IAbD;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,MAAoC;QAC1C,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IASD;;;;;;;;;;OAUG;IACH,EAAE,CAAC,MAAoC;QACnC,OAAO,IAAI,UAAU,CAAC,IAAI,6BAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACxE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,KAAuC;QAC9C,OAAO,qBAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC;aAC7D,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS;aACvB,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;aACnB,IAAI,EAAE;aACN,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAE,QAAQ,CAAC,CACnC,CAAC;IACV,CAAC;CACJ;AAvDD,gCAuDC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Question } from '@serenity-js/core';
|
|
2
|
-
/**
|
|
3
|
-
* @desc
|
|
4
|
-
* Returns the result of last script executed via {@link ExecuteScript}
|
|
5
|
-
*/
|
|
6
|
-
export declare class LastScriptExecution {
|
|
7
|
-
/**
|
|
8
|
-
* @desc
|
|
9
|
-
* Enables asserting on the result of a function executed via {@link ExecuteScript}.
|
|
10
|
-
*
|
|
11
|
-
* @returns {Question<R>}
|
|
12
|
-
*/
|
|
13
|
-
static result<R>(): Question<R>;
|
|
14
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LastScriptExecution = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const abilities_1 = require("../abilities");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Returns the result of last script executed via {@link ExecuteScript}
|
|
9
|
-
*/
|
|
10
|
-
class LastScriptExecution {
|
|
11
|
-
/**
|
|
12
|
-
* @desc
|
|
13
|
-
* Enables asserting on the result of a function executed via {@link ExecuteScript}.
|
|
14
|
-
*
|
|
15
|
-
* @returns {Question<R>}
|
|
16
|
-
*/
|
|
17
|
-
static result() {
|
|
18
|
-
return core_1.Question.about(`last script execution result`, actor => abilities_1.BrowseTheWeb.as(actor).getLastScriptExecutionResult());
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.LastScriptExecution = LastScriptExecution;
|
|
22
|
-
//# sourceMappingURL=LastScriptExecution.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LastScriptExecution.js","sourceRoot":"","sources":["../../../src/screenplay/questions/LastScriptExecution.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAE7C,4CAA4C;AAE5C;;;GAGG;AACH,MAAa,mBAAmB;IAE5B;;;;;OAKG;IACH,MAAM,CAAC,MAAM;QACT,OAAO,eAAQ,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,EAAE,CAC1D,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,4BAA4B,EAAE,CAAC,CAAC;IAC/D,CAAC;CACJ;AAZD,kDAYC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Answerable } from '@serenity-js/core';
|
|
2
|
-
import type { Element } from 'webdriverio';
|
|
3
|
-
import { TargetBuilder } from './TargetBuilder';
|
|
4
|
-
/**
|
|
5
|
-
* @desc
|
|
6
|
-
* Fluent interface to make the instantiation of
|
|
7
|
-
* the {@link @serenity-js/core/lib/screenplay~Question}
|
|
8
|
-
* about a nested {@link Target} more readable.
|
|
9
|
-
*
|
|
10
|
-
* @see {@link Target}
|
|
11
|
-
*
|
|
12
|
-
* @interface
|
|
13
|
-
*/
|
|
14
|
-
export interface NestedTargetBuilder<T> {
|
|
15
|
-
/**
|
|
16
|
-
* @desc
|
|
17
|
-
* Instantiates a {@link @serenity-js/core/lib/screenplay~Question}
|
|
18
|
-
* about a {@link Target}.
|
|
19
|
-
*
|
|
20
|
-
* @param {@serenity-js/core/lib/screenplay~Answerable<Element<'async'>>} parent
|
|
21
|
-
* @returns {TargetBuilder}
|
|
22
|
-
*
|
|
23
|
-
* @see {@link Target}
|
|
24
|
-
* @see {@link TargetBuilder}
|
|
25
|
-
*/
|
|
26
|
-
of: (parent: Answerable<Element<'async'>>) => TargetBuilder<T>;
|
|
27
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NestedTargetBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/questions/NestedTargetBuilder.ts"],"names":[],"mappings":""}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Locator } from './locators';
|
|
2
|
-
/**
|
|
3
|
-
* @desc
|
|
4
|
-
* Fluent interface to make the instantiation of
|
|
5
|
-
* the {@link @serenity-js/core/lib/screenplay~Question}
|
|
6
|
-
* about a {@link Target} more readable.
|
|
7
|
-
*
|
|
8
|
-
* @see {@link Target}
|
|
9
|
-
*
|
|
10
|
-
* @interface
|
|
11
|
-
*/
|
|
12
|
-
export interface TargetBuilder<T> {
|
|
13
|
-
/**
|
|
14
|
-
* @desc
|
|
15
|
-
* Instantiates a {@link @serenity-js/core/lib/screenplay~Question}
|
|
16
|
-
* about a {@link Target}.
|
|
17
|
-
*
|
|
18
|
-
* @param {Locator} locator
|
|
19
|
-
* @returns {@serenity-js/core/lib/screenplay~Question}
|
|
20
|
-
*
|
|
21
|
-
* @see {@link Target}
|
|
22
|
-
* @see {@link Locator}
|
|
23
|
-
*/
|
|
24
|
-
located: (locator: Locator) => T;
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TargetBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/questions/TargetBuilder.ts"],"names":[],"mappings":""}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { Answerable, MetaQuestion, Question } from '@serenity-js/core';
|
|
2
|
-
import type { Element, ElementArray } from 'webdriverio';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Resolves to the visible (i.e. not hidden by CSS) `innerText` of:
|
|
6
|
-
* - a given {@link WebElement}, represented by Answerable<{@link @wdio/types~Element}>
|
|
7
|
-
* - a group of {@link WebElement}s, represented by Answerable<{@link @wdio/types~ElementArray}>
|
|
8
|
-
*
|
|
9
|
-
* The result includes the visible text of any sub-elements, without any leading or trailing whitespace.
|
|
10
|
-
*
|
|
11
|
-
* @example <caption>Example widget</caption>
|
|
12
|
-
* <h1>Shopping list</h1>
|
|
13
|
-
* <ul id="shopping-list">
|
|
14
|
-
* <li>Coffee<li>
|
|
15
|
-
* <li class="bought">Honey<li>
|
|
16
|
-
* <li>Chocolate<li>
|
|
17
|
-
* </ul>
|
|
18
|
-
*
|
|
19
|
-
* @example <caption>Retrieve text of a single element</caption>
|
|
20
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
21
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
22
|
-
* import { BrowseTheWeb, by, Target, Text } from '@serenity-js/webdriverio';
|
|
23
|
-
*
|
|
24
|
-
* const header = () =>
|
|
25
|
-
* Target.the('header').located(by.tagName('h1'))
|
|
26
|
-
*
|
|
27
|
-
* actorCalled('Lisa')
|
|
28
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
29
|
-
* .attemptsTo(
|
|
30
|
-
* Ensure.that(Text.of(header()), equals('Shopping list')),
|
|
31
|
-
* )
|
|
32
|
-
*
|
|
33
|
-
* @example <caption>Retrieve text of a multiple elements</caption>
|
|
34
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
35
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
36
|
-
* import { BrowseTheWeb, by, Target, Text } from '@serenity-js/webdriverio';
|
|
37
|
-
*
|
|
38
|
-
* const shoppingListItems = () =>
|
|
39
|
-
* Target.the('shopping list items').located(by.css('#shopping-list li'))
|
|
40
|
-
*
|
|
41
|
-
* actorCalled('Lisa')
|
|
42
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
43
|
-
* .attemptsTo(
|
|
44
|
-
* Ensure.that(
|
|
45
|
-
* Text.ofAll(shoppingListItems()),
|
|
46
|
-
* equals([ 'Coffee', 'Honey', 'Chocolate' ])
|
|
47
|
-
* ),
|
|
48
|
-
* )
|
|
49
|
-
*
|
|
50
|
-
* @example <caption>Find element with matching text</caption>
|
|
51
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
52
|
-
* import { contain, Ensure } from '@serenity-js/assertions';
|
|
53
|
-
* import { BrowseTheWeb, by, CSSClasses, Target, Text } from '@serenity-js/webdriverio';
|
|
54
|
-
*
|
|
55
|
-
* const shoppingListItemCalled = (name: string) =>
|
|
56
|
-
* Target.the('shopping list items').located(by.css('#shopping-list li'))
|
|
57
|
-
* .where(Text, equals(name))
|
|
58
|
-
* .first()
|
|
59
|
-
*
|
|
60
|
-
* actorCalled('Lisa')
|
|
61
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
62
|
-
* .attemptsTo(
|
|
63
|
-
* Ensure.that(
|
|
64
|
-
* CSSClasses.of(shoppingListItemCalled('Honey)),
|
|
65
|
-
* contain('bought')
|
|
66
|
-
* ),
|
|
67
|
-
* )
|
|
68
|
-
*
|
|
69
|
-
* @public
|
|
70
|
-
* @see {@link Target}
|
|
71
|
-
*/
|
|
72
|
-
export declare class Text {
|
|
73
|
-
/**
|
|
74
|
-
* @desc
|
|
75
|
-
* Retrieves text of a single {@link WebElement},
|
|
76
|
-
* represented by Answerable<{@link @wdio/types~Element}>.
|
|
77
|
-
*
|
|
78
|
-
* @param {Answerable<Element<'async'>>} element
|
|
79
|
-
* @returns {Question<Promise<string>> & MetaQuestion<Answerable<Element<'async'>>, Promise<string>>}
|
|
80
|
-
*
|
|
81
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
82
|
-
*/
|
|
83
|
-
static of(element: Answerable<Element<'async'>>): Question<Promise<string>> & MetaQuestion<Answerable<Element<'async'>>, Promise<string>>;
|
|
84
|
-
/**
|
|
85
|
-
* @desc
|
|
86
|
-
* Retrieves text of a group of {@link WebElement}s,
|
|
87
|
-
* represented by Answerable<{@link @wdio/types~ElementArray}>
|
|
88
|
-
*
|
|
89
|
-
* @param {Answerable<ElementArray>} elements
|
|
90
|
-
* @returns {Question<Promise<string[]>> & MetaQuestion<Answerable<Element<'async'>>, Promise<string[]>>}
|
|
91
|
-
*
|
|
92
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
93
|
-
*/
|
|
94
|
-
static ofAll(elements: Answerable<ElementArray>): Question<Promise<string[]>> & MetaQuestion<Answerable<Element<'async'>>, Promise<string[]>>;
|
|
95
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Text = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const targets_1 = require("./targets");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Resolves to the visible (i.e. not hidden by CSS) `innerText` of:
|
|
9
|
-
* - a given {@link WebElement}, represented by Answerable<{@link @wdio/types~Element}>
|
|
10
|
-
* - a group of {@link WebElement}s, represented by Answerable<{@link @wdio/types~ElementArray}>
|
|
11
|
-
*
|
|
12
|
-
* The result includes the visible text of any sub-elements, without any leading or trailing whitespace.
|
|
13
|
-
*
|
|
14
|
-
* @example <caption>Example widget</caption>
|
|
15
|
-
* <h1>Shopping list</h1>
|
|
16
|
-
* <ul id="shopping-list">
|
|
17
|
-
* <li>Coffee<li>
|
|
18
|
-
* <li class="bought">Honey<li>
|
|
19
|
-
* <li>Chocolate<li>
|
|
20
|
-
* </ul>
|
|
21
|
-
*
|
|
22
|
-
* @example <caption>Retrieve text of a single element</caption>
|
|
23
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
24
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
25
|
-
* import { BrowseTheWeb, by, Target, Text } from '@serenity-js/webdriverio';
|
|
26
|
-
*
|
|
27
|
-
* const header = () =>
|
|
28
|
-
* Target.the('header').located(by.tagName('h1'))
|
|
29
|
-
*
|
|
30
|
-
* actorCalled('Lisa')
|
|
31
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
32
|
-
* .attemptsTo(
|
|
33
|
-
* Ensure.that(Text.of(header()), equals('Shopping list')),
|
|
34
|
-
* )
|
|
35
|
-
*
|
|
36
|
-
* @example <caption>Retrieve text of a multiple elements</caption>
|
|
37
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
38
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
39
|
-
* import { BrowseTheWeb, by, Target, Text } from '@serenity-js/webdriverio';
|
|
40
|
-
*
|
|
41
|
-
* const shoppingListItems = () =>
|
|
42
|
-
* Target.the('shopping list items').located(by.css('#shopping-list li'))
|
|
43
|
-
*
|
|
44
|
-
* actorCalled('Lisa')
|
|
45
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
46
|
-
* .attemptsTo(
|
|
47
|
-
* Ensure.that(
|
|
48
|
-
* Text.ofAll(shoppingListItems()),
|
|
49
|
-
* equals([ 'Coffee', 'Honey', 'Chocolate' ])
|
|
50
|
-
* ),
|
|
51
|
-
* )
|
|
52
|
-
*
|
|
53
|
-
* @example <caption>Find element with matching text</caption>
|
|
54
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
55
|
-
* import { contain, Ensure } from '@serenity-js/assertions';
|
|
56
|
-
* import { BrowseTheWeb, by, CSSClasses, Target, Text } from '@serenity-js/webdriverio';
|
|
57
|
-
*
|
|
58
|
-
* const shoppingListItemCalled = (name: string) =>
|
|
59
|
-
* Target.the('shopping list items').located(by.css('#shopping-list li'))
|
|
60
|
-
* .where(Text, equals(name))
|
|
61
|
-
* .first()
|
|
62
|
-
*
|
|
63
|
-
* actorCalled('Lisa')
|
|
64
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
65
|
-
* .attemptsTo(
|
|
66
|
-
* Ensure.that(
|
|
67
|
-
* CSSClasses.of(shoppingListItemCalled('Honey)),
|
|
68
|
-
* contain('bought')
|
|
69
|
-
* ),
|
|
70
|
-
* )
|
|
71
|
-
*
|
|
72
|
-
* @public
|
|
73
|
-
* @see {@link Target}
|
|
74
|
-
*/
|
|
75
|
-
class Text {
|
|
76
|
-
/**
|
|
77
|
-
* @desc
|
|
78
|
-
* Retrieves text of a single {@link WebElement},
|
|
79
|
-
* represented by Answerable<{@link @wdio/types~Element}>.
|
|
80
|
-
*
|
|
81
|
-
* @param {Answerable<Element<'async'>>} element
|
|
82
|
-
* @returns {Question<Promise<string>> & MetaQuestion<Answerable<Element<'async'>>, Promise<string>>}
|
|
83
|
-
*
|
|
84
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
85
|
-
*/
|
|
86
|
-
static of(element) {
|
|
87
|
-
return new TextOfSingleElement(element);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* @desc
|
|
91
|
-
* Retrieves text of a group of {@link WebElement}s,
|
|
92
|
-
* represented by Answerable<{@link @wdio/types~ElementArray}>
|
|
93
|
-
*
|
|
94
|
-
* @param {Answerable<ElementArray>} elements
|
|
95
|
-
* @returns {Question<Promise<string[]>> & MetaQuestion<Answerable<Element<'async'>>, Promise<string[]>>}
|
|
96
|
-
*
|
|
97
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
98
|
-
*/
|
|
99
|
-
static ofAll(elements) {
|
|
100
|
-
return new TextOfMultipleElements(elements);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
exports.Text = Text;
|
|
104
|
-
class TextOfSingleElement extends core_1.Question {
|
|
105
|
-
constructor(element) {
|
|
106
|
-
super(`the text of ${element}`);
|
|
107
|
-
this.element = element;
|
|
108
|
-
}
|
|
109
|
-
of(parent) {
|
|
110
|
-
return new TextOfSingleElement(new targets_1.TargetNestedElement(parent, this.element));
|
|
111
|
-
}
|
|
112
|
-
answeredBy(actor) {
|
|
113
|
-
return actor.answer(this.element)
|
|
114
|
-
.then(element => element.getText());
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
class TextOfMultipleElements extends core_1.Question {
|
|
118
|
-
constructor(elements) {
|
|
119
|
-
super(`the text of ${elements}`);
|
|
120
|
-
this.elements = elements;
|
|
121
|
-
}
|
|
122
|
-
of(parent) {
|
|
123
|
-
return new TextOfMultipleElements(new targets_1.TargetNestedElements(parent, this.elements));
|
|
124
|
-
}
|
|
125
|
-
async answeredBy(actor) {
|
|
126
|
-
const elements = await actor.answer(this.elements);
|
|
127
|
-
return Promise.all(elements.map(answer => answer.getText()));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
//# sourceMappingURL=Text.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Text.ts"],"names":[],"mappings":";;;AAAA,4CAAwG;AAGxG,uCAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,MAAa,IAAI;IAEb;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,CAAC,OAAqC;QAC3C,OAAO,IAAI,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,CAAC,QAAkC;QAC3C,OAAO,IAAI,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;CACJ;AA7BD,oBA6BC;AAED,MAAM,mBACF,SAAQ,eAAyB;IAGjC,YAA6B,OAAqC;QAC9D,KAAK,CAAC,eAAgB,OAAQ,EAAE,CAAC,CAAC;QADT,YAAO,GAAP,OAAO,CAA8B;IAElE,CAAC;IAED,EAAE,CAAC,MAAoC;QACnC,OAAO,IAAI,mBAAmB,CAAC,IAAI,6BAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,UAAU,CAAC,KAAuC;QAC9C,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;aAC5B,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAA;IAC3C,CAAC;CACJ;AAED,MAAM,sBACF,SAAQ,eAA2B;IAGnC,YAA6B,QAAkC;QAC3D,KAAK,CAAC,eAAgB,QAAS,EAAE,CAAC,CAAC;QADV,aAAQ,GAAR,QAAQ,CAA0B;IAE/D,CAAC;IAED,EAAE,CAAC,MAAoC;QACnC,OAAO,IAAI,sBAAsB,CAAC,IAAI,8BAAoB,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvF,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,KAAuC;QACpD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnD,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACjE,CAAC;CACJ"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, MetaQuestion, Question, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { Element } from 'webdriverio';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Returns the `value` attribute of a given {@link WebElement},
|
|
6
|
-
* represented by Answerable<{@link @wdio/types~Element}>
|
|
7
|
-
*
|
|
8
|
-
* @example <caption>Example widget</caption>
|
|
9
|
-
* <input type="text" id="username" value="Alice" />
|
|
10
|
-
*
|
|
11
|
-
* @example <caption>Retrieve CSS classes of a given WebElement</caption>
|
|
12
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
13
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
14
|
-
* import { BrowseTheWeb, by, Value, Target } from '@serenity-js/webdriverio';
|
|
15
|
-
*
|
|
16
|
-
* const usernameField = () =>
|
|
17
|
-
* Target.the('username field').located(by.id('username'))
|
|
18
|
-
*
|
|
19
|
-
* actorCalled('Lisa')
|
|
20
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
21
|
-
* .attemptsTo(
|
|
22
|
-
* Ensure.that(Value.of(usernameField), equals('Alice')),
|
|
23
|
-
* )
|
|
24
|
-
*
|
|
25
|
-
* @extends {@serenity-js/core/lib/screenplay~Question}
|
|
26
|
-
* @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
27
|
-
*/
|
|
28
|
-
export declare class Value extends Question<Promise<string>> implements MetaQuestion<Answerable<Element<'async'>>, Promise<string>> {
|
|
29
|
-
private readonly element;
|
|
30
|
-
/**
|
|
31
|
-
* @param {Answerable<Element<'async'>>} element
|
|
32
|
-
* @returns {Value}
|
|
33
|
-
*/
|
|
34
|
-
static of(element: Answerable<Element<'async'>>): Question<Promise<string>> & MetaQuestion<Answerable<Element<'async'>>, Promise<string>>;
|
|
35
|
-
/**
|
|
36
|
-
* @param {Answerable<Element<'async'>>} element
|
|
37
|
-
*/
|
|
38
|
-
constructor(element: Answerable<Element<'async'>>);
|
|
39
|
-
/**
|
|
40
|
-
* @desc
|
|
41
|
-
* Resolves to the value of a given [`input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)
|
|
42
|
-
* {@link WebElement}, located in the context of a `parent` element.
|
|
43
|
-
*
|
|
44
|
-
* @param {Answerable<Element<'async'>>} parent
|
|
45
|
-
* @returns {Question<Promise<string>>}
|
|
46
|
-
*
|
|
47
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
48
|
-
*/
|
|
49
|
-
of(parent: Answerable<Element<'async'>>): Question<Promise<string>>;
|
|
50
|
-
/**
|
|
51
|
-
* @desc
|
|
52
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
53
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
54
|
-
*
|
|
55
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
56
|
-
* @returns {Promise<void>}
|
|
57
|
-
*
|
|
58
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
59
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
60
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
61
|
-
*/
|
|
62
|
-
answeredBy(actor: AnswersQuestions & UsesAbilities): Promise<string>;
|
|
63
|
-
}
|