From 49c0b2d1f42e98c76294da4073139edc886d931f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Sun, 10 May 2026 18:56:57 +0200 Subject: [PATCH] Add visual-tests job to CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Runs Vitest browser visual regression tests (drawElevationChart) on every PR and push to main. Uses the same Playwright/Chromium cache as the e2e job. On first run (no committed snapshots yet) the tests create the snapshots and pass. On subsequent runs they compare against committed snapshots and fail on visual regression. Failed runs upload a visual-snapshots-diff artifact so the diff is visible in the Actions UI. To update snapshots after an intentional visual change: Actions → "Update visual snapshots" → Run workflow (or add the `update-snapshots` label to the PR). Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/ci.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 326b3e0..61fa59e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,6 +110,44 @@ jobs: - run: pnpm install --frozen-lockfile - run: pnpm build + visual-tests: + name: Visual Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: pnpm/action-setup@v6 + - uses: actions/setup-node@v6 + with: + node-version: 24 + cache: pnpm + - run: pnpm install --frozen-lockfile + + - name: Cache Playwright browsers + id: playwright-cache + uses: actions/cache@v5 + with: + path: ~/.cache/ms-playwright + key: playwright-${{ hashFiles('pnpm-lock.yaml') }} + + - name: Install Playwright Chromium + if: steps.playwright-cache.outputs.cache-hit != 'true' + run: pnpm exec playwright install --with-deps chromium + + - name: Install Playwright deps only + if: steps.playwright-cache.outputs.cache-hit == 'true' + run: pnpm exec playwright install-deps chromium + + - name: Run visual regression tests + run: pnpm --filter @trails-cool/planner test:visual + + - name: Upload screenshots on failure + if: failure() + uses: actions/upload-artifact@v7 + with: + name: visual-snapshots-diff + path: apps/planner/app/**/__screenshots__/ + retention-days: 7 + e2e: name: E2E Tests needs: build