Skip to content

Commit a18561c

Browse files
committed
fix: run storybook tests
1 parent 993d7df commit a18561c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

.storybook/test-runner.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type {TestRunnerConfig} from '@storybook/test-runner';
2-
import {getStoryContext} from '@storybook/test-runner';
2+
import {getStoryContext, waitForPageReady} from '@storybook/test-runner';
33
import {checkA11y, configureAxe, injectAxe} from 'axe-playwright';
44

55
/*
@@ -8,18 +8,21 @@ import {checkA11y, configureAxe, injectAxe} from 'axe-playwright';
88
*/
99
const config: TestRunnerConfig = {
1010
async preVisit(page) {
11+
await waitForPageReady(page);
1112
await injectAxe(page);
1213
},
1314
async postVisit(page, context) {
1415
// Get the entire context of a story, including parameters, args, argTypes, etc.
1516
const storyContext = await getStoryContext(page, context);
17+
await waitForPageReady(page);
1618

1719
// Apply story-level a11y rules
1820
await configureAxe(page, {
1921
rules: storyContext.parameters?.a11y?.config?.rules,
2022
reporter: 'no-passes',
2123
});
2224

25+
await new Promise(resolve => setTimeout(resolve, 100));
2326
await checkA11y(page, '#storybook-root', {
2427
verbose: false,
2528
detailedReport: true,

0 commit comments

Comments
 (0)