Skip to content

Commit 57c7fd0

Browse files
committed
fix(storybook): add timeout for waitForLoadState
PATCH
1 parent 7ade2ee commit 57c7fd0

File tree

3 files changed

+90
-83
lines changed

3 files changed

+90
-83
lines changed

package-lock.json

Lines changed: 77 additions & 77 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,18 @@
2929
"devDependencies": {
3030
"@playwright/test": "^1.34.3",
3131
"@types/fs-extra": "^11.0.1",
32-
"@types/node": "^20.3.1",
33-
"@typescript-eslint/eslint-plugin": "^5.60.0",
34-
"@typescript-eslint/parser": "^5.60.0",
32+
"@types/node": "^20.3.2",
33+
"@typescript-eslint/eslint-plugin": "^5.60.1",
34+
"@typescript-eslint/parser": "^5.60.1",
3535
"eslint": "^8.43.0",
3636
"eslint-config-prettier": "^8.8.0",
3737
"eslint-plugin-prettier": "^4.2.1",
3838
"get-port": "^7.0.0",
3939
"husky": "^8.0.3",
4040
"npm-run-all": "^4.1.5",
4141
"prettier": "^2.8.8",
42-
"semantic-release": "^21.0.5",
43-
"typescript": "^5.1.3",
42+
"semantic-release": "^21.0.6",
43+
"typescript": "^5.1.5",
4444
"vite": "^4.3.9",
4545
"vite-plugin-static-copy": "^0.16.0"
4646
},

src/storybookPlaywright.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,21 @@ export const storybookPlaywright = {
153153
*/
154154
timeout?: number
155155
},
156+
options = {
157+
waitForLoadStateTimeout: 2000,
158+
},
156159
actionBeforeScreenshot?: (page: Page) => Promise<void>
157160
) => {
158161
const page = context.pages()[0]
159162

160163
await page.goto(`/iframe.html?id=${story.id}`)
161164
await expect(page.locator('.sb-show-main')).toBeVisible()
162165
await expect(page.locator('.sb-show-errordisplay')).not.toBeVisible()
163-
await page.waitForLoadState('networkidle')
166+
try {
167+
await page.waitForLoadState('networkidle', { timeout: options.waitForLoadStateTimeout })
168+
} catch {
169+
// ignored
170+
}
164171
if (actionBeforeScreenshot) {
165172
await actionBeforeScreenshot(page)
166173
}

0 commit comments

Comments
 (0)