Path: blob/main/test/smoke/src/areas/chat/chat.test.ts
4778 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, Logger } from '../../../../automation';6import { installAllHandlers } from '../../utils';78export function setup(logger: Logger) {9describe('Chat', () => {1011// Shared before/after handling12installAllHandlers(logger);1314it('can disable AI features', async function () {15const app = this.app as Application;1617await app.workbench.settingsEditor.addUserSetting('chat.disableAIFeatures', 'true');1819// await for setting to apply in the UI20await app.code.waitForElements('.noauxiliarybar', true, elements => elements.length === 1);2122// assert that AI related commands are not present23let expectedFound = false;24const unexpectedFound: Set<string> = new Set();25for (const term of ['chat', 'agent', 'copilot', 'mcp']) {26const commands = await app.workbench.quickaccess.getVisibleCommandNames(term);27for (const command of commands) {28if (command === 'Chat: Use AI Features with Copilot for free...') {29expectedFound = true;30continue;31}3233if (command.includes('Chat') || command.includes('Agent') || command.includes('Copilot') || command.includes('MCP')) {34unexpectedFound.add(command);35}36}37}3839if (!expectedFound) {40throw new Error(`Expected AI related command not found`);41}4243if (unexpectedFound.size > 0) {44throw new Error(`Unexpected AI related commands found after having disabled AI features: ${JSON.stringify(Array.from(unexpectedFound), undefined, 0)}`);45}46});47});48}495051