cosmos-explorer/test/notebooks/upload.spec.ts

26 lines
1.2 KiB
TypeScript
Raw Normal View History

2021-04-20 04:08:25 +01:00
import { jest } from "@jest/globals";
import "expect-playwright";
import fs from "fs";
import path from "path";
2021-07-22 00:22:31 +01:00
import { waitForExplorer } from "../utils/waitForExplorer";
2021-04-20 04:08:25 +01:00
jest.setTimeout(240000);
const filename = "GettingStarted.ipynb";
const fileToUpload = `GettingStarted-ignore${Math.floor(Math.random() * 100000)}.ipynb`;
fs.copyFileSync(path.join(__dirname, filename), path.join(__dirname, fileToUpload));
test("Notebooks", async () => {
await page.goto("https://localhost:1234/testExplorer.html?accountName=portal-sql-runner-west-us");
2021-07-22 00:22:31 +01:00
const explorer = await waitForExplorer();
2021-04-20 04:08:25 +01:00
// Upload and Delete Notebook
await explorer.click('[data-test="My Notebooks"] [aria-label="More"]');
await explorer.click('button[role="menuitem"]:has-text("Upload File")');
await explorer.setInputFiles("#importFileInput", path.join(__dirname, fileToUpload));
await explorer.click('[aria-label="Upload"]');
2021-04-20 04:08:25 +01:00
await explorer.click(`[data-test="${fileToUpload}"] [aria-label="More"]`);
await explorer.click('button[role="menuitem"]:has-text("Delete")');
await explorer.click('button:has-text("Delete")');
await expect(explorer).not.toHaveText(".notebookResourceTree", fileToUpload);
});