Fix self-serve vehicle step progression

This commit is contained in:
Jeppe Bundgaard
2026-06-03 17:51:46 +02:00
parent 05cabd8edc
commit cf29589e29
4 changed files with 121 additions and 28 deletions
+25 -7
View File
@@ -59,6 +59,12 @@ async function fillRegistration(page, value = "ab12345") {
await registration.press("Escape");
}
async function fillRegistrationWithoutClosingAutocomplete(page, value = "ab12345") {
const registration = page.locator('input[placeholder*="registreringsnummer"]').first();
await registration.fill(value);
await expect(registration).toHaveValue(value.toUpperCase());
}
async function selectVehicleType(page, vehicleTypeId = 2) {
await page.getByTestId(`self-serve-vehicle-type-${vehicleTypeId}`).click();
await expect(page.getByTestId("self-serve-vehicle-selector-description")).toContainText(/Truck|Van|Car/);
@@ -79,7 +85,7 @@ async function completeGuidedWash(page) {
function collectSelfServeRequests(page) {
const requests = {
departments: [],
vehicleTypes: [],
vehicleTypeProducts: [],
customerVehicles: [],
allowed: [],
conditions: [],
@@ -99,7 +105,7 @@ function collectSelfServeRequests(page) {
};
if (url.pathname.endsWith("/guest/departments")) requests.departments.push(entry);
if (url.pathname.endsWith("/modules/xlvask/internal/vehicle-types")) requests.vehicleTypes.push(entry);
if (url.pathname.endsWith("/products")) requests.vehicleTypeProducts.push(entry);
if (url.pathname.endsWith("/vehicles")) requests.customerVehicles.push(entry);
if (url.pathname.endsWith("/department/selfserve/vehicle/allowed")) requests.allowed.push(entry);
if (url.pathname.endsWith("/department/selfserve/vehicle/conditions")) requests.conditions.push(entry);
@@ -146,10 +152,6 @@ test.describe("User MyWashStart mocked flow", () => {
await page.getByTestId("self-serve-wash-type-manual").click();
await page.getByTestId("self-serve-nav-confirm").click();
await expect(page.getByTestId("self-serve-tasks-step")).toBeVisible({ timeout: 10_000 });
await page.getByTestId("self-serve-task-9001-toggle").click();
await expect(page.getByTestId("self-serve-nav-confirm")).toBeEnabled();
await page.getByTestId("self-serve-nav-confirm").click();
await expect(page.getByTestId("self-serve-live-elapsed")).toBeVisible({ timeout: 10_000 });
await completeGuidedWash(page);
@@ -158,7 +160,7 @@ test.describe("User MyWashStart mocked flow", () => {
await expect(page.getByTestId("self-serve-completed-step")).toBeVisible({ timeout: 15_000 });
expect(requests.departments[0]?.url.searchParams.get("include_lanes")).toBe("true");
expect(requests.vehicleTypes.length).toBeGreaterThan(0);
expect(requests.vehicleTypeProducts.length).toBeGreaterThan(0);
expect(requests.customerVehicles.length).toBeGreaterThan(0);
expect(requests.allowed.length).toBeGreaterThan(0);
expect(requests.conditions.some((request) => request.body?.question === 11 && request.body?.value === true)).toBe(
@@ -172,6 +174,22 @@ test.describe("User MyWashStart mocked flow", () => {
);
});
test("registration autocomplete does not cover vehicle type selection", async ({ page }) => {
await mockApi(page, {
authenticated: true,
permissions: ["user"],
sessionData: { customer_number: 12345679 },
selfServe: true,
});
await primeMockSession(page, { token: "user-my-wash-registration-overlay-token", bootPath: "/user/wash/start" });
await expect(page.getByTestId("self-serve-department-name")).toContainText("Roskilde", { timeout: 15_000 });
await fillRegistrationWithoutClosingAutocomplete(page);
await selectVehicleType(page, 2);
await expect(page.getByTestId("self-serve-nav-next")).toBeEnabled();
});
test("machine wash enables the relay after START and rolls back when relay enable fails", async ({ page }) => {
const requests = collectSelfServeRequests(page);
await seedSavedProgress(page, {