From 3df1eac2fc21af636b1854d038ddf615740f5a5d Mon Sep 17 00:00:00 2001 From: catlog22 Date: Mon, 29 Dec 2025 16:42:31 +0800 Subject: [PATCH] test(ci): add visual regression testing workflow Solution-ID: SOL-1735410002 Issue-ID: ISS-1766921318981-22 Task-ID: T4 --- .github/workflows/visual-tests.yml | 41 ++++++++++++++++++++++++++++++ README.md | 1 + package.json | 1 + 3 files changed, 43 insertions(+) create mode 100644 .github/workflows/visual-tests.yml diff --git a/.github/workflows/visual-tests.yml b/.github/workflows/visual-tests.yml new file mode 100644 index 00000000..f2d37112 --- /dev/null +++ b/.github/workflows/visual-tests.yml @@ -0,0 +1,41 @@ +name: Visual Regression Tests + +on: + pull_request: + push: + branches: + - main + +jobs: + visual-tests: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Install Playwright browsers + run: npx playwright install --with-deps chromium + + - name: Run visual tests + run: npm run test:visual + + - name: Upload visual artifacts on failure + if: failure() + uses: actions/upload-artifact@v4 + with: + name: visual-regression-artifacts + path: | + ccw/tests/visual/snapshots/current + ccw/tests/visual/snapshots/diff + retention-days: 7 diff --git a/README.md b/README.md index ddcb1f00..e187e3e6 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ [![npm](https://img.shields.io/npm/v/claude-code-workflow.svg)](https://www.npmjs.com/package/claude-code-workflow) [![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE) [![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg)]() +[![Visual Tests](https://github.com/catlog22/Claude-Code-Workflow/actions/workflows/visual-tests.yml/badge.svg)](https://github.com/catlog22/Claude-Code-Workflow/actions/workflows/visual-tests.yml) **Languages:** [English](README.md) | [中文](README_CN.md) diff --git a/package.json b/package.json index 0e7c1c59..51cb569c 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "build": "tsc -p ccw/tsconfig.json", "start": "node ccw/bin/ccw.js", "test": "node --experimental-strip-types --test ccw/tests/*.test.js", + "test:visual": "node --experimental-strip-types --test ccw/tests/visual/**/*.visual.test.ts", "prepublishOnly": "npm run build && echo 'Ready to publish @dyw/claude-code-workflow'" }, "keywords": [