Files
SnapOtter/.github/workflows/update-visual-baselines.yml
T
SnapOtter e44be61053 test: add real device-emulated mobile and tablet testing (phase 3)
Replace the fake resized-desktop mobile specs with real Playwright device
projects (Pixel 7, iPhone 14, iPad gen 7, Galaxy Tab S9) that exercise
real touch, mobile UA, DPR, and WebKit engine.

Device projects in playwright.config.ts:
- mobile-chromium (Pixel 7, 412x839, Chromium)
- mobile-webkit (iPhone 14, 390x664, WebKit)
- tablet-webkit (iPad gen 7, 810x1080, WebKit)
- tablet-chromium (Galaxy Tab S9, 640x1024, Chromium)

Device specs (16 mobile, 10 tablet):
- Core flow: navigate to tool, upload, process, download
- Responsive chrome: bottom-nav, sidebar hidden, search, overflow
- Touch interactions: before-after slider, crop canvas
- Editor gate: phone asserts "Desktop Recommended" message
- Editor tablet: iPad (810px) renders canvas, Galaxy Tab (640px) shows gate
- SSE visibility-recovery regression guard
- RTL Arabic locale responsive check

Key finding: Galaxy Tab S9 viewport (640px) is below the 768px mobile
breakpoint, so useMobile() returns true and the editor shows the mobile
gate. Only iPad gen 7 (810px) is classified as non-mobile.

Component tests (17 tests, Vitest/jsdom):
- use-mobile hook: breakpoint behavior across all 4 device widths
- mobile-bottom-nav: render, navigation links, settings callback, icons

CI wiring:
- ci.yml: mobile-chromium smoke job (PR gate)
- nightly.yml: full device matrix with webkit
- update-visual-baselines.yml: webkit + device projects for goldens

Parity: 13218 passed, 0 dropped (PARITY OK)
2026-06-20 02:15:50 +08:00

53 lines
2.2 KiB
YAML

name: Update Visual Baselines
on:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
update-baselines:
name: Regenerate linux visual baselines
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: ./.github/actions/setup
- name: Get Playwright version
id: pw-version
run: echo "version=$(node -p "require('@playwright/test/package.json').version")" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.pw-version.outputs.version }}
- name: Install Playwright browsers (chromium + webkit for device projects)
run: pnpm playwright install --with-deps chromium webkit
- name: Regenerate baselines (desktop + device projects)
run: pnpm playwright test --project=chromium-visual --project=mobile-chromium --project=mobile-webkit --project=tablet-webkit --project=tablet-chromium --update-snapshots
env:
PW_WORKERS: "2"
- name: Open PR with refreshed baselines
env:
GH_TOKEN: ${{ github.token }}
run: |
if git diff --quiet -- 'tests/e2e/__screenshots__'; then
untracked=$(git ls-files --others --exclude-standard -- 'tests/e2e/__screenshots__')
if [ -z "$untracked" ]; then
echo "No baseline changes."
exit 0
fi
fi
BRANCH="chore/visual-baselines-${GITHUB_RUN_ID}"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git checkout -b "$BRANCH"
git add tests/e2e/__screenshots__
git commit -m "test(e2e): refresh linux visual baselines"
git push origin "$BRANCH"
gh pr create --title "test(e2e): refresh linux visual baselines" \
--body "Automated baseline refresh from the update-visual-baselines workflow. Review the image diffs before merging." \
--base main --head "$BRANCH"