Skip to content

Commit

Permalink
Ported configuration test
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Oct 21, 2023
1 parent 854eb53 commit 6aca0ce
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 63 deletions.
4 changes: 2 additions & 2 deletions __tests__/frontend-playwright/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { calls, setup } from "../test-utils-playwright/stub-endpoints";
test.beforeEach(async ({ page }) => {
await page.goto("/");
await setup(page);
});

test("works with basic configuration", async ({ page }) => {
await page.evaluate(() => {
window._endpointStubs.listFolders = {
status: "success",
Expand All @@ -22,7 +20,9 @@ test("works with basic configuration", async ({ page }) => {
value: { status: "success", response: { errors: [] } },
};
});
});

test("works with basic configuration", async ({ page }) => {
await expect(
page.getByText("Shared drive mover", { exact: true }),
).toBeVisible();
Expand Down
67 changes: 67 additions & 0 deletions __tests__/frontend-playwright/configuration.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { expect, test } from "@playwright/test";

import { calls, 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: "success", response: [] },
};
window._endpointStubs.listSharedDrives = {
status: "success",
value: { status: "success", response: [] },
};
window._endpointStubs.move = {
status: "success",
value: { status: "success", response: { errors: [] } },
};
});
});

test("works with copy configuration", async ({ page }) => {
await expect(
page.getByText("Shared drive mover", { exact: true }),
).toBeVisible();
await page.getByText("Copy comments").click();
await page.getByText("Continue").click();
await page.getByText("My Drive").click();
await page.getByText("Continue").click();
await page.getByText("My Drive").click();
await page.getByText("Continue").click();
await expect(
page.getByText(
'contents of the folder "My Drive" into the folder "My Drive"',
),
).toBeVisible();
await page.getByText("Move", { exact: true }).click();
await expect(page.getByText("Done!", { exact: true })).toBeVisible();
await expect(page.getByText("Successfully moved")).toBeVisible();
expect(calls.move).toHaveLength(1);
expect(calls.move[0]).toStrictEqual(["root", "root", false, true, false]);
});

test("works with merge configuration", async ({ page }) => {
await expect(
page.getByText("Shared drive mover", { exact: true }),
).toBeVisible();
await page.getByText("Merge folders").click();
await page.getByText("Continue").click();
await page.getByText("My Drive").click();
await page.getByText("Continue").click();
await page.getByText("My Drive").click();
await page.getByText("Continue").click();
await expect(
page.getByText(
'contents of the folder "My Drive" into the folder "My Drive"',
),
).toBeVisible();
await page.getByText("Move", { exact: true }).click();
await expect(page.getByText("Done!", { exact: true })).toBeVisible();
await expect(page.getByText("Successfully moved")).toBeVisible();
expect(calls.move).toHaveLength(1);
expect(calls.move[0]).toStrictEqual(["root", "root", true, false, false]);
});
61 changes: 0 additions & 61 deletions __tests__/frontend/configuration.cy.ts

This file was deleted.

0 comments on commit 6aca0ce

Please sign in to comment.