diff --git a/tests/e2e/self-serve-wash.spec.js b/tests/e2e/self-serve-wash.spec.js index 7d41d295..551915fe 100644 --- a/tests/e2e/self-serve-wash.spec.js +++ b/tests/e2e/self-serve-wash.spec.js @@ -50,18 +50,20 @@ async function advanceGuidedWashToLastStep(page) { } } -function waitForLaneCommandRequest(page, command) { - return page.waitForRequest((request) => { - if (!request.url().includes("/modules/self-serve/lane/command")) { +async function waitForLaneCommandRequest(page, command) { + const request = await page.waitForRequest((candidateRequest) => { + if (!candidateRequest.url().includes("/modules/self-serve/lane/command")) { return false; } - if (request.method() !== "POST") { + if (candidateRequest.method() !== "POST") { return false; } - const body = request.postDataJSON?.() || {}; + const body = candidateRequest.postDataJSON?.() || {}; return body.command === command; }); + await request.response(); + return request; } function buildSavedProgress(overrides = {}) { @@ -234,7 +236,7 @@ test.describe("Self-serve wash", () => { lane_id: 7, command: "OPEN_PROPERTY_EXIT_GATE", }); - await expect(page.getByTestId("self-serve-completed-step")).toBeVisible(); + await expect(page.getByTestId("self-serve-completed-step")).toBeVisible({ timeout: 15_000 }); await page.getByTestId("self-serve-nav-close").click(); await expect(page.getByTestId("self-serve-completed-step")).toBeHidden(); await expect(page.getByTestId("self-serve-vehicle-step")).toBeVisible(); @@ -857,7 +859,7 @@ test.describe("Self-serve wash", () => { command: "OPEN_PROPERTY_EXIT_GATE", }); await expect(page.getByTestId("self-serve-action-error")).toBeHidden(); - await expect(page.getByTestId("self-serve-completed-step")).toBeVisible(); + await expect(page.getByTestId("self-serve-completed-step")).toBeVisible({ timeout: 15_000 }); await expect(page.getByTestId("self-serve-live-elapsed")).toBeHidden(); });