@histoire/plugin-percy 0.16.0 → 0.16.3

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/index.d.ts CHANGED
@@ -17,5 +17,13 @@ export interface PercyPluginOptions {
17
17
  * Percy options.
18
18
  */
19
19
  percyOptions?: any;
20
+ /**
21
+ * Delay puppeteer page screenshot after page load
22
+ */
23
+ pptrWait?: number;
24
+ /**
25
+ * Navigation Parameter
26
+ */
27
+ pptrOptions?: any;
20
28
  }
21
29
  export declare function HstPercy(options?: PercyPluginOptions): Plugin;
package/dist/index.js CHANGED
@@ -7,6 +7,8 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
7
7
  const require = createRequire(import.meta.url);
8
8
  const defaultOptions = {
9
9
  percyOptions: {},
10
+ pptrWait: 0,
11
+ pptrOptions: {},
10
12
  };
11
13
  export function HstPercy(options = {}) {
12
14
  const finalOptions = defu(options, defaultOptions);
@@ -37,7 +39,8 @@ export function HstPercy(options = {}) {
37
39
  return;
38
40
  }
39
41
  const page = await browser.newPage();
40
- await page.goto(url);
42
+ await page.goto(url, finalOptions.pptrOptions);
43
+ await new Promise(resolve => setTimeout(resolve, finalOptions.pptrWait));
41
44
  const name = `${story.title} > ${variant.title}`;
42
45
  await page.evaluate(await fetchPercyDOM());
43
46
  const domSnapshot = await page.evaluate((opts) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/plugin-percy",
3
- "version": "0.16.0",
3
+ "version": "0.16.3",
4
4
  "description": "Histoire plugin to take screenshots with Percy for visual regression testing",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -32,10 +32,10 @@
32
32
  "devDependencies": {
33
33
  "@types/node": "^17.0.32",
34
34
  "typescript": "^4.9.5",
35
- "histoire": "0.16.0"
35
+ "histoire": "0.16.2"
36
36
  },
37
37
  "peerDependencies": {
38
- "histoire": "^0.15.8"
38
+ "histoire": "^0.16.2"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "rimraf dist && tsc -d",
package/src/index.ts CHANGED
@@ -17,10 +17,22 @@ export interface PercyPluginOptions {
17
17
  * Percy options.
18
18
  */
19
19
  percyOptions?: any
20
+
21
+ /**
22
+ * Delay puppeteer page screenshot after page load
23
+ */
24
+ pptrWait?: number
25
+
26
+ /**
27
+ * Navigation Parameter
28
+ */
29
+ pptrOptions?: any
20
30
  }
21
31
 
22
32
  const defaultOptions: PercyPluginOptions = {
23
33
  percyOptions: {},
34
+ pptrWait: 0,
35
+ pptrOptions: {},
24
36
  }
25
37
 
26
38
  export function HstPercy (options: PercyPluginOptions = {}): Plugin {
@@ -57,7 +69,9 @@ export function HstPercy (options: PercyPluginOptions = {}): Plugin {
57
69
  }
58
70
 
59
71
  const page = await browser.newPage()
60
- await page.goto(url)
72
+ await page.goto(url, finalOptions.pptrOptions)
73
+
74
+ await new Promise(resolve => setTimeout(resolve, finalOptions.pptrWait))
61
75
 
62
76
  const name = `${story.title} > ${variant.title}`
63
77
  await page.evaluate(await fetchPercyDOM())