Skip to content

Commit

Permalink
Should remove some more traceback by (1) waiting for a notebook to be…
Browse files Browse the repository at this point in the history
… ready and (2) killing the kernels on teardown
  • Loading branch information
brichet committed Jun 20, 2024
1 parent 7796daa commit f8fc2ce
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ test.afterEach(async ({ request, page, tmpPath }) => {
await page.notebook.close();
}
}
await page.kernel.shutdownAll();

const contents = galata.newContentsHelper(request, page);
await contents.deleteDirectory(tmpPath);
Expand Down Expand Up @@ -221,7 +222,8 @@ test("manual cell", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/blank.ipynb`);
} else {
await page.filebrowser.open("blank.ipynb");
await page.notebook.open("blank.ipynb");
await page.notebook.activate("blank.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -262,7 +264,8 @@ test("task cell", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/task.ipynb`);
} else {
await page.filebrowser.open("task.ipynb");
await page.notebook.open("task.ipynb");
await page.notebook.activate("task.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -302,7 +305,8 @@ test("solution cell", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/blank.ipynb`);
} else {
await page.filebrowser.open("blank.ipynb");
await page.notebook.open("blank.ipynb");
await page.notebook.activate("blank.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -338,7 +342,8 @@ test("tests cell", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/blank.ipynb`);
} else {
await page.filebrowser.open("blank.ipynb");
await page.notebook.open("blank.ipynb");
await page.notebook.activate("blank.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -379,7 +384,8 @@ test("tests to solution cell", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/blank.ipynb`);
} else {
await page.filebrowser.open("blank.ipynb");
await page.notebook.open("blank.ipynb");
await page.notebook.activate("blank.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -428,7 +434,8 @@ test("locked cell", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/blank.ipynb`);
} else {
await page.filebrowser.open("blank.ipynb");
await page.notebook.open("blank.ipynb");
await page.notebook.activate("blank.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -465,7 +472,8 @@ test("tab key", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/blank.ipynb`);
} else {
await page.filebrowser.open("blank.ipynb");
await page.notebook.open("blank.ipynb");
await page.notebook.activate("blank.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -494,7 +502,8 @@ test("total points", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/blank.ipynb`);
} else {
await page.filebrowser.open("blank.ipynb");
await page.notebook.open("blank.ipynb");
await page.notebook.activate("blank.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -548,7 +557,8 @@ test("task total points", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/task.ipynb`);
} else {
await page.filebrowser.open("task.ipynb");
await page.notebook.open("task.ipynb");
await page.notebook.activate("task.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -602,7 +612,8 @@ test("cell ids", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/blank.ipynb`);
} else {
await page.filebrowser.open("blank.ipynb");
await page.notebook.open("blank.ipynb");
await page.notebook.activate("blank.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -640,7 +651,8 @@ test("task cell ids", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/task.ipynb`);
} else {
await page.filebrowser.open("task.ipynb");
await page.notebook.open("task.ipynb");
await page.notebook.activate("task.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -678,7 +690,8 @@ test("negative points", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/blank.ipynb`);
} else {
await page.filebrowser.open("blank.ipynb");
await page.notebook.open("blank.ipynb");
await page.notebook.activate("blank.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -707,7 +720,8 @@ test("task negative points", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/task.ipynb`);
} else {
await page.filebrowser.open("task.ipynb");
await page.notebook.open("task.ipynb");
await page.notebook.activate("task.ipynb");
}

await activateToolbar(page);
Expand Down Expand Up @@ -735,7 +749,8 @@ test("schema version", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/old-schema.ipynb`);
} else {
await page.filebrowser.open("old-schema.ipynb");
await page.notebook.open("old-schema.ipynb");
await page.notebook.activate("old-schema.ipynb");
}

// activate toolbar should show an error modal
Expand All @@ -752,7 +767,8 @@ test("invalid nbgrader cell type", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/blank.ipynb`);
} else {
await page.filebrowser.open("blank.ipynb");
await page.notebook.open("blank.ipynb");
await page.notebook.activate("blank.ipynb");
}

await activateToolbar(page);
Expand Down
1 change: 0 additions & 1 deletion nbgrader/tests/ui-tests/formgrader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ test.beforeEach(async ({ request, tmpPath }) => {
if (await contents.fileExists("nbgrader_config.py")){
await contents.deleteFile("nbgrader_config.py");
}

await contents.uploadFile(
path.resolve(__dirname, "./files/nbgrader_config.py"),
"nbgrader_config.py"
Expand Down
22 changes: 15 additions & 7 deletions nbgrader/tests/ui-tests/validate_assignment.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ test.afterEach(async ({ request, page, tmpPath }) => {
await page.notebook.close();
}
}
await page.kernel.shutdownAll();

const contents = galata.newContentsHelper(request, page);
await contents.deleteDirectory(tmpPath);
Expand All @@ -108,7 +109,8 @@ test("Validation success", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/submitted-changed.ipynb`);
} else {
await page.filebrowser.open("submitted-changed.ipynb");
await page.notebook.open("submitted-changed.ipynb");
await page.notebook.activate("submitted-changed.ipynb");
}

// click on validate, and expect a success modal
Expand All @@ -128,7 +130,8 @@ test("Validation failure", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/submitted-unchanged.ipynb`);
} else {
await page.filebrowser.open("submitted-unchanged.ipynb");
await page.notebook.open("submitted-unchanged.ipynb");
await page.notebook.activate("submitted-unchanged.ipynb");
}

// click on validate, and expect an error modal
Expand All @@ -150,7 +153,8 @@ test("Validation grade cell changed", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/submitted-grade-cell-changed.ipynb`);
} else {
await page.filebrowser.open("submitted-grade-cell-changed.ipynb");
await page.notebook.open("submitted-grade-cell-changed.ipynb");
await page.notebook.activate("submitted-grade-cell-changed.ipynb");
}

// click on validate, and expect an error modal
Expand All @@ -172,7 +176,8 @@ test("Validation locked cell changed", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/submitted-locked-cell-changed.ipynb`);
} else {
await page.filebrowser.open("submitted-locked-cell-changed.ipynb");
await page.notebook.open("submitted-locked-cell-changed.ipynb");
await page.notebook.activate("submitted-locked-cell-changed.ipynb");
}

// click on validate, and expect an error modal
Expand All @@ -194,7 +199,8 @@ test("Validation open relative file", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/open_relative_file.ipynb`);
} else {
await page.filebrowser.open("open_relative_file.ipynb");
await page.notebook.open("open_relative_file.ipynb");
await page.notebook.activate("open_relative_file.ipynb");
}

// click on validate, and expect a success modal
Expand All @@ -216,7 +222,8 @@ test("Validation grade cell type changed", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/submitted-grade-cell-type-changed.ipynb`);
} else {
await page.filebrowser.open("submitted-grade-cell-type-changed.ipynb");
await page.notebook.open("submitted-grade-cell-type-changed.ipynb");
await page.notebook.activate("submitted-grade-cell-type-changed.ipynb");
}

// click on validate, and expect an error modal
Expand All @@ -238,7 +245,8 @@ test("Validation answer cell type changed", async ({ page, tmpPath }) => {
if (isNotebook) {
await page.goto(`notebooks/${tmpPath}/submitted-answer-cell-type-changed.ipynb`);
} else {
await page.filebrowser.open("submitted-answer-cell-type-changed.ipynb");
await page.notebook.open("submitted-answer-cell-type-changed.ipynb");
await page.notebook.activate("submitted-answer-cell-type-changed.ipynb");
}

// click on validate, and expect an error modal
Expand Down

0 comments on commit f8fc2ce

Please sign in to comment.