diff --git a/__tests__/frontend-playwright/source-selection-unhandled-error.spec.ts b/__tests__/frontend-playwright/source-selection-unhandled-error.spec.ts new file mode 100644 index 00000000..3d80a3c5 --- /dev/null +++ b/__tests__/frontend-playwright/source-selection-unhandled-error.spec.ts @@ -0,0 +1,28 @@ +import { expect, test } from "@playwright/test"; + +import { setup } from "../test-utils-playwright/stub-endpoints"; + +test("handles raw errors in source folder selection gracefully", async ({ + page, +}) => { + await page.goto("/"); + await setup(page); + + await page.evaluate(() => { + window._endpointStubs.listSharedDrives = [ + { + status: "failure", + value: new Error("ERROR MESSAGE"), + }, + ]; + }); + + await expect( + page.getByText("Shared drive mover", { exact: true }), + ).toBeVisible(); + await page.getByText("Continue").click(); + await expect( + page.getByText("An error occurred", { exact: true }), + ).toBeVisible(); + await expect(page.getByText("ERROR MESSAGE")).toBeVisible(); +}); diff --git a/__tests__/frontend/source-selection-unhandled-error.cy.ts b/__tests__/frontend/source-selection-unhandled-error.cy.ts deleted file mode 100644 index 435ac463..00000000 --- a/__tests__/frontend/source-selection-unhandled-error.cy.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { stubEndpoints } from "../test-utils/stubEndpoints"; - -stubEndpoints({ - listSharedDrives: (_, failureHandler) => { - setTimeout(() => { - failureHandler(new Error("ERROR MESSAGE")); - }, 100); - }, -}); - -it("handles raw errors in source folder selection gracefully", () => { - cy.visit("http://localhost:8080"); - cy.contains("Shared drive mover"); - cy.contains("Continue").click(); - cy.contains("An error occurred").should("be.visible"); - cy.contains("ERROR MESSAGE"); -});