Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Aug 9, 2024
1 parent a299792 commit 943b595
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .storybook/test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ module.exports = {
async preVisit(page, context) {
const storyContext = await getStoryContext(page, context)
const viewport = storyContext.parameters?.testOptions?.viewport || DEFAULT_VIEWPORT
const viewPortChange = page.waitForFunction(() => window.innerWidth === viewport.width)
await page.setViewportSize(viewport)
await page.waitForFunction(() => window.innerWidth == viewport.width)
await viewPortChange
},
async postVisit(page, context) {
ATTEMPT_COUNT_PER_ID[context.id] = (ATTEMPT_COUNT_PER_ID[context.id] || 0) + 1
Expand All @@ -95,8 +96,9 @@ module.exports = {
// When retrying, resize the viewport and then resize again to default,
// just in case the retry is due to a useResizeObserver fail
await page.setViewportSize({ width: 1920, height: 1080 })
const viewPortChange = page.waitForFunction(() => window.innerWidth === viewport.width)
await page.setViewportSize(viewport)
await page.waitForFunction(() => window.innerWidth == viewport.width)
await viewPortChange
}
const browserContext = page.context()
const { snapshotBrowsers = ['chromium'] } = storyContext.parameters?.testOptions ?? {}
Expand Down
5 changes: 5 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export default defineConfig({
name: 'chromium',
use: {
...devices['Desktop Chrome'],
viewport: null,
launchOptions: {
...devices['Desktop Chrome']['launchOptions'],
args: ['--window-size=1280,720'],
},
},
},

Expand Down

0 comments on commit 943b595

Please sign in to comment.