Skip to content

Commit bad954c

Browse files
Phase 12: cross-app visual/DOM/CSS/functional parity suite
Add a Playwright-based parity harness comparing the Angular and React apps: - playwright.config.ts with angular/react projects + desktop/mobile viewports - tests/visual-parity.spec.ts: full-page screenshots across pages/themes/viewports - tests/dom-parity.spec.ts: structural assertions - tests/style-parity.spec.ts: computed-style assertions - tests/functional-parity.spec.ts: behavioural assertions - tests/compare-screenshots.ts: pixelmatch diff + HTML report - npm scripts (test:visual:*, test:parity) and visual-parity CI workflow Shared fixtures/helpers mock the HN API so both apps render identical data. Co-Authored-By: Lukas Burger <lukaskburger@gmail.com>
1 parent 18c54cc commit bad954c

12 files changed

Lines changed: 2248 additions & 34 deletions
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Visual Parity
2+
3+
on:
4+
push:
5+
branches: ['**']
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
visual-parity:
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 30
13+
env:
14+
# Angular 9 + webpack 4 need the legacy OpenSSL provider on Node 17+.
15+
NODE_OPTIONS: --openssl-legacy-provider
16+
ANGULAR_BASE_URL: http://localhost:4200
17+
REACT_BASE_URL: http://localhost:5173
18+
19+
steps:
20+
- name: Checkout React app (this branch)
21+
uses: actions/checkout@v4
22+
with:
23+
path: react-app
24+
25+
- name: Checkout Angular app (master)
26+
uses: actions/checkout@v4
27+
with:
28+
ref: master
29+
path: angular-app
30+
31+
- name: Set up Node
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
36+
- name: Install Angular dependencies
37+
working-directory: angular-app
38+
run: npm ci --legacy-peer-deps || npm install --legacy-peer-deps
39+
40+
- name: Install React dependencies
41+
working-directory: react-app
42+
run: npm ci || npm install
43+
44+
- name: Install Playwright browser
45+
working-directory: react-app
46+
run: npx playwright install --with-deps chromium
47+
48+
- name: Start Angular app (port 4200)
49+
working-directory: angular-app
50+
run: npx ng serve --host 0.0.0.0 --port 4200 &
51+
52+
- name: Start React app (port 5173)
53+
working-directory: react-app
54+
run: npm run dev -- --host 0.0.0.0 --port 5173 &
55+
56+
- name: Wait for both apps to be healthy
57+
working-directory: react-app
58+
run: npx wait-on -t 300000 http-get://localhost:4200 http-get://localhost:5173
59+
60+
- name: Run cross-app parity suite
61+
working-directory: react-app
62+
run: npm run test:parity
63+
64+
- name: Upload screenshots and report
65+
if: always()
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: visual-parity-screenshots
69+
path: |
70+
react-app/screenshots/
71+
react-app/playwright-report/
72+
if-no-files-found: warn

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,10 @@ Thumbs.db
4747

4848
# Vite
4949
*.local
50+
51+
# Playwright / visual-parity artifacts
52+
/screenshots
53+
/playwright-report
54+
/test-results
55+
/blob-report
56+
/playwright/.cache

0 commit comments

Comments
 (0)