mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 15:06:55 +00:00
a93c8509cd
* initial commit for notbooks pupeteer tests * Added Auth * added try catch block with screenshot for error * Addressed PR comments * renamed params * renamed param * fixed formatting error * Updates mongo spec to remove waitFor on already awaited selector * added logging statements * format errors fixed * added ci env variables * increased delay for render * removed logging * added delay * fix format error * removed deletion * reverted package.json change Co-authored-by: zfoster <notzachfoster@gmail.com>
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import "expect-puppeteer";
|
|
import { getTestExplorerFrame, uploadNotebookIfNotExist } from "./notebookTestUtils";
|
|
import { ElementHandle, Frame } from "puppeteer";
|
|
|
|
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();
|
|
uploadedNotebookNode = await uploadNotebookIfNotExist(frame, notebookName);
|
|
await uploadedNotebookNode.click();
|
|
await frame.waitForSelector(".tabNavText");
|
|
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;
|
|
}
|
|
});
|
|
});
|