diff --git a/__tests__/frontend-playwright/destination-selection-unhandled-error.spec.ts b/__tests__/frontend-playwright/destination-selection-unhandled-error.spec.ts index cb568f37..b58fc68f 100644 --- a/__tests__/frontend-playwright/destination-selection-unhandled-error.spec.ts +++ b/__tests__/frontend-playwright/destination-selection-unhandled-error.spec.ts @@ -1,6 +1,6 @@ import { expect, test } from "@playwright/test"; -import { calls, setup } from "../test-utils-playwright/stub-endpoints"; +import { setup } from "../test-utils-playwright/stub-endpoints"; test.beforeEach(async ({ page }) => { await page.goto("/"); diff --git a/__tests__/frontend-playwright/destination-selection-unknown-error.spec.ts b/__tests__/frontend-playwright/destination-selection-unknown-error.spec.ts new file mode 100644 index 00000000..f37cfc1a --- /dev/null +++ b/__tests__/frontend-playwright/destination-selection-unknown-error.spec.ts @@ -0,0 +1,41 @@ +import { expect, test } from "@playwright/test"; + +import { setup } from "../test-utils-playwright/stub-endpoints"; + +test.beforeEach(async ({ page }) => { + await page.goto("/"); + await setup(page); + + await page.evaluate(() => { + window._endpointStubs.listFolders = { + status: "success", + value: { status: "error", type: "unknown" }, + }; + window._endpointStubs.listSharedDrives = { + status: "success", + value: { + status: "success", + response: [ + { id: "ID_DRIVE_1", name: "DRIVE 1" }, + { id: "ID_DRIVE_2", name: "DRIVE 2" }, + ], + }, + }; + }); +}); + +test("handles raw errors in source folder selection gracefully", async ({ + page, +}) => { + await expect( + page.getByText("Shared drive mover", { exact: true }), + ).toBeVisible(); + await page.getByText("Continue").click(); + await page.getByText("DRIVE 1").click(); + await page.getByText("Continue").click(); + await page.getByText("DRIVE 2").dblclick(); + await expect( + page.getByText("An error occurred", { exact: true }), + ).toBeVisible(); + await expect(page.getByText("An unknown error occurred")).toBeVisible(); +}); diff --git a/__tests__/frontend/destination-selection-unknown-error.cy.ts b/__tests__/frontend/destination-selection-unknown-error.cy.ts deleted file mode 100644 index d56e8eae..00000000 --- a/__tests__/frontend/destination-selection-unknown-error.cy.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { stubEndpoints } from "../test-utils/stubEndpoints"; - -stubEndpoints({ - listFolders: (successHandler) => { - setTimeout(() => { - successHandler({ status: "error", type: "unknown" }); - }, 100); - }, - listSharedDrives: (successHandler) => { - successHandler({ - status: "success", - response: [ - { id: "ID_DRIVE_1", name: "DRIVE 1" }, - { id: "ID_DRIVE_2", name: "DRIVE 2" }, - ], - }); - }, -}); - -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("DRIVE 1").click(); - cy.contains("Continue").click(); - cy.contains("DRIVE 2").dblclick(); - cy.contains("An error occurred").should("be.visible"); - cy.contains("An unknown error occurred").should("be.visible"); -});