Skip to content

Commit fe6db40

Browse files
authored
allow time to scroll (microsoft#204646)
1 parent 533da38 commit fe6db40

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

extensions/vscode-api-tests/src/singlefolder-tests/interactiveWindow.test.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,13 @@ async function addCellAndRun(code: string, notebook: vscode.NotebookDocument) {
9999
}
100100

101101
// Verify visible range has the last cell
102-
assert.strictEqual(notebookEditor.visibleRanges[notebookEditor.visibleRanges.length - 1].end, notebookEditor.notebook.cellCount, `Last cell is not visible`);
103-
102+
if (!lastCellIsVisible(notebookEditor)) {
103+
// scroll happens async, so give it some time to scroll
104+
await new Promise<void>((resolve) => setTimeout(() => {
105+
assert.ok(lastCellIsVisible(notebookEditor), `Last cell is not visible`);
106+
resolve();
107+
}, 1000));
108+
}
104109
});
105110

106111
test('Interactive window has the correct kernel', async () => {
@@ -120,3 +125,8 @@ async function addCellAndRun(code: string, notebook: vscode.NotebookDocument) {
120125

121126
});
122127
});
128+
129+
function lastCellIsVisible(notebookEditor: vscode.NotebookEditor) {
130+
const lastVisibleCell = notebookEditor.visibleRanges[notebookEditor.visibleRanges.length - 1].end;
131+
return notebookEditor.notebook.cellCount === lastVisibleCell;
132+
}

0 commit comments

Comments
 (0)