@serenity-js/webdriverio 2.32.2 → 3.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -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} +79 -23
- package/lib/screenplay/abilities/{BrowseTheWeb.js → BrowseTheWebWithWebdriverIO.js} +160 -25
- 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/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/WebdriverIONativeElementRoot.d.ts +2 -0
- package/lib/screenplay/{interactions/EnterBuilder.js → models/WebdriverIONativeElementRoot.js} +1 -1
- package/lib/screenplay/models/WebdriverIONativeElementRoot.js.map +1 -0
- package/lib/screenplay/models/WebdriverIOPage.d.ts +24 -0
- package/lib/screenplay/models/WebdriverIOPage.js +98 -0
- package/lib/screenplay/models/WebdriverIOPage.js.map +1 -0
- package/lib/screenplay/models/WebdriverIOPageElement.d.ts +22 -0
- package/lib/screenplay/models/WebdriverIOPageElement.js +75 -0
- package/lib/screenplay/models/WebdriverIOPageElement.js.map +1 -0
- package/lib/screenplay/models/WebdriverIOPageElements.d.ts +15 -0
- package/lib/screenplay/models/WebdriverIOPageElements.js +65 -0
- package/lib/screenplay/models/WebdriverIOPageElements.js.map +1 -0
- package/lib/screenplay/models/index.d.ts +6 -0
- package/lib/{input → screenplay/models}/index.js +6 -1
- package/lib/screenplay/models/index.js.map +1 -0
- package/package.json +22 -32
- 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} +200 -31
- 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/WebdriverIOModalDialog.ts +45 -0
- package/src/screenplay/models/WebdriverIONativeElementRoot.ts +3 -0
- package/src/screenplay/models/WebdriverIOPage.ts +120 -0
- package/src/screenplay/models/WebdriverIOPageElement.ts +92 -0
- package/src/screenplay/models/WebdriverIOPageElements.ts +91 -0
- package/src/screenplay/models/index.ts +6 -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.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 +0 -15
- package/lib/stage/crew/photographer/index.js.map +0 -1
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +0 -28
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +0 -65
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js.map +0 -1
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +0 -18
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +0 -30
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js.map +0 -1
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +0 -17
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +0 -28
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js.map +0 -1
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +0 -19
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +0 -28
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js.map +0 -1
- package/lib/stage/crew/photographer/strategies/index.d.ts +0 -4
- package/lib/stage/crew/photographer/strategies/index.js +0 -17
- package/lib/stage/crew/photographer/strategies/index.js.map +0 -1
- package/lib/stage/index.d.ts +0 -1
- package/lib/stage/index.js +0 -14
- package/lib/stage/index.js.map +0 -1
- package/src/expectations/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,152 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Press = void 0;
|
|
4
|
-
const core_1 = require("@serenity-js/core");
|
|
5
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
-
const input_1 = require("../../input");
|
|
7
|
-
const abilities_1 = require("../abilities");
|
|
8
|
-
const WebElementInteraction_1 = require("./WebElementInteraction");
|
|
9
|
-
/**
|
|
10
|
-
* @desc
|
|
11
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
12
|
-
* send a key press or a sequence of keys to a Web element.
|
|
13
|
-
*
|
|
14
|
-
* *Please note*: On macOS, some keyboard shortcuts might not work with the [`devtools` protocol](https://webdriver.io/docs/automationProtocols/#devtools-protocol).
|
|
15
|
-
*
|
|
16
|
-
* For example:
|
|
17
|
-
* - to *copy*, instead of `Meta+C`, use `Control+Insert`
|
|
18
|
-
* - to *cut*, instead of `Meta+X`, use `Control+Delete`
|
|
19
|
-
* - to *paste*, instead of `Meta+V`, use `Shift+Insert`
|
|
20
|
-
*
|
|
21
|
-
* @example <caption>Example widget</caption>
|
|
22
|
-
* <form>
|
|
23
|
-
* <input type="text" name="example" id="example" />
|
|
24
|
-
* </form>
|
|
25
|
-
*
|
|
26
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
27
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
28
|
-
*
|
|
29
|
-
* class Form {
|
|
30
|
-
* static exampleInput = Target.the('example input')
|
|
31
|
-
* .located(by.id('example'));
|
|
32
|
-
* }
|
|
33
|
-
*
|
|
34
|
-
* @example <caption>Pressing keys</caption>
|
|
35
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
36
|
-
* import { BrowseTheWeb, Key, Press, Value } from '@serenity-js/webdriverio';
|
|
37
|
-
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
38
|
-
*
|
|
39
|
-
* actorCalled('Priyanka')
|
|
40
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
41
|
-
* .attemptsTo(
|
|
42
|
-
* Press.the('H', 'i', '!', Key.ENTER).in(Form.exampleInput),
|
|
43
|
-
* Ensure.that(Value.of(Form.exampleInput), equals('Hi!')),
|
|
44
|
-
* );
|
|
45
|
-
*
|
|
46
|
-
* @see {@link Key}
|
|
47
|
-
* @see {@link BrowseTheWeb}
|
|
48
|
-
* @see {@link Target}
|
|
49
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
50
|
-
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
51
|
-
*
|
|
52
|
-
* @extends {WebElementInteraction}
|
|
53
|
-
*/
|
|
54
|
-
class Press extends WebElementInteraction_1.WebElementInteraction {
|
|
55
|
-
/**
|
|
56
|
-
* @param {Answerable<Array<Key | string>>} keys
|
|
57
|
-
* A sequence of one or more keys to press
|
|
58
|
-
*/
|
|
59
|
-
constructor(keys) {
|
|
60
|
-
super((0, io_1.formatted) `#actor presses ${keys}`);
|
|
61
|
-
this.keys = keys;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* @desc
|
|
65
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
66
|
-
*
|
|
67
|
-
* @param {...keys: Array<Answerable<Key | string | Key[] | string[]>>} keys
|
|
68
|
-
* A sequence of one or more keys to press
|
|
69
|
-
*
|
|
70
|
-
* @returns {PressBuilder}
|
|
71
|
-
*/
|
|
72
|
-
static the(...keys) {
|
|
73
|
-
return new Press(KeySequence.of(keys));
|
|
74
|
-
}
|
|
75
|
-
in(field /* | Question<AlertPromise> | AlertPromise */) {
|
|
76
|
-
return new PressKeyInField(this.keys, field);
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* @desc
|
|
80
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
81
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
82
|
-
*
|
|
83
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
84
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
85
|
-
*
|
|
86
|
-
* @returns {PromiseLike<void>}
|
|
87
|
-
*
|
|
88
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
89
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
90
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
91
|
-
*/
|
|
92
|
-
async performAs(actor) {
|
|
93
|
-
const keys = await actor.answer(this.keys);
|
|
94
|
-
return abilities_1.BrowseTheWeb.as(actor).sendKeys(keys);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
exports.Press = Press;
|
|
98
|
-
class PressKeyInField extends WebElementInteraction_1.WebElementInteraction {
|
|
99
|
-
/**
|
|
100
|
-
* @param {Answerable<Array<Key | string>>} keys
|
|
101
|
-
* A sequence of one or more keys to press
|
|
102
|
-
*
|
|
103
|
-
* @param {Answerable<Element<'async'>>} field
|
|
104
|
-
* Web element to send the keys to
|
|
105
|
-
*/
|
|
106
|
-
constructor(keys, field /* todo | Question<AlertPromise> | AlertPromise */) {
|
|
107
|
-
super((0, io_1.formatted) `#actor presses ${keys} in ${field}`);
|
|
108
|
-
this.keys = keys;
|
|
109
|
-
this.field = field;
|
|
110
|
-
}
|
|
111
|
-
async performAs(actor) {
|
|
112
|
-
const field = await this.resolve(actor, this.field);
|
|
113
|
-
const keys = await actor.answer(this.keys);
|
|
114
|
-
await abilities_1.BrowseTheWeb.as(actor).browser.execute(
|
|
115
|
-
/* istanbul ignore next */
|
|
116
|
-
function focus(element) {
|
|
117
|
-
element.focus();
|
|
118
|
-
}, field);
|
|
119
|
-
return abilities_1.BrowseTheWeb.as(actor).sendKeys(keys);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* @package
|
|
124
|
-
*/
|
|
125
|
-
class KeySequence extends core_1.Question {
|
|
126
|
-
constructor(keys) {
|
|
127
|
-
super(KeySequence.describe(keys));
|
|
128
|
-
this.keys = keys;
|
|
129
|
-
}
|
|
130
|
-
static of(keys) {
|
|
131
|
-
return new KeySequence(keys);
|
|
132
|
-
}
|
|
133
|
-
answeredBy(actor) {
|
|
134
|
-
return Promise.all(this.keys.map(part => actor.answer(part))).then(keys => keys.flat().filter(key => !!key));
|
|
135
|
-
}
|
|
136
|
-
static describe(keys) {
|
|
137
|
-
const prefix = keys.length === 1 ? 'key' : 'keys';
|
|
138
|
-
const description = keys.reduce((acc, key, index) => {
|
|
139
|
-
const separator = input_1.Key.isKey(key) && key.isModifier
|
|
140
|
-
? '-'
|
|
141
|
-
: acc.separator;
|
|
142
|
-
return {
|
|
143
|
-
description: index === 0
|
|
144
|
-
? `${key}`
|
|
145
|
-
: `${acc.description}${acc.separator}${key}`,
|
|
146
|
-
separator,
|
|
147
|
-
};
|
|
148
|
-
}, { description: '', separator: ', ' }).description;
|
|
149
|
-
return `${prefix} ${description}`;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
//# sourceMappingURL=Press.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Press.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Press.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { Answerable } from '@serenity-js/core';
|
|
2
|
-
import { Interaction } from '@serenity-js/core/lib/screenplay';
|
|
3
|
-
import { Element } from 'webdriverio';
|
|
4
|
-
/**
|
|
5
|
-
* @desc
|
|
6
|
-
* Fluent interface to make the instantiation of
|
|
7
|
-
* the {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
8
|
-
* to {@link Press} more readable.
|
|
9
|
-
*
|
|
10
|
-
* @see {@link Press}
|
|
11
|
-
*
|
|
12
|
-
* @interface
|
|
13
|
-
*/
|
|
14
|
-
export interface PressBuilder {
|
|
15
|
-
/**
|
|
16
|
-
* @desc
|
|
17
|
-
* Instantiates an {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
18
|
-
* to {@link Press}.
|
|
19
|
-
*
|
|
20
|
-
* @param {Question<ElementFinder> | ElementFinder | Question<AlertPromise> | AlertPromise} field
|
|
21
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
22
|
-
*
|
|
23
|
-
* @see {@link Target}
|
|
24
|
-
*/
|
|
25
|
-
in: (field: Answerable<Element<'async'>>) => Interaction;
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PressBuilder.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/PressBuilder.ts"],"names":[],"mappings":""}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, Interaction, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { Element } from 'webdriverio';
|
|
3
|
-
import { WebElementInteraction } from './WebElementInteraction';
|
|
4
|
-
/**
|
|
5
|
-
* @desc
|
|
6
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
7
|
-
* perfom a right click on a given Web element.
|
|
8
|
-
*
|
|
9
|
-
* This is typically used to open a [custom context menu](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event)
|
|
10
|
-
* on a given Web element, since it's not possible to interact with the standard context menu offered by your browser
|
|
11
|
-
*
|
|
12
|
-
* @example <caption>Example widget</caption>
|
|
13
|
-
* <form>
|
|
14
|
-
* <input type="text" id="field"
|
|
15
|
-
* oncontextmenu="showMenu(); return false;" />
|
|
16
|
-
*
|
|
17
|
-
* <div id="context-menu" style="display:none">
|
|
18
|
-
* Custom context menu
|
|
19
|
-
* </div>
|
|
20
|
-
* </form>
|
|
21
|
-
*
|
|
22
|
-
* <script>
|
|
23
|
-
* function showMenu() {
|
|
24
|
-
* document.getElementById("context-menu").style.display = 'block';
|
|
25
|
-
* }
|
|
26
|
-
* </script>
|
|
27
|
-
*
|
|
28
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
29
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
30
|
-
*
|
|
31
|
-
* class Form {
|
|
32
|
-
* static exampleInput = Target.the('example input')
|
|
33
|
-
* .located(by.id('example'));
|
|
34
|
-
* static exampleContextMenu = Target.the('example context menu')
|
|
35
|
-
* .located(by.id('context-menu'));
|
|
36
|
-
* }
|
|
37
|
-
*
|
|
38
|
-
* @example <caption>Right-click on an element</caption>
|
|
39
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
40
|
-
* import { BrowseTheWeb, RightClick, isVisible } from '@serenity-js/webdriverio';
|
|
41
|
-
* import { Ensure } from '@serenity-js/assertions';
|
|
42
|
-
*
|
|
43
|
-
* actorCalled('Chloé')
|
|
44
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
45
|
-
* .attemptsTo(
|
|
46
|
-
* RightClick.on(Form.exampleInput),
|
|
47
|
-
* Ensure.that(Form.exampleContextMenu, isVisible()),
|
|
48
|
-
* );
|
|
49
|
-
*
|
|
50
|
-
* @see {@link BrowseTheWeb}
|
|
51
|
-
* @see {@link Target}
|
|
52
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
53
|
-
* @see {@link isVisible}
|
|
54
|
-
*
|
|
55
|
-
* @extends {WebElementInteraction}
|
|
56
|
-
*/
|
|
57
|
-
export declare class RightClick extends WebElementInteraction {
|
|
58
|
-
private readonly target;
|
|
59
|
-
/**
|
|
60
|
-
* @desc
|
|
61
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
62
|
-
*
|
|
63
|
-
* @param {Answerable<Element<'async'>>} target
|
|
64
|
-
* The element to be right-clicked on
|
|
65
|
-
*
|
|
66
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
67
|
-
*/
|
|
68
|
-
static on(target: Answerable<Element<'async'>>): Interaction;
|
|
69
|
-
/**
|
|
70
|
-
* @param {Answerable<Element<'async'>>} target
|
|
71
|
-
* The element to be right-clicked on
|
|
72
|
-
*/
|
|
73
|
-
constructor(target: Answerable<Element<'async'>>);
|
|
74
|
-
/**
|
|
75
|
-
* @desc
|
|
76
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
77
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
78
|
-
*
|
|
79
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
80
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
81
|
-
*
|
|
82
|
-
* @returns {PromiseLike<void>}
|
|
83
|
-
*
|
|
84
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
85
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
86
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
87
|
-
*/
|
|
88
|
-
performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>;
|
|
89
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RightClick = void 0;
|
|
4
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
5
|
-
const WebElementInteraction_1 = require("./WebElementInteraction");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
9
|
-
* perfom a right click on a given Web element.
|
|
10
|
-
*
|
|
11
|
-
* This is typically used to open a [custom context menu](https://developer.mozilla.org/en-US/docs/Web/API/Element/click_event)
|
|
12
|
-
* on a given Web element, since it's not possible to interact with the standard context menu offered by your browser
|
|
13
|
-
*
|
|
14
|
-
* @example <caption>Example widget</caption>
|
|
15
|
-
* <form>
|
|
16
|
-
* <input type="text" id="field"
|
|
17
|
-
* oncontextmenu="showMenu(); return false;" />
|
|
18
|
-
*
|
|
19
|
-
* <div id="context-menu" style="display:none">
|
|
20
|
-
* Custom context menu
|
|
21
|
-
* </div>
|
|
22
|
-
* </form>
|
|
23
|
-
*
|
|
24
|
-
* <script>
|
|
25
|
-
* function showMenu() {
|
|
26
|
-
* document.getElementById("context-menu").style.display = 'block';
|
|
27
|
-
* }
|
|
28
|
-
* </script>
|
|
29
|
-
*
|
|
30
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
31
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
32
|
-
*
|
|
33
|
-
* class Form {
|
|
34
|
-
* static exampleInput = Target.the('example input')
|
|
35
|
-
* .located(by.id('example'));
|
|
36
|
-
* static exampleContextMenu = Target.the('example context menu')
|
|
37
|
-
* .located(by.id('context-menu'));
|
|
38
|
-
* }
|
|
39
|
-
*
|
|
40
|
-
* @example <caption>Right-click on an element</caption>
|
|
41
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
42
|
-
* import { BrowseTheWeb, RightClick, isVisible } from '@serenity-js/webdriverio';
|
|
43
|
-
* import { Ensure } from '@serenity-js/assertions';
|
|
44
|
-
*
|
|
45
|
-
* actorCalled('Chloé')
|
|
46
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
47
|
-
* .attemptsTo(
|
|
48
|
-
* RightClick.on(Form.exampleInput),
|
|
49
|
-
* Ensure.that(Form.exampleContextMenu, isVisible()),
|
|
50
|
-
* );
|
|
51
|
-
*
|
|
52
|
-
* @see {@link BrowseTheWeb}
|
|
53
|
-
* @see {@link Target}
|
|
54
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
55
|
-
* @see {@link isVisible}
|
|
56
|
-
*
|
|
57
|
-
* @extends {WebElementInteraction}
|
|
58
|
-
*/
|
|
59
|
-
class RightClick extends WebElementInteraction_1.WebElementInteraction {
|
|
60
|
-
/**
|
|
61
|
-
* @param {Answerable<Element<'async'>>} target
|
|
62
|
-
* The element to be right-clicked on
|
|
63
|
-
*/
|
|
64
|
-
constructor(target) {
|
|
65
|
-
super((0, io_1.formatted) `#actor right-clicks on ${target}`);
|
|
66
|
-
this.target = target;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* @desc
|
|
70
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
71
|
-
*
|
|
72
|
-
* @param {Answerable<Element<'async'>>} target
|
|
73
|
-
* The element to be right-clicked on
|
|
74
|
-
*
|
|
75
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
76
|
-
*/
|
|
77
|
-
static on(target) {
|
|
78
|
-
return new RightClick(target);
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* @desc
|
|
82
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
83
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
84
|
-
*
|
|
85
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
86
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
87
|
-
*
|
|
88
|
-
* @returns {PromiseLike<void>}
|
|
89
|
-
*
|
|
90
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
91
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
92
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
93
|
-
*/
|
|
94
|
-
async performAs(actor) {
|
|
95
|
-
const element = await this.resolve(actor, this.target);
|
|
96
|
-
return element.click({ button: 'right' });
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.RightClick = RightClick;
|
|
100
|
-
//# sourceMappingURL=RightClick.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RightClick.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/RightClick.ts"],"names":[],"mappings":";;;AACA,iDAAqD;AAGrD,mEAAgE;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,MAAa,UAAW,SAAQ,6CAAqB;IAcjD;;;OAGG;IACH,YAA6B,MAAoC;QAC7D,KAAK,CAAC,IAAA,cAAS,EAAC,0BAA2B,MAAO,EAAE,CAAC,CAAC;QAD7B,WAAM,GAAN,MAAM,CAA8B;IAEjE,CAAC;IAnBD;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,CAAC,MAAoC;QAC1C,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAClC,CAAC;IAUD;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,SAAS,CAAC,KAAuC;QACnD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvD,OAAO,OAAO,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9C,CAAC;CACJ;AAxCD,gCAwCC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Answerable, AnswersQuestions, Interaction, UsesAbilities } from '@serenity-js/core';
|
|
2
|
-
import { Element } from 'webdriverio';
|
|
3
|
-
import { WebElementInteraction } from './WebElementInteraction';
|
|
4
|
-
/**
|
|
5
|
-
* @desc
|
|
6
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
7
|
-
* scroll until a given Web element comes into view.
|
|
8
|
-
*
|
|
9
|
-
* @example <caption>Example widget</caption>
|
|
10
|
-
* <!--
|
|
11
|
-
* an element somewhere at the bottom of the page,
|
|
12
|
-
* outside of the visible area
|
|
13
|
-
* -->
|
|
14
|
-
* <input type="submit" id="submit" />
|
|
15
|
-
*
|
|
16
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
17
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
18
|
-
*
|
|
19
|
-
* class Form {
|
|
20
|
-
* static submitButton = Target.the('submit button')
|
|
21
|
-
* .located(by.id('submit'));
|
|
22
|
-
* }
|
|
23
|
-
*
|
|
24
|
-
* @example <caption>Scrolling to element</caption>
|
|
25
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
26
|
-
* import { Ensure } from '@serenity-js/assertions';
|
|
27
|
-
* import { BrowseTheWeb, Scroll, isVisible } from '@serenity-js/webdriverio';
|
|
28
|
-
*
|
|
29
|
-
* actorCalled('Sara')
|
|
30
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
31
|
-
* .attemptsTo(
|
|
32
|
-
* Scroll.to(Form.submitButton),
|
|
33
|
-
* Ensure.that(Form.submitButton, isVisible()),
|
|
34
|
-
* );
|
|
35
|
-
*
|
|
36
|
-
* @see {@link BrowseTheWeb}
|
|
37
|
-
* @see {@link Target}
|
|
38
|
-
* @see {@link isVisible}
|
|
39
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
40
|
-
*
|
|
41
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
42
|
-
*/
|
|
43
|
-
export declare class Scroll extends WebElementInteraction {
|
|
44
|
-
private readonly target;
|
|
45
|
-
/**
|
|
46
|
-
* @desc
|
|
47
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
48
|
-
*
|
|
49
|
-
* @param {Answerable<Element<'async'>>} target
|
|
50
|
-
* The element to be scrolled to
|
|
51
|
-
*
|
|
52
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
53
|
-
*/
|
|
54
|
-
static to(target: Answerable<Element<'async'>>): Interaction;
|
|
55
|
-
/**
|
|
56
|
-
* @param {Answerable<Element<'async'>>} target
|
|
57
|
-
* The element to be scrolled to
|
|
58
|
-
*/
|
|
59
|
-
constructor(target: Answerable<Element<'async'>>);
|
|
60
|
-
/**
|
|
61
|
-
* @desc
|
|
62
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
63
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
64
|
-
*
|
|
65
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
66
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
67
|
-
*
|
|
68
|
-
* @returns {PromiseLike<void>}
|
|
69
|
-
*
|
|
70
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
71
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
72
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
73
|
-
*/
|
|
74
|
-
performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>;
|
|
75
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Scroll = void 0;
|
|
4
|
-
const io_1 = require("@serenity-js/core/lib/io");
|
|
5
|
-
const WebElementInteraction_1 = require("./WebElementInteraction");
|
|
6
|
-
/**
|
|
7
|
-
* @desc
|
|
8
|
-
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
9
|
-
* scroll until a given Web element comes into view.
|
|
10
|
-
*
|
|
11
|
-
* @example <caption>Example widget</caption>
|
|
12
|
-
* <!--
|
|
13
|
-
* an element somewhere at the bottom of the page,
|
|
14
|
-
* outside of the visible area
|
|
15
|
-
* -->
|
|
16
|
-
* <input type="submit" id="submit" />
|
|
17
|
-
*
|
|
18
|
-
* @example <caption>Lean Page Object describing the widget</caption>
|
|
19
|
-
* import { by, Target } from '@serenity-js/webdriverio';
|
|
20
|
-
*
|
|
21
|
-
* class Form {
|
|
22
|
-
* static submitButton = Target.the('submit button')
|
|
23
|
-
* .located(by.id('submit'));
|
|
24
|
-
* }
|
|
25
|
-
*
|
|
26
|
-
* @example <caption>Scrolling to element</caption>
|
|
27
|
-
* import { actorCalled } from '@serenity-js/core';
|
|
28
|
-
* import { Ensure } from '@serenity-js/assertions';
|
|
29
|
-
* import { BrowseTheWeb, Scroll, isVisible } from '@serenity-js/webdriverio';
|
|
30
|
-
*
|
|
31
|
-
* actorCalled('Sara')
|
|
32
|
-
* .whoCan(BrowseTheWeb.using(browser))
|
|
33
|
-
* .attemptsTo(
|
|
34
|
-
* Scroll.to(Form.submitButton),
|
|
35
|
-
* Ensure.that(Form.submitButton, isVisible()),
|
|
36
|
-
* );
|
|
37
|
-
*
|
|
38
|
-
* @see {@link BrowseTheWeb}
|
|
39
|
-
* @see {@link Target}
|
|
40
|
-
* @see {@link isVisible}
|
|
41
|
-
* @see {@link @serenity-js/assertions~Ensure}
|
|
42
|
-
*
|
|
43
|
-
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
44
|
-
*/
|
|
45
|
-
class Scroll extends WebElementInteraction_1.WebElementInteraction {
|
|
46
|
-
/**
|
|
47
|
-
* @param {Answerable<Element<'async'>>} target
|
|
48
|
-
* The element to be scrolled to
|
|
49
|
-
*/
|
|
50
|
-
constructor(target) {
|
|
51
|
-
super((0, io_1.formatted) `#actor scrolls to ${target}`);
|
|
52
|
-
this.target = target;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* @desc
|
|
56
|
-
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
57
|
-
*
|
|
58
|
-
* @param {Answerable<Element<'async'>>} target
|
|
59
|
-
* The element to be scrolled to
|
|
60
|
-
*
|
|
61
|
-
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
62
|
-
*/
|
|
63
|
-
static to(target) {
|
|
64
|
-
return new Scroll(target);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* @desc
|
|
68
|
-
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
69
|
-
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
70
|
-
*
|
|
71
|
-
* @param {UsesAbilities & AnswersQuestions} actor
|
|
72
|
-
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
73
|
-
*
|
|
74
|
-
* @returns {PromiseLike<void>}
|
|
75
|
-
*
|
|
76
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
77
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
78
|
-
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
79
|
-
*/
|
|
80
|
-
async performAs(actor) {
|
|
81
|
-
const element = await this.resolve(actor, this.target);
|
|
82
|
-
return element.scrollIntoView();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
exports.Scroll = Scroll;
|
|
86
|
-
//# sourceMappingURL=Scroll.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Scroll.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Scroll.ts"],"names":[],"mappings":";;;AACA,iDAAqD;AAGrD,mEAAgE;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAa,MAAO,SAAQ,6CAAqB;IAe7C;;;OAGG;IACH,YAA6B,MAAoC;QAC7D,KAAK,CAAC,IAAA,cAAS,EAAC,qBAAsB,MAAO,EAAE,CAAC,CAAC;QADxB,WAAM,GAAN,MAAM,CAA8B;IAEjE,CAAC;IAnBD;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,CAAC,MAAoC;QAC1C,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAUD;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,SAAS,CAAC,KAAuC;QACnD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACvD,OAAO,OAAO,CAAC,cAAc,EAAE,CAAC;IACpC,CAAC;CACJ;AAzCD,wBAyCC"}
|