mirror of
https://github.com/Microsoft/vscode
synced 2024-10-01 08:50:48 +00:00
Make sticky scroll smoketest more consistent
This commit is contained in:
parent
26db70d00a
commit
90d1e81ce9
|
@ -3,7 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Application, Terminal, SettingsEditor } from '../../../../automation';
|
||||
import { Application, Terminal, SettingsEditor, TerminalCommandIdWithValue } from '../../../../automation';
|
||||
import { timeout } from '../../utils';
|
||||
import { setTerminalTestSettings } from './terminal-helpers';
|
||||
|
||||
export function setup() {
|
||||
|
@ -17,7 +18,8 @@ export function setup() {
|
|||
terminal = app.workbench.terminal;
|
||||
settingsEditor = app.workbench.settingsEditor;
|
||||
await setTerminalTestSettings(app, [
|
||||
['terminal.integrated.enableStickyScroll', 'true']
|
||||
['terminal.integrated.enableStickyScroll', 'true'],
|
||||
['terminal.integrated.shellIntegration.enabled', 'true']
|
||||
]);
|
||||
});
|
||||
|
||||
|
@ -25,14 +27,26 @@ export function setup() {
|
|||
await settingsEditor.clearUserSettings();
|
||||
});
|
||||
|
||||
async function createShellIntegrationProfile() {
|
||||
await terminal.runCommandWithValue(TerminalCommandIdWithValue.NewWithProfile, process.platform === 'win32' ? 'PowerShell' : 'bash');
|
||||
}
|
||||
|
||||
it('should show sticky scroll when appropriate', async () => {
|
||||
// There should not be a visible sticky scroll element initially
|
||||
await terminal.createTerminal();
|
||||
await createShellIntegrationProfile();
|
||||
await app.code.waitForElements('.terminal-sticky-scroll', false, elements => elements.length === 0);
|
||||
|
||||
// Print a simple command in order to ensure shell integration sequences appear at the
|
||||
// correct place. This helps avoid a race condition if too much data floods into the
|
||||
// terminal before things are initialized.
|
||||
await terminal.runCommandInTerminal('echo "start up"');
|
||||
await terminal.waitForTerminalText(buffer => buffer.some(line => line.startsWith('start up')));
|
||||
|
||||
// Allow to settle, again to avoid race conditions (with conpty)
|
||||
await timeout(500);
|
||||
|
||||
// Running ls should show the sticky scroll element
|
||||
await terminal.runCommandInTerminal(`ls`); // Long in pwsh
|
||||
await terminal.runCommandInTerminal(`ls -la`); // Long in bash/zsh
|
||||
await terminal.runCommandInTerminal(process.platform === 'win32' ? `ls` : `ls -la`);
|
||||
await app.code.waitForElements('.terminal-sticky-scroll', false, elements => elements.length === 1 && elements[0].textContent.indexOf('ls') >= 0);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue