mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
Merge pull request #152278 from microsoft/tyriar/150478_4
Enable shell integration smoke tests (Linux/macOS) and terminal smoke tests on desktop
This commit is contained in:
commit
09d0431d20
|
@ -12,6 +12,12 @@ export class SettingsEditor {
|
||||||
|
|
||||||
constructor(private code: Code, private editors: Editors, private editor: Editor, private quickaccess: QuickAccess) { }
|
constructor(private code: Code, private editors: Editors, private editor: Editor, private quickaccess: QuickAccess) { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write a single setting key value pair.
|
||||||
|
*
|
||||||
|
* Warning: You may need to set `editor.wordWrap` to `"on"` if this is called with a really long
|
||||||
|
* setting.
|
||||||
|
*/
|
||||||
async addUserSetting(setting: string, value: string): Promise<void> {
|
async addUserSetting(setting: string, value: string): Promise<void> {
|
||||||
await this.openUserSettingsFile();
|
await this.openUserSettingsFile();
|
||||||
|
|
||||||
|
@ -20,6 +26,20 @@ export class SettingsEditor {
|
||||||
await this.editors.saveOpenedFile();
|
await this.editors.saveOpenedFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write several settings faster than multiple calls to {@link addUserSetting}.
|
||||||
|
*
|
||||||
|
* Warning: You will likely also need to set `editor.wordWrap` to `"on"` if `addUserSetting` is
|
||||||
|
* called after this in the test.
|
||||||
|
*/
|
||||||
|
async addUserSettings(settings: [key: string, value: string][]): Promise<void> {
|
||||||
|
await this.openUserSettingsFile();
|
||||||
|
|
||||||
|
await this.code.dispatchKeybinding('right');
|
||||||
|
await this.editor.waitForTypeInEditor('settings.json', settings.map(v => `"${v[0]}": ${v[1]},`).join(''));
|
||||||
|
await this.editors.saveOpenedFile();
|
||||||
|
}
|
||||||
|
|
||||||
async clearUserSettings(): Promise<void> {
|
async clearUserSettings(): Promise<void> {
|
||||||
await this.openUserSettingsFile();
|
await this.openUserSettingsFile();
|
||||||
await this.quickaccess.runCommand('editor.action.selectAll');
|
await this.quickaccess.runCommand('editor.action.selectAll');
|
||||||
|
|
|
@ -83,8 +83,16 @@ export class Terminal {
|
||||||
await this.code.dispatchKeybinding('enter');
|
await this.code.dispatchKeybinding('enter');
|
||||||
await this.quickinput.waitForQuickInputClosed();
|
await this.quickinput.waitForQuickInputClosed();
|
||||||
}
|
}
|
||||||
if (commandId === TerminalCommandId.Show || commandId === TerminalCommandId.CreateNewEditor || commandId === TerminalCommandId.CreateNew || commandId === TerminalCommandId.NewWithProfile) {
|
switch (commandId) {
|
||||||
return await this._waitForTerminal(expectedLocation === 'editor' || commandId === TerminalCommandId.CreateNewEditor ? 'editor' : 'panel');
|
case TerminalCommandId.Show:
|
||||||
|
case TerminalCommandId.CreateNewEditor:
|
||||||
|
case TerminalCommandId.CreateNew:
|
||||||
|
case TerminalCommandId.NewWithProfile:
|
||||||
|
await this._waitForTerminal(expectedLocation === 'editor' || commandId === TerminalCommandId.CreateNewEditor ? 'editor' : 'panel');
|
||||||
|
break;
|
||||||
|
case TerminalCommandId.KillAll:
|
||||||
|
await this.code.waitForElements(Selector.Xterm, true, e => e.length === 0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,18 @@
|
||||||
|
|
||||||
import { Application } from '../../../../automation';
|
import { Application } from '../../../../automation';
|
||||||
|
|
||||||
export async function setTerminalTestSettings(app: Application) {
|
export async function setTerminalTestSettings(app: Application, additionalSettings: [key: string, value: string][] = []) {
|
||||||
// Always show tabs to make getting terminal groups easier
|
await app.workbench.settingsEditor.addUserSettings([
|
||||||
await app.workbench.settingsEditor.addUserSetting('terminal.integrated.tabs.hideCondition', '"never"');
|
// Work wrap is required when calling settingsEditor.addUserSetting multiple times or the
|
||||||
// Use the DOM renderer for smoke tests so they can be inspected in the playwright trace
|
// click to focus will fail
|
||||||
// viewer
|
['editor.wordWrap', '"on"'],
|
||||||
await app.workbench.settingsEditor.addUserSetting('terminal.integrated.gpuAcceleration', '"off"');
|
// Always show tabs to make getting terminal groups easier
|
||||||
|
['terminal.integrated.tabs.hideCondition', '"never"'],
|
||||||
|
// Use the DOM renderer for smoke tests so they can be inspected in the playwright trace
|
||||||
|
// viewer
|
||||||
|
['terminal.integrated.gpuAcceleration', '"off"'],
|
||||||
|
...additionalSettings
|
||||||
|
]);
|
||||||
|
|
||||||
// Close the settings editor
|
// Close the settings editor
|
||||||
await app.workbench.quickaccess.runCommand('workbench.action.closeAllEditors');
|
await app.workbench.quickaccess.runCommand('workbench.action.closeAllEditors');
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { Application, Terminal, SettingsEditor, TerminalCommandIdWithValue } from '../../../../automation';
|
import { Application, Terminal, SettingsEditor, TerminalCommandIdWithValue, TerminalCommandId } from '../../../../automation';
|
||||||
import { setTerminalTestSettings } from './terminal-helpers';
|
import { setTerminalTestSettings } from './terminal-helpers';
|
||||||
|
|
||||||
export function setup() {
|
export function setup() {
|
||||||
|
@ -16,8 +16,11 @@ export function setup() {
|
||||||
app = this.app as Application;
|
app = this.app as Application;
|
||||||
terminal = app.workbench.terminal;
|
terminal = app.workbench.terminal;
|
||||||
settingsEditor = app.workbench.settingsEditor;
|
settingsEditor = app.workbench.settingsEditor;
|
||||||
await settingsEditor.addUserSetting('terminal.integrated.shellIntegration.enabled', 'true');
|
await setTerminalTestSettings(app, [['terminal.integrated.shellIntegration.enabled', 'true']]);
|
||||||
await setTerminalTestSettings(app);
|
});
|
||||||
|
|
||||||
|
afterEach(async function () {
|
||||||
|
await app.workbench.terminal.runCommand(TerminalCommandId.KillAll);
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
|
@ -28,22 +31,23 @@ export function setup() {
|
||||||
await terminal.runCommandWithValue(TerminalCommandIdWithValue.NewWithProfile, process.platform === 'win32' ? 'PowerShell' : 'bash');
|
await terminal.runCommandWithValue(TerminalCommandIdWithValue.NewWithProfile, process.platform === 'win32' ? 'PowerShell' : 'bash');
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: These are currently flaky https://github.com/microsoft/vscode/issues/150478
|
// TODO: Some agents may not have pwsh installed?
|
||||||
describe.skip('Shell integration', function () {
|
(process.platform === 'win32' ? describe.skip : describe)(`Shell integration`, function () {
|
||||||
describe('Decorations', function () {
|
describe('Decorations', function () {
|
||||||
describe('Should show default icons', function () {
|
describe('Should show default icons', function () {
|
||||||
|
|
||||||
it('Placeholder', async () => {
|
it('Placeholder', async () => {
|
||||||
await createShellIntegrationProfile();
|
await createShellIntegrationProfile();
|
||||||
await terminal.assertCommandDecorations({ placeholder: 1, success: 0, error: 0 });
|
await terminal.assertCommandDecorations({ placeholder: 1, success: 0, error: 0 });
|
||||||
});
|
});
|
||||||
it('Success', async () => {
|
it('Success', async () => {
|
||||||
await createShellIntegrationProfile();
|
await createShellIntegrationProfile();
|
||||||
await terminal.runCommandInTerminal(`ls`);
|
await terminal.runCommandInTerminal(`echo "success"`);
|
||||||
await terminal.assertCommandDecorations({ placeholder: 1, success: 1, error: 0 });
|
await terminal.assertCommandDecorations({ placeholder: 1, success: 1, error: 0 });
|
||||||
});
|
});
|
||||||
it('Error', async () => {
|
it('Error', async () => {
|
||||||
await createShellIntegrationProfile();
|
await createShellIntegrationProfile();
|
||||||
await terminal.runCommandInTerminal(`fsdkfsjdlfksjdkf`);
|
await terminal.runCommandInTerminal(`false`);
|
||||||
await terminal.assertCommandDecorations({ placeholder: 1, success: 0, error: 1 });
|
await terminal.assertCommandDecorations({ placeholder: 1, success: 0, error: 1 });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -51,12 +55,13 @@ export function setup() {
|
||||||
it('Should update and show custom icons', async () => {
|
it('Should update and show custom icons', async () => {
|
||||||
await createShellIntegrationProfile();
|
await createShellIntegrationProfile();
|
||||||
await terminal.assertCommandDecorations({ placeholder: 1, success: 0, error: 0 });
|
await terminal.assertCommandDecorations({ placeholder: 1, success: 0, error: 0 });
|
||||||
await terminal.runCommandInTerminal(`ls`);
|
await terminal.runCommandInTerminal(`echo "foo"`);
|
||||||
await terminal.runCommandInTerminal(`fsdkfsjdlfksjdkf`);
|
await terminal.runCommandInTerminal(`bar`);
|
||||||
await settingsEditor.addUserSetting('terminal.integrated.shellIntegration.decorationIcon', '"zap"');
|
await settingsEditor.addUserSetting('terminal.integrated.shellIntegration.decorationIcon', '"zap"');
|
||||||
await settingsEditor.addUserSetting('terminal.integrated.shellIntegration.decorationIconSuccess', '"zap"');
|
await settingsEditor.addUserSetting('terminal.integrated.shellIntegration.decorationIconSuccess', '"zap"');
|
||||||
await settingsEditor.addUserSetting('terminal.integrated.shellIntegration.decorationIconError', '"zap"');
|
await settingsEditor.addUserSetting('terminal.integrated.shellIntegration.decorationIconError', '"zap"');
|
||||||
await terminal.assertCommandDecorations(undefined, { updatedIcon: "zap", count: 3 });
|
await terminal.assertCommandDecorations(undefined, { updatedIcon: "zap", count: 3 });
|
||||||
|
await app.workbench.terminal.runCommand(TerminalCommandId.KillAll);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -400,7 +400,7 @@ describe(`VSCode Smoke Tests (${opts.web ? 'Web' : 'Electron'})`, () => {
|
||||||
setupSearchTests(logger);
|
setupSearchTests(logger);
|
||||||
setupNotebookTests(logger);
|
setupNotebookTests(logger);
|
||||||
setupLanguagesTests(logger);
|
setupLanguagesTests(logger);
|
||||||
if (opts.web) { setupTerminalTests(logger); } // Tests require playwright driver (https://github.com/microsoft/vscode/issues/146811)
|
setupTerminalTests(logger);
|
||||||
setupStatusbarTests(logger);
|
setupStatusbarTests(logger);
|
||||||
if (quality !== Quality.Dev && quality !== Quality.OSS) { setupExtensionTests(logger); }
|
if (quality !== Quality.Dev && quality !== Quality.OSS) { setupExtensionTests(logger); }
|
||||||
setupMultirootTests(logger);
|
setupMultirootTests(logger);
|
||||||
|
|
Loading…
Reference in a new issue