import { expect, test } from "@playwright/test"; import { bookingTestData, operatorCredentials } from "./fixtures"; const LIVE_ENABLED = process.env.PLAYWRIGHT_LIVE === "1"; test.describe("Admin Module - POS Mobile Order Flow", () => { test.beforeEach(async ({ page }, testInfo) => { test.skip(testInfo.project.name !== "chromium-mobile", "Live mobile POS smoke is scoped to chromium-mobile."); test.skip(!LIVE_ENABLED, "Set PLAYWRIGHT_LIVE=1 to run the live mobile POS smoke suite."); await page.goto("/admin/login"); await page.fill('input[name="user_id"]', operatorCredentials.userId); await page.fill('input[name="password"]', operatorCredentials.password); await page.click("#operator_login_button"); await expect(page).toHaveURL(/\/admin(\?.*)?$/, { timeout: 15_000 }); }); test("operator login reaches the mobile POS scanner shell", async ({ page }) => { await page.goto(`/admin/${bookingTestData.departmentId}/modules/pos`); await expect(page.getByTestId("pos-mobile-step-1-shell")).toBeVisible({ timeout: 20_000 }); await expect(page.getByTestId("pos-mobile-step-1-title")).toContainText("Scan nummerplader"); await expect(page.getByTestId("pos-mobile-manual-input-toggle")).toBeVisible(); }); test("manual registration input opens and uppercases the value", async ({ page }) => { await page.goto(`/admin/${bookingTestData.departmentId}/modules/pos`); await expect(page.getByTestId("pos-mobile-manual-input-toggle")).toBeVisible({ timeout: 20_000 }); await page.getByTestId("pos-mobile-manual-input-toggle").click(); await expect(page.getByTestId("pos-mobile-manual-input")).toBeVisible({ timeout: 10_000 }); await page.getByTestId("pos-mobile-reg-input-1").fill("ec21233"); await expect(page.getByTestId("pos-mobile-reg-input-1")).toHaveValue("EC21233"); }); });