mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-18 23:59:43 +01:00
adds component explorer
This commit is contained in:
committed by
Henning Dieterichs
parent
7c127d91a5
commit
2751fb4d2f
80
.github/workflows/screenshot-test.yml
vendored
Normal file
80
.github/workflows/screenshot-test.yml
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
name: Screenshot Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- 'release/*'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: screenshots-${{ github.event.pull_request.number || github.sha }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
screenshots:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
env:
|
||||
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Install build/vite dependencies
|
||||
run: npm ci
|
||||
working-directory: build/vite
|
||||
|
||||
- name: Install Playwright Chromium
|
||||
run: npx playwright install chromium
|
||||
|
||||
- name: Capture screenshots
|
||||
run: npx component-explorer screenshot --project ./test/componentFixtures/component-explorer.json
|
||||
|
||||
- name: Compare screenshots
|
||||
id: compare
|
||||
run: |
|
||||
npx component-explorer screenshot:compare \
|
||||
--project ./test/componentFixtures \
|
||||
--report ./test/componentFixtures/.screenshots/report.json \
|
||||
--report-markdown ./test/componentFixtures/.screenshots/report.md
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload screenshot report
|
||||
if: steps.compare.outcome == 'failure'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: screenshot-diff
|
||||
path: |
|
||||
test/componentFixtures/.screenshots/current/
|
||||
test/componentFixtures/.screenshots/report.json
|
||||
test/componentFixtures/.screenshots/report.md
|
||||
|
||||
- name: Post summary
|
||||
if: always()
|
||||
run: |
|
||||
if [ -f test/componentFixtures/.screenshots/report.md ]; then
|
||||
cat test/componentFixtures/.screenshots/report.md >> $GITHUB_STEP_SUMMARY
|
||||
elif [ "${{ steps.compare.outcome }}" == "success" ]; then
|
||||
echo "## Screenshots ✅" >> $GITHUB_STEP_SUMMARY
|
||||
echo "No visual changes detected." >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
|
||||
- name: Fail if screenshots changed
|
||||
if: steps.compare.outcome == 'failure'
|
||||
run: |
|
||||
echo "::error::Screenshot differences detected. Download the 'screenshot-diff' artifact to review changes."
|
||||
exit 1
|
||||
Reference in New Issue
Block a user