Skip to content

Commit 160f5bc

Browse files
adewaleclaude
andcommitted
feat: Add pre-push hook with two-phase E2E testing
Add comprehensive pre-push hook to ensure E2E tests pass before pushing: - Phase 1: Smoke test (~20s, Chromium only) - 3 critical test files - Phase 2: Full test (~3-5min, all browsers) - Chromium, Firefox, WebKit Requires wrangler dev running on port 8787 for reliable E2E testing. Also: - Add test:e2e:smoke and test:e2e:full npm scripts - Remove playwright-report/ from git tracking (add to .gitignore) - Update PLAYWRIGHT-TESTING.md spec with pre-push documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 27a8c17 commit 160f5bc

File tree

92 files changed

+106
-3195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+106
-3195
lines changed

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ debug-reports/
2929

3030
# Playwright test results
3131
test-results/
32+
playwright-report/

app/.husky/pre-push

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#!/bin/sh
2+
3+
# Pre-push hook: Two-phase E2E testing
4+
# Phase 1: Smoke test (fast, ~20s, Chromium only)
5+
# Phase 2: Full test (comprehensive, ~3-5min, all browsers)
6+
#
7+
# REQUIRES: wrangler dev running on port 8787
8+
# Start with: npm run build && npx wrangler dev
9+
10+
set -e
11+
12+
cd app
13+
14+
echo ""
15+
echo "========================================"
16+
echo " PRE-PUSH: E2E Test Suite"
17+
echo "========================================"
18+
echo ""
19+
20+
# Check if wrangler dev is running (required for E2E tests)
21+
if ! lsof -i:8787 > /dev/null 2>&1; then
22+
echo "❌ ERROR: wrangler dev is not running on port 8787"
23+
echo ""
24+
echo "E2E tests require the real backend for reliable results."
25+
echo ""
26+
echo "To start the backend:"
27+
echo " cd app && npm run build && npx wrangler dev"
28+
echo ""
29+
echo "Then try pushing again."
30+
echo ""
31+
echo "To skip E2E tests (not recommended):"
32+
echo " git push --no-verify"
33+
echo ""
34+
exit 1
35+
fi
36+
37+
echo "✓ Backend detected on port 8787"
38+
echo ""
39+
40+
# Phase 1: Smoke Test (fast feedback)
41+
echo "----------------------------------------"
42+
echo "Phase 1: Smoke Test (~20s, Chromium)"
43+
echo "----------------------------------------"
44+
echo ""
45+
46+
SMOKE_START=$(date +%s)
47+
48+
if npm run test:e2e:smoke; then
49+
SMOKE_END=$(date +%s)
50+
SMOKE_DURATION=$((SMOKE_END - SMOKE_START))
51+
echo ""
52+
echo "✅ Smoke test passed! (${SMOKE_DURATION}s)"
53+
echo ""
54+
else
55+
echo ""
56+
echo "❌ Smoke test FAILED"
57+
echo ""
58+
echo "Fix the issues above before pushing."
59+
echo "To skip: git push --no-verify"
60+
echo ""
61+
exit 1
62+
fi
63+
64+
# Phase 2: Full Test (comprehensive, all browsers)
65+
echo "----------------------------------------"
66+
echo "Phase 2: Full Test (~3-5min, All Browsers)"
67+
echo "----------------------------------------"
68+
echo ""
69+
70+
FULL_START=$(date +%s)
71+
72+
if npm run test:e2e:full; then
73+
FULL_END=$(date +%s)
74+
FULL_DURATION=$((FULL_END - FULL_START))
75+
echo ""
76+
echo "✅ Full test passed! (${FULL_DURATION}s)"
77+
echo ""
78+
else
79+
echo ""
80+
echo "❌ Full test FAILED"
81+
echo ""
82+
echo "Some tests failed on Firefox or WebKit."
83+
echo "Review the failures above."
84+
echo "To skip: git push --no-verify"
85+
echo ""
86+
exit 1
87+
fi
88+
89+
TOTAL_DURATION=$((SMOKE_DURATION + FULL_DURATION))
90+
91+
echo "========================================"
92+
echo " ✅ All E2E tests passed! (${TOTAL_DURATION}s)"
93+
echo " Pushing to remote..."
94+
echo "========================================"
95+
echo ""

app/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
"test:unit:watch": "vitest",
1515
"test:integration": "cd test/integration && npm test",
1616
"test:all": "npm run test:unit && npm run test:integration",
17+
"test:e2e": "npx playwright test",
18+
"test:e2e:smoke": "npx playwright test --project=chromium e2e/track-reorder.spec.ts e2e/plock-editor.spec.ts e2e/pitch-contour-alignment.spec.ts",
19+
"test:e2e:full": "npx playwright test --project=chromium --project=firefox --project=webkit",
1720
"validate:sync": "tsx scripts/validate-sync-checklist.ts",
1821
"validate:samples": "bash scripts/validate-sample-volume.sh",
1922
"samples": "tsx scripts/process-samples.ts",

app/playwright-report/data/004094af178776a510d8bfb14a86dcb3a0011c99.md

Lines changed: 0 additions & 94 deletions
This file was deleted.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)