Skip to content

Commit

Permalink
try awaiting viewport change
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Aug 9, 2024
1 parent 40c0760 commit a299792
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .storybook/test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ module.exports = {
const storyContext = await getStoryContext(page, context)
const viewport = storyContext.parameters?.testOptions?.viewport || DEFAULT_VIEWPORT
await page.setViewportSize(viewport)
await page.waitForFunction(() => window.innerWidth == viewport.width)
},
async postVisit(page, context) {
ATTEMPT_COUNT_PER_ID[context.id] = (ATTEMPT_COUNT_PER_ID[context.id] || 0) + 1
Expand All @@ -95,6 +96,7 @@ module.exports = {
// just in case the retry is due to a useResizeObserver fail
await page.setViewportSize({ width: 1920, height: 1080 })
await page.setViewportSize(viewport)
await page.waitForFunction(() => window.innerWidth == viewport.width)
}
const browserContext = page.context()
const { snapshotBrowsers = ['chromium'] } = storyContext.parameters?.testOptions ?? {}
Expand Down

0 comments on commit a299792

Please sign in to comment.