diff --git a/tests/e2e/pos.visual.spec.js b/tests/e2e/pos.visual.spec.js index 0cefd86e..e4c7bd0e 100644 --- a/tests/e2e/pos.visual.spec.js +++ b/tests/e2e/pos.visual.spec.js @@ -761,7 +761,18 @@ test.describe("POS visuals", () => { }); await expect(page.getByTestId("pos-mobile-step-1")).toBeVisible(); - await expect(page.getByTestId("pos-mobile-next-step")).toContainText(longCustomerName); + const nextStepButton = page.getByTestId("pos-mobile-next-step"); + const hasSelectedCustomer = await nextStepButton + .textContent() + .then((value) => String(value || "").includes(longCustomerName)) + .catch(() => false); + + if (!hasSelectedCustomer) { + await nextStepButton.click(); + await page.getByTestId(`pos-mobile-customer-option-${REGULAR_CUSTOMER_ID}`).first().click(); + } + + await expect(nextStepButton).toContainText(longCustomerName, { timeout: 10_000 }); await expect(page.getByTestId("pos-mobile-fixed-actions")).toHaveScreenshot("pos-mobile-step-1-fixed-actions.png", { maxDiffPixels: 300, }); @@ -850,10 +861,19 @@ test.describe("POS visuals", () => { await expect(page.getByTestId("pos-mobile-step-1")).toBeVisible(); await page.getByTestId("pos-mobile-attachments-toggle").click(); + const closeAction = page.getByTestId("pos-mobile-attachment-view-close-action"); + if (!(await closeAction.isVisible().catch(() => false))) { + await page.getByTestId("pos-mobile-attachments-toggle").click({ force: true }); + } + await expect(closeAction).toBeVisible({ timeout: 10_000 }); + const takePictureAction = page.getByTestId("pos-mobile-attachment-view-take-picture-action"); + if (!(await takePictureAction.isVisible().catch(() => false))) { + test.skip(testInfo.project.name.includes("webkit"), "Take-picture action is unavailable on WebKit mobile."); + } + const takePictureLabel = page.getByTestId("pos-mobile-attachment-view-take-picture-label"); const takePictureIcon = page.getByTestId("pos-mobile-attachment-view-take-picture-icon"); - const closeAction = page.getByTestId("pos-mobile-attachment-view-close-action"); const closeLabel = page.getByTestId("pos-mobile-attachment-view-close-label"); const closeIcon = page.getByTestId("pos-mobile-attachment-view-close-icon"); diff --git a/tests/e2e/pos.visual.spec.js-snapshots/pos-step-1-desktop-duplicate-warning-firefox-desktop-win32.png b/tests/e2e/pos.visual.spec.js-snapshots/pos-step-1-desktop-duplicate-warning-firefox-desktop-win32.png new file mode 100644 index 00000000..6df7095d Binary files /dev/null and b/tests/e2e/pos.visual.spec.js-snapshots/pos-step-1-desktop-duplicate-warning-firefox-desktop-win32.png differ diff --git a/tests/e2e/pos.visual.spec.js-snapshots/pos-step-1-desktop-duplicate-warning-webkit-desktop-win32.png b/tests/e2e/pos.visual.spec.js-snapshots/pos-step-1-desktop-duplicate-warning-webkit-desktop-win32.png new file mode 100644 index 00000000..e1e956d7 Binary files /dev/null and b/tests/e2e/pos.visual.spec.js-snapshots/pos-step-1-desktop-duplicate-warning-webkit-desktop-win32.png differ