Mock /ping in driverAuth e2e so the ConnectivityIssue overlay does not hide the driver entry point (#266)
🤖 Generated with [OpenClaw](https://openclaw.ai) ## Why `tests/e2e/driverAuth.spec.ts` (added in #265) failed across 4 full-E2E matrix jobs on master: - `E2E-full-Chromium-mobile-subuser-shard-1-of-1` (job 93176119977) - `E2E-full-Chromium-desktop-subuser-shard-1-of-1` (job 93176119967) - `E2E-full-Firefox-mobile-subuser-shard-1-of-1` (job 93176119955) - `E2E-full-WebKit-mobile-subuser-shard-1-of-1` (job 93176119945) Root cause: `/login` wraps the LoginForm in ConnectivityIssue, which renders an overlay when GET /ping does not return ok. In the full subuser E2E matrix driverAuth.spec.ts runs first; the api backend may not yet have answered /ping by then, so the overlay covered the page and `driver-login-link` was not visible. Targeted E2E (driverAuth only) passed because the api was warm by then. ## Fix Add a `test.beforeEach` that mocks `/ping` to return `{ data: { ok: true } }`, mirroring the pattern already used in `superuser-department-lanes.spec.ts`. With /ping short-circuited, ConnectivityIssue renders the LoginForm slot and `driver-login-link` is reachable. ## Risk Low. The mock only affects this spec; other suites and the live api are untouched. driverAuth previously passed under targeted E2E, so the page logic itself is fine — this just removes a race against the api health check at the top of the subuser test list. --------- Co-authored-by: Truck Wash Agent <agent@copenhagentruckwash.local>
This commit is contained in:
co-authored by
Truck Wash Agent
parent
d4f92cd259
commit
82c95d32c0
@@ -11,6 +11,23 @@ import { expect, test } from "@playwright/test";
|
||||
* on mobile (form inputs reachable, submit button visible).
|
||||
*/
|
||||
|
||||
// `/login` wraps the LoginForm in ConnectivityIssue, which shows an overlay
|
||||
// when GET /ping fails. In the full E2E matrix the api health check may not
|
||||
// have come up yet when this suite runs first, so mock /ping to short-circuit
|
||||
// the overlay and let the LoginForm (with the driver entry point) mount.
|
||||
const pingOkBody = JSON.stringify({ data: { ok: true } });
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.route(/\/ping(\?.*)?$/i, async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
headers: { "access-control-allow-origin": "*" },
|
||||
body: pingOkBody,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("[AUTH][Driver] discoverability", () => {
|
||||
test("/login surfaces the driver login button on desktop and mobile", async ({ page }, testInfo) => {
|
||||
await page.goto("/login");
|
||||
|
||||
Reference in New Issue
Block a user