Spaces:
Running
Running
File size: 3,308 Bytes
45b3519 8fe4e41 58bf1b1 8fe4e41 58bf1b1 8fe4e41 58bf1b1 8fe4e41 58bf1b1 8fe4e41 58bf1b1 8fe4e41 58bf1b1 8fe4e41 58bf1b1 8fe4e41 58bf1b1 8fe4e41 58bf1b1 8fe4e41 58bf1b1 8fe4e41 58bf1b1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
// Tests the basic directory operations, such as creating and deleting folders and workspaces.
import { expect, test } from "@playwright/test";
import { Splash, Workspace } from "./lynxkite";
test.describe("Directory operations", () => {
let splash: Splash;
test.beforeAll(async ({ browser }) => {
const page = await browser.newPage();
// To make deletion confirmation dialog to be automatically accepted
page.on("dialog", async (dialog) => {
await dialog.accept();
});
splash = await Splash.open(page);
});
test("Create workspace with default name", async () => {
const workspace = await Workspace.empty(splash.page);
// Not checking for exact match, since there may be pre-existing "Untitled" workspaces
expect(workspace.name).toContain("Untitled");
await workspace.close();
});
test("Create & delete workspace", async () => {
const workspaceName = `TestWorkspace-${Date.now()}`;
const workspace = await Workspace.empty(splash.page, workspaceName);
await workspace.expectCurrentWorkspaceIs(workspaceName);
// Add a box so the workspace is saved
await workspace.addBox("Import Parquet");
await workspace.close();
await splash.deleteEntry(workspaceName);
await expect(splash.getEntry(workspaceName)).not.toBeVisible();
});
test("Create & delete folder", async () => {
const folderName = `TestFolder-${Date.now()}`;
await splash.createFolder(folderName);
await expect(splash.currentFolder()).toHaveText(folderName);
await splash.goHome();
await splash.deleteEntry(folderName);
await expect(splash.getEntry(folderName)).not.toBeVisible();
});
test("Create folder with default name", async () => {
await splash.createFolder();
await expect(splash.currentFolder()).toContainText("Untitled");
});
});
test.describe
.serial("Nested folders & workspaces operations", () => {
let splash: Splash;
test.beforeEach(() => {
// Nested navigation doesn't work yet
test.skip();
});
test.beforeAll(async ({ browser }) => {
const page = await browser.newPage();
// To make deletion confirmation dialog to be automatically accepted
page.on("dialog", async (dialog) => {
await dialog.accept();
});
splash = await Splash.open(page);
await splash.createFolder("TestFolder");
});
test.afterAll(async () => {
//cleanup
test.skip();
await splash.goHome();
await splash.deleteEntry("TestFolder");
});
test("Create nested folder", async () => {
await splash.createFolder("TestFolder2");
await expect(splash.currentFolder()).toHaveText("TestFolder2");
await splash.toParent();
});
test("Delete nested folder", async () => {
await splash.deleteEntry("TestFolder2");
await expect(splash.getEntry("TestFolder2")).not.toBeVisible();
});
test("Create nested workspace", async () => {
const workspace = splash.createWorkspace("TestWorkspace");
await workspace.expectCurrentWorkspaceIs("TestWorkspace");
await workspace.close();
});
test("Delete nested workspace", async () => {
await splash.deleteEntry("TestWorkspace");
await expect(splash.getEntry("TestWorkspace")).not.toBeVisible();
});
});
|