Skip to content

Commit 4ce5000

Browse files
authored
Handle multiple spinners (#136)
1 parent 4078882 commit 4ce5000

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/jupyterlab/notebook.spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ test.describe("JupyterLab Benchmark", () => {
138138
await page.dblclick(`#filebrowser >> text=${tmpPath}`);
139139

140140
const spinner = page.locator('[role="main"] >> .jp-SpinnerContent');
141+
// Ensure there is no hanging document
142+
while ((await spinner.count()) > 0) {
143+
await spinner.first().waitFor({ state: "hidden" });
144+
}
141145

142146
const openTime = await perf.measure(async () => {
143147
// Open the notebook and wait for the spinner to be hidden
@@ -147,7 +151,8 @@ test.describe("JupyterLab Benchmark", () => {
147151
]);
148152

149153
if ((await spinner.count()) > 0) {
150-
spinner.waitFor({ state: "hidden" });
154+
// They should be only one document
155+
await spinner.waitFor({ state: "hidden" });
151156
}
152157
});
153158

@@ -193,8 +198,8 @@ test.describe("JupyterLab Benchmark", () => {
193198
page.dblclick(`#filebrowser >> text=${filename}_copy.ipynb`),
194199
]);
195200

196-
if ((await spinner.count()) > 0) {
197-
spinner.waitFor({ state: "hidden" });
201+
while ((await spinner.count()) > 0) {
202+
await spinner.first().waitFor({ state: "hidden" });
198203
}
199204
}
200205

0 commit comments

Comments
 (0)