Skip to content

Commit

Permalink
tests: add aria-snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
khiga8 committed Feb 19, 2025
1 parent 947b59d commit 074fbe8
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions e2e/components/Aria-snapshots.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {test, expect} from '@playwright/test'
// @ts-ignore since this file is generated in the ci to generate this file run npm run build:storybook in packages/react
import componentsConfig from '../../packages/react/storybook-static/index.json'
import {visit} from '../test-helpers/storybook'

/**
* These stories should not be tested in the CI because they are stress-tests and
* perform slowly
*/
const SKIPPED_TESTS = [
'components-treeview-features--stress-test',
'components-treeview-features--contain-intrinsic-size',
'components-filteredactionlist--default',
]

type Component = {
name: string
}

const {entries} = componentsConfig

test.describe('ARIA snapshots', () => {
for (const [id] of Object.entries(entries as Record<string, Component>)) {
if (SKIPPED_TESTS.includes(id)) {
continue
}

test(`@aria-snapshots for ${id}`, async ({page}) => {
await visit(page, {id})
const defaultScreenshot = await page.locator('.story-wrap').ariaSnapshot()
expect(defaultScreenshot).toMatchSnapshot([`${id}`, 'aria-snapshot.yml'])
})
}
})

Check failure on line 34 in e2e/components/Aria-snapshots.test.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `⏎`

0 comments on commit 074fbe8

Please sign in to comment.