allow time to scroll (#204646)

This commit is contained in:
Aaron Munger 2024-02-07 11:08:03 -08:00 committed by GitHub
parent 533da38207
commit fe6db4073f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -99,8 +99,13 @@ async function addCellAndRun(code: string, notebook: vscode.NotebookDocument) {
}
// Verify visible range has the last cell
assert.strictEqual(notebookEditor.visibleRanges[notebookEditor.visibleRanges.length - 1].end, notebookEditor.notebook.cellCount, `Last cell is not visible`);
if (!lastCellIsVisible(notebookEditor)) {
// scroll happens async, so give it some time to scroll
await new Promise<void>((resolve) => setTimeout(() => {
assert.ok(lastCellIsVisible(notebookEditor), `Last cell is not visible`);
resolve();
}, 1000));
}
});
test('Interactive window has the correct kernel', async () => {
@ -120,3 +125,8 @@ async function addCellAndRun(code: string, notebook: vscode.NotebookDocument) {
});
});
function lastCellIsVisible(notebookEditor: vscode.NotebookEditor) {
const lastVisibleCell = notebookEditor.visibleRanges[notebookEditor.visibleRanges.length - 1].end;
return notebookEditor.notebook.cellCount === lastVisibleCell;
}