E2E: booking flow test fails — time slot buttons not found #65
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
apps/e2e/tests/book.spec.ts:62(complete booking flow) consistently fails:The test expects time slot buttons to be visible but none appear. This happens consistently on feature branches but passes on main.
Possible causes
Impact
Non-blocking for unrelated PRs, but creates CI noise. Appeared in PRs #64 (merged despite this failure as changes were unrelated).
Expected fix
Investigate the E2E test setup to ensure booking time slots are properly seeded, or adjust the test to handle empty availability gracefully.
Root Cause
The VitePWA workbox configuration includes
runtimeCachingfor/api/*requests with aNetworkFirststrategy. When the service worker activates during the E2E test, it intercepts API requests before Playwright'spage.route()mocks can handle them. This means the availability mock is bypassed, the request hits the real API server (which returns empty availability since no data is seeded), and no time slot buttons are rendered.The test fails intermittently between main/branches because the timing of service worker activation varies — if the SW activates before the availability fetch fires, the mock is bypassed; if not, it works.
Fix
PR #66 adds
serviceWorkers: 'block'to the Playwright config, preventing the service worker from activating during E2E tests. This is Playwright's recommended approach when usingpage.route()for request interception.