-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (77 loc) · 3.11 KB
/
Copy pathplaywright.yml
File metadata and controls
87 lines (77 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# =============================================================================
# Playwright Tests — functional + pixel-by-pixel visual regression.
#
# BASELINE STRATEGY (macOS dev vs. Linux CI):
# Rendering differs between operating systems, so visual baselines are
# platform-suffixed (see `snapshotPathTemplate` in playwright.config.ts:
# `...-{projectName}-{platform}{ext}`). Locally on macOS you generate
# `-darwin` snapshots; they are NOT the source of truth for CI.
#
# The authoritative `-linux` baselines are committed by humans. CI must not
# write back to `main`:
# * push to main / pull_request -> strict compare against committed Linux
# baselines; a real visual diff fails the build.
# * manual dispatch with `update_snapshots=true` -> generate Linux baselines
# in the official Playwright container and upload them as an artifact only.
#
# The container image is pinned to the installed @playwright/test version
# (1.61.1) so the browser binaries and the test runner stay in lockstep.
# =============================================================================
name: Playwright Tests
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
inputs:
update_snapshots:
description: Generate Linux baselines and upload them as an artifact without committing.
required: false
type: boolean
default: false
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.61.1-jammy
env:
# The Playwright container expects HOME=/root; some Actions runners unset it.
HOME: /root
CI: 'true'
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install dependencies
run: npm ci
# ---- Normal CI: strict compare against committed Linux baselines ----
- name: Run Playwright tests (strict compare)
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.update_snapshots != 'true' }}
run: npx playwright test
# ---- Manual helper: generate Linux baselines, but never commit/push ----
- name: Generate Linux baselines
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.update_snapshots == 'true' }}
run: npx playwright test --update-snapshots
- name: Upload generated Linux baselines
if: ${{ always() && github.event_name == 'workflow_dispatch' && github.event.inputs.update_snapshots == 'true' }}
uses: actions/upload-artifact@v7
with:
name: linux-visual-baselines
path: tests/__screenshots__/
retention-days: 14
# ---- Always publish the report + raw results for inspection ----
- name: Upload Playwright report
if: always()
uses: actions/upload-artifact@v7
with:
name: playwright-report
path: playwright-report/
retention-days: 14
- name: Upload test results
if: always()
uses: actions/upload-artifact@v7
with:
name: test-results
path: test-results/
retention-days: 14