@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,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Value = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
const targets_1 = require("./targets");
|
|
7
|
-
/**
|
|
8
|
-
* @desc
|
|
9
|
-
* Returns the `value` attribute of a given {@link WebElement},
|
|
10
|
-
* represented by Answerable<{@link @wdio/types~Element}>
|
|
11
|
-
*
|
|
12
|
-
* @example <caption>Example widget</caption>
|
|
13
|
-
* <input type="text" id="username" value="Alice" />
|
|
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, Value, Target } from '@serenity-js/webdriverio';
|
|
19
|
-
*
|
|
20
|
-
* const usernameField = () =>
|
|
21
|
-
* Target.the('username field').located(by.id('username'))
|
|
22
|
-
*
|
|
23
|
-
* actorCalled('Lisa')
|
|
24
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
25
|
-
* .attemptsTo(
|
|
26
|
-
* Ensure.that(Value.of(usernameField), equals('Alice')),
|
|
27
|
-
* )
|
|
28
|
-
*
|
|
29
|
-
* @extends {@serenity-js/core/lib/screenplay~Question}
|
|
30
|
-
* @implements {@serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
31
|
-
*/
|
|
32
|
-
class Value extends core_1.Question {
|
|
33
|
-
/**
|
|
34
|
-
* @param {Answerable<Element<'async'>>} element
|
|
35
|
-
*/
|
|
36
|
-
constructor(element) {
|
|
37
|
-
super((0, io_1.formatted) `the value of ${element}`);
|
|
38
|
-
this.element = element;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* @param {Answerable<Element<'async'>>} element
|
|
42
|
-
* @returns {Value}
|
|
43
|
-
*/
|
|
44
|
-
static of(element) {
|
|
45
|
-
return new Value(element);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @desc
|
|
49
|
-
* Resolves to the value of a given [`input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input)
|
|
50
|
-
* {@link WebElement}, located in the context of a `parent` element.
|
|
51
|
-
*
|
|
52
|
-
* @param {Answerable<Element<'async'>>} parent
|
|
53
|
-
* @returns {Question<Promise<string>>}
|
|
54
|
-
*
|
|
55
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
56
|
-
*/
|
|
57
|
-
of(parent) {
|
|
58
|
-
return new Value(new targets_1.TargetNestedElement(parent, this.element));
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* @desc
|
|
62
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
63
|
-
* answer this {@link @serenity-js/core/lib/screenplay~Question}.
|
|
64
|
-
*
|
|
65
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
66
|
-
* @returns {Promise<void>}
|
|
67
|
-
*
|
|
68
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
69
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
70
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
71
|
-
*/
|
|
72
|
-
async answeredBy(actor) {
|
|
73
|
-
const element = await actor.answer(this.element);
|
|
74
|
-
return element.getValue();
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.Value = Value;
|
|
78
|
-
//# sourceMappingURL=Value.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Value.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Value.ts"],"names":[],"mappings":";;;AAAA,4CAAwG;AACxG,iDAAqD;AAGrD,uCAAgD;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,KACT,SAAQ,eAAyB;IAWjC;;OAEG;IACH,YAA6B,OAAqC;QAC9D,KAAK,CAAC,IAAA,cAAS,EAAA,gBAAiB,OAAQ,EAAE,CAAC,CAAC;QADnB,YAAO,GAAP,OAAO,CAA8B;IAElE,CAAC;IAbD;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,OAAqC;QAC3C,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IASD;;;;;;;;;OASG;IACH,EAAE,CAAC,MAAoC;QACnC,OAAO,IAAI,KAAK,CAAC,IAAI,6BAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,UAAU,CAAC,KAAuC;QACpD,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEjD,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;CACJ;AAlDD,sBAkDC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Question } from '@serenity-js/core';
|
|
2
|
-
export declare class Website {
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Retrieves the document title of the current top-level browsing context, equivalent to calling `document.title`.
|
|
6
|
-
*
|
|
7
|
-
* @returns {@serenity-js/core/lib/screenplay~Question<Promise<string>>}
|
|
8
|
-
*
|
|
9
|
-
* @see https://webdriver.io/docs/api/webdriver/#gettitle
|
|
10
|
-
*/
|
|
11
|
-
static title(): Question<Promise<string>>;
|
|
12
|
-
/**
|
|
13
|
-
* @desc
|
|
14
|
-
* Retrieves the URL of the current top-level browsing context.
|
|
15
|
-
*
|
|
16
|
-
* @returns {@serenity-js/core/lib/screenplay~Question<Promise<string>>}
|
|
17
|
-
*
|
|
18
|
-
* @see https://webdriver.io/docs/api/webdriver/#geturl
|
|
19
|
-
*/
|
|
20
|
-
static url(): Question<Promise<string>>;
|
|
21
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Website = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const abilities_1 = require("../abilities");
|
|
6
|
-
class Website {
|
|
7
|
-
/**
|
|
8
|
-
* @desc
|
|
9
|
-
* Retrieves the document title of the current top-level browsing context, equivalent to calling `document.title`.
|
|
10
|
-
*
|
|
11
|
-
* @returns {@serenity-js/core/lib/screenplay~Question<Promise<string>>}
|
|
12
|
-
*
|
|
13
|
-
* @see https://webdriver.io/docs/api/webdriver/#gettitle
|
|
14
|
-
*/
|
|
15
|
-
static title() {
|
|
16
|
-
return core_1.Question.about(`the title of the current page`, actor => abilities_1.BrowseTheWeb.as(actor).browser.getTitle());
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @desc
|
|
20
|
-
* Retrieves the URL of the current top-level browsing context.
|
|
21
|
-
*
|
|
22
|
-
* @returns {@serenity-js/core/lib/screenplay~Question<Promise<string>>}
|
|
23
|
-
*
|
|
24
|
-
* @see https://webdriver.io/docs/api/webdriver/#geturl
|
|
25
|
-
*/
|
|
26
|
-
static url() {
|
|
27
|
-
return core_1.Question.about(`the url of the current page`, actor => abilities_1.BrowseTheWeb.as(actor).browser.getUrl());
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.Website = Website;
|
|
31
|
-
//# sourceMappingURL=Website.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Website.js","sourceRoot":"","sources":["../../../src/screenplay/questions/Website.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAE7C,4CAA4C;AAE5C,MAAa,OAAO;IAEhB;;;;;;;OAOG;IACH,MAAM,CAAC,KAAK;QACR,OAAO,eAAQ,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,EAAE,CAC3D,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,CAC5C,CAAC;IACN,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,GAAG;QACN,OAAO,eAAQ,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,EAAE,CACzD,wBAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAC1C,CAAC;IACN,CAAC;CACJ;AA7BD,0BA6BC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export * from './Attribute';
|
|
2
|
-
export * from './CSSClasses';
|
|
3
|
-
export * from './LastScriptExecution';
|
|
4
|
-
export * from './locators';
|
|
5
|
-
export * from './NestedTargetBuilder';
|
|
6
|
-
export * from './TargetBuilder';
|
|
7
|
-
export * from './targets';
|
|
8
|
-
export * from './Text';
|
|
9
|
-
export * from './Value';
|
|
10
|
-
export * from './Website';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./Attribute"), exports);
|
|
14
|
-
__exportStar(require("./CSSClasses"), exports);
|
|
15
|
-
__exportStar(require("./LastScriptExecution"), exports);
|
|
16
|
-
__exportStar(require("./locators"), exports);
|
|
17
|
-
__exportStar(require("./NestedTargetBuilder"), exports);
|
|
18
|
-
__exportStar(require("./TargetBuilder"), exports);
|
|
19
|
-
__exportStar(require("./targets"), exports);
|
|
20
|
-
__exportStar(require("./Text"), exports);
|
|
21
|
-
__exportStar(require("./Value"), exports);
|
|
22
|
-
__exportStar(require("./Website"), exports);
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/questions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA4B;AAC5B,+CAA6B;AAC7B,wDAAsC;AACtC,6CAA2B;AAC3B,wDAAsC;AACtC,kDAAgC;AAChC,4CAA0B;AAC1B,yCAAuB;AACvB,0CAAwB;AACxB,4CAA0B"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, Expectation, MetaQuestion, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { ListAdapter } from '@serenity-js/core/lib/screenplay/questions/lists';
|
|
3
|
-
import type { Element, ElementArray } from 'webdriverio';
|
|
4
|
-
/**
|
|
5
|
-
* @desc
|
|
6
|
-
* Adapts {@link ElementArray} so that it can be used with {@link @serenity-js/core/lib/screenplay/questions~List}.
|
|
7
|
-
*
|
|
8
|
-
* You most likely won't need to use this class directly. Instead, check out {@link Target} and {@link Target.all}.
|
|
9
|
-
*
|
|
10
|
-
* @see {@link Target}
|
|
11
|
-
*
|
|
12
|
-
* @implements {@serenity-js/core/lib/screenplay/questions/lists~ListAdapter}
|
|
13
|
-
*/
|
|
14
|
-
export declare class ElementArrayListAdapter implements ListAdapter<Promise<Element<'async'>>, Promise<ElementArray>> {
|
|
15
|
-
private readonly collection;
|
|
16
|
-
constructor(collection: Answerable<ElementArray>);
|
|
17
|
-
/**
|
|
18
|
-
* @desc
|
|
19
|
-
* Returns the number of {@link Element}s that the underlying {@link ElementArray} contains,
|
|
20
|
-
* left after applying any filters.
|
|
21
|
-
*
|
|
22
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
23
|
-
* @returns {Promise<number>}
|
|
24
|
-
*/
|
|
25
|
-
count(actor: AnswersQuestions & UsesAbilities): Promise<number>;
|
|
26
|
-
/**
|
|
27
|
-
* @desc
|
|
28
|
-
* Returns the first of {@link Element}s that the underlying {@link ElementArray} contains,
|
|
29
|
-
* left after applying any filters
|
|
30
|
-
*
|
|
31
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
32
|
-
* @returns {Element<'async'>}
|
|
33
|
-
*/
|
|
34
|
-
first(actor: AnswersQuestions & UsesAbilities): Promise<Element<'async'>>;
|
|
35
|
-
/**
|
|
36
|
-
* @desc
|
|
37
|
-
* Returns the last of {@link Element}s that the underlying {@link ElementArray} contains,
|
|
38
|
-
* left after applying any filters
|
|
39
|
-
*
|
|
40
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
41
|
-
* @returns {Element<'async'>}
|
|
42
|
-
*/
|
|
43
|
-
last(actor: AnswersQuestions & UsesAbilities): Promise<Element<'async'>>;
|
|
44
|
-
/**
|
|
45
|
-
* @desc
|
|
46
|
-
* Returns the nth of {@link Element}s that the underlying {@link ElementArray} contains,
|
|
47
|
-
* left after applying any filters
|
|
48
|
-
*
|
|
49
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
50
|
-
*
|
|
51
|
-
* @param {number} index
|
|
52
|
-
* Zero-based index of the item to return
|
|
53
|
-
*
|
|
54
|
-
* @returns {Element<'async'>}
|
|
55
|
-
*/
|
|
56
|
-
get(actor: AnswersQuestions & UsesAbilities, index: number): Promise<Element<'async'>>;
|
|
57
|
-
/**
|
|
58
|
-
* @desc
|
|
59
|
-
* Returns the underlying {@link ElementArray},
|
|
60
|
-
* with any filters applied.
|
|
61
|
-
*
|
|
62
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
63
|
-
* @returns {Element<'async'>}
|
|
64
|
-
*/
|
|
65
|
-
items(actor: AnswersQuestions & UsesAbilities): Promise<ElementArray>;
|
|
66
|
-
/**
|
|
67
|
-
* @desc
|
|
68
|
-
* Filters the underlying {@link ElementArray} so that the result contains only those {@link Element<'async'>}s that meet the {@link Expectation}
|
|
69
|
-
*
|
|
70
|
-
* @param {@serenity-js/core/lib/screenplay/questions~MetaQuestion<Answerable<Element<'async'>>, Promise<Answer_Type> | Answer_Type>} question
|
|
71
|
-
* @param {@serenity-js/core/lib/screenplay/questions~Expectation<any, Answer_Type>} expectation
|
|
72
|
-
*
|
|
73
|
-
* @returns {@serenity-js/core/lib/screenplay/questions/lists~ListAdapter<Element<'async'>, ElementArrayFinder>}
|
|
74
|
-
*
|
|
75
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
76
|
-
*/
|
|
77
|
-
withFilter<Answer_Type>(question: MetaQuestion<Answerable<Element<'async'>>, Promise<Answer_Type> | Answer_Type>, expectation: Expectation<any, Answer_Type>): ListAdapter<Promise<Element<'async'>>, Promise<ElementArray>>;
|
|
78
|
-
/**
|
|
79
|
-
* @desc
|
|
80
|
-
* Returns a human-readable description of the underlying {@link ElementArray}.
|
|
81
|
-
*
|
|
82
|
-
* @returns {string}
|
|
83
|
-
*/
|
|
84
|
-
toString(): string;
|
|
85
|
-
private elements;
|
|
86
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ElementArrayListAdapter = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Adapts {@link ElementArray} so that it can be used with {@link @serenity-js/core/lib/screenplay/questions~List}.
|
|
9
|
-
*
|
|
10
|
-
* You most likely won't need to use this class directly. Instead, check out {@link Target} and {@link Target.all}.
|
|
11
|
-
*
|
|
12
|
-
* @see {@link Target}
|
|
13
|
-
*
|
|
14
|
-
* @implements {@serenity-js/core/lib/screenplay/questions/lists~ListAdapter}
|
|
15
|
-
*/
|
|
16
|
-
class ElementArrayListAdapter {
|
|
17
|
-
constructor(collection) {
|
|
18
|
-
this.collection = collection;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* @desc
|
|
22
|
-
* Returns the number of {@link Element}s that the underlying {@link ElementArray} contains,
|
|
23
|
-
* left after applying any filters.
|
|
24
|
-
*
|
|
25
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
26
|
-
* @returns {Promise<number>}
|
|
27
|
-
*/
|
|
28
|
-
async count(actor) {
|
|
29
|
-
const elements = await this.elements(actor);
|
|
30
|
-
return elements.length;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @desc
|
|
34
|
-
* Returns the first of {@link Element}s that the underlying {@link ElementArray} contains,
|
|
35
|
-
* left after applying any filters
|
|
36
|
-
*
|
|
37
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
38
|
-
* @returns {Element<'async'>}
|
|
39
|
-
*/
|
|
40
|
-
async first(actor) {
|
|
41
|
-
const elements = await this.elements(actor);
|
|
42
|
-
return elements[0];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @desc
|
|
46
|
-
* Returns the last of {@link Element}s that the underlying {@link ElementArray} contains,
|
|
47
|
-
* left after applying any filters
|
|
48
|
-
*
|
|
49
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
50
|
-
* @returns {Element<'async'>}
|
|
51
|
-
*/
|
|
52
|
-
async last(actor) {
|
|
53
|
-
const elements = await this.elements(actor);
|
|
54
|
-
return elements[elements.length - 1];
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* @desc
|
|
58
|
-
* Returns the nth of {@link Element}s that the underlying {@link ElementArray} contains,
|
|
59
|
-
* left after applying any filters
|
|
60
|
-
*
|
|
61
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
62
|
-
*
|
|
63
|
-
* @param {number} index
|
|
64
|
-
* Zero-based index of the item to return
|
|
65
|
-
*
|
|
66
|
-
* @returns {Element<'async'>}
|
|
67
|
-
*/
|
|
68
|
-
async get(actor, index) {
|
|
69
|
-
const elements = await this.elements(actor);
|
|
70
|
-
return elements[index];
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* @desc
|
|
74
|
-
* Returns the underlying {@link ElementArray},
|
|
75
|
-
* with any filters applied.
|
|
76
|
-
*
|
|
77
|
-
* @param {AnswersQuestions & UsesAbilities} actor
|
|
78
|
-
* @returns {Element<'async'>}
|
|
79
|
-
*/
|
|
80
|
-
items(actor) {
|
|
81
|
-
return this.elements(actor);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* @desc
|
|
85
|
-
* Filters the underlying {@link ElementArray} so that the result contains only those {@link Element<'async'>}s that meet the {@link Expectation}
|
|
86
|
-
*
|
|
87
|
-
* @param {@serenity-js/core/lib/screenplay/questions~MetaQuestion<Answerable<Element<'async'>>, Promise<Answer_Type> | Answer_Type>} question
|
|
88
|
-
* @param {@serenity-js/core/lib/screenplay/questions~Expectation<any, Answer_Type>} expectation
|
|
89
|
-
*
|
|
90
|
-
* @returns {@serenity-js/core/lib/screenplay/questions/lists~ListAdapter<Element<'async'>, ElementArrayFinder>}
|
|
91
|
-
*
|
|
92
|
-
* @see {@link @serenity-js/core/lib/screenplay/questions~MetaQuestion}
|
|
93
|
-
*/
|
|
94
|
-
withFilter(question, expectation) {
|
|
95
|
-
return new ElementArrayListAdapter(new ElementArrayListFilter(this.collection, question, expectation));
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* @desc
|
|
99
|
-
* Returns a human-readable description of the underlying {@link ElementArray}.
|
|
100
|
-
*
|
|
101
|
-
* @returns {string}
|
|
102
|
-
*/
|
|
103
|
-
toString() {
|
|
104
|
-
return (0, io_1.formatted) `${this.collection}`;
|
|
105
|
-
}
|
|
106
|
-
elements(actor) {
|
|
107
|
-
return actor.answer(this.collection);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
exports.ElementArrayListAdapter = ElementArrayListAdapter;
|
|
111
|
-
/**
|
|
112
|
-
* @private
|
|
113
|
-
*/
|
|
114
|
-
class ElementArrayListFilter extends core_1.Question {
|
|
115
|
-
constructor(collection, question, expectation) {
|
|
116
|
-
super([
|
|
117
|
-
(0, io_1.formatted) `${collection}`,
|
|
118
|
-
collection instanceof ElementArrayListFilter ? 'and' : 'where',
|
|
119
|
-
(0, io_1.formatted) `${question} does ${expectation}`
|
|
120
|
-
].join(' '));
|
|
121
|
-
this.collection = collection;
|
|
122
|
-
this.question = question;
|
|
123
|
-
this.expectation = expectation;
|
|
124
|
-
}
|
|
125
|
-
async answeredBy(actor) {
|
|
126
|
-
const collection = await actor.answer(this.collection);
|
|
127
|
-
const outcomes = await Promise.all(collection.map((element) => actor.answer(this.question.of(element))
|
|
128
|
-
.then((answer) => this.expectation.answeredBy(actor)(answer))));
|
|
129
|
-
const matching = collection.filter((element, index) => outcomes[index] instanceof core_1.ExpectationMet);
|
|
130
|
-
matching.selector = collection.selector;
|
|
131
|
-
matching.parent = collection.parent;
|
|
132
|
-
matching.foundWith = collection.foundWith;
|
|
133
|
-
matching.props = collection.props;
|
|
134
|
-
return matching;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
//# sourceMappingURL=lists.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lists.js","sourceRoot":"","sources":["../../../src/screenplay/questions/lists.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
import { Question } from '@serenity-js/core';
|
|
2
|
-
import type { Browser, Element, ElementArray, Selector } from 'webdriverio';
|
|
3
|
-
/**
|
|
4
|
-
* @desc
|
|
5
|
-
* Represents a way to retrieve one and multiple Web elements using a given strategy.
|
|
6
|
-
*
|
|
7
|
-
* @see {@link by}
|
|
8
|
-
* @see {@link Locators}
|
|
9
|
-
*/
|
|
10
|
-
export declare class Locator {
|
|
11
|
-
private readonly description;
|
|
12
|
-
private readonly locateOne;
|
|
13
|
-
private readonly locateAll;
|
|
14
|
-
constructor(description: string, locateOne: (browserInstance: Browser<'async'>) => Promise<Element<'async'>>, locateAll: (browserInstance: Browser<'async'>) => Promise<ElementArray>);
|
|
15
|
-
/**
|
|
16
|
-
* @desc
|
|
17
|
-
* Returns a {@link @serenity-js/core/lib/screenplay~Question} that resolves
|
|
18
|
-
* to the first Web element found using a given strategy.
|
|
19
|
-
*
|
|
20
|
-
* @returns {@serenity-js/core/lib/screenplay~Question<Promise<Element<'async'>>>}
|
|
21
|
-
*/
|
|
22
|
-
firstMatching(): Question<Promise<Element<'async'>>>;
|
|
23
|
-
/**
|
|
24
|
-
* @desc
|
|
25
|
-
* Returns a {@link @serenity-js/core/lib/screenplay~Question} that resolves
|
|
26
|
-
* to all the Web elements found using a given strategy.
|
|
27
|
-
*
|
|
28
|
-
* @returns {@serenity-js/core/lib/screenplay~Question<Promise<ElementArray>>}
|
|
29
|
-
*/
|
|
30
|
-
allMatching(): Question<Promise<ElementArray>>;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @desc
|
|
34
|
-
* {@link Locator} factory. You probably want to use {@link by} instead in your tests.
|
|
35
|
-
*/
|
|
36
|
-
export declare class Locators {
|
|
37
|
-
/**
|
|
38
|
-
* @desc
|
|
39
|
-
* Locates elements by their `id` attribute.
|
|
40
|
-
*
|
|
41
|
-
* @example <caption>Example widget</caption>
|
|
42
|
-
* <input id="username" />
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
46
|
-
*
|
|
47
|
-
* const usernameField = Target.the('username field').located(by.id('username'));
|
|
48
|
-
*
|
|
49
|
-
* @param {string} id
|
|
50
|
-
* @returns {Locator}
|
|
51
|
-
*
|
|
52
|
-
* @see {@link Target}
|
|
53
|
-
* @see https://webdriver.io/docs/selectors/#id
|
|
54
|
-
*/
|
|
55
|
-
id(id: string): Locator;
|
|
56
|
-
/**
|
|
57
|
-
* @desc
|
|
58
|
-
* Locates elements using a CSS selector
|
|
59
|
-
*
|
|
60
|
-
* @example <caption>Example widget</caption>
|
|
61
|
-
* <div id="article">
|
|
62
|
-
* <h1>Title</h1>
|
|
63
|
-
* <h2>Section 1</h2>
|
|
64
|
-
* <h2>Section 2</h2>
|
|
65
|
-
* </div>
|
|
66
|
-
*
|
|
67
|
-
* @example <caption>Locating a single element</caption>
|
|
68
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
69
|
-
*
|
|
70
|
-
* const title = Target.the('article title').located(by.css('#article h1'));
|
|
71
|
-
*
|
|
72
|
-
* @example <caption>Locating multiple elements</caption>
|
|
73
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
74
|
-
*
|
|
75
|
-
* const titles = Target.all('section titles').located(by.css('#article h2'));
|
|
76
|
-
*
|
|
77
|
-
* @param {Selector} selector
|
|
78
|
-
* @returns {Locator}
|
|
79
|
-
*
|
|
80
|
-
* @see {@link Target}
|
|
81
|
-
* @see https://webdriver.io/docs/selectors/#css-query-selector
|
|
82
|
-
*/
|
|
83
|
-
css(selector: Selector): Locator;
|
|
84
|
-
/**
|
|
85
|
-
* @desc
|
|
86
|
-
* Locates elements by HTML tag name
|
|
87
|
-
*
|
|
88
|
-
* @example <caption>Example widget</caption>
|
|
89
|
-
* <ul>
|
|
90
|
-
* <li>Item 1</li>
|
|
91
|
-
* <li>Item 2</li>
|
|
92
|
-
* </ul>
|
|
93
|
-
* <span>Total price: £5</span>
|
|
94
|
-
*
|
|
95
|
-
* @example <caption>Locating a single element</caption>
|
|
96
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
97
|
-
*
|
|
98
|
-
* const totalPrice = Target.the('total price').located(by.tagName('span'));
|
|
99
|
-
*
|
|
100
|
-
* @example <caption>Locating multiple elements</caption>
|
|
101
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
102
|
-
*
|
|
103
|
-
* const items = Target.all('shopping basket items').located(by.tagName('li'));
|
|
104
|
-
*
|
|
105
|
-
* @param {string} tagName
|
|
106
|
-
* @returns {Locator}
|
|
107
|
-
*
|
|
108
|
-
* @see {@link Target}
|
|
109
|
-
* @see https://webdriver.io/docs/selectors/#tag-name
|
|
110
|
-
*/
|
|
111
|
-
tagName(tagName: string): Locator;
|
|
112
|
-
/**
|
|
113
|
-
* @desc
|
|
114
|
-
* Locates an HTML anchor element with a specific text in it.
|
|
115
|
-
*
|
|
116
|
-
* @example <caption>Example widget</caption>
|
|
117
|
-
* <a href="https://serenity-js.org">Serenity/JS</a>
|
|
118
|
-
*
|
|
119
|
-
* @example <caption>Locating a single element</caption>
|
|
120
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
121
|
-
*
|
|
122
|
-
* const serenityWebsite = Target.the('Serenity/JS website link').located(by.linkText('Serenity/JS'));
|
|
123
|
-
*
|
|
124
|
-
* @example <caption>Locating multiple elements</caption>
|
|
125
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
126
|
-
*
|
|
127
|
-
* const items = Target.all('Serenity/JS website links').located(by.linkText('Serenity/JS'));
|
|
128
|
-
*
|
|
129
|
-
* @param {string} linkText
|
|
130
|
-
* @returns {Locator}
|
|
131
|
-
*
|
|
132
|
-
* @see {@link Target}
|
|
133
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
|
|
134
|
-
* @see https://webdriver.io/docs/selectors/#link-text
|
|
135
|
-
*/
|
|
136
|
-
linkText(linkText: string): Locator;
|
|
137
|
-
/**
|
|
138
|
-
* @desc
|
|
139
|
-
* Locates an HTML anchor element with which visible text partially matches `partialLinkText`
|
|
140
|
-
*
|
|
141
|
-
* @example <caption>Example widget</caption>
|
|
142
|
-
* <a href="https://serenity-js.org">Serenity/JS</a>
|
|
143
|
-
* <a href="https://serenity-bdd.info/#/">Serenity BDD</a>
|
|
144
|
-
*
|
|
145
|
-
* @example <caption>Locating a single element</caption>
|
|
146
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
147
|
-
*
|
|
148
|
-
* const serenityWebsite = Target.the('Serenity/JS website link').located(by.partialLinkText('JS'));
|
|
149
|
-
*
|
|
150
|
-
* @example <caption>Locating multiple elements</caption>
|
|
151
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
152
|
-
*
|
|
153
|
-
* const serenityWebsites = Target.all('Serenity frameworks').located(by.partialLinkText('Serenity'));
|
|
154
|
-
*
|
|
155
|
-
* @param {string} partialLinkText
|
|
156
|
-
* @returns {Locator}
|
|
157
|
-
*
|
|
158
|
-
* @see {@link Target}
|
|
159
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a
|
|
160
|
-
* @see https://webdriver.io/docs/selectors/#link-text
|
|
161
|
-
*/
|
|
162
|
-
partialLinkText(partialLinkText: string): Locator;
|
|
163
|
-
/**
|
|
164
|
-
* @desc
|
|
165
|
-
* Locates elements using an [XPath](https://developer.mozilla.org/en-US/docs/Web/XPath) selector.
|
|
166
|
-
*
|
|
167
|
-
* Please note that whenever possible you should use {@link Locators#id} and {@link Locators#css} locators
|
|
168
|
-
* instead of XPath to make your tests more robust.
|
|
169
|
-
*
|
|
170
|
-
* @example <caption>Example widget</caption>
|
|
171
|
-
* <div id="article">
|
|
172
|
-
* <h1>Title</h1>
|
|
173
|
-
* <h2>Section 1</h2>
|
|
174
|
-
* <h2>Section 2</h2>
|
|
175
|
-
* </div>
|
|
176
|
-
*
|
|
177
|
-
* @example <caption>Locating a single element</caption>
|
|
178
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
179
|
-
*
|
|
180
|
-
* const title = Target.the('article title').located(by.xpath('//*[@id="article"]/h1'));
|
|
181
|
-
*
|
|
182
|
-
* @example <caption>Locating multiple elements</caption>
|
|
183
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
184
|
-
*
|
|
185
|
-
* const title = Target.the('article title').located(by.xpath('//*[@id="article"]/h2'));
|
|
186
|
-
*
|
|
187
|
-
* @param {string} xpath
|
|
188
|
-
* @returns {Locator}
|
|
189
|
-
*
|
|
190
|
-
* @see {@link Target}
|
|
191
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/XPath
|
|
192
|
-
* @see https://webdriver.io/docs/selectors/#xpath
|
|
193
|
-
*/
|
|
194
|
-
xpath(xpath: string): Locator;
|
|
195
|
-
}
|
|
196
|
-
export declare const by: Locators;
|