@serenity-js/web 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 +50 -0
- package/LICENSE.md +201 -0
- package/NOTICE.md +1 -0
- package/README.md +21 -0
- package/lib/errors/CookieMissingError.d.ts +4 -0
- package/lib/errors/CookieMissingError.js +11 -0
- package/lib/errors/CookieMissingError.js.map +1 -0
- package/lib/errors/index.d.ts +1 -0
- package/lib/errors/index.js +14 -0
- package/lib/errors/index.js.map +1 -0
- package/lib/expectations/ElementExpectation.d.ts +11 -0
- package/lib/expectations/ElementExpectation.js +27 -0
- package/lib/expectations/ElementExpectation.js.map +1 -0
- package/lib/expectations/index.d.ts +6 -0
- package/lib/expectations/index.js +19 -0
- package/lib/expectations/index.js.map +1 -0
- package/lib/expectations/isActive.d.ts +15 -0
- package/lib/expectations/isActive.js +22 -0
- package/lib/expectations/isActive.js.map +1 -0
- package/lib/expectations/isClickable.d.ts +20 -0
- package/lib/expectations/isClickable.js +30 -0
- package/lib/expectations/isClickable.js.map +1 -0
- package/lib/expectations/isEnabled.d.ts +14 -0
- package/lib/expectations/isEnabled.js +20 -0
- package/lib/expectations/isEnabled.js.map +1 -0
- package/lib/expectations/isPresent.d.ts +15 -0
- package/lib/expectations/isPresent.js +22 -0
- package/lib/expectations/isPresent.js.map +1 -0
- package/lib/expectations/isSelected.d.ts +14 -0
- package/lib/expectations/isSelected.js +23 -0
- package/lib/expectations/isSelected.js.map +1 -0
- package/lib/expectations/isVisible.d.ts +14 -0
- package/lib/expectations/isVisible.js +26 -0
- package/lib/expectations/isVisible.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/input/Key.d.ts +73 -0
- package/lib/input/Key.js +84 -0
- package/lib/input/Key.js.map +1 -0
- package/lib/input/index.d.ts +1 -0
- package/lib/input/index.js +14 -0
- package/lib/input/index.js.map +1 -0
- package/lib/screenplay/abilities/BrowseTheWeb.d.ts +58 -0
- package/lib/screenplay/abilities/BrowseTheWeb.js +19 -0
- package/lib/screenplay/abilities/BrowseTheWeb.js.map +1 -0
- package/lib/screenplay/abilities/BrowserCapabilities.d.ts +5 -0
- package/lib/screenplay/abilities/BrowserCapabilities.js +3 -0
- package/lib/screenplay/abilities/BrowserCapabilities.js.map +1 -0
- package/lib/screenplay/abilities/index.d.ts +2 -0
- package/lib/screenplay/abilities/index.js +15 -0
- package/lib/screenplay/abilities/index.js.map +1 -0
- package/lib/screenplay/index.d.ts +4 -0
- package/lib/screenplay/index.js +17 -0
- package/lib/screenplay/index.js.map +1 -0
- package/lib/screenplay/interactions/Clear.d.ts +79 -0
- package/lib/screenplay/interactions/Clear.js +97 -0
- package/lib/screenplay/interactions/Clear.js.map +1 -0
- package/lib/screenplay/interactions/Click.d.ts +73 -0
- package/lib/screenplay/interactions/Click.js +85 -0
- package/lib/screenplay/interactions/Click.js.map +1 -0
- package/lib/screenplay/interactions/DoubleClick.d.ts +90 -0
- package/lib/screenplay/interactions/DoubleClick.js +101 -0
- package/lib/screenplay/interactions/DoubleClick.js.map +1 -0
- package/lib/screenplay/interactions/Enter.d.ts +73 -0
- package/lib/screenplay/interactions/Enter.js +86 -0
- package/lib/screenplay/interactions/Enter.js.map +1 -0
- package/lib/screenplay/interactions/EnterBuilder.d.ts +25 -0
- package/lib/screenplay/interactions/EnterBuilder.js +3 -0
- package/lib/screenplay/interactions/EnterBuilder.js.map +1 -0
- package/lib/screenplay/interactions/ExecuteScript.d.ts +206 -0
- package/lib/screenplay/interactions/ExecuteScript.js +312 -0
- package/lib/screenplay/interactions/ExecuteScript.js.map +1 -0
- package/lib/screenplay/interactions/Hover.d.ts +78 -0
- package/lib/screenplay/interactions/Hover.js +89 -0
- package/lib/screenplay/interactions/Hover.js.map +1 -0
- package/lib/screenplay/interactions/Navigate.d.ts +142 -0
- package/lib/screenplay/interactions/Navigate.js +198 -0
- package/lib/screenplay/interactions/Navigate.js.map +1 -0
- package/lib/screenplay/interactions/PageElementInteraction.d.ts +39 -0
- package/lib/screenplay/interactions/PageElementInteraction.js +54 -0
- package/lib/screenplay/interactions/PageElementInteraction.js.map +1 -0
- package/lib/screenplay/interactions/Press.d.ts +84 -0
- package/lib/screenplay/interactions/Press.js +171 -0
- package/lib/screenplay/interactions/Press.js.map +1 -0
- package/lib/screenplay/interactions/PressBuilder.d.ts +26 -0
- package/lib/screenplay/interactions/PressBuilder.js +3 -0
- package/lib/screenplay/interactions/PressBuilder.js.map +1 -0
- package/lib/screenplay/interactions/RightClick.d.ts +89 -0
- package/lib/screenplay/interactions/RightClick.js +100 -0
- package/lib/screenplay/interactions/RightClick.js.map +1 -0
- package/lib/screenplay/interactions/Scroll.d.ts +83 -0
- package/lib/screenplay/interactions/Scroll.js +97 -0
- package/lib/screenplay/interactions/Scroll.js.map +1 -0
- package/lib/screenplay/interactions/Select.d.ts +212 -0
- package/lib/screenplay/interactions/Select.js +291 -0
- package/lib/screenplay/interactions/Select.js.map +1 -0
- package/lib/screenplay/interactions/SelectBuilder.d.ts +33 -0
- package/lib/screenplay/interactions/SelectBuilder.js +3 -0
- package/lib/screenplay/interactions/SelectBuilder.js.map +1 -0
- package/lib/screenplay/interactions/Switch.d.ts +150 -0
- package/lib/screenplay/interactions/Switch.js +209 -0
- package/lib/screenplay/interactions/Switch.js.map +1 -0
- package/lib/screenplay/interactions/TakeScreenshot.d.ts +67 -0
- package/lib/screenplay/interactions/TakeScreenshot.js +86 -0
- package/lib/screenplay/interactions/TakeScreenshot.js.map +1 -0
- package/lib/screenplay/interactions/Wait.d.ts +143 -0
- package/lib/screenplay/interactions/Wait.js +242 -0
- package/lib/screenplay/interactions/Wait.js.map +1 -0
- package/lib/screenplay/interactions/WaitBuilder.d.ts +32 -0
- package/lib/screenplay/interactions/WaitBuilder.js +3 -0
- package/lib/screenplay/interactions/WaitBuilder.js.map +1 -0
- package/lib/screenplay/interactions/index.d.ts +16 -0
- package/lib/screenplay/interactions/index.js +29 -0
- package/lib/screenplay/interactions/index.js.map +1 -0
- package/lib/screenplay/models/Cookie.d.ts +117 -0
- package/lib/screenplay/models/Cookie.js +176 -0
- package/lib/screenplay/models/Cookie.js.map +1 -0
- package/lib/screenplay/models/CookieData.d.ts +89 -0
- package/lib/screenplay/models/CookieData.js +3 -0
- package/lib/screenplay/models/CookieData.js.map +1 -0
- package/lib/screenplay/models/ModalDialog.d.ts +9 -0
- package/lib/screenplay/models/ModalDialog.js +14 -0
- package/lib/screenplay/models/ModalDialog.js.map +1 -0
- package/lib/screenplay/models/Page.d.ts +83 -0
- package/lib/screenplay/models/Page.js +52 -0
- package/lib/screenplay/models/Page.js.map +1 -0
- package/lib/screenplay/models/PageElement.d.ts +30 -0
- package/lib/screenplay/models/PageElement.js +62 -0
- package/lib/screenplay/models/PageElement.js.map +1 -0
- package/lib/screenplay/models/PageElements.d.ts +20 -0
- package/lib/screenplay/models/PageElements.js +49 -0
- package/lib/screenplay/models/PageElements.js.map +1 -0
- package/lib/screenplay/models/index.d.ts +6 -0
- package/lib/screenplay/models/index.js +19 -0
- package/lib/screenplay/models/index.js.map +1 -0
- package/lib/screenplay/questions/Attribute.d.ts +83 -0
- package/lib/screenplay/questions/Attribute.js +103 -0
- package/lib/screenplay/questions/Attribute.js.map +1 -0
- package/lib/screenplay/questions/CssClasses.d.ts +93 -0
- package/lib/screenplay/questions/CssClasses.js +113 -0
- package/lib/screenplay/questions/CssClasses.js.map +1 -0
- package/lib/screenplay/questions/ElementQuestion.d.ts +34 -0
- package/lib/screenplay/questions/ElementQuestion.js +53 -0
- package/lib/screenplay/questions/ElementQuestion.js.map +1 -0
- package/lib/screenplay/questions/LastScriptExecution.d.ts +14 -0
- package/lib/screenplay/questions/LastScriptExecution.js +22 -0
- package/lib/screenplay/questions/LastScriptExecution.js.map +1 -0
- package/lib/screenplay/questions/Selected.d.ts +185 -0
- package/lib/screenplay/questions/Selected.js +210 -0
- package/lib/screenplay/questions/Selected.js.map +1 -0
- package/lib/screenplay/questions/Text.d.ts +99 -0
- package/lib/screenplay/questions/Text.js +131 -0
- package/lib/screenplay/questions/Text.js.map +1 -0
- package/lib/screenplay/questions/Value.d.ts +64 -0
- package/lib/screenplay/questions/Value.js +78 -0
- package/lib/screenplay/questions/Value.js.map +1 -0
- package/lib/screenplay/questions/index.d.ts +6 -0
- package/lib/screenplay/questions/index.js +19 -0
- package/lib/screenplay/questions/index.js.map +1 -0
- package/lib/stage/crew/index.d.ts +1 -0
- package/lib/stage/crew/index.js +14 -0
- package/lib/stage/crew/index.js.map +1 -0
- package/lib/stage/crew/photographer/Photographer.d.ts +83 -0
- package/lib/stage/crew/photographer/Photographer.js +102 -0
- package/lib/stage/crew/photographer/Photographer.js.map +1 -0
- package/lib/stage/crew/photographer/index.d.ts +2 -0
- package/lib/stage/crew/photographer/index.js +15 -0
- package/lib/stage/crew/photographer/index.js.map +1 -0
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.d.ts +28 -0
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js +81 -0
- package/lib/stage/crew/photographer/strategies/PhotoTakingStrategy.js.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.d.ts +18 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js +30 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.js.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.d.ts +17 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js +28 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfFailures.js.map +1 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.d.ts +19 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js +28 -0
- package/lib/stage/crew/photographer/strategies/TakePhotosOfInteractions.js.map +1 -0
- package/lib/stage/crew/photographer/strategies/index.d.ts +4 -0
- package/lib/stage/crew/photographer/strategies/index.js +17 -0
- package/lib/stage/crew/photographer/strategies/index.js.map +1 -0
- package/lib/stage/index.d.ts +1 -0
- package/lib/stage/index.js +14 -0
- package/lib/stage/index.js.map +1 -0
- package/package.json +85 -0
- package/src/errors/CookieMissingError.ts +7 -0
- package/src/errors/index.ts +1 -0
- package/src/expectations/ElementExpectation.ts +32 -0
- package/src/expectations/index.ts +6 -0
- package/src/expectations/isActive.ts +22 -0
- package/src/expectations/isClickable.ts +32 -0
- package/src/expectations/isEnabled.ts +19 -0
- package/src/expectations/isPresent.ts +21 -0
- package/src/expectations/isSelected.ts +24 -0
- package/src/expectations/isVisible.ts +28 -0
- package/src/index.ts +5 -0
- package/src/input/Key.ts +83 -0
- package/src/input/index.ts +1 -0
- package/src/screenplay/abilities/BrowseTheWeb.ts +89 -0
- package/src/screenplay/abilities/BrowserCapabilities.ts +5 -0
- package/src/screenplay/abilities/index.ts +2 -0
- package/src/screenplay/index.ts +4 -0
- package/src/screenplay/interactions/Clear.ts +102 -0
- package/src/screenplay/interactions/Click.ts +86 -0
- package/src/screenplay/interactions/DoubleClick.ts +102 -0
- package/src/screenplay/interactions/Enter.ts +92 -0
- package/src/screenplay/interactions/EnterBuilder.ts +28 -0
- package/src/screenplay/interactions/ExecuteScript.ts +345 -0
- package/src/screenplay/interactions/Hover.ts +90 -0
- package/src/screenplay/interactions/Navigate.ts +209 -0
- package/src/screenplay/interactions/PageElementInteraction.ts +59 -0
- package/src/screenplay/interactions/Press.ts +194 -0
- package/src/screenplay/interactions/PressBuilder.ts +29 -0
- package/src/screenplay/interactions/RightClick.ts +100 -0
- package/src/screenplay/interactions/Scroll.ts +99 -0
- package/src/screenplay/interactions/Select.ts +317 -0
- package/src/screenplay/interactions/SelectBuilder.ts +36 -0
- package/src/screenplay/interactions/Switch.ts +225 -0
- package/src/screenplay/interactions/TakeScreenshot.ts +89 -0
- package/src/screenplay/interactions/Wait.ts +264 -0
- package/src/screenplay/interactions/WaitBuilder.ts +34 -0
- package/src/screenplay/interactions/index.ts +16 -0
- package/src/screenplay/models/Cookie.ts +219 -0
- package/src/screenplay/models/CookieData.ts +97 -0
- package/src/screenplay/models/ModalDialog.ts +19 -0
- package/src/screenplay/models/Page.ts +147 -0
- package/src/screenplay/models/PageElement.ts +95 -0
- package/src/screenplay/models/PageElements.ts +70 -0
- package/src/screenplay/models/index.ts +6 -0
- package/src/screenplay/questions/Attribute.ts +112 -0
- package/src/screenplay/questions/CssClasses.ts +118 -0
- package/src/screenplay/questions/ElementQuestion.ts +60 -0
- package/src/screenplay/questions/LastScriptExecution.ts +21 -0
- package/src/screenplay/questions/Selected.ts +212 -0
- package/src/screenplay/questions/Text.ts +153 -0
- package/src/screenplay/questions/Value.ts +82 -0
- package/src/screenplay/questions/index.ts +6 -0
- package/src/stage/crew/index.ts +1 -0
- package/src/stage/crew/photographer/Photographer.ts +108 -0
- package/src/stage/crew/photographer/index.ts +2 -0
- package/src/stage/crew/photographer/strategies/PhotoTakingStrategy.ts +116 -0
- package/src/stage/crew/photographer/strategies/TakePhotosBeforeAndAfterInteractions.ts +28 -0
- package/src/stage/crew/photographer/strategies/TakePhotosOfFailures.ts +26 -0
- package/src/stage/crew/photographer/strategies/TakePhotosOfInteractions.ts +26 -0
- package/src/stage/crew/photographer/strategies/index.ts +4 -0
- package/src/stage/index.ts +1 -0
- package/tsconfig.eslint.json +10 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Expectation } from '@serenity-js/core';
|
|
2
|
+
import { PageElement } from '../screenplay';
|
|
3
|
+
/**
|
|
4
|
+
* @desc
|
|
5
|
+
* Expectation that the element is present in the DOM of the page and visible.
|
|
6
|
+
*
|
|
7
|
+
* @returns {@serenity-js/core/lib/screenplay/questions~Expectation<boolean, Element<'async'>>}
|
|
8
|
+
*
|
|
9
|
+
* @see https://webdriver.io/docs/api/element/isDisplayed/
|
|
10
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
11
|
+
* @see {@link @serenity-js/core/lib/screenplay/questions~Check}
|
|
12
|
+
* @see {@link Wait}
|
|
13
|
+
*/
|
|
14
|
+
export declare function isVisible(): Expectation<boolean, PageElement>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isVisible = void 0;
|
|
4
|
+
const assertions_1 = require("@serenity-js/assertions");
|
|
5
|
+
const core_1 = require("@serenity-js/core");
|
|
6
|
+
const ElementExpectation_1 = require("./ElementExpectation");
|
|
7
|
+
const isPresent_1 = require("./isPresent");
|
|
8
|
+
/**
|
|
9
|
+
* @desc
|
|
10
|
+
* Expectation that the element is present in the DOM of the page and visible.
|
|
11
|
+
*
|
|
12
|
+
* @returns {@serenity-js/core/lib/screenplay/questions~Expectation<boolean, Element<'async'>>}
|
|
13
|
+
*
|
|
14
|
+
* @see https://webdriver.io/docs/api/element/isDisplayed/
|
|
15
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
16
|
+
* @see {@link @serenity-js/core/lib/screenplay/questions~Check}
|
|
17
|
+
* @see {@link Wait}
|
|
18
|
+
*/
|
|
19
|
+
function isVisible() {
|
|
20
|
+
return core_1.Expectation.to('become visible').soThatActual((0, assertions_1.and)((0, isPresent_1.isPresent)(), isDisplayed()));
|
|
21
|
+
}
|
|
22
|
+
exports.isVisible = isVisible;
|
|
23
|
+
function isDisplayed() {
|
|
24
|
+
return ElementExpectation_1.ElementExpectation.forElementTo('become displayed', actual => actual.isDisplayed());
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=isVisible.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isVisible.js","sourceRoot":"","sources":["../../src/expectations/isVisible.ts"],"names":[],"mappings":";;;AAAA,wDAA8C;AAC9C,4CAAgD;AAGhD,6DAA0D;AAC1D,2CAAwC;AAExC;;;;;;;;;;GAUG;AACH,SAAgB,SAAS;IACrB,OAAO,kBAAW,CAAC,EAAE,CAAc,gBAAgB,CAAC,CAAC,YAAY,CAAC,IAAA,gBAAG,EACjE,IAAA,qBAAS,GAAE,EACX,WAAW,EAAE,CAChB,CAAC,CAAC;AACP,CAAC;AALD,8BAKC;AAED,SAAS,WAAW;IAChB,OAAO,uCAAkB,CAAC,YAAY,CAAC,kBAAkB,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AAC/F,CAAC"}
|
package/lib/index.d.ts
ADDED
package/lib/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
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("./errors"), exports);
|
|
14
|
+
__exportStar(require("./expectations"), exports);
|
|
15
|
+
__exportStar(require("./input"), exports);
|
|
16
|
+
__exportStar(require("./screenplay"), exports);
|
|
17
|
+
__exportStar(require("./stage"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyB;AACzB,iDAA+B;AAC/B,0CAAwB;AACxB,+CAA6B;AAC7B,0CAAwB"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @desc
|
|
3
|
+
* Represents pressable keys that aren't text to be used with {@link Press}.
|
|
4
|
+
*
|
|
5
|
+
* Note that modifier like Shift, Alt and Meta (a.k.a. Command on Mac) will stay pressed
|
|
6
|
+
*
|
|
7
|
+
* @enum {string}
|
|
8
|
+
* @see {@link Press}
|
|
9
|
+
* @see https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions
|
|
10
|
+
* @see https://github.com/puppeteer/puppeteer/blob/v7.1.0/src/common/USKeyboardLayout.ts
|
|
11
|
+
* @see https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/node/selenium-webdriver/lib/input.js#L46
|
|
12
|
+
* @see https://github.com/webdriverio/webdriverio/blob/main/packages/wdio-utils/src/constants.ts#L5
|
|
13
|
+
*/
|
|
14
|
+
export declare class Key {
|
|
15
|
+
readonly devtoolsName: string;
|
|
16
|
+
readonly utf16codePoint: string;
|
|
17
|
+
readonly isModifier: boolean;
|
|
18
|
+
static Alt: Key;
|
|
19
|
+
static ArrowDown: Key;
|
|
20
|
+
static ArrowLeft: Key;
|
|
21
|
+
static ArrowRight: Key;
|
|
22
|
+
static ArrowUp: Key;
|
|
23
|
+
static Backspace: Key;
|
|
24
|
+
static Cancel: Key;
|
|
25
|
+
static Clear: Key;
|
|
26
|
+
static Control: Key;
|
|
27
|
+
static Delete: Key;
|
|
28
|
+
static End: Key;
|
|
29
|
+
static Enter: Key;
|
|
30
|
+
static Escape: Key;
|
|
31
|
+
static F1: Key;
|
|
32
|
+
static F2: Key;
|
|
33
|
+
static F3: Key;
|
|
34
|
+
static F4: Key;
|
|
35
|
+
static F5: Key;
|
|
36
|
+
static F6: Key;
|
|
37
|
+
static F7: Key;
|
|
38
|
+
static F8: Key;
|
|
39
|
+
static F9: Key;
|
|
40
|
+
static F10: Key;
|
|
41
|
+
static F11: Key;
|
|
42
|
+
static F12: Key;
|
|
43
|
+
static Help: Key;
|
|
44
|
+
static Home: Key;
|
|
45
|
+
static Insert: Key;
|
|
46
|
+
static Meta: Key;
|
|
47
|
+
static Numpad0: Key;
|
|
48
|
+
static Numpad1: Key;
|
|
49
|
+
static Numpad2: Key;
|
|
50
|
+
static Numpad3: Key;
|
|
51
|
+
static Numpad4: Key;
|
|
52
|
+
static Numpad5: Key;
|
|
53
|
+
static Numpad6: Key;
|
|
54
|
+
static Numpad7: Key;
|
|
55
|
+
static Numpad8: Key;
|
|
56
|
+
static Numpad9: Key;
|
|
57
|
+
static NumpadAdd: Key;
|
|
58
|
+
static NumpadDecimal: Key;
|
|
59
|
+
static NumpadDivide: Key;
|
|
60
|
+
static NumpadEqual: Key;
|
|
61
|
+
static NumpadMultiply: Key;
|
|
62
|
+
static NumpadSubtract: Key;
|
|
63
|
+
static PageDown: Key;
|
|
64
|
+
static PageUp: Key;
|
|
65
|
+
static Pause: Key;
|
|
66
|
+
static Semicolon: Key;
|
|
67
|
+
static Shift: Key;
|
|
68
|
+
static Space: Key;
|
|
69
|
+
static Tab: Key;
|
|
70
|
+
static isKey(maybeKey: unknown): maybeKey is Key;
|
|
71
|
+
constructor(devtoolsName: string, utf16codePoint: string, isModifier?: boolean);
|
|
72
|
+
toString(): string;
|
|
73
|
+
}
|
package/lib/input/Key.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Key = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @desc
|
|
6
|
+
* Represents pressable keys that aren't text to be used with {@link Press}.
|
|
7
|
+
*
|
|
8
|
+
* Note that modifier like Shift, Alt and Meta (a.k.a. Command on Mac) will stay pressed
|
|
9
|
+
*
|
|
10
|
+
* @enum {string}
|
|
11
|
+
* @see {@link Press}
|
|
12
|
+
* @see https://w3c.github.io/webdriver/webdriver-spec.html#keyboard-actions
|
|
13
|
+
* @see https://github.com/puppeteer/puppeteer/blob/v7.1.0/src/common/USKeyboardLayout.ts
|
|
14
|
+
* @see https://github.com/SeleniumHQ/selenium/blob/trunk/javascript/node/selenium-webdriver/lib/input.js#L46
|
|
15
|
+
* @see https://github.com/webdriverio/webdriverio/blob/main/packages/wdio-utils/src/constants.ts#L5
|
|
16
|
+
*/
|
|
17
|
+
class Key {
|
|
18
|
+
constructor(devtoolsName, utf16codePoint, isModifier = false) {
|
|
19
|
+
this.devtoolsName = devtoolsName;
|
|
20
|
+
this.utf16codePoint = utf16codePoint;
|
|
21
|
+
this.isModifier = isModifier;
|
|
22
|
+
}
|
|
23
|
+
static isKey(maybeKey) {
|
|
24
|
+
return !!maybeKey
|
|
25
|
+
&& maybeKey instanceof Key;
|
|
26
|
+
}
|
|
27
|
+
toString() {
|
|
28
|
+
return this.devtoolsName.replace(/([a-z])([\dA-Z])/g, '$1 $2');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.Key = Key;
|
|
32
|
+
Key.Alt = new Key('Alt', '\uE00A', true);
|
|
33
|
+
Key.ArrowDown = new Key('ArrowDown', '\uE015');
|
|
34
|
+
Key.ArrowLeft = new Key('ArrowLeft', '\uE012');
|
|
35
|
+
Key.ArrowRight = new Key('ArrowRight', '\uE014');
|
|
36
|
+
Key.ArrowUp = new Key('ArrowUp', '\uE013');
|
|
37
|
+
Key.Backspace = new Key('Backspace', '\uE003');
|
|
38
|
+
Key.Cancel = new Key('Cancel', '\uE001');
|
|
39
|
+
Key.Clear = new Key('Clear', '\uE005');
|
|
40
|
+
Key.Control = new Key('Control', '\uE009', true);
|
|
41
|
+
Key.Delete = new Key('Delete', '\uE017');
|
|
42
|
+
Key.End = new Key('End', '\uE010');
|
|
43
|
+
Key.Enter = new Key('Enter', '\uE007');
|
|
44
|
+
Key.Escape = new Key('Escape', '\uE00C');
|
|
45
|
+
Key.F1 = new Key('F1', '\uE031');
|
|
46
|
+
Key.F2 = new Key('F2', '\uE032');
|
|
47
|
+
Key.F3 = new Key('F3', '\uE033');
|
|
48
|
+
Key.F4 = new Key('F4', '\uE034');
|
|
49
|
+
Key.F5 = new Key('F5', '\uE035');
|
|
50
|
+
Key.F6 = new Key('F6', '\uE036');
|
|
51
|
+
Key.F7 = new Key('F7', '\uE037');
|
|
52
|
+
Key.F8 = new Key('F8', '\uE038');
|
|
53
|
+
Key.F9 = new Key('F9', '\uE039');
|
|
54
|
+
Key.F10 = new Key('F10', '\uE03A');
|
|
55
|
+
Key.F11 = new Key('F11', '\uE03B');
|
|
56
|
+
Key.F12 = new Key('F12', '\uE03C');
|
|
57
|
+
Key.Help = new Key('Help', '\uE002');
|
|
58
|
+
Key.Home = new Key('Home', '\uE011');
|
|
59
|
+
Key.Insert = new Key('Insert', '\uE016');
|
|
60
|
+
Key.Meta = new Key('Meta', '\uE03D', true);
|
|
61
|
+
Key.Numpad0 = new Key('Numpad0', '\uE01A');
|
|
62
|
+
Key.Numpad1 = new Key('Numpad1', '\uE01B');
|
|
63
|
+
Key.Numpad2 = new Key('Numpad2', '\uE01C');
|
|
64
|
+
Key.Numpad3 = new Key('Numpad3', '\uE01D');
|
|
65
|
+
Key.Numpad4 = new Key('Numpad4', '\uE01E');
|
|
66
|
+
Key.Numpad5 = new Key('Numpad5', '\uE01F');
|
|
67
|
+
Key.Numpad6 = new Key('Numpad6', '\uE020');
|
|
68
|
+
Key.Numpad7 = new Key('Numpad7', '\uE021');
|
|
69
|
+
Key.Numpad8 = new Key('Numpad8', '\uE022');
|
|
70
|
+
Key.Numpad9 = new Key('Numpad9', '\uE023');
|
|
71
|
+
Key.NumpadAdd = new Key('NumpadAdd', '\uE025');
|
|
72
|
+
Key.NumpadDecimal = new Key('NumpadDecimal', '\uE028');
|
|
73
|
+
Key.NumpadDivide = new Key('NumpadDivide', '\uE029');
|
|
74
|
+
Key.NumpadEqual = new Key('NumpadEqual', '\uE019');
|
|
75
|
+
Key.NumpadMultiply = new Key('NumpadMultiply', '\uE024');
|
|
76
|
+
Key.NumpadSubtract = new Key('NumpadSubtract', '\uE027');
|
|
77
|
+
Key.PageDown = new Key('PageDown', '\uE00F');
|
|
78
|
+
Key.PageUp = new Key('PageUp', '\uE00E');
|
|
79
|
+
Key.Pause = new Key('Pause', '\uE00B');
|
|
80
|
+
Key.Semicolon = new Key('Semicolon', '\uE018');
|
|
81
|
+
Key.Shift = new Key('Shift', '\uE008', true);
|
|
82
|
+
Key.Space = new Key('Space', '\uE00D');
|
|
83
|
+
Key.Tab = new Key('Tab', '\uE004');
|
|
84
|
+
//# sourceMappingURL=Key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Key.js","sourceRoot":"","sources":["../../src/input/Key.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Key';
|
|
@@ -0,0 +1,14 @@
|
|
|
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("./Key"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/input/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wCAAsB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Ability, Duration, UsesAbilities } from '@serenity-js/core';
|
|
2
|
+
import { Key } from '../../input';
|
|
3
|
+
import { Cookie, CookieData, ModalDialog, Page, PageElement, PageElements } from '../models';
|
|
4
|
+
import { BrowserCapabilities } from './BrowserCapabilities';
|
|
5
|
+
export declare abstract class BrowseTheWeb implements Ability {
|
|
6
|
+
/**
|
|
7
|
+
* @desc
|
|
8
|
+
* Used to access the Actor's ability to {@link BrowseTheWeb}
|
|
9
|
+
* from within the {@link @serenity-js/core/lib/screenplay~Interaction} classes,
|
|
10
|
+
* such as {@link Click}.
|
|
11
|
+
*
|
|
12
|
+
* @param {@serenity-js/core/lib/screenplay/actor~UsesAbilities} actor
|
|
13
|
+
* @return {BrowseTheWeb}
|
|
14
|
+
*/
|
|
15
|
+
static as(actor: UsesAbilities): BrowseTheWeb;
|
|
16
|
+
abstract navigateTo(destination: string): Promise<void>;
|
|
17
|
+
abstract navigateBack(): Promise<void>;
|
|
18
|
+
abstract navigateForward(): Promise<void>;
|
|
19
|
+
abstract reloadPage(): Promise<void>;
|
|
20
|
+
abstract waitFor(duration: Duration): Promise<void>;
|
|
21
|
+
abstract waitUntil(condition: () => boolean | Promise<boolean>, timeout: Duration): Promise<void>;
|
|
22
|
+
abstract findByCss(selector: string): PageElement;
|
|
23
|
+
abstract findByCssContainingText(selector: string, text: string): PageElement;
|
|
24
|
+
abstract findById(selector: string): PageElement;
|
|
25
|
+
abstract findByTagName(selector: string): PageElement;
|
|
26
|
+
abstract findByXPath(selector: string): PageElement;
|
|
27
|
+
abstract findAllByCss(selector: string): PageElements;
|
|
28
|
+
abstract findAllByTagName(selector: string): PageElements;
|
|
29
|
+
abstract findAllByXPath(selector: string): PageElements;
|
|
30
|
+
abstract browserCapabilities(): Promise<BrowserCapabilities>;
|
|
31
|
+
abstract sendKeys(keys: Array<Key | string>): Promise<void>;
|
|
32
|
+
abstract executeScript<Result, InnerArguments extends any[]>(script: string | ((...parameters: InnerArguments) => Result), ...args: InnerArguments): Promise<Result>;
|
|
33
|
+
abstract executeAsyncScript<Result, Parameters extends any[]>(script: string | ((...args: [...parameters: Parameters, callback: (result: Result) => void]) => void), ...args: Parameters): Promise<Result>;
|
|
34
|
+
abstract lastScriptExecutionResult<R = any>(): R;
|
|
35
|
+
abstract takeScreenshot(): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* @desc
|
|
38
|
+
* Returns a {@link Page} representing the currently active top-level browsing context.
|
|
39
|
+
*
|
|
40
|
+
* @returns {Promise<Page>}
|
|
41
|
+
*/
|
|
42
|
+
abstract currentPage(): Promise<Page>;
|
|
43
|
+
/**
|
|
44
|
+
* @desc
|
|
45
|
+
* Returns an array of {@link Page} objects representing all the available
|
|
46
|
+
* top-level browsing context, e.g. all the open browser tabs.
|
|
47
|
+
*
|
|
48
|
+
* @returns {Promise<Array<Page>>}
|
|
49
|
+
*/
|
|
50
|
+
abstract allPages(): Promise<Array<Page>>;
|
|
51
|
+
abstract cookie(name: string): Promise<Cookie>;
|
|
52
|
+
abstract setCookie(cookieData: CookieData): Promise<void>;
|
|
53
|
+
abstract deleteAllCookies(): Promise<void>;
|
|
54
|
+
abstract modalDialog(): Promise<ModalDialog>;
|
|
55
|
+
abstract switchToFrame(targetOrIndex: PageElement | number | string): Promise<void>;
|
|
56
|
+
abstract switchToParentFrame(): Promise<void>;
|
|
57
|
+
abstract switchToDefaultContent(): Promise<void>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BrowseTheWeb = void 0;
|
|
4
|
+
class BrowseTheWeb {
|
|
5
|
+
/**
|
|
6
|
+
* @desc
|
|
7
|
+
* Used to access the Actor's ability to {@link BrowseTheWeb}
|
|
8
|
+
* from within the {@link @serenity-js/core/lib/screenplay~Interaction} classes,
|
|
9
|
+
* such as {@link Click}.
|
|
10
|
+
*
|
|
11
|
+
* @param {@serenity-js/core/lib/screenplay/actor~UsesAbilities} actor
|
|
12
|
+
* @return {BrowseTheWeb}
|
|
13
|
+
*/
|
|
14
|
+
static as(actor) {
|
|
15
|
+
return actor.abilityTo(BrowseTheWeb);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.BrowseTheWeb = BrowseTheWeb;
|
|
19
|
+
//# sourceMappingURL=BrowseTheWeb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowseTheWeb.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/BrowseTheWeb.ts"],"names":[],"mappings":";;;AAMA,MAAsB,YAAY;IAC9B;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,CAAC,KAAoB;QAC1B,OAAO,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACzC,CAAC;CAqEJ;AAjFD,oCAiFC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserCapabilities.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/BrowserCapabilities.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
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("./BrowserCapabilities"), exports);
|
|
14
|
+
__exportStar(require("./BrowseTheWeb"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/screenplay/abilities/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wDAAsC;AACtC,iDAA+B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
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("./abilities"), exports);
|
|
14
|
+
__exportStar(require("./interactions"), exports);
|
|
15
|
+
__exportStar(require("./models"), exports);
|
|
16
|
+
__exportStar(require("./questions"), exports);
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/screenplay/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,8CAA4B;AAC5B,iDAA+B;AAC/B,2CAAyB;AACzB,8CAA4B"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Answerable, AnswersQuestions, Interaction, UsesAbilities } from '@serenity-js/core';
|
|
2
|
+
import { PageElement } from '../models';
|
|
3
|
+
import { PageElementInteraction } from './PageElementInteraction';
|
|
4
|
+
/**
|
|
5
|
+
* @desc
|
|
6
|
+
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
7
|
+
* clear the `value` of a [form `input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
8
|
+
*
|
|
9
|
+
* @example <caption>Example widget</caption>
|
|
10
|
+
* <form>
|
|
11
|
+
* <input type="text" name="example" id="example" />
|
|
12
|
+
* </form>
|
|
13
|
+
*
|
|
14
|
+
* @example <caption>Lean Page Object describing the widget</caption>
|
|
15
|
+
* import { by, Target } from '@serenity-js/webdriverio';
|
|
16
|
+
*
|
|
17
|
+
* class Form {
|
|
18
|
+
* static exampleInput = Target.the('example input')
|
|
19
|
+
* .located(by.id('example'));
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* @example <caption>Clearing the value of an input field</caption>
|
|
23
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
24
|
+
* import { BrowseTheWeb, Clear, Enter, Value } from '@serenity-js/webdriverio';
|
|
25
|
+
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
26
|
+
*
|
|
27
|
+
* actorCalled('Inés')
|
|
28
|
+
* .whoCan(BrowseTheWeb.using(browser))
|
|
29
|
+
* .attemptsTo(
|
|
30
|
+
* Enter.theValue('Hello world!').into(Form.exampleInput),
|
|
31
|
+
* Ensure.that(Value.of(Form.exampleInput), equals('Hello world!')),
|
|
32
|
+
*
|
|
33
|
+
* Clear.theValueOf(Form.exampleInput),
|
|
34
|
+
* Ensure.that(Value.of(Form.exampleInput), equals('')),
|
|
35
|
+
* );
|
|
36
|
+
*
|
|
37
|
+
* @see {@link BrowseTheWeb}
|
|
38
|
+
* @see {@link Enter}
|
|
39
|
+
* @see {@link Value}
|
|
40
|
+
* @see {@link Target}
|
|
41
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
42
|
+
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
43
|
+
*
|
|
44
|
+
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
45
|
+
*/
|
|
46
|
+
export declare class Clear extends PageElementInteraction {
|
|
47
|
+
private readonly field;
|
|
48
|
+
/**
|
|
49
|
+
* @desc
|
|
50
|
+
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
51
|
+
*
|
|
52
|
+
* @param {Answerable<PageElement>} field
|
|
53
|
+
* The field to be cleared
|
|
54
|
+
*
|
|
55
|
+
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
56
|
+
*/
|
|
57
|
+
static theValueOf(field: Answerable<PageElement>): Interaction;
|
|
58
|
+
/**
|
|
59
|
+
* @param {Answerable<PageElement>} field
|
|
60
|
+
* The element to be clicked on
|
|
61
|
+
*/
|
|
62
|
+
constructor(field: Answerable<PageElement>);
|
|
63
|
+
/**
|
|
64
|
+
* @desc
|
|
65
|
+
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
66
|
+
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
67
|
+
*
|
|
68
|
+
* @param {UsesAbilities & AnswersQuestions} actor
|
|
69
|
+
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
70
|
+
*
|
|
71
|
+
* @returns {PromiseLike<void>}
|
|
72
|
+
*
|
|
73
|
+
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
74
|
+
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
75
|
+
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
76
|
+
*/
|
|
77
|
+
performAs(actor: UsesAbilities & AnswersQuestions): Promise<void>;
|
|
78
|
+
private capitaliseFirstLetter;
|
|
79
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Clear = void 0;
|
|
4
|
+
const core_1 = require("@serenity-js/core");
|
|
5
|
+
const io_1 = require("@serenity-js/core/lib/io");
|
|
6
|
+
const PageElementInteraction_1 = require("./PageElementInteraction");
|
|
7
|
+
/**
|
|
8
|
+
* @desc
|
|
9
|
+
* Instructs the {@link @serenity-js/core/lib/screenplay/actor~Actor} to
|
|
10
|
+
* clear the `value` of a [form `input`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).
|
|
11
|
+
*
|
|
12
|
+
* @example <caption>Example widget</caption>
|
|
13
|
+
* <form>
|
|
14
|
+
* <input type="text" name="example" id="example" />
|
|
15
|
+
* </form>
|
|
16
|
+
*
|
|
17
|
+
* @example <caption>Lean Page Object describing the widget</caption>
|
|
18
|
+
* import { by, Target } from '@serenity-js/webdriverio';
|
|
19
|
+
*
|
|
20
|
+
* class Form {
|
|
21
|
+
* static exampleInput = Target.the('example input')
|
|
22
|
+
* .located(by.id('example'));
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* @example <caption>Clearing the value of an input field</caption>
|
|
26
|
+
* import { actorCalled } from '@serenity-js/core';
|
|
27
|
+
* import { BrowseTheWeb, Clear, Enter, Value } from '@serenity-js/webdriverio';
|
|
28
|
+
* import { Ensure, equals } from '@serenity-js/assertions';
|
|
29
|
+
*
|
|
30
|
+
* actorCalled('Inés')
|
|
31
|
+
* .whoCan(BrowseTheWeb.using(browser))
|
|
32
|
+
* .attemptsTo(
|
|
33
|
+
* Enter.theValue('Hello world!').into(Form.exampleInput),
|
|
34
|
+
* Ensure.that(Value.of(Form.exampleInput), equals('Hello world!')),
|
|
35
|
+
*
|
|
36
|
+
* Clear.theValueOf(Form.exampleInput),
|
|
37
|
+
* Ensure.that(Value.of(Form.exampleInput), equals('')),
|
|
38
|
+
* );
|
|
39
|
+
*
|
|
40
|
+
* @see {@link BrowseTheWeb}
|
|
41
|
+
* @see {@link Enter}
|
|
42
|
+
* @see {@link Value}
|
|
43
|
+
* @see {@link Target}
|
|
44
|
+
* @see {@link @serenity-js/assertions~Ensure}
|
|
45
|
+
* @see {@link @serenity-js/assertions/lib/expectations~equals}
|
|
46
|
+
*
|
|
47
|
+
* @extends {@serenity-js/core/lib/screenplay~Interaction}
|
|
48
|
+
*/
|
|
49
|
+
class Clear extends PageElementInteraction_1.PageElementInteraction {
|
|
50
|
+
/**
|
|
51
|
+
* @param {Answerable<PageElement>} field
|
|
52
|
+
* The element to be clicked on
|
|
53
|
+
*/
|
|
54
|
+
constructor(field) {
|
|
55
|
+
super((0, io_1.formatted) `#actor clears the value of ${field}`);
|
|
56
|
+
this.field = field;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* @desc
|
|
60
|
+
* Instantiates this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
61
|
+
*
|
|
62
|
+
* @param {Answerable<PageElement>} field
|
|
63
|
+
* The field to be cleared
|
|
64
|
+
*
|
|
65
|
+
* @returns {@serenity-js/core/lib/screenplay~Interaction}
|
|
66
|
+
*/
|
|
67
|
+
static theValueOf(field) {
|
|
68
|
+
return new Clear(field);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* @desc
|
|
72
|
+
* Makes the provided {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
73
|
+
* perform this {@link @serenity-js/core/lib/screenplay~Interaction}.
|
|
74
|
+
*
|
|
75
|
+
* @param {UsesAbilities & AnswersQuestions} actor
|
|
76
|
+
* An {@link @serenity-js/core/lib/screenplay/actor~Actor} to perform this {@link @serenity-js/core/lib/screenplay~Interaction}
|
|
77
|
+
*
|
|
78
|
+
* @returns {PromiseLike<void>}
|
|
79
|
+
*
|
|
80
|
+
* @see {@link @serenity-js/core/lib/screenplay/actor~Actor}
|
|
81
|
+
* @see {@link @serenity-js/core/lib/screenplay/actor~UsesAbilities}
|
|
82
|
+
* @see {@link @serenity-js/core/lib/screenplay/actor~AnswersQuestions}
|
|
83
|
+
*/
|
|
84
|
+
async performAs(actor) {
|
|
85
|
+
const element = await this.resolve(actor, this.field);
|
|
86
|
+
const value = await element.value();
|
|
87
|
+
if (value === null || value === undefined) {
|
|
88
|
+
throw new core_1.LogicError(this.capitaliseFirstLetter((0, io_1.formatted) `${this.field} doesn't seem to have a 'value' attribute that could be cleared.`));
|
|
89
|
+
}
|
|
90
|
+
return element.clearValue();
|
|
91
|
+
}
|
|
92
|
+
capitaliseFirstLetter(text) {
|
|
93
|
+
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.Clear = Clear;
|
|
97
|
+
//# sourceMappingURL=Clear.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Clear.js","sourceRoot":"","sources":["../../../src/screenplay/interactions/Clear.ts"],"names":[],"mappings":";;;AAAA,4CAAyG;AACzG,iDAAqD;AAGrD,qEAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,MAAa,KAAM,SAAQ,+CAAsB;IAe7C;;;OAGG;IACH,YAA6B,KAA8B;QACvD,KAAK,CAAC,IAAA,cAAS,EAAC,8BAA+B,KAAM,EAAE,CAAC,CAAC;QADhC,UAAK,GAAL,KAAK,CAAyB;IAE3D,CAAC;IAnBD;;;;;;;;OAQG;IACH,MAAM,CAAC,UAAU,CAAC,KAA8B;QAC5C,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAUD;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,SAAS,CAAC,KAAuC;QACnD,MAAM,OAAO,GAAK,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACxD,MAAM,KAAK,GAAO,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;QAExC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;YACvC,MAAM,IAAI,iBAAU,CAChB,IAAI,CAAC,qBAAqB,CAAC,IAAA,cAAS,EAAC,GAAI,IAAI,CAAC,KAAM,kEAAkE,CAAC,CAC1H,CAAC;SACL;QAED,OAAO,OAAO,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;IAEO,qBAAqB,CAAC,IAAY;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;CACJ;AArDD,sBAqDC"}
|