From cee5d91b47a61bce95aa01805a5d38e60f4f4255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20D=C4=9Bdi=C4=8D?= Date: Sun, 22 Oct 2023 18:27:14 +0200 Subject: [PATCH] Ported source selection unknown error test --- .../source-selection-unknown-error.spec.ts | 28 +++++++++++++++++++ .../source-selection-unknown-error.cy.ts | 17 ----------- 2 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 __tests__/frontend-playwright/source-selection-unknown-error.spec.ts delete mode 100644 __tests__/frontend/source-selection-unknown-error.cy.ts diff --git a/__tests__/frontend-playwright/source-selection-unknown-error.spec.ts b/__tests__/frontend-playwright/source-selection-unknown-error.spec.ts new file mode 100644 index 00000000..2ab5ea4a --- /dev/null +++ b/__tests__/frontend-playwright/source-selection-unknown-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: "success", + value: { status: "error", type: "unknown" }, + }, + ]; + }); + + 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("An unknown error occurred")).toBeVisible(); +}); diff --git a/__tests__/frontend/source-selection-unknown-error.cy.ts b/__tests__/frontend/source-selection-unknown-error.cy.ts deleted file mode 100644 index 1650ec7f..00000000 --- a/__tests__/frontend/source-selection-unknown-error.cy.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { stubEndpoints } from "../test-utils/stubEndpoints"; - -stubEndpoints({ - listSharedDrives: (successHandler) => { - setTimeout(() => { - successHandler({ status: "error", type: "unknown" }); - }, 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("An unknown error occurred").should("be.visible"); -});