playwright-ci
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChinesePlaywright CI/CD
Playwright CI/CD
Ship reliable tests in every pipeline — CI-specific patterns for speed, stability, and actionable reports.
9 guides covering CI/CD setup, parallel execution, containerized runs, reporting, and infrastructure patterns for all major CI providers.
在每个流水线中交付可靠的测试 —— 针对CI优化的模式,兼顾速度、稳定性和可执行的报告。
9份指南,涵盖所有主流CI提供商的CI/CD设置、并行执行、容器化运行、报告以及基础设施模式。
Golden Rules
黄金准则
- in CI only — surface flakiness in pipelines, not locally
retries: 2 - — capture rich debugging artifacts without slowing every run
traces: 'on-first-retry' - Shard across runners — splits tests evenly; scale horizontally, not vertically
--shard=N/M - Cache browser binaries — keyed on Playwright version
~/.cache/ms-playwright - Upload artifacts on failure — traces, screenshots, and HTML reports as CI artifacts
- Use the official Docker image — has all OS deps pre-installed
mcr.microsoft.com/playwright:v* - Global setup for auth — run login once in , reuse
globalSetupacross workersstorageState - Fail fast, debug later — keep CI runs short; use trace viewer and HTML reports to investigate
- 仅在CI中设置—— 在流水线中暴露不稳定测试,而非本地环境
retries: 2 - —— 捕获丰富的调试工件,且不会拖慢每次运行
traces: 'on-first-retry' - 在多个运行器间分片 —— 均匀拆分测试;横向扩展,而非纵向扩展
--shard=N/M - 缓存浏览器二进制文件 —— 基于Playwright版本缓存目录
~/.cache/ms-playwright - 失败时上传工件 —— 将追踪文件、截图和HTML报告作为CI工件上传
- 使用官方Docker镜像 —— 预安装了所有系统依赖
mcr.microsoft.com/playwright:v* - 全局设置用于身份验证 —— 在中执行一次登录,在多个工作进程间复用
globalSetupstorageState - 快速失败,事后调试 —— 缩短CI运行时间;使用追踪查看器和HTML报告进行问题排查
Guide Index
指南索引
CI Providers
CI提供商
| Provider | Guide |
|---|---|
| GitHub Actions | ci-github-actions.md |
| GitLab CI | ci-gitlab.md |
| CircleCI / Azure DevOps / Jenkins | ci-other.md |
| 提供商 | 指南 |
|---|---|
| GitHub Actions | ci-github-actions.md |
| GitLab CI | ci-gitlab.md |
| CircleCI / Azure DevOps / Jenkins | ci-other.md |
Execution & Scaling
执行与扩展
| Topic | Guide |
|---|---|
| Parallel execution & sharding | parallel-and-sharding.md |
| Docker & containers | docker-and-containers.md |
| Multi-project config | projects-and-dependencies.md |
| 主题 | 指南 |
|---|---|
| 并行执行与分片 | parallel-and-sharding.md |
| Docker与容器 | docker-and-containers.md |
| 多项目配置 | projects-and-dependencies.md |
Reporting & Setup
报告与设置
| Topic | Guide |
|---|---|
| Reports & artifacts | reporting-and-artifacts.md |
| Code coverage | test-coverage.md |
| Global setup/teardown | global-setup-teardown.md |
| 主题 | 指南 |
|---|---|
| 报告与工件 | reporting-and-artifacts.md |
| 代码覆盖率 | test-coverage.md |
| 全局启动/清理 | global-setup-teardown.md |