2021-01-20 06:42:45 +00:00
|
|
|
import { uploadNotebookIfNotExist } from "./notebookTestUtils";
|
2020-11-19 17:29:38 +00:00
|
|
|
import { ElementHandle, Frame } from "puppeteer";
|
2021-01-20 06:42:45 +00:00
|
|
|
import { getTestExplorerFrame } from "../testExplorer/TestExplorerUtils";
|
2020-11-19 17:29:38 +00:00
|
|
|
|
|
|
|
jest.setTimeout(300000);
|
|
|
|
|
|
|
|
const notebookName = "GettingStarted.ipynb";
|
|
|
|
let frame: Frame;
|
|
|
|
let uploadedNotebookNode: ElementHandle<Element>;
|
|
|
|
|
|
|
|
describe("Notebook UI tests", () => {
|
|
|
|
it("Upload, Open and Delete Notebook", async () => {
|
|
|
|
try {
|
|
|
|
frame = await getTestExplorerFrame();
|
2021-01-20 06:42:45 +00:00
|
|
|
await frame.waitForSelector(".galleryHeader");
|
2020-11-19 17:29:38 +00:00
|
|
|
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);
|
2020-11-19 17:29:38 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|