Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/test/smoke/src/areas/chat/chat.test.ts
4778 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, Logger } from '../../../../automation';
7
import { installAllHandlers } from '../../utils';
8
9
export function setup(logger: Logger) {
10
describe('Chat', () => {
11
12
// Shared before/after handling
13
installAllHandlers(logger);
14
15
it('can disable AI features', async function () {
16
const app = this.app as Application;
17
18
await app.workbench.settingsEditor.addUserSetting('chat.disableAIFeatures', 'true');
19
20
// await for setting to apply in the UI
21
await app.code.waitForElements('.noauxiliarybar', true, elements => elements.length === 1);
22
23
// assert that AI related commands are not present
24
let expectedFound = false;
25
const unexpectedFound: Set<string> = new Set();
26
for (const term of ['chat', 'agent', 'copilot', 'mcp']) {
27
const commands = await app.workbench.quickaccess.getVisibleCommandNames(term);
28
for (const command of commands) {
29
if (command === 'Chat: Use AI Features with Copilot for free...') {
30
expectedFound = true;
31
continue;
32
}
33
34
if (command.includes('Chat') || command.includes('Agent') || command.includes('Copilot') || command.includes('MCP')) {
35
unexpectedFound.add(command);
36
}
37
}
38
}
39
40
if (!expectedFound) {
41
throw new Error(`Expected AI related command not found`);
42
}
43
44
if (unexpectedFound.size > 0) {
45
throw new Error(`Unexpected AI related commands found after having disabled AI features: ${JSON.stringify(Array.from(unexpectedFound), undefined, 0)}`);
46
}
47
});
48
});
49
}
50
51