Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
francinelucca committed Nov 25, 2024
1 parent f6667d4 commit 1065328
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 35 deletions.
38 changes: 4 additions & 34 deletions e2e/components/Overlay.test.ts
Original file line number Diff line number Diff line change
@@ -1,77 +1,47 @@
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'

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

Expand All @@ -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`)
})
Expand All @@ -104,7 +75,6 @@ test.describe('Overlay ', () => {
open: true,
},
})
await story.setup(page)

await expect(page).toHaveNoViolations()
})
Expand Down
2 changes: 1 addition & 1 deletion e2e/test-helpers/storybook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 1065328

Please sign in to comment.