name: Frontend Playwright

on:
  workflow_dispatch:
  pull_request:
  push:
    branches:
      - main

jobs:
  e2e:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: frontend

    steps:
      - uses: actions/checkout@v4

      - uses: pnpm/action-setup@v4
        with:
          version: 10

      - uses: actions/setup-node@v4
        with:
          node-version: 24
          cache: pnpm
          cache-dependency-path: frontend/pnpm-lock.yaml

      - name: Install deps
        run: pnpm install --frozen-lockfile

      - name: Build app
        run: pnpm build-only

      - name: Install Playwright browser
        run: pnpm exec playwright install --with-deps chromium

      - name: Run e2e
        run: pnpm test:e2e
