Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/test/smoke/src/areas/terminal/terminal-profiles.test.ts
3520 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { Application, Terminal, TerminalCommandId, TerminalCommandIdWithValue, SettingsEditor } from '../../../../automation';
7
import { setTerminalTestSettings } from './terminal-helpers';
8
9
const CONTRIBUTED_PROFILE_NAME = `JavaScript Debug Terminal`;
10
const ANY_PROFILE_NAME = '^((?!JavaScript Debug Terminal).)*$';
11
12
export function setup(options?: { skipSuite: boolean }) {
13
(options?.skipSuite ? describe.skip : describe)('Terminal Profiles', () => {
14
// Acquire automation API
15
let terminal: Terminal;
16
let settingsEditor: SettingsEditor;
17
18
before(async function () {
19
const app = this.app as Application;
20
terminal = app.workbench.terminal;
21
settingsEditor = app.workbench.settingsEditor;
22
await setTerminalTestSettings(app);
23
});
24
25
after(async function () {
26
await settingsEditor.clearUserSettings();
27
});
28
29
it('should launch the default profile', async () => {
30
await terminal.runCommand(TerminalCommandId.Show);
31
await terminal.assertSingleTab({ name: ANY_PROFILE_NAME });
32
});
33
34
// This test alone fails in web & remote smoke tests with the introduction of dialogs showing
35
// in smoke tests. It's likely due to the other changes in this commit in the terminal service.
36
it.skip('should set the default profile to a contributed one', async () => {
37
await terminal.runCommandWithValue(TerminalCommandIdWithValue.SelectDefaultProfile, CONTRIBUTED_PROFILE_NAME);
38
await terminal.createTerminal();
39
await terminal.assertSingleTab({ name: CONTRIBUTED_PROFILE_NAME });
40
});
41
42
it('should use the default contributed profile on panel open and for splitting', async () => {
43
await terminal.runCommandWithValue(TerminalCommandIdWithValue.SelectDefaultProfile, CONTRIBUTED_PROFILE_NAME);
44
await terminal.runCommand(TerminalCommandId.Show);
45
await terminal.runCommand(TerminalCommandId.Split);
46
await terminal.assertTerminalGroups([[{ name: CONTRIBUTED_PROFILE_NAME }, { name: CONTRIBUTED_PROFILE_NAME }]]);
47
});
48
49
it('should set the default profile', async () => {
50
await terminal.runCommandWithValue(TerminalCommandIdWithValue.SelectDefaultProfile, process.platform === 'win32' ? 'PowerShell' : undefined);
51
await terminal.createTerminal();
52
await terminal.assertSingleTab({ name: ANY_PROFILE_NAME });
53
});
54
55
it('should use the default profile on panel open and for splitting', async () => {
56
await terminal.runCommand(TerminalCommandId.Show);
57
await terminal.assertSingleTab({ name: ANY_PROFILE_NAME });
58
await terminal.runCommand(TerminalCommandId.Split);
59
await terminal.assertTerminalGroups([[{}, {}]]);
60
});
61
62
it('createWithProfile command should create a terminal with a profile', async () => {
63
await terminal.runCommandWithValue(TerminalCommandIdWithValue.NewWithProfile);
64
await terminal.assertSingleTab({ name: ANY_PROFILE_NAME });
65
});
66
67
it('createWithProfile command should create a terminal with a contributed profile', async () => {
68
await terminal.runCommandWithValue(TerminalCommandIdWithValue.NewWithProfile, CONTRIBUTED_PROFILE_NAME);
69
await terminal.assertSingleTab({ name: CONTRIBUTED_PROFILE_NAME });
70
});
71
72
it('createWithProfile command should create a split terminal with a profile', async () => {
73
await terminal.runCommand(TerminalCommandId.Show);
74
await terminal.runCommandWithValue(TerminalCommandIdWithValue.NewWithProfile, undefined, true);
75
await terminal.assertTerminalGroups([[{}, {}]]);
76
});
77
78
it('createWithProfile command should create a split terminal with a contributed profile', async () => {
79
await terminal.runCommand(TerminalCommandId.Show);
80
await terminal.assertSingleTab({});
81
await terminal.runCommandWithValue(TerminalCommandIdWithValue.NewWithProfile, CONTRIBUTED_PROFILE_NAME, true);
82
await terminal.assertTerminalGroups([[{ name: ANY_PROFILE_NAME }, { name: CONTRIBUTED_PROFILE_NAME }]]);
83
});
84
});
85
}
86
87