name: Playwright Tests

on: [push, pull_request]

jobs:
  e2e:
    runs-on: ubuntu-latest

    steps:
       - name: Checkout repo
         uses: actions/checkout@v6
 
       - name: Setup Node
         uses: actions/setup-node@v6
         with:
           node-version: 24
 
       - name: Install dependencies
         run: npm ci
 
       - name: Install Playwright browsers
         run: npx playwright install --with-deps chromium
 
       - name: Build test dist
         run: npm run build:test
 
       - name: Run Playwright tests
         run: npx playwright test
         env:
           CI: true
 
       - name: Upload Playwright report
         if: always()
         uses: actions/upload-artifact@v6
         with:
           name: playwright-report
           path: playwright-report/
           retention-days: 30
