Wait for self-serve completion command response

This commit is contained in:
Jeppe B
2026-05-30 17:45:06 +02:00
parent ff70326665
commit 25f2be875c
+9 -7
View File
@@ -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();
});