Fingers crossed for working CI e2e tests
Some checks failed
ci/woodpecker/push/ci Pipeline failed
ci/woodpecker/push/deploy unknown status

This commit is contained in:
2026-02-01 14:36:17 -03:00
parent e34e0e4c7b
commit 0266d472d9
5 changed files with 58 additions and 8 deletions

41
scripts/update-e2e-snapshots.sh Executable file
View File

@@ -0,0 +1,41 @@
#!/usr/bin/env bash
# Regenerate Playwright visual regression snapshots.
# - When Docker is available: runs in the same image as CI (Playwright Noble) for a CI-accurate baseline.
# - When Docker is not available (e.g. devcontainer): runs Playwright in the current environment;
# the Linux snapshot may still differ slightly from CI — if CI fails, run this script on the host with Docker.
set -e
SCRIPT_DIR="${BASH_SOURCE%/*}"
PROJECT_ROOT="${SCRIPT_DIR}/.."
cd "$PROJECT_ROOT"
if command -v docker >/dev/null 2>&1; then
PLAYWRIGHT_IMAGE="${PLAYWRIGHT_IMAGE:-mcr.microsoft.com/playwright:v1.58.0-noble}"
echo "Using Docker image: $PLAYWRIGHT_IMAGE (same as CI)"
echo "Project root: $PROJECT_ROOT"
echo ""
docker run --rm \
-v "$PROJECT_ROOT:/app" -w /app \
-e CI=1 \
"$PLAYWRIGHT_IMAGE" \
bash -c '
corepack enable && corepack prepare pnpm@10.28.2 --activate
pnpm install --frozen-lockfile || pnpm install
pnpm run build
npx serve dist -p 4173 &
sleep 2
pnpm exec playwright test --update-snapshots
'
else
echo "Docker not found — updating snapshots in the current environment."
echo "If CI later fails with a snapshot mismatch, run this script on a host with Docker for a CI-accurate baseline."
echo ""
# Unset CI so Playwright config starts the preview server
unset CI
pnpm exec playwright test --update-snapshots
fi
echo ""
echo "Snapshots updated. Commit the changed files under tests/visual.spec.ts-snapshots/ if needed."