@pixeleye/storybook
Advanced tools
Comparing version 0.5.13 to 0.5.14
@@ -20,6 +20,13 @@ export interface RawStory { | ||
} | ||
interface Channel { | ||
on: (event: string, callback: (data: unknown) => void) => void; | ||
emit: (event: string, data: unknown) => void; | ||
} | ||
export type SBWindow = typeof window & { | ||
__STORYBOOK_CLIENT_API__: API; | ||
__STORYBOOK_PREVIEW__: { | ||
channel: Channel; | ||
}; | ||
}; | ||
export {}; | ||
//# sourceMappingURL=stories.d.ts.map |
@@ -11,2 +11,9 @@ // src/capture.ts | ||
} | ||
var timeout = (prom, time) => { | ||
let timer; | ||
return Promise.race([ | ||
prom, | ||
new Promise((_r, rej) => timer = setTimeout(rej, time)) | ||
]).finally(() => clearTimeout(timer)); | ||
}; | ||
async function captureStories({ | ||
@@ -65,6 +72,28 @@ storybookURL, | ||
{ | ||
waitUntil: "networkidle", | ||
timeout: 12e4 | ||
waitUntil: "domcontentloaded" | ||
} | ||
); | ||
await page.waitForFunction( | ||
() => window.__STORYBOOK_PREVIEW__.channel, | ||
{ | ||
timeout: 6e4 | ||
} | ||
); | ||
await timeout( | ||
page.evaluate(() => { | ||
const { channel } = window.__STORYBOOK_PREVIEW__; | ||
return new Promise((resolve) => { | ||
channel.on("storyRendered", () => { | ||
resolve(); | ||
}); | ||
}); | ||
}), | ||
6e4 | ||
); | ||
await page.waitForLoadState("load", { | ||
timeout: 6e4 | ||
}); | ||
await page.waitForFunction(() => document.fonts.ready, { | ||
timeout: 6e4 | ||
}); | ||
const selector = "body"; | ||
@@ -71,0 +100,0 @@ await page.waitForSelector(selector); |
{ | ||
"name": "@pixeleye/storybook", | ||
"private": false, | ||
"version": "0.5.13", | ||
"version": "0.5.14", | ||
"main": "./dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "./dist/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
45564
297