Storybook test-runner "Timeout waiting for Storybook to be ready" in CI
The test-runner drives a live Storybook over HTTP. If nothing is serving Storybook when the runner starts, it waits, then fails with a readiness timeout. In CI you must build and serve Storybook (or run storybook dev) before the runner and wait for it to be up.
What this error means
The test-storybook step fails with "Timeout of ...ms exceeded while waiting for Storybook to be ready" without ever running a test.
[test-storybook] It seems that your Storybook instance is not running at:
http://127.0.0.1:6006. Are you sure it's running?
Timeout waiting for Storybook to be readyCommon causes
Storybook is not being served in CI
The runner assumes a Storybook at http://127.0.0.1:6006, but no storybook dev or static server was started in the job.
The runner starts before Storybook is up
Storybook is starting but the test-runner races ahead before the server accepts connections.
How to fix it
Serve the built Storybook, then wait, then test
- Build Storybook to a static folder.
- Serve it and use
wait-onto block until the port responds. - Run the test-runner against the served URL, all in one step with
concurrently.
npx concurrently -k -s first -n SB,TEST \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:127.0.0.1:6006 && npx test-storybook"Point the runner at the served URL
Set the URL explicitly so the runner connects to where Storybook is served.
npx test-storybook --url http://127.0.0.1:6006How to prevent it
- Always serve Storybook (built static or dev) before the test-runner in CI.
- Gate the runner on
wait-onso it starts only after the server is up. - Use
concurrently -k -s firstso the server is torn down when tests finish.