added try catch block with screenshot for error

This commit is contained in:
Srinath Narayanan
2020-11-13 14:30:30 -08:00
parent 58b5caed7e
commit 394e1398d1
2 changed files with 22 additions and 15 deletions

View File

@@ -41,7 +41,7 @@ class TestExplorer {
window.location.search
.substr(1)
.split("&")
.forEach((item) => {
.forEach(item => {
const tmp = item.split("=");
const value = decodeURIComponent(tmp[1]);
switch (tmp[0]) {

View File

@@ -6,6 +6,7 @@ jest.setTimeout(300000);
describe("Notebook UI tests", () => {
it("Upload, Open and Delete Notebook", async () => {
try {
const frame = await getTestExplorerFrame();
const uploadNotebookName = "GettingStarted.ipynb";
const uploadNotebookPath = path.join(__dirname, "testNotebooks", uploadNotebookName);
@@ -23,5 +24,11 @@ describe("Notebook UI tests", () => {
await deleteNotebook(frame, uploadedNotebookNode);
const deletedNotebookNode = await getNotebookNode(frame, uploadNotebookName);
expect(deletedNotebookNode).toBeUndefined();
} 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;
}
});
});