chore(e2e): run Playwright visual tests in Docker (#DS-5311) - #1845
chore(e2e): run Playwright visual tests in Docker (#DS-5311)#1845lskramarov wants to merge 2 commits into
Conversation
🚨 E2E tests failedReview the report for details. 💡 Comment |
|
Visit the preview URL for this PR (updated for commit b49c949): https://koobiq-next--prs-1845-6woeds21.web.app (expires Sat, 08 Aug 2026 15:47:20 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: c9e37e518febda70d0317d07e8ceb35ac43c534c |
| yarn run e2e:docker:update-snapshots # Run E2E tests in Docker and update the baselines | ||
| ``` | ||
|
|
||
| The committed baselines under `__screenshots__` are compared with `threshold: 0` and have no |
There was a problem hiding this comment.
это не нужно в AGENTS.md, дубль из packages/e2e/README.md
There was a problem hiding this comment.
Одно для человека другое для агента, так же ? и тут скорее из ридми нужно выбрасывать и для агента больше писать..
🚨 E2E tests failedReview the report for details. 💡 Comment |
|
/approve-snapshots |
|
🔄 Updating snapshots. |
|
|
c9f88ee to
63f1c91
Compare
|
Two things worth resolving before merge: 1.
2. No layer caching for the Docker build in CI
|
faa3740 to
b49c949
Compare
There was a problem hiding this comment.
Pull request overview
This PR makes Playwright visual regression testing reproducible by running the component E2E suite inside a Docker image that matches CI’s OS/font stack and the exact @playwright/test version. It also updates CI to run the same Docker-based workflow and documents the supported local/CI snapshot update path.
Changes:
- Add a Docker image +
docker composerunner (e2e:docker) to run Playwright component tests in a CI-matching environment and safely update committed baselines. - Update GitHub Actions E2E workflows to execute the suite (and snapshot approval flow) via the Docker runner instead of installing browsers on the runner.
- Add worker-count override validation in
playwright.config.ts, plus documentation and repo attributes/ignore rules to support reliable Docker builds and screenshot handling.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tools/e2e/run.js | Wrapper that validates prerequisites, derives Playwright version from package.json, and runs the suite via Compose (with an update-snapshots overlay when needed). |
| tools/e2e/Dockerfile | Digest-pinned Playwright base image with deterministic fonts, Yarn 4 shim, Node version aligned to .nvmrc, and a browser-revision assertion. |
| tools/e2e/docker-compose.yml | Compose service for running the suite with sensible defaults (platform pin, worker cap, bind-mounted outputs). |
| tools/e2e/docker-compose.update.yml | Overlay that mounts packages/components only when updating snapshots, to write baselines back to the working tree. |
| tools/e2e/assert-browsers.js | Build-time check ensuring the image’s baked browsers match what playwright-core expects for the installed version. |
| playwright.config.ts | Adds validated PLAYWRIGHT_WORKERS override handling to prevent silent “0 tests ran” success cases. |
| packages/e2e/README.md | Documents Docker as the supported path for visual tests and snapshot regeneration. |
| package.json | Adds e2e:docker and e2e:docker:update-snapshots scripts. |
| docs/guides/06-testing.md | Expands testing docs with Docker-based visual testing guidance and worker-count rationale. |
| AGENTS.md | Adds the Docker E2E commands and guidance to avoid non-Linux baseline regeneration. |
| .github/workflows/e2e.yml | Runs component E2E tests via npm run e2e:docker (container builds/installs internally). |
| .github/workflows/e2e-approve-snapshots.yml | Regenerates baselines via npm run e2e:docker:update-snapshots using the same container as the comparator job. |
| .gitattributes | Forces LF for tools/e2e/** and marks PNGs as binary to protect baseline bytes. |
| .dockerignore | Limits Docker build context size and excludes transient/local outputs while keeping committed baselines included. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
не совсем понятен смысл этого скрипта, какую проблему он решает? ведь mcr.microsoft.com/playwright образ уже содержит все необходимые браузеры
| # library on the Angular build's hot path, which costs about 5 seconds per run across the host | ||
| # filesystem boundary (measured: 27s against 32s for the same spec). Updating snapshots is rare and | ||
| # can afford both; a plain run should pay for neither. | ||
| services: |
There was a problem hiding this comment.
обновление скриншотов и сами тесты запускается на разных platform (смотри) , могут быть расхождения, когда падает определенный скриншот тест, а при обновлении обновятся N других
в дата-грид используется единый docker-compose для обоих сценариев, мб и здесь поступим также?
| # by mount target in some versions and replaced them wholesale in others; spelling all three | ||
| # out is correct either way, and a repeated identical target is a no-op when they are merged. | ||
| volumes: | ||
| - ../../packages/components:/app/packages/components |
There was a problem hiding this comment.
в доке есть е2е тесты, но пока нет скриншотов, я к тому, что артефакты из документации тоже можно возвращать (это минор, можно будет при необходимости добавить)
There was a problem hiding this comment.
удобный подход, когда ты игнорируешь все по умолчанию, и кладешь в образ только то, что действительно необходимо, пример:
# Exclude everything by default, then explicitly allow only what is needed.
**
# Yarn Berry binary and configuration
!.yarn/releases/
!.yarn/releases/**
!.yarnrc.yml
!package.json
!yarn.lock
# Application and test source code
!packages/components/я к тому что, в данной реализации в докер образ попадают например packages/components-dev, packages/docs-examples и тд
сам файл можно положить рядом с Dockerfile в tools/e2e/
| @@ -17,7 +60,7 @@ export default defineConfig({ | |||
| fullyParallel: true, | |||
| forbidOnly: isCI, | |||
| retries: isCI ? 2 : 0, | |||
There was a problem hiding this comment.
в идеале конечно отключить retries в 0, чтобы исключить нестабильные тесты на этапе разработки, но лучше это отдельно сделать
| # The two fc-match calls are the assertion, not a demonstration: they are what stops this layer | ||
| # from being "cleaned up" later on the reasonable-sounding grounds that the fonts are bundled. A | ||
| # regression here is otherwise silent until six screenshots disagree for no visible reason. | ||
| RUN apt-get update \ |
There was a problem hiding this comment.
в случае дата-грид помогла установка runs-on: ubuntu-24.04-arm в воркфлоу и platform: linux/arm64 для компоуза, но раз работает давай оставим
No description provided.