Spaces:
Running
Running
File size: 1,380 Bytes
8fe4e41 1cbdba3 8fe4e41 1cbdba3 8fe4e41 58bf1b1 8fe4e41 58bf1b1 8fe4e41 1cbdba3 8fe4e41 1cbdba3 8fe4e41 1cbdba3 8fe4e41 1cbdba3 8fe4e41 1cbdba3 |
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 |
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
// Test uploading a file in an import box.
import { expect, test } from "@playwright/test";
import { Splash, Workspace } from "./lynxkite";
let workspace: Workspace;
test.beforeEach(async ({ browser }) => {
workspace = await Workspace.empty(
await browser.newPage(),
"upload_spec_test",
);
});
test.afterEach(async () => {
await workspace.close();
const splash = await new Splash(workspace.page);
splash.page.on("dialog", async (dialog) => {
await dialog.accept();
});
await splash.deleteEntry("upload_spec_test");
});
test("can upload and import a simple CSV", async () => {
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const csvPath = join(__dirname, "data", "upload_test.csv");
await workspace.addBox("Import CSV");
const csvBox = workspace.getBox("Import CSV 1");
const filenameInput = csvBox.locator("input.input-bordered").nth(0);
await filenameInput.click();
await filenameInput.fill(csvPath);
await filenameInput.press("Enter");
await workspace.addBox("View tables");
const tableBox = workspace.getBox("View tables 1");
await workspace.connectBoxes("Import CSV 1", "View tables 1");
const tableRows = tableBox.locator("table tbody tr");
await expect(tableRows).toHaveCount(4);
});
|