Skip to content

Storybook Tests

Storybook Tests #64

name: Storybook Tests
on:
workflow_run:
workflows: ["Continuous Integration"]
branches: [main]
types:
- completed
workflow_dispatch:
jobs:
storybook-tests:
runs-on: ubuntu-22.04
timeout-minutes: 60
if: ${{
github.event.workflow_run.conclusion == 'success' ||
github.event_name == 'workflow_dispatch' }}
steps:
- name: Clone you-say repo in Ubuntu
uses: actions/checkout@v4
with:
# We need to fetch all branches and commits so that Nx affected has a base to compare against.
fetch-depth: 0
- name: Derive appropriate SHAs for base and head for `nx affected` commands
uses: nrwl/nx-set-shas@v4
- name: Setup NodeJS version
uses: actions/setup-node@v4
with:
node-version: 20.10.0
cache: "npm"
- name: Install 3rd party libraries/packages
run: npm ci --include="dev" --ignore-scripts
- name: Install playwright
run: npx playwright install --with-deps
- name: Start Storybook
run: npx nx build-storybook frontend
- name: Run Storybook tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server apps/frontend/storybook-static --port 6006 --silent" \
"npx wait-on http://127.0.0.1:6006 && npx nx test-storybook frontend --url http://127.0.0.1:6006"