storybook-addon-playwright 4.19.2 → 4.20.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/.vscode/tasks.json +1 -1
- package/dist/api/server/data/action-schema.json +39 -0
- package/dist/api/server/scripts/generate-action-schema.js +1 -0
- package/dist/api/server/scripts/generate-action-schema.js.map +1 -1
- package/dist/page-extra/clear-input-and-type.d.ts +3 -0
- package/dist/page-extra/clear-input-and-type.js +13 -0
- package/dist/page-extra/clear-input-and-type.js.map +1 -0
- package/dist/page-extra/clear-input.js +4 -5
- package/dist/page-extra/clear-input.js.map +1 -1
- package/dist/page-extra/extend-page.js +2 -0
- package/dist/page-extra/extend-page.js.map +1 -1
- package/dist/page-extra/typings/extra.d.ts +29 -0
- package/package.json +1 -1
package/.vscode/tasks.json
CHANGED
|
@@ -24,6 +24,45 @@
|
|
|
24
24
|
],
|
|
25
25
|
"description": "This method fetches an element with `selector`, waits for actionability checks, focuses the element, clear it and triggers an input event. If the element matching selector is not an <input>, <textarea> or [contenteditable] element, this method throws an error."
|
|
26
26
|
},
|
|
27
|
+
"clearInputAndType": {
|
|
28
|
+
"kind": "function",
|
|
29
|
+
"type": "Promise",
|
|
30
|
+
"parameters": {
|
|
31
|
+
"selector": {
|
|
32
|
+
"type": "string"
|
|
33
|
+
},
|
|
34
|
+
"text": {
|
|
35
|
+
"type": "string"
|
|
36
|
+
},
|
|
37
|
+
"options": {
|
|
38
|
+
"type": "object",
|
|
39
|
+
"properties": {
|
|
40
|
+
"delay": {
|
|
41
|
+
"type": "number",
|
|
42
|
+
"description": "Time to wait between key presses in milliseconds. Defaults to 0."
|
|
43
|
+
},
|
|
44
|
+
"noWaitAfter": {
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"description": "Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to inaccessible pages. Defaults to `false`."
|
|
47
|
+
},
|
|
48
|
+
"strict": {
|
|
49
|
+
"type": "boolean",
|
|
50
|
+
"description": "When true, the call requires selector to resolve to a single element. If given selector resolves to more then one element, the call throws an exception."
|
|
51
|
+
},
|
|
52
|
+
"timeout": {
|
|
53
|
+
"type": "number",
|
|
54
|
+
"description": "Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by using the [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout) or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods."
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"additionalProperties": false
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"required": [
|
|
61
|
+
"selector",
|
|
62
|
+
"text"
|
|
63
|
+
],
|
|
64
|
+
"description": "This method fetches an element with `selector`, waits for actionability checks, focuses the element, clear it and type text and triggers an input event. If the element matching selector is not an <input>, <textarea> or [contenteditable] element, this method throws an error."
|
|
65
|
+
},
|
|
27
66
|
"dragDropSelector": {
|
|
28
67
|
"kind": "function",
|
|
29
68
|
"type": "Promise",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-action-schema.js","sourceRoot":"","sources":["../../../../src/api/server/scripts/generate-action-schema.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AAKnD,MAAM,gBAAgB,GAAqB;IACzC,OAAO;IACP,UAAU;IACV,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,kBAAkB;IAClB,uBAAuB;IACvB,gBAAgB;IAChB,mBAAmB;IACnB,uBAAuB;IACvB,iBAAiB;IACjB,YAAY;IACZ,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;IACpB,UAAU;IACV,WAAW;IACX,YAAY;IACZ,aAAa;IACb,UAAU;IACV,aAAa;IACb,aAAa;CACd,CAAC;AAEF,MAAM,iBAAiB,GAAgB;IACrC,OAAO;IACP,UAAU;IACV,MAAM;IACN,MAAM;IACN,IAAI;CACL,CAAC;AAEF,MAAM,iBAAiB,GAAsB,CAAC,KAAK,CAAC,CAAC;AAErD,MAAM,YAAY,GAAG;IACnB,GAAG,gBAAgB;IACnB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC7C,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,GAAG,CAAC,CAAC;CACxC,CAAC;AAEP,MAAM,oBAAoB,GAAG,CAAC,WAAmB,EAAE,EAAE;IAC1D,MAAM,MAAM,GAAG,IAAA,gCAAc,EAAC;QAC5B,YAAY,EAAE,YAAY;QAC1B,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,gBAAgB;KACvB,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAPW,QAAA,oBAAoB,wBAO/B"}
|
|
1
|
+
{"version":3,"file":"generate-action-schema.js","sourceRoot":"","sources":["../../../../src/api/server/scripts/generate-action-schema.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AAKnD,MAAM,gBAAgB,GAAqB;IACzC,OAAO;IACP,UAAU;IACV,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,OAAO;IACP,MAAM;IACN,OAAO;IACP,SAAS;IACT,gBAAgB;IAChB,iBAAiB;IACjB,gBAAgB;IAChB,kBAAkB;IAClB,uBAAuB;IACvB,gBAAgB;IAChB,mBAAmB;IACnB,uBAAuB;IACvB,iBAAiB;IACjB,YAAY;IACZ,mBAAmB;IACnB,qBAAqB;IACrB,qBAAqB;IACrB,oBAAoB;IACpB,UAAU;IACV,WAAW;IACX,YAAY;IACZ,aAAa;IACb,UAAU;IACV,aAAa;IACb,aAAa;CACd,CAAC;AAEF,MAAM,iBAAiB,GAAgB;IACrC,OAAO;IACP,UAAU;IACV,MAAM;IACN,MAAM;IACN,IAAI;CACL,CAAC;AAEF,MAAM,iBAAiB,GAAsB,CAAC,KAAK,CAAC,CAAC;AAErD,MAAM,YAAY,GAAG;IACnB,GAAG,gBAAgB;IACnB,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,GAAG,CAAC,CAAC;IAC7C,GAAG,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,cAAc,GAAG,CAAC,CAAC;CACxC,CAAC;AAEP,MAAM,oBAAoB,GAAG,CAAC,WAAmB,EAAE,EAAE;IAC1D,MAAM,MAAM,GAAG,IAAA,gCAAc,EAAC;QAC5B,YAAY,EAAE,YAAY;QAC1B,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,gBAAgB;KACvB,CAAC,CAAC;IACH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAPW,QAAA,oBAAoB,wBAO/B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clearInputAndType = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const clear_input_1 = require("./clear-input");
|
|
6
|
+
function clearInputAndType(selector, text, options) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
yield clear_input_1.clearInput.call(this, selector);
|
|
9
|
+
yield this.type(selector, text, options);
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
exports.clearInputAndType = clearInputAndType;
|
|
13
|
+
//# sourceMappingURL=clear-input-and-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear-input-and-type.js","sourceRoot":"","sources":["../../src/page-extra/clear-input-and-type.ts"],"names":[],"mappings":";;;;AAEA,+CAA2C;AAE3C,SAAsB,iBAAiB,CAErC,QAAgB,EAChB,IAAY,EACZ,OAAkC;;QAElC,MAAM,wBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEtC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;CAAA;AATD,8CASC"}
|
|
@@ -2,15 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.clearInput = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
function clearInput(selector, options) {
|
|
5
|
+
function clearInput(selector, options = {}) {
|
|
6
6
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
7
|
+
const { blur, timeout } = options;
|
|
7
8
|
yield this.fill(selector, '');
|
|
8
|
-
if (
|
|
9
|
-
return;
|
|
10
|
-
if (options.blur) {
|
|
9
|
+
if (blur) {
|
|
11
10
|
yield this.$eval(selector, (e) => e.blur());
|
|
12
11
|
}
|
|
13
|
-
if (
|
|
12
|
+
if (timeout) {
|
|
14
13
|
yield this.waitForTimeout(options.timeout);
|
|
15
14
|
}
|
|
16
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear-input.js","sourceRoot":"","sources":["../../src/page-extra/clear-input.ts"],"names":[],"mappings":";;;;AAGA,SAAsB,UAAU,CAE9B,QAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"clear-input.js","sourceRoot":"","sources":["../../src/page-extra/clear-input.ts"],"names":[],"mappings":";;;;AAGA,SAAsB,UAAU,CAE9B,QAAgB,EAChB,UAA6B,EAAE;;QAE/B,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAElC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAE9B,IAAI,IAAI,EAAE;YACR,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;SAC7C;QAED,IAAI,OAAO,EAAE;YACX,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SAC5C;IACH,CAAC;CAAA;AAhBD,gCAgBC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.extendPage = void 0;
|
|
4
4
|
const _1 = require(".");
|
|
5
5
|
const touch_from_to_1 = require("./touch-from-to");
|
|
6
|
+
const clear_input_and_type_1 = require("./clear-input-and-type");
|
|
6
7
|
function extendPage(page) {
|
|
7
8
|
const thisPage = page;
|
|
8
9
|
thisPage.dragDropSelector = _1.dragDropSelector;
|
|
@@ -11,6 +12,7 @@ function extendPage(page) {
|
|
|
11
12
|
thisPage.mouseMoveToSelector = _1.mouseMoveToSelector;
|
|
12
13
|
thisPage.setSelectorSize = _1.setSelectorSize;
|
|
13
14
|
thisPage.clearInput = _1.clearInput;
|
|
15
|
+
thisPage.clearInputAndType = clear_input_and_type_1.clearInputAndType;
|
|
14
16
|
thisPage.selectorMouseWheel = _1.selectorMouseWheel;
|
|
15
17
|
thisPage.touchCancel = _1.touchCancel;
|
|
16
18
|
thisPage.touchMove = _1.touchMove;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extend-page.js","sourceRoot":"","sources":["../../src/page-extra/extend-page.ts"],"names":[],"mappings":";;;AAGA,wBAaW;AACX,mDAA8C;
|
|
1
|
+
{"version":3,"file":"extend-page.js","sourceRoot":"","sources":["../../src/page-extra/extend-page.ts"],"names":[],"mappings":";;;AAGA,wBAaW;AACX,mDAA8C;AAC9C,iEAA2D;AAE3D,SAAgB,UAAU,CAAiB,IAAO;IAChD,MAAM,QAAQ,GAAG,IAAmC,CAAC;IAErD,QAAQ,CAAC,gBAAgB,GAAG,mBAAgB,CAAC;IAC7C,QAAQ,CAAC,cAAc,GAAG,iBAAc,CAAC;IACzC,QAAQ,CAAC,mBAAmB,GAAG,sBAAmB,CAAC;IACnD,QAAQ,CAAC,mBAAmB,GAAG,sBAAmB,CAAC;IACnD,QAAQ,CAAC,eAAe,GAAG,kBAAe,CAAC;IAC3C,QAAQ,CAAC,UAAU,GAAG,aAAU,CAAC;IACjC,QAAQ,CAAC,iBAAiB,GAAG,wCAAiB,CAAC;IAC/C,QAAQ,CAAC,kBAAkB,GAAG,qBAAkB,CAAC;IACjD,QAAQ,CAAC,WAAW,GAAG,cAAW,CAAC;IACnC,QAAQ,CAAC,SAAS,GAAG,YAAS,CAAC;IAC/B,QAAQ,CAAC,QAAQ,GAAG,WAAQ,CAAC;IAC7B,QAAQ,CAAC,UAAU,GAAG,aAAU,CAAC;IACjC,QAAQ,CAAC,WAAW,GAAG,2BAAW,CAAC;IACnC,QAAQ,CAAC,WAAW,GAAG,cAAW,CAAC;IAEnC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAnBD,gCAmBC"}
|
|
@@ -27,6 +27,30 @@ export interface PageExtraTouchOptions {
|
|
|
27
27
|
export interface ClearInputOptions extends PageExtraTimeOut {
|
|
28
28
|
blur?: boolean;
|
|
29
29
|
}
|
|
30
|
+
export interface ClearInputAndTypeOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Time to wait between key presses in milliseconds. Defaults to 0.
|
|
33
|
+
*/
|
|
34
|
+
delay?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Actions that initiate navigations are waiting for these navigations to happen and for pages to start loading. You can
|
|
37
|
+
* opt out of waiting via setting this flag. You would only need this option in the exceptional cases such as navigating to
|
|
38
|
+
* inaccessible pages. Defaults to `false`.
|
|
39
|
+
*/
|
|
40
|
+
noWaitAfter?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* When true, the call requires selector to resolve to a single element. If given selector resolves to more then one
|
|
43
|
+
* element, the call throws an exception.
|
|
44
|
+
*/
|
|
45
|
+
strict?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Maximum time in milliseconds, defaults to 30 seconds, pass `0` to disable timeout. The default value can be changed by
|
|
48
|
+
* using the
|
|
49
|
+
* [browserContext.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-browsercontext#browser-context-set-default-timeout)
|
|
50
|
+
* or [page.setDefaultTimeout(timeout)](https://playwright.dev/docs/api/class-page#page-set-default-timeout) methods.
|
|
51
|
+
*/
|
|
52
|
+
timeout?: number;
|
|
53
|
+
}
|
|
30
54
|
export interface SelectorMouseWheelOptions {
|
|
31
55
|
deltaMode?: number;
|
|
32
56
|
deltaX?: number;
|
|
@@ -66,6 +90,11 @@ export interface PlaywrightPageWithExtra {
|
|
|
66
90
|
* If the element matching selector is not an <input>, <textarea> or [contenteditable] element, this method throws an error.
|
|
67
91
|
*/
|
|
68
92
|
clearInput: (selector: string, options?: ClearInputOptions) => Promise<void>;
|
|
93
|
+
/**
|
|
94
|
+
* This method fetches an element with `selector`, waits for actionability checks, focuses the element, clear it and type text and triggers an input event.
|
|
95
|
+
* If the element matching selector is not an <input>, <textarea> or [contenteditable] element, this method throws an error.
|
|
96
|
+
*/
|
|
97
|
+
clearInputAndType: (selector: string, text: string, options?: ClearInputAndTypeOptions) => Promise<void>;
|
|
69
98
|
/**
|
|
70
99
|
* This method fetches an element with `selector`, and move it to the position given by user.
|
|
71
100
|
* If there's no element matching `selector`, the method waits until a matching element appears in the DOM.
|
package/package.json
CHANGED