You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading to Storybook 8.5.0, I encountered an issue when running yarn test-storybook in combination with axe-playwright. Specifically, the test runner throws the following error:
page.evaluate: Error: Axe is already running. Use `await axe.run()` to wait for the previous run to finish before starting a new run.
This issue occurs when running tests with --maxWorkers=2 or higher. However, it works fine if I downgrade back to 8.4.7 or if I reduce the number of workers to --maxWorkers=1 in 8.5.0.
Was there a change in how @storybook/test-runner or Storybook 8.5.0 handles parallel worker processes?
Is there a way to ensure compatibility with axe-playwright when running test-storybook with multiple workers?
Are there any known workarounds or fixes to address this regression?
Additional information
This issue does not occur when using the Storybook dev server (yarn storybook) instead of http-server. The same test works fine when pointed to http://localhost:4400 (the Storybook dev server) with --maxWorkers=2.
I suspect this might be related to how lifecycle events are handled in @storybook/test-runner for static vs. dynamic Storybook builds in the 8.5.0 release.
//.storybook/test-runner.tsimporttype{TestRunnerConfig}from'@storybook/test-runner';import{getStoryContext}from'@storybook/test-runner';import{injectAxe,checkA11y,configureAxe}from'axe-playwright';/* * See https://storybook.js.org/docs/writing-tests/test-runner#test-hook-api * to learn more about the test-runner hooks API. */constconfig: TestRunnerConfig={asyncpreVisit(page){awaitinjectAxe(page);},asyncpostVisit(page,context){// Get the entire context of a story, including parameters, args, argTypes, etc.conststoryContext=awaitgetStoryContext(page,context);// Apply story-level a11y rulesawaitconfigureAxe(page,{rules: storyContext.parameters?.a11y?.config?.rules,});constelement=storyContext.parameters?.a11y?.element??'body';awaitcheckA11y(page,element,{detailedReport: true,detailedReportOptions: {html: true,},});},};exportdefaultconfig;
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Summary
After upgrading to Storybook 8.5.0, I encountered an issue when running
yarn test-storybook
in combination with axe-playwright. Specifically, the test runner throws the following error:This issue occurs when running tests with
--maxWorkers=2
or higher. However, it works fine if I downgrade back to 8.4.7 or if I reduce the number of workers to--maxWorkers=1
in 8.5.0.Environment Details:
Storybook Version: 8.5.0
@storybook/test-runner
Version: Latest (installed alongside Storybook 8.5.0)Test Runner Command:
--maxWorkers
to 1 avoids the issue:Questions:
Was there a change in how
@storybook/test-runner
or Storybook 8.5.0 handles parallel worker processes?Is there a way to ensure compatibility with
axe-playwright
when runningtest-storybook
with multiple workers?Are there any known workarounds or fixes to address this regression?
Additional information
This issue does not occur when using the Storybook dev server (
yarn storybook
) instead ofhttp-server
. The same test works fine when pointed tohttp://localhost:4400
(the Storybook dev server) with--maxWorkers=2
.I suspect this might be related to how lifecycle events are handled in
@storybook/test-runner
for static vs. dynamic Storybook builds in the 8.5.0 release.Similar issue [Investigation]: Support React 19 #29805 (comment)
Create a reproduction
Beta Was this translation helpful? Give feedback.
All reactions