-
Notifications
You must be signed in to change notification settings - Fork 598
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']) | ||
}) | ||
} | ||
}) | ||