Skip to content

Commit 9c4f615

Browse files
authored
fix(notebooks): wait for the run button to be inactive (#5495)
1 parent 66f719d commit 9c4f615

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

apps/frontend/lib/notebook/utils-server.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,28 @@ async function generateNotebookHtml(browser: Browser, url: string) {
4242
hidden: true,
4343
});
4444
logger.info("Spinner disappeared.");
45-
// const previewButton = await page.waitForSelector("[id='preview-button']", {
46-
// timeout: LONG_TIMEOUT_MS,
47-
// });
45+
const previewButton = await page.waitForSelector("[id='preview-button']", {
46+
timeout: LONG_TIMEOUT_MS,
47+
});
4848

49-
// await previewButton?.click();
49+
await previewButton?.click();
5050

51-
// logger.info("Clicked preview button, waiting for interrupt button...");
51+
logger.info("Clicked preview button, waiting for interrupt button...");
5252
// Wait for the interrupt button to have the inactive-button class for at least 10 seconds
5353
await page.waitForFunction(
5454
() => {
5555
const spinner = document.querySelector(
5656
"[data-testid='loading-indicator']",
5757
);
58-
const button = document.querySelector('[data-testid="interrupt-button"]');
59-
const hasInactiveClass = button?.classList.contains("inactive-button");
58+
const interruptButton = document.querySelector(
59+
'[data-testid="interrupt-button"]',
60+
);
61+
const runButton = document.querySelector('[data-testid="run-button"]');
62+
const needsToRun = runButton?.classList.contains("yellow");
63+
const hasInactiveClass =
64+
interruptButton?.classList.contains("inactive-button");
6065

61-
if (!hasInactiveClass || spinner) {
66+
if (!hasInactiveClass || spinner || needsToRun) {
6267
window.stableStart = undefined;
6368
return false;
6469
} else {

0 commit comments

Comments
 (0)