diff --git a/e2e/components/Overlay.test.ts b/e2e/components/Overlay.test.ts index e559ce3fed4..30347211877 100644 --- a/e2e/components/Overlay.test.ts +++ b/e2e/components/Overlay.test.ts @@ -1,4 +1,4 @@ -import {test, expect, type Page} from '@playwright/test' +import {test, expect} from '@playwright/test' import {visit} from '../test-helpers/storybook' import {themes} from '../test-helpers/themes' @@ -6,72 +6,42 @@ const stories = [ { title: 'Default', id: 'private-components-overlay--default', - setup: async (page: Page) => { - await page.waitForSelector('div[role="dialog"]') - }, }, { title: 'Playground', id: 'private-components-overlay--playground', - setup: async (page: Page) => { - await page.waitForSelector('div[role="dialog"]') - }, }, { title: 'Dialog Overlay', id: 'private-components-overlay-features--dialog-overlay', - setup: async (page: Page) => { - await page.waitForSelector('div[role="dialog"]') - }, }, { title: 'Dropdown Overlay', id: 'private-components-overlay-features--dropdown-overlay', - setup: async (page: Page) => { - await page.waitForSelector('div[role="none"]') - }, }, { title: 'Memex Issue Overlay', id: 'private-components-overlay-features--memex-issue-overlay', - setup: async (page: Page) => { - await page.waitForSelector('div[role="dialog"]') - }, }, { title: 'Memex Nested Overlays', id: 'private-components-overlay-features--memex-nested-overlays', - setup: async (page: Page) => { - await page.waitForSelector('div[role="dialog"]') - }, }, { title: 'Nested Overlays', id: 'private-components-overlay-features--nested-overlays', - setup: async (page: Page) => { - await page.waitForSelector('div[role="dialog"]') - }, }, { title: 'Overlay On Top Of Overlay', id: 'private-components-overlay-features--overlay-on-top-of-overlay', - setup: async (page: Page) => { - await page.waitForSelector('div[role="dialog"]') - }, }, { title: 'Positioned Overlays', id: 'private-components-overlay-features--positioned-overlays', - setup: async (page: Page) => { - await page.waitForSelector('div[role="dialog"]') - }, }, { title: 'SX Props', id: 'private-components-overlay-dev--sx-props', - setup: async (page: Page) => { - await page.waitForSelector('div[role="dialog"]') - }, }, ] as const @@ -86,10 +56,11 @@ test.describe('Overlay ', () => { globals: { colorScheme: theme, }, + args: { + open: true, + }, }) - await story.setup(page) - // Default state expect(await page.screenshot()).toMatchSnapshot(`Overlay.${story.title}.${theme}.png`) }) @@ -104,7 +75,6 @@ test.describe('Overlay ', () => { open: true, }, }) - await story.setup(page) await expect(page).toHaveNoViolations() }) diff --git a/e2e/test-helpers/storybook.ts b/e2e/test-helpers/storybook.ts index ccb890c8316..cd07cbb4629 100644 --- a/e2e/test-helpers/storybook.ts +++ b/e2e/test-helpers/storybook.ts @@ -54,7 +54,7 @@ export async function visit(page: Page, options: Options) { await page.goto(url.toString()) await page.waitForSelector('body.sb-show-main:not(.sb-show-preparing-story)') - await page.waitForSelector('#storybook-root > *', {state: 'attached'}) + await page.waitForSelector('#storybook-root > *') await waitForImages(page) }