Skip to content
Latchkey

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-runner
[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 ready

Common 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

  1. Build Storybook to a static folder.
  2. Serve it and use wait-on to block until the port responds.
  3. Run the test-runner against the served URL, all in one step with concurrently.
Terminal
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.

Terminal
npx test-storybook --url http://127.0.0.1:6006

How to prevent it

  • Always serve Storybook (built static or dev) before the test-runner in CI.
  • Gate the runner on wait-on so it starts only after the server is up.
  • Use concurrently -k -s first so the server is torn down when tests finish.

Frequently asked questions

What causes ""Timeout ... waiting for Storybook""?
The runner assumes a Storybook at http://127.0.0.1:6006, but no storybook dev or static server was started in the job.
How do I fix "Timeout ... waiting for Storybook"?
Serve the built Storybook, then wait, then test

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card