fix(e2e): add race condition guards to checkpoint UI tests - #262
Conversation
Four checkpoint tests were calling count() immediately after the API response without waiting for React to render. This caused intermittent failures where the locator found 0 checkpoint items despite the API returning 3 checkpoints. Fix: Wait for checkpoint items OR empty state to be visible before calling count() to ensure React has finished rendering. Tests fixed: - should show restore confirmation dialog - should display checkpoint diff preview - should display checkpoint metadata - should allow deleting checkpoint Result: 48/50 checkpoint tests pass (96%). Remaining 2 failures are WebKit login timeouts tracked in #230.
WalkthroughThis PR adds explicit visibility waits to end-to-end tests for the checkpoint UI to synchronize test execution and prevent race conditions between DOM rendering and test assertions. Changes
Possibly related issues
Possibly related PRs
Poem
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)tests/**/*.{ts,tsx,test.ts}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
tests/e2e/**/*.{ts,test.ts}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (3)📓 Common learnings📚 Learning: 2026-01-11T23:33:31.895ZApplied to files:
📚 Learning: 2026-01-11T23:33:31.895ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
🔇 Additional comments (4)
Comment |
Add race condition guards using
|
Summary
count()was called before React renderedChanges
Added
await expect(checkpointItems.first().or(emptyState)).toBeVisible()beforecount()calls in:should show restore confirmation dialogshould display checkpoint diff previewshould display checkpoint metadatashould allow deleting checkpointTest Results
Remaining 2 failures are WebKit login timeouts tracked in #230 (not checkpoint-specific).
Test plan
npx playwright test test_checkpoint_ui.spec.ts --project=chromium- 10/10 passSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.