mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-06-12 23:47:29 +01:00
removed deletion
This commit is contained in:
+1
-1
@@ -189,7 +189,7 @@
|
|||||||
"pack:fast": "node --max_old_space_size=10196 ./node_modules/webpack/bin/webpack.js --mode development --progress",
|
"pack:fast": "node --max_old_space_size=10196 ./node_modules/webpack/bin/webpack.js --mode development --progress",
|
||||||
"copyToConsumers": "node copyToConsumers",
|
"copyToConsumers": "node copyToConsumers",
|
||||||
"test": "rimraf coverage && jest",
|
"test": "rimraf coverage && jest",
|
||||||
"test:e2e": "jest -c ./jest.config.e2e.js --detectOpenHandles test/notebooks/uploadOpenAndDeleteNotebook.spec.ts",
|
"test:e2e": "jest -c ./jest.config.e2e.js --detectOpenHandles test/notebooks/uploadAndOpenNotebook.spec.ts",
|
||||||
"watch": "npm run start",
|
"watch": "npm run start",
|
||||||
"wait-for-server": "wait-on -t 240000 -i 5000 -v https-get://0.0.0.0:1234/",
|
"wait-for-server": "wait-on -t 240000 -i 5000 -v https-get://0.0.0.0:1234/",
|
||||||
"build:ase": "gulp build:ase",
|
"build:ase": "gulp build:ase",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { ElementHandle, Frame } from "puppeteer";
|
import { ElementHandle, Frame } from "puppeteer";
|
||||||
import { TestExplorerParams } from "./testExplorer/TestExplorerParams";
|
import { TestExplorerParams } from "./testExplorer/TestExplorerParams";
|
||||||
|
import * as path from "path";
|
||||||
|
|
||||||
export const NOTEBOOK_OPERATION_DELAY = 5000;
|
export const NOTEBOOK_OPERATION_DELAY = 5000;
|
||||||
export const RENDER_DELAY = 2500;
|
export const RENDER_DELAY = 2500;
|
||||||
@@ -53,9 +54,14 @@ export const getTestExplorerFrame = async (): Promise<Frame> => {
|
|||||||
return testExplorerFrame;
|
return testExplorerFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const uploadNotebook = async (frame: Frame, uploadNotebookPath: string): Promise<void> => {
|
export const uploadNotebookIfNotExist = async (frame: Frame, notebookName: string): Promise<ElementHandle<Element>> => {
|
||||||
const notebookResourceTree = await frame.waitForSelector(".notebookResourceTree");
|
const notebookNode = await getNotebookNode(frame, notebookName);
|
||||||
|
if (notebookNode) {
|
||||||
|
return notebookNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
const uploadNotebookPath = path.join(__dirname, "testNotebooks", notebookName);
|
||||||
|
const notebookResourceTree = await frame.waitForSelector(".notebookResourceTree");
|
||||||
const treeNodeHeadersBeforeUpload = await notebookResourceTree.$$(".treeNodeHeader");
|
const treeNodeHeadersBeforeUpload = await notebookResourceTree.$$(".treeNodeHeader");
|
||||||
|
|
||||||
const ellipses = await treeNodeHeadersBeforeUpload[2].$("button");
|
const ellipses = await treeNodeHeadersBeforeUpload[2].$("button");
|
||||||
@@ -76,6 +82,7 @@ export const uploadNotebook = async (frame: Frame, uploadNotebookPath: string):
|
|||||||
await submitButton.click();
|
await submitButton.click();
|
||||||
|
|
||||||
await frame.waitFor(NOTEBOOK_OPERATION_DELAY);
|
await frame.waitFor(NOTEBOOK_OPERATION_DELAY);
|
||||||
|
return await getNotebookNode(frame, notebookName);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getNotebookNode = async (frame: Frame, uploadNotebookName: string): Promise<ElementHandle<Element>> => {
|
export const getNotebookNode = async (frame: Frame, uploadNotebookName: string): Promise<ElementHandle<Element>> => {
|
||||||
@@ -92,17 +99,3 @@ export const getNotebookNode = async (frame: Frame, uploadNotebookName: string):
|
|||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const deleteNotebook = async (frame: Frame, notebookNodeToDelete: ElementHandle<Element>): Promise<void> => {
|
|
||||||
const ellipses = await notebookNodeToDelete.$(".treeMenuEllipsis");
|
|
||||||
await ellipses.click();
|
|
||||||
|
|
||||||
await frame.waitFor(RENDER_DELAY);
|
|
||||||
|
|
||||||
const menuItems = await frame.$$(".ms-ContextualMenu-item");
|
|
||||||
await menuItems[1].click();
|
|
||||||
|
|
||||||
const deleteAcceptButton = await frame.waitForSelector(".ms-Dialog-action");
|
|
||||||
await deleteAcceptButton.click();
|
|
||||||
await frame.waitFor(NOTEBOOK_OPERATION_DELAY);
|
|
||||||
};
|
|
||||||
|
|||||||
+2
-19
@@ -1,12 +1,5 @@
|
|||||||
import "expect-puppeteer";
|
import "expect-puppeteer";
|
||||||
import {
|
import { getTestExplorerFrame, uploadNotebookIfNotExist } from "./notebookTestUtils";
|
||||||
deleteNotebook,
|
|
||||||
getNotebookNode,
|
|
||||||
getTestExplorerFrame,
|
|
||||||
RENDER_DELAY,
|
|
||||||
uploadNotebook
|
|
||||||
} from "./notebookTestUtils";
|
|
||||||
import * as path from "path";
|
|
||||||
import { ElementHandle, Frame } from "puppeteer";
|
import { ElementHandle, Frame } from "puppeteer";
|
||||||
|
|
||||||
jest.setTimeout(300000);
|
jest.setTimeout(300000);
|
||||||
@@ -19,23 +12,13 @@ describe("Notebook UI tests", () => {
|
|||||||
it("Upload, Open and Delete Notebook", async () => {
|
it("Upload, Open and Delete Notebook", async () => {
|
||||||
try {
|
try {
|
||||||
frame = await getTestExplorerFrame();
|
frame = await getTestExplorerFrame();
|
||||||
const uploadNotebookPath = path.join(__dirname, "testNotebooks", notebookName);
|
uploadedNotebookNode = await uploadNotebookIfNotExist(frame, notebookName);
|
||||||
await uploadNotebook(frame, uploadNotebookPath);
|
|
||||||
uploadedNotebookNode = await getNotebookNode(frame, notebookName);
|
|
||||||
|
|
||||||
await uploadedNotebookNode.click();
|
await uploadedNotebookNode.click();
|
||||||
await frame.waitForSelector(".tabNavText");
|
await frame.waitForSelector(".tabNavText");
|
||||||
const tabTitle = await frame.$eval(".tabNavText", element => element.textContent);
|
const tabTitle = await frame.$eval(".tabNavText", element => element.textContent);
|
||||||
expect(tabTitle).toEqual(notebookName);
|
expect(tabTitle).toEqual(notebookName);
|
||||||
const closeIcon = await frame.waitForSelector(".close-Icon");
|
const closeIcon = await frame.waitForSelector(".close-Icon");
|
||||||
await closeIcon.click();
|
await closeIcon.click();
|
||||||
await frame.waitFor(RENDER_DELAY);
|
|
||||||
|
|
||||||
await deleteNotebook(frame, uploadedNotebookNode);
|
|
||||||
const deletedNotebookNode = await getNotebookNode(frame, notebookName);
|
|
||||||
if (deletedNotebookNode) {
|
|
||||||
throw new Error(`Deletion of notebook ${notebookName} failed`);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const testName = (expect as any).getState().currentTestName;
|
const testName = (expect as any).getState().currentTestName;
|
||||||
Reference in New Issue
Block a user