Skip to content

Commit 31b9e9a

Browse files
committed
Wait for terminal data before using terminal.selection APIs
1 parent 4714906 commit 31b9e9a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,13 +357,27 @@ import { assertNoRpc, poll } from '../utils';
357357
test('should be defined after selecting all content', async () => {
358358
const terminal = window.createTerminal({ name: 'selection test' });
359359
terminal.show();
360+
// Wait for some terminal data
361+
await new Promise<void>(r => {
362+
const disposable = window.onDidWriteTerminalData(() => {
363+
disposable.dispose();
364+
r();
365+
});
366+
});
360367
await commands.executeCommand('workbench.action.terminal.selectAll');
361368
await poll<void>(() => Promise.resolve(), () => terminal.selection !== undefined, 'selection should be defined');
362369
terminal.dispose();
363370
});
364371
test('should be undefined after clearing a selection', async () => {
365372
const terminal = window.createTerminal({ name: 'selection test' });
366373
terminal.show();
374+
// Wait for some terminal data
375+
await new Promise<void>(r => {
376+
const disposable = window.onDidWriteTerminalData(() => {
377+
disposable.dispose();
378+
r();
379+
});
380+
});
367381
await commands.executeCommand('workbench.action.terminal.selectAll');
368382
await poll<void>(() => Promise.resolve(), () => terminal.selection !== undefined, 'selection should be defined');
369383
await commands.executeCommand('workbench.action.terminal.clearSelection');

0 commit comments

Comments
 (0)