storybook-addon-playwright 4.16.2 → 4.17.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/dist/api/server/data/action-schema.json +34 -0
- package/dist/page-extra/drag-drop-selector.d.ts +2 -2
- package/dist/page-extra/drag-drop-selector.js +4 -3
- package/dist/page-extra/drag-drop-selector.js.map +1 -1
- package/dist/page-extra/mouse-down-on-selector.d.ts +2 -2
- package/dist/page-extra/mouse-down-on-selector.js +3 -2
- package/dist/page-extra/mouse-down-on-selector.js.map +1 -1
- package/dist/page-extra/mouse-from-to.js +3 -3
- package/dist/page-extra/mouse-from-to.js.map +1 -1
- package/dist/page-extra/mouse-move-to-selector.d.ts +2 -2
- package/dist/page-extra/mouse-move-to-selector.js +3 -2
- package/dist/page-extra/mouse-move-to-selector.js.map +1 -1
- package/dist/page-extra/typings/extra.d.ts +10 -4
- package/package.json +1 -1
|
@@ -54,6 +54,16 @@
|
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"additionalProperties": false
|
|
57
|
+
},
|
|
58
|
+
"options": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"steps": {
|
|
62
|
+
"type": "number",
|
|
63
|
+
"default": 1
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"additionalProperties": false
|
|
57
67
|
}
|
|
58
68
|
},
|
|
59
69
|
"required": [
|
|
@@ -93,6 +103,10 @@
|
|
|
93
103
|
"options": {
|
|
94
104
|
"type": "object",
|
|
95
105
|
"properties": {
|
|
106
|
+
"steps": {
|
|
107
|
+
"type": "number",
|
|
108
|
+
"default": 1
|
|
109
|
+
},
|
|
96
110
|
"skipMouseUp": {
|
|
97
111
|
"type": "boolean"
|
|
98
112
|
}
|
|
@@ -150,6 +164,16 @@
|
|
|
150
164
|
}
|
|
151
165
|
},
|
|
152
166
|
"additionalProperties": false
|
|
167
|
+
},
|
|
168
|
+
"options": {
|
|
169
|
+
"type": "object",
|
|
170
|
+
"properties": {
|
|
171
|
+
"steps": {
|
|
172
|
+
"type": "number",
|
|
173
|
+
"default": 1
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"additionalProperties": false
|
|
153
177
|
}
|
|
154
178
|
},
|
|
155
179
|
"required": [
|
|
@@ -175,6 +199,16 @@
|
|
|
175
199
|
}
|
|
176
200
|
},
|
|
177
201
|
"additionalProperties": false
|
|
202
|
+
},
|
|
203
|
+
"options": {
|
|
204
|
+
"type": "object",
|
|
205
|
+
"properties": {
|
|
206
|
+
"steps": {
|
|
207
|
+
"type": "number",
|
|
208
|
+
"default": 1
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"additionalProperties": false
|
|
178
212
|
}
|
|
179
213
|
},
|
|
180
214
|
"required": [
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Position } from './typings';
|
|
1
|
+
import { MouseOptions, Position } from './typings';
|
|
2
2
|
import { Page } from 'playwright';
|
|
3
|
-
export declare function dragDropSelector(this: Page, selector: string, to: Position, mouseDownRelativeToSelector?: Position): Promise<void>;
|
|
3
|
+
export declare function dragDropSelector(this: Page, selector: string, to: Position, mouseDownRelativeToSelector?: Position, options?: MouseOptions): Promise<void>;
|
|
@@ -4,17 +4,18 @@ exports.dragDropSelector = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const get_point_by_direction_1 = require("./utils/get-point-by-direction");
|
|
6
6
|
const get_boundingBox_1 = require("./utils/get-boundingBox");
|
|
7
|
-
function dragDropSelector(selector, to, mouseDownRelativeToSelector) {
|
|
7
|
+
function dragDropSelector(selector, to, mouseDownRelativeToSelector, options) {
|
|
8
8
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const { steps = 1 } = options || {};
|
|
9
10
|
const box = yield (0, get_boundingBox_1.getBoundingBox)(this, selector);
|
|
10
11
|
const mouseDownRelativeX = (0, get_point_by_direction_1.getPointByDirection)(box.width / 2, 'x', mouseDownRelativeToSelector);
|
|
11
12
|
const mouseDownRelativeY = (0, get_point_by_direction_1.getPointByDirection)(box.height / 2, 'y', mouseDownRelativeToSelector);
|
|
12
13
|
const mouseMoveX = (0, get_point_by_direction_1.getPointByDirection)(0, 'x', to);
|
|
13
14
|
const mouseMoveY = (0, get_point_by_direction_1.getPointByDirection)(0, 'y', to);
|
|
14
15
|
// move mouse to center of element or specified point
|
|
15
|
-
yield this.mouse.move(box.x + mouseDownRelativeX, box.y + mouseDownRelativeY);
|
|
16
|
+
yield this.mouse.move(box.x + mouseDownRelativeX, box.y + mouseDownRelativeY, { steps });
|
|
16
17
|
yield this.mouse.down();
|
|
17
|
-
yield this.mouse.move(mouseMoveX, mouseMoveY);
|
|
18
|
+
yield this.mouse.move(mouseMoveX, mouseMoveY, { steps });
|
|
18
19
|
yield this.mouse.up();
|
|
19
20
|
});
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag-drop-selector.js","sourceRoot":"","sources":["../../src/page-extra/drag-drop-selector.ts"],"names":[],"mappings":";;;;AAAA,2EAAqE;AAGrE,6DAAyD;AAEzD,SAAsB,gBAAgB,CAEpC,QAAgB,EAChB,EAAY,EACZ,2BAAsC;;
|
|
1
|
+
{"version":3,"file":"drag-drop-selector.js","sourceRoot":"","sources":["../../src/page-extra/drag-drop-selector.ts"],"names":[],"mappings":";;;;AAAA,2EAAqE;AAGrE,6DAAyD;AAEzD,SAAsB,gBAAgB,CAEpC,QAAgB,EAChB,EAAY,EACZ,2BAAsC,EACtC,OAAsB;;QAEtB,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;QAEpC,MAAM,GAAG,GAAG,MAAM,IAAA,gCAAc,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEjD,MAAM,kBAAkB,GAAG,IAAA,4CAAmB,EAC5C,GAAG,CAAC,KAAK,GAAG,CAAC,EACb,GAAG,EACH,2BAA2B,CAC5B,CAAC;QAEF,MAAM,kBAAkB,GAAG,IAAA,4CAAmB,EAC5C,GAAG,CAAC,MAAM,GAAG,CAAC,EACd,GAAG,EACH,2BAA2B,CAC5B,CAAC;QAEF,MAAM,UAAU,GAAG,IAAA,4CAAmB,EAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QACnD,MAAM,UAAU,GAAG,IAAA,4CAAmB,EAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QAEnD,qDAAqD;QACrD,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CACnB,GAAG,CAAC,CAAC,GAAG,kBAAkB,EAC1B,GAAG,CAAC,CAAC,GAAG,kBAAkB,EAC1B,EAAE,KAAK,EAAE,CACV,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAExB,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAEzD,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;IACxB,CAAC;CAAA;AAtCD,4CAsCC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Position, ExtendedPage } from './typings';
|
|
2
|
-
export declare function mouseDownOnSelector(this: ExtendedPage, selector: string, point?: Position): Promise<void>;
|
|
1
|
+
import { Position, ExtendedPage, MouseOptions } from './typings';
|
|
2
|
+
export declare function mouseDownOnSelector(this: ExtendedPage, selector: string, point?: Position, options?: MouseOptions): Promise<void>;
|
|
@@ -4,13 +4,14 @@ exports.mouseDownOnSelector = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const get_point_by_direction_1 = require("./utils/get-point-by-direction");
|
|
6
6
|
const get_boundingBox_1 = require("./utils/get-boundingBox");
|
|
7
|
-
function mouseDownOnSelector(selector, point) {
|
|
7
|
+
function mouseDownOnSelector(selector, point, options) {
|
|
8
8
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const { steps = 1 } = options || {};
|
|
9
10
|
const box = yield (0, get_boundingBox_1.getBoundingBox)(this, selector);
|
|
10
11
|
const mouseDownRelativeX = (0, get_point_by_direction_1.getPointByDirection)(box.width / 2, 'x', point);
|
|
11
12
|
const mouseDownRelativeY = (0, get_point_by_direction_1.getPointByDirection)(box.height / 2, 'y', point);
|
|
12
13
|
// move mouse to center on selector
|
|
13
|
-
yield this.mouse.move(box.x + mouseDownRelativeX, box.y + mouseDownRelativeY);
|
|
14
|
+
yield this.mouse.move(box.x + mouseDownRelativeX, box.y + mouseDownRelativeY, { steps });
|
|
14
15
|
yield this.mouse.down();
|
|
15
16
|
});
|
|
16
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mouse-down-on-selector.js","sourceRoot":"","sources":["../../src/page-extra/mouse-down-on-selector.ts"],"names":[],"mappings":";;;;AACA,2EAAqE;AACrE,6DAAyD;AAEzD,SAAsB,mBAAmB,CAEvC,QAAgB,EAChB,KAAgB;;
|
|
1
|
+
{"version":3,"file":"mouse-down-on-selector.js","sourceRoot":"","sources":["../../src/page-extra/mouse-down-on-selector.ts"],"names":[],"mappings":";;;;AACA,2EAAqE;AACrE,6DAAyD;AAEzD,SAAsB,mBAAmB,CAEvC,QAAgB,EAChB,KAAgB,EAChB,OAAsB;;QAEtB,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;QAEpC,MAAM,GAAG,GAAG,MAAM,IAAA,gCAAc,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEjD,MAAM,kBAAkB,GAAG,IAAA,4CAAmB,EAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAC1E,MAAM,kBAAkB,GAAG,IAAA,4CAAmB,EAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAE3E,mCAAmC;QACnC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CACnB,GAAG,CAAC,CAAC,GAAG,kBAAkB,EAC1B,GAAG,CAAC,CAAC,GAAG,kBAAkB,EAC1B,EAAE,KAAK,EAAE,CACV,CAAC;QAEF,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;CAAA;AArBD,kDAqBC"}
|
|
@@ -4,11 +4,11 @@ exports.mouseFromTo = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
function mouseFromTo(from, to, options) {
|
|
6
6
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
7
|
-
const { skipMouseUp } = options || {};
|
|
7
|
+
const { skipMouseUp, steps = 1 } = options || {};
|
|
8
8
|
// move mouse to center of element or specified point
|
|
9
|
-
yield this.mouse.move(from.x, from.y);
|
|
9
|
+
yield this.mouse.move(from.x, from.y, { steps });
|
|
10
10
|
yield this.mouse.down();
|
|
11
|
-
yield this.mouse.move(to.x, to.y);
|
|
11
|
+
yield this.mouse.move(to.x, to.y, { steps });
|
|
12
12
|
if (!skipMouseUp)
|
|
13
13
|
yield this.mouse.up();
|
|
14
14
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mouse-from-to.js","sourceRoot":"","sources":["../../src/page-extra/mouse-from-to.ts"],"names":[],"mappings":";;;;AAGA,SAAsB,WAAW,CAE/B,IAAc,EACd,EAAY,EACZ,OAA4B;;QAE5B,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"mouse-from-to.js","sourceRoot":"","sources":["../../src/page-extra/mouse-from-to.ts"],"names":[],"mappings":";;;;AAGA,SAAsB,WAAW,CAE/B,IAAc,EACd,EAAY,EACZ,OAA4B;;QAE5B,MAAM,EAAE,WAAW,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;QAEjD,qDAAqD;QACrD,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAEjD,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAExB,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAE7C,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;IAC1C,CAAC;CAAA;AAhBD,kCAgBC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Position, ExtendedPage } from './typings';
|
|
2
|
-
export declare function mouseMoveToSelector(this: ExtendedPage, selector: string, point?: Position): Promise<void>;
|
|
1
|
+
import { Position, ExtendedPage, MouseOptions } from './typings';
|
|
2
|
+
export declare function mouseMoveToSelector(this: ExtendedPage, selector: string, point?: Position, options?: MouseOptions): Promise<void>;
|
|
@@ -4,13 +4,14 @@ exports.mouseMoveToSelector = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const get_point_by_direction_1 = require("./utils/get-point-by-direction");
|
|
6
6
|
const get_boundingBox_1 = require("./utils/get-boundingBox");
|
|
7
|
-
function mouseMoveToSelector(selector, point) {
|
|
7
|
+
function mouseMoveToSelector(selector, point, options) {
|
|
8
8
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const { steps = 1 } = options || {};
|
|
9
10
|
const box = yield (0, get_boundingBox_1.getBoundingBox)(this, selector);
|
|
10
11
|
const mouseDownRelativeX = (0, get_point_by_direction_1.getPointByDirection)(box.width / 2, 'x', point);
|
|
11
12
|
const mouseDownRelativeY = (0, get_point_by_direction_1.getPointByDirection)(box.height / 2, 'y', point);
|
|
12
13
|
// move mouse to center on selector or specified point
|
|
13
|
-
yield this.mouse.move(box.x + mouseDownRelativeX, box.y + mouseDownRelativeY);
|
|
14
|
+
yield this.mouse.move(box.x + mouseDownRelativeX, box.y + mouseDownRelativeY, { steps });
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
17
|
exports.mouseMoveToSelector = mouseMoveToSelector;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mouse-move-to-selector.js","sourceRoot":"","sources":["../../src/page-extra/mouse-move-to-selector.ts"],"names":[],"mappings":";;;;AACA,2EAAqE;AACrE,6DAAyD;AAEzD,SAAsB,mBAAmB,CAEvC,QAAgB,EAChB,KAAgB;;
|
|
1
|
+
{"version":3,"file":"mouse-move-to-selector.js","sourceRoot":"","sources":["../../src/page-extra/mouse-move-to-selector.ts"],"names":[],"mappings":";;;;AACA,2EAAqE;AACrE,6DAAyD;AAEzD,SAAsB,mBAAmB,CAEvC,QAAgB,EAChB,KAAgB,EAChB,OAAsB;;QAEtB,MAAM,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;QAEpC,MAAM,GAAG,GAAG,MAAM,IAAA,gCAAc,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEjD,MAAM,kBAAkB,GAAG,IAAA,4CAAmB,EAAC,GAAG,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAC1E,MAAM,kBAAkB,GAAG,IAAA,4CAAmB,EAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAE3E,sDAAsD;QACtD,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CACnB,GAAG,CAAC,CAAC,GAAG,kBAAkB,EAC1B,GAAG,CAAC,CAAC,GAAG,kBAAkB,EAC1B,EAAE,KAAK,EAAE,CACV,CAAC;IACJ,CAAC;CAAA;AAnBD,kDAmBC"}
|
|
@@ -51,7 +51,13 @@ export interface ElementHandleBoundingBox {
|
|
|
51
51
|
*/
|
|
52
52
|
height: number;
|
|
53
53
|
}
|
|
54
|
-
export interface
|
|
54
|
+
export interface MouseOptions {
|
|
55
|
+
/**
|
|
56
|
+
* @default 1
|
|
57
|
+
*/
|
|
58
|
+
steps?: number;
|
|
59
|
+
}
|
|
60
|
+
export interface MouseFromToOptions extends MouseOptions {
|
|
55
61
|
skipMouseUp?: boolean;
|
|
56
62
|
}
|
|
57
63
|
export interface PlaywrightPageWithExtra {
|
|
@@ -67,7 +73,7 @@ export interface PlaywrightPageWithExtra {
|
|
|
67
73
|
* @param to Required and selector will move to position given to this option
|
|
68
74
|
* @param mouseDownRelativeToSelector By default the center on selector will be selected for mousedown, but if mouseDownRelativeToSelector set the specified position will be used for mousedown.
|
|
69
75
|
*/
|
|
70
|
-
dragDropSelector: (selector: string, to: Position, mouseDownRelativeToSelector?: Position) => Promise<void>;
|
|
76
|
+
dragDropSelector: (selector: string, to: Position, mouseDownRelativeToSelector?: Position, options?: MouseOptions) => Promise<void>;
|
|
71
77
|
/**
|
|
72
78
|
* This method will perform mouse down, move,and up from to selected location.
|
|
73
79
|
* @param from position in page
|
|
@@ -87,14 +93,14 @@ export interface PlaywrightPageWithExtra {
|
|
|
87
93
|
* @param selector A selector to search for element to click. If there are multiple elements satisfying the selector, the first will be clicked.
|
|
88
94
|
* @param point
|
|
89
95
|
*/
|
|
90
|
-
mouseDownOnSelector: (selector: string, point?: Position) => Promise<void>;
|
|
96
|
+
mouseDownOnSelector: (selector: string, point?: Position, options?: MouseOptions) => Promise<void>;
|
|
91
97
|
/**
|
|
92
98
|
* This method fetches an element with `selector`, and move the mouse to center of selector.
|
|
93
99
|
* If there's no element matching `selector`, the method waits until a matching element appears in the DOM.
|
|
94
100
|
* @param selector A selector to search for element to click. If there are multiple elements satisfying the selector, the first will be clicked.
|
|
95
101
|
* @param point
|
|
96
102
|
*/
|
|
97
|
-
mouseMoveToSelector: (selector: string, point?: Position) => Promise<void>;
|
|
103
|
+
mouseMoveToSelector: (selector: string, point?: Position, options?: MouseOptions) => Promise<void>;
|
|
98
104
|
/**
|
|
99
105
|
* This method fetches an element with `selector`, set the height and with.
|
|
100
106
|
* If there's no element matching `selector`, the method waits until a matching element appears in the DOM.
|
package/package.json
CHANGED