Path: blob/main/test/smoke/src/areas/terminal/terminal-profiles.test.ts
3520 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { Application, Terminal, TerminalCommandId, TerminalCommandIdWithValue, SettingsEditor } from '../../../../automation';6import { setTerminalTestSettings } from './terminal-helpers';78const CONTRIBUTED_PROFILE_NAME = `JavaScript Debug Terminal`;9const ANY_PROFILE_NAME = '^((?!JavaScript Debug Terminal).)*$';1011export function setup(options?: { skipSuite: boolean }) {12(options?.skipSuite ? describe.skip : describe)('Terminal Profiles', () => {13// Acquire automation API14let terminal: Terminal;15let settingsEditor: SettingsEditor;1617before(async function () {18const app = this.app as Application;19terminal = app.workbench.terminal;20settingsEditor = app.workbench.settingsEditor;21await setTerminalTestSettings(app);22});2324after(async function () {25await settingsEditor.clearUserSettings();26});2728it('should launch the default profile', async () => {29await terminal.runCommand(TerminalCommandId.Show);30await terminal.assertSingleTab({ name: ANY_PROFILE_NAME });31});3233// This test alone fails in web & remote smoke tests with the introduction of dialogs showing34// in smoke tests. It's likely due to the other changes in this commit in the terminal service.35it.skip('should set the default profile to a contributed one', async () => {36await terminal.runCommandWithValue(TerminalCommandIdWithValue.SelectDefaultProfile, CONTRIBUTED_PROFILE_NAME);37await terminal.createTerminal();38await terminal.assertSingleTab({ name: CONTRIBUTED_PROFILE_NAME });39});4041it('should use the default contributed profile on panel open and for splitting', async () => {42await terminal.runCommandWithValue(TerminalCommandIdWithValue.SelectDefaultProfile, CONTRIBUTED_PROFILE_NAME);43await terminal.runCommand(TerminalCommandId.Show);44await terminal.runCommand(TerminalCommandId.Split);45await terminal.assertTerminalGroups([[{ name: CONTRIBUTED_PROFILE_NAME }, { name: CONTRIBUTED_PROFILE_NAME }]]);46});4748it('should set the default profile', async () => {49await terminal.runCommandWithValue(TerminalCommandIdWithValue.SelectDefaultProfile, process.platform === 'win32' ? 'PowerShell' : undefined);50await terminal.createTerminal();51await terminal.assertSingleTab({ name: ANY_PROFILE_NAME });52});5354it('should use the default profile on panel open and for splitting', async () => {55await terminal.runCommand(TerminalCommandId.Show);56await terminal.assertSingleTab({ name: ANY_PROFILE_NAME });57await terminal.runCommand(TerminalCommandId.Split);58await terminal.assertTerminalGroups([[{}, {}]]);59});6061it('createWithProfile command should create a terminal with a profile', async () => {62await terminal.runCommandWithValue(TerminalCommandIdWithValue.NewWithProfile);63await terminal.assertSingleTab({ name: ANY_PROFILE_NAME });64});6566it('createWithProfile command should create a terminal with a contributed profile', async () => {67await terminal.runCommandWithValue(TerminalCommandIdWithValue.NewWithProfile, CONTRIBUTED_PROFILE_NAME);68await terminal.assertSingleTab({ name: CONTRIBUTED_PROFILE_NAME });69});7071it('createWithProfile command should create a split terminal with a profile', async () => {72await terminal.runCommand(TerminalCommandId.Show);73await terminal.runCommandWithValue(TerminalCommandIdWithValue.NewWithProfile, undefined, true);74await terminal.assertTerminalGroups([[{}, {}]]);75});7677it('createWithProfile command should create a split terminal with a contributed profile', async () => {78await terminal.runCommand(TerminalCommandId.Show);79await terminal.assertSingleTab({});80await terminal.runCommandWithValue(TerminalCommandIdWithValue.NewWithProfile, CONTRIBUTED_PROFILE_NAME, true);81await terminal.assertTerminalGroups([[{ name: ANY_PROFILE_NAME }, { name: CONTRIBUTED_PROFILE_NAME }]]);82});83});84}858687