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

29 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

import { uploadNotebookIfNotExist } from "./notebookTestUtils";
jest.setTimeout(300000);
const notebookName = "GettingStarted.ipynb";
describe("Notebook UI tests", () => {
it("Upload, Open and Delete Notebook", async () => {
try {
2021-03-15 03:53:16 +00:00
await page.goto("https://localhost:1234/testExplorer.html");
const handle = await page.waitForSelector("iframe");
const frame = await handle.contentFrame();
await frame.waitForSelector(".galleryHeader");
2021-03-15 03:53:16 +00:00
const uploadedNotebookNode = await uploadNotebookIfNotExist(frame, notebookName);
await uploadedNotebookNode.click();
await frame.waitForSelector(".tabNavText");
2021-01-20 15:15:01 +00:00
const tabTitle = await frame.$eval(".tabNavText", (element) => element.textContent);
expect(tabTitle).toEqual(notebookName);
const closeIcon = await frame.waitForSelector(".close-Icon");
await closeIcon.click();
} catch (error) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const testName = (expect as any).getState().currentTestName;
await page.screenshot({ path: `Test Failed ${testName}.jpg` });
throw error;
}
});
});