storybook-addon-playwright 4.13.2 → 4.13.4

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.
@@ -89,11 +89,25 @@
89
89
  }
90
90
  },
91
91
  "additionalProperties": false
92
+ },
93
+ "options": {
94
+ "type": "object",
95
+ "properties": {
96
+ "releaseMouse": {
97
+ "type": "boolean",
98
+ "default": true
99
+ }
100
+ },
101
+ "required": [
102
+ "releaseMouse"
103
+ ],
104
+ "additionalProperties": false
92
105
  }
93
106
  },
94
107
  "required": [
95
108
  "from",
96
- "to"
109
+ "to",
110
+ "options"
97
111
  ],
98
112
  "description": "This method will perform mouse down, move,and up from to selected location."
99
113
  },
@@ -10,9 +10,12 @@ const testFileScreenshots = (options) => tslib_1.__awaiter(void 0, void 0, void
10
10
  const { fileName, onComplete, storyId, requestType } = options;
11
11
  const configs = configs_1.getConfigs();
12
12
  const storiesData = yield utils_1.getStoryPlaywrightData(fileName);
13
+ const storyBaseId = (storiesData.storyData.length > 0
14
+ ? storiesData.storyData[0].storyId
15
+ : storyId).split('--')[0];
13
16
  const limit = p_limit_1.default(configs.concurrencyLimit.story);
14
17
  if (configs.beforeFileImageDiff) {
15
- configs.beforeFileImageDiff(options);
18
+ yield configs.beforeFileImageDiff(Object.assign(Object.assign({}, options), { storyId: storyBaseId }));
16
19
  }
17
20
  const promisees = storiesData.storyData.reduce((arr, story) => {
18
21
  if (requestType === 'story' && storyId && story.storyId !== storyId)
@@ -37,7 +40,7 @@ const testFileScreenshots = (options) => tslib_1.__awaiter(void 0, void 0, void
37
40
  return arr;
38
41
  }, []);
39
42
  if (configs.afterFileImageDiff) {
40
- configs.afterFileImageDiff(results, options);
43
+ yield configs.afterFileImageDiff(results, Object.assign(Object.assign({}, options), { storyId: storyBaseId }));
41
44
  }
42
45
  if (onComplete)
43
46
  onComplete(results);
@@ -1 +1 @@
1
- {"version":3,"file":"test-file-screenshots.js","sourceRoot":"","sources":["../../../../src/api/server/services/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MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACpC,GAAG,GAAG,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QACrB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,OAAO,CAAC,kBAAkB,EAAE;QAC9B,OAAO,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KAC9C;IAED,IAAI,UAAU;QAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAEpC,OAAO,OAAO,CAAC;AACjB,CAAC,CAAA,CAAC;AAlDW,QAAA,mBAAmB,uBAkD9B"}
1
+ {"version":3,"file":"test-file-screenshots.js","sourceRoot":"","sources":["../../../../src/api/server/services/test-file-screenshots.ts"],"names":[],"mappings":";;;;AACA,qEAAgE;AAChE,oCAAkD;AAElD,8DAA6B;AAC7B,wCAAwC;AASjC,MAAM,mBAAmB,GAAG,CACjC,OAA4B,EACA,EAAE;IAC9B,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAC/D,MAAM,OAAO,GAAG,oBAAU,EAAE,CAAC;IAE7B,MAAM,WAAW,GAAG,MAAM,8BAAsB,CAAC,QAAQ,CAAC,CAAC;IAE3D,MAAM,WAAW,GAAG,CAClB,WAAW,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC;QAC9B,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO;QAClC,CAAC,CAAC,OAAO,CACZ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAEjB,MAAM,KAAK,GAAG,iBAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAErD,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,IACpB,CAAC;KACJ;IAED,IAAI,UAAU;QAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAEpC,OAAO,OAAO,CAAC;AACjB,CAAC,CAAA,CAAC;AA3DW,QAAA,mBAAmB,uBA2D9B"}
@@ -1,3 +1,3 @@
1
- import { Position } from './typings';
1
+ import { MouseFromToOptions, Position } from './typings';
2
2
  import { Page } from 'playwright';
3
- export declare function mouseFromTo(this: Page, from: Position, to: Position): Promise<void>;
3
+ export declare function mouseFromTo(this: Page, from: Position, to: Position, options: MouseFromToOptions): Promise<void>;
@@ -2,13 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.mouseFromTo = void 0;
4
4
  const tslib_1 = require("tslib");
5
- function mouseFromTo(from, to) {
5
+ function mouseFromTo(from, to, options) {
6
6
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
7
+ const { releaseMouse = true } = options || {};
7
8
  // move mouse to center of element or specified point
8
9
  yield this.mouse.move(from.x, from.y);
9
10
  yield this.mouse.down();
10
11
  yield this.mouse.move(to.x, to.y);
11
- yield this.mouse.up();
12
+ if (releaseMouse)
13
+ yield this.mouse.up();
12
14
  });
13
15
  }
14
16
  exports.mouseFromTo = mouseFromTo;
@@ -1 +1 @@
1
- {"version":3,"file":"mouse-from-to.js","sourceRoot":"","sources":["../../src/page-extra/mouse-from-to.ts"],"names":[],"mappings":";;;;AAGA,SAAsB,WAAW,CAAa,IAAc,EAAE,EAAY;;QACxE,qDAAqD;QACrD,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAEtC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAExB,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAElC,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;IACxB,CAAC;CAAA;AATD,kCASC"}
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,OAA2B;;QAE3B,MAAM,EAAE,YAAY,GAAG,IAAI,EAAE,GAAG,OAAO,IAAI,EAAE,CAAC;QAE9C,qDAAqD;QACrD,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAEtC,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAExB,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;QAElC,IAAI,YAAY;YAAE,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC;IAC1C,CAAC;CAAA;AAhBD,kCAgBC"}
@@ -51,6 +51,12 @@ export interface ElementHandleBoundingBox {
51
51
  */
52
52
  height: number;
53
53
  }
54
+ export interface MouseFromToOptions {
55
+ /**
56
+ * @default true
57
+ */
58
+ releaseMouse: boolean;
59
+ }
54
60
  export interface PlaywrightPageWithExtra {
55
61
  /**
56
62
  * This method fetches an element with `selector`, waits for actionability checks, focuses the element, clear it and triggers an input event.
@@ -70,7 +76,7 @@ export interface PlaywrightPageWithExtra {
70
76
  * @param from position in page
71
77
  * @param to position in page
72
78
  */
73
- mouseFromTo: (from: Position, to: Position) => Promise<void>;
79
+ mouseFromTo: (from: Position, to: Position, options: MouseFromToOptions) => Promise<void>;
74
80
  /**
75
81
  * This method fetches an element with `selector`, and set the selector scrollLeft and scrollTop.
76
82
  * If there's no element matching `selector`, the method waits until a matching element appears in the DOM.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storybook-addon-playwright",
3
- "version": "4.13.2",
3
+ "version": "4.13.4",
4
4
  "description": "An addon to visually test the stories in the multiple browsers within storybook environment",
5
5
  "author": "m.doaie <mdoaie@yahoo.co.uk>",
6
6
  "engines": {