Skip to content

Setup Playwright tests, misc fixes #14

Setup Playwright tests, misc fixes

Setup Playwright tests, misc fixes #14

Workflow file for this run

name: Test Frontend
on:
pull_request:
paths:
- "app/**"
defaults:
run:
working-directory: ./app
jobs:
# test that app can build without issues
test-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v1
- name: Install packages
run: bunx msw init && bun install
- name: SSH debug
if: runner.debug == '1'
uses: mxschmitt/action-tmate@v3
- name: Run test
run: bun run build
# test that app has no typescript errors
test-types:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v1
- name: Install packages
run: bunx msw init && bun install
- name: SSH debug
if: runner.debug == '1'
uses: mxschmitt/action-tmate@v3
- name: Run test
run: bun run test:types
# test that app is properly formatted and linted
test-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v1
- name: Install packages
run: bunx msw init && bun install
- name: SSH debug
if: runner.debug == '1'
uses: mxschmitt/action-tmate@v3
- name: Run test
run: bun run test:lint
# run end to end integration tests
test-e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v1
- name: Install packages
run: bun install
- name: SSH debug
if: runner.debug == '1'
uses: mxschmitt/action-tmate@v3
# https://github.com/microsoft/playwright/issues/7249
- name: Get Playwright version
run: |
PLAYWRIGHT_VERSION=$(npm ls @playwright/test | grep @playwright | sed 's/.*@//')
echo "Playwright Version: $PLAYWRIGHT_VERSION"
echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV
- name: Cache Playwright
id: cache-playwright
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ env.PLAYWRIGHT_VERSION }}
- name: Install Playwright with dependencies
if: steps.cache-playwright.outputs.cache-hit != 'true'
run: npx playwright install --with-deps
- name: Install Playwright's dependencies
if: steps.cache-playwright.outputs.cache-hit == 'true'
run: npx playwright install-deps
- name: Run test
run: bun run test:e2e
- name: Store Artifacts from Failed Tests
if: failure()
uses: actions/upload-artifact@v2
with:
name: test-results
path: test-results/
retention-days: 30