feat: integrate Playwright for E2E UI testing
CI Pipeline / Code Linting (pull_request) Successful in 15s
CI Pipeline / Run Unit Tests (pull_request) Successful in 20s
CI Pipeline / Run E2E Tests (Playwright) (pull_request) Successful in 47s
CI Pipeline / Build Verification (pull_request) Successful in 13s
CI Pipeline / Generate Quality Report (pull_request) Successful in 19s
CI Pipeline / Code Linting (pull_request) Successful in 15s
CI Pipeline / Run Unit Tests (pull_request) Successful in 20s
CI Pipeline / Run E2E Tests (Playwright) (pull_request) Successful in 47s
CI Pipeline / Build Verification (pull_request) Successful in 13s
CI Pipeline / Generate Quality Report (pull_request) Successful in 19s
Add comprehensive Playwright integration for end-to-end UI testing with
full CI/CD pipeline support.
Changes:
---------
1. **Playwright Installation & Configuration**
- Installed @playwright/test and http-server
- Created playwright.config.js with optimized settings
- Configured to use Chromium browser in headless mode
- Auto-starts local web server on port 8080 for testing
2. **E2E Test Suite**
Created tests/e2e/ directory with comprehensive tests:
- **status-message.spec.js** (5 tests)
✓ Status message element exists in DOM
✓ Status message is hidden by default
✓ New game shows status message
✓ Status message has correct CSS classes
- **layout-stability.spec.js** (5 tests)
✓ Chess board has fixed 600x600px dimensions
✓ Board squares are exactly 75px × 75px
✓ Column widths remain stable when pieces are captured
✓ Row heights remain stable when highlighting moves
✓ Last-move highlighting does not change layout
3. **Package.json Scripts**
- test: Runs both unit and E2E tests
- test:unit: Jest unit tests only
- test:e2e: Playwright E2E tests
- test:e2e:headed: Run with browser visible
- test:e2e:ui: Interactive UI mode
4. **CI Pipeline Updates (.gitea/workflows/ci.yml)**
- Split test job into test-unit and test-e2e
- Added Playwright browser installation step
- Configured artifact upload for Playwright reports
- Updated job dependencies to include E2E tests
Test Results:
-------------
✅ 9/9 Playwright E2E tests passing
✅ 124/124 Jest unit tests passing
✅ Total: 133 tests passing
CI Configuration:
-----------------
- Runs Playwright in CI mode (retries: 2, workers: 1)
- Uses GitHub reporter for CI, list reporter for local
- Captures screenshots on failure
- Traces on first retry for debugging
- Artifacts retained for 30 days
Usage:
------
npm run test # All tests (unit + E2E)
npm run test:unit # Jest unit tests only
npm run test:e2e # Playwright E2E tests
npm run test:e2e:ui # Interactive UI mode
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude
parent
bd268926b4
commit
b2df8786ca
+37
-6
@@ -33,8 +33,8 @@ jobs:
|
||||
run: npm run lint
|
||||
continue-on-error: false
|
||||
|
||||
test:
|
||||
name: Run Tests
|
||||
test-unit:
|
||||
name: Run Unit Tests
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
@@ -50,7 +50,7 @@ jobs:
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Run tests with coverage
|
||||
- name: Run unit tests with coverage
|
||||
run: npm run test:coverage
|
||||
|
||||
- name: Check coverage threshold
|
||||
@@ -69,14 +69,45 @@ jobs:
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: test-results
|
||||
name: unit-test-results
|
||||
path: coverage/
|
||||
retention-days: 30
|
||||
|
||||
test-e2e:
|
||||
name: Run E2E Tests (Playwright)
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '18'
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install Playwright Browsers
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Run Playwright tests
|
||||
run: npm run test:e2e
|
||||
|
||||
- name: Upload Playwright Report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: playwright-report
|
||||
path: playwright-report/
|
||||
retention-days: 30
|
||||
|
||||
build-verification:
|
||||
name: Build Verification
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test]
|
||||
needs: [lint, test-unit, test-e2e]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
@@ -113,7 +144,7 @@ jobs:
|
||||
quality-report:
|
||||
name: Generate Quality Report
|
||||
runs-on: ubuntu-latest
|
||||
needs: [lint, test, build-verification]
|
||||
needs: [lint, test-unit, test-e2e, build-verification]
|
||||
if: always()
|
||||
|
||||
steps:
|
||||
|
||||
Reference in New Issue
Block a user