Files
Profa 4cb914757b fix(ci): upgrade Node.js from 20 to 24 across all workflows
Matches local dev environment (Node 24 / npm 11) to fix lockfile
compatibility issues causing `npm ci` failures (jose@5.10.0 missing).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-05 13:33:58 +00:00

297 lines
8.7 KiB
YAML

# Sauce Demo E2E Tests CI/CD Pipeline
# Generated by: qe-queen-coordinator
# Date: 2026-01-25
name: Sauce Demo E2E Tests
on:
push:
branches: [main, develop]
paths:
- 'tests/e2e/**'
- '.github/workflows/sauce-demo-e2e.yml'
pull_request:
branches: [main]
paths:
- 'tests/e2e/**'
schedule:
# Run daily at 6 AM UTC
- cron: '0 6 * * *'
workflow_dispatch:
inputs:
test_suite:
description: 'Test suite to run'
required: false
default: 'all'
type: choice
options:
- all
- critical
- security
- purchase
- cart
- auth
- search
env:
BASE_URL: https://sauce-demo.myshopify.com
CI: true
# Permissions for PR checks and artifact uploads
permissions:
contents: read
pull-requests: write
checks: write
actions: read
jobs:
lint-and-typecheck:
name: Lint and Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: tests/e2e/package-lock.json
- name: Install dependencies
working-directory: tests/e2e
run: npm ci
- name: Type check
working-directory: tests/e2e
run: npx tsc --noEmit
e2e-tests:
name: E2E Tests (${{ matrix.browser }})
runs-on: ubuntu-latest
needs: lint-and-typecheck
strategy:
fail-fast: false
matrix:
browser: [chromium, firefox, webkit]
shard: [1, 2]
total-shards: [2]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: tests/e2e/package-lock.json
- name: Install dependencies
working-directory: tests/e2e
run: npm ci
- name: Install Playwright browsers
working-directory: tests/e2e
run: npx playwright install --with-deps ${{ matrix.browser }}
- name: Run E2E tests
working-directory: tests/e2e
run: |
if [ "${{ github.event.inputs.test_suite }}" == "all" ] || [ -z "${{ github.event.inputs.test_suite }}" ]; then
npx playwright test --project=${{ matrix.browser }} --shard=${{ matrix.shard }}/${{ matrix.total-shards }}
else
npx playwright test --project=${{ matrix.browser }} --grep @${{ github.event.inputs.test_suite }} --shard=${{ matrix.shard }}/${{ matrix.total-shards }}
fi
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-results-${{ matrix.browser }}-shard-${{ matrix.shard }}
path: |
tests/e2e/test-results/
tests/e2e/playwright-report/
retention-days: 30
- name: Upload screenshots on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: failure-screenshots-${{ matrix.browser }}-shard-${{ matrix.shard }}
path: tests/e2e/test-results/**/*.png
retention-days: 7
critical-tests:
name: Critical Path Tests
runs-on: ubuntu-latest
needs: lint-and-typecheck
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: tests/e2e/package-lock.json
- name: Install dependencies
working-directory: tests/e2e
run: npm ci
- name: Install Playwright browsers
working-directory: tests/e2e
run: npx playwright install --with-deps chromium
- name: Run critical tests
working-directory: tests/e2e
run: npx playwright test --grep @critical --project=chromium
- name: Upload critical test results
uses: actions/upload-artifact@v4
if: always()
with:
name: critical-test-results
path: tests/e2e/test-results/
retention-days: 30
security-tests:
name: Security Tests
runs-on: ubuntu-latest
needs: lint-and-typecheck
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: tests/e2e/package-lock.json
- name: Install dependencies
working-directory: tests/e2e
run: npm ci
- name: Install Playwright browsers
working-directory: tests/e2e
run: npx playwright install --with-deps chromium
- name: Run security tests
working-directory: tests/e2e
run: npx playwright test --grep @security --project=chromium
- name: Upload security test results
uses: actions/upload-artifact@v4
if: always()
with:
name: security-test-results
path: tests/e2e/test-results/
retention-days: 30
mobile-tests:
name: Mobile Tests
runs-on: ubuntu-latest
needs: e2e-tests
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: tests/e2e/package-lock.json
- name: Install dependencies
working-directory: tests/e2e
run: npm ci
- name: Install Playwright browsers
working-directory: tests/e2e
run: npx playwright install --with-deps chromium webkit
- name: Run mobile tests
working-directory: tests/e2e
run: npx playwright test --project=mobile-chrome --project=mobile-safari --grep @critical
- name: Upload mobile test results
uses: actions/upload-artifact@v4
if: always()
with:
name: mobile-test-results
path: tests/e2e/test-results/
retention-days: 30
merge-reports:
name: Merge Test Reports
runs-on: ubuntu-latest
needs: [e2e-tests, critical-tests, security-tests]
if: always()
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: all-results
- name: Merge reports
run: |
mkdir -p merged-report
echo "# Sauce Demo E2E Test Results" > merged-report/summary.md
echo "" >> merged-report/summary.md
echo "**Run Date:** $(date)" >> merged-report/summary.md
echo "**Commit:** ${{ github.sha }}" >> merged-report/summary.md
echo "" >> merged-report/summary.md
# Count results
total_tests=0
passed_tests=0
failed_tests=0
for dir in all-results/*/; do
if [ -f "$dir/results.json" ]; then
tests=$(jq '.stats.total // 0' "$dir/results.json")
passed=$(jq '.stats.passed // 0' "$dir/results.json")
failed=$(jq '.stats.failed // 0' "$dir/results.json")
total_tests=$((total_tests + tests))
passed_tests=$((passed_tests + passed))
failed_tests=$((failed_tests + failed))
fi
done
echo "## Summary" >> merged-report/summary.md
echo "- Total Tests: $total_tests" >> merged-report/summary.md
echo "- Passed: $passed_tests" >> merged-report/summary.md
echo "- Failed: $failed_tests" >> merged-report/summary.md
- name: Upload merged report
uses: actions/upload-artifact@v4
with:
name: merged-test-report
path: merged-report/
retention-days: 90
notify-on-failure:
name: Notify on Failure
runs-on: ubuntu-latest
needs: [e2e-tests, critical-tests, security-tests]
if: failure()
steps:
- name: Create failure summary
run: |
echo "## E2E Test Failure Alert" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "One or more E2E test jobs failed." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Workflow:** ${{ github.workflow }}" >> $GITHUB_STEP_SUMMARY
echo "**Run ID:** ${{ github.run_id }}" >> $GITHUB_STEP_SUMMARY
echo "**Commit:** ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY