Search code examples
javascriptgithub-actionsworkflowstorybook

Storybook test runner workflow fails and exits with timeout error


I want to add a CI workflow for a component library that runs tests on every push event. Here's the workflow file:

name: "UI Tests"

on: push

jobs:
  interaction-and-accessibility:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v4

      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: "18.16.0"

      - name: Install dependencies
        run: npm install --legacy-peer-deps

      - name: Install Playwright
        run: npx playwright install

      - name: Build Storybook
        run: npm run build-storybook --quiet

      - name: Serve Storybook and run tests
        run: |
        npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
        "npx http-server storybook-static --port 6006 --silent" \
        "npx wait-on tcp:6006 && npm run test-storybook"

The issue

The whole workflow works perfectly, but whenever it reach "Serve Storybook and run tests" part it takes forever till the operation is canceled due to timeout error.

I tried to run it locally with act or remotely with gitHub Actions, but the same error persists.

Did anyone run into the same issue or has a clue on how to solve this issue?

Thanks!


Solution

  • Please try the solution here: https://github.com/storybookjs/test-runner/issues/301

    this can be resolved by updating the npx wait-on command to npx wait-on tcp:127.0.0.1:6006 (or whatever the correct address is for the http-server