Skip to content

Chore/clean up

Chore/clean up #38

Workflow file for this run

name: "UI Tests"
on:
pull_request:
branches: [dev]
jobs:
# Install and cache npm dependencies
install-cache:
runs-on: ubuntu-latest
steps:
- name: Checkout Commit
uses: actions/checkout@v4
- name: Cache npm dependencies
uses: actions/cache@v4
id: npm-cache
with:
path: |
node_modules
key: ${{ runner.os }}-npm-v10-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-v10
- name: Install dependencies if cache invalid
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci
# Run interaction and accessibility tests
interaction-and-accessibility:
runs-on: ubuntu-latest
needs: install-cache
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "21.x"
- name: Restore npm dependencies
uses: actions/cache@v4
id: npm-cache
with:
path: |
node_modules
key: ${{ runner.os }}-npm-v10-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-v10
- name: Install Playwright
run: npx playwright install --with-deps
- 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"
# Run visual and composition tests with Chromatic
visual-and-composition:
runs-on: ubuntu-latest
needs: interaction-and-accessibility
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore npm dependencies
uses: actions/cache@v4
id: npm-cache
with:
path: |
node_modules
key: ${{ runner.os }}-npm-v10-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-v10
- name: Run Chromatic
uses: chromaui/action@latest
with:
# ⚠️ Make sure to configure a `CHROMATIC_PROJECT_TOKEN` repository secret
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}