Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions test/automation/src/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const CHAT_VIEW = 'div[id="workbench.panel.chat"]';
// The chat view sets `data-bound-chat-resource` once its widget is bound to a
// chat session and clears it while it rebinds to another one.
const CHAT_VIEW_BOUND_SESSION = `${CHAT_VIEW} .chat-viewpane[data-bound-chat-resource]`;
// The resource of a local chat session (`LocalChatSessionUri`).
const LOCAL_CHAT_SESSION_RESOURCE_PREFIX = 'vscode-chat-session://local/';
const CHAT_EDITOR = '.editor-instance .interactive-session';
const CHAT_INPUT_EDITOR = `${CHAT_VIEW} .interactive-input-part .monaco-editor[role="code"]`;
const CHAT_INPUT_EDITOR_FOCUSED = `${CHAT_VIEW} .interactive-input-part .monaco-editor.focused[role="code"]`;
Expand Down Expand Up @@ -78,6 +80,22 @@ export class Chat {
await this.code.waitForElement(CHAT_VIEW_BOUND_SESSION, element => !!element && element.attributes['data-bound-chat-resource'] !== previousSessionResource, retryCount);
}

/**
* Waits until the chat view is bound to a local chat session other than
* `previousSessionResource`, such as the one `smoketest.openLocalChat`
* opens. That command keeps running after the command palette closes, and
* first waits for the command that opens a local chat to be registered: a
* message sent before then goes to the session the view had, such as the
* Agent Host Copilot session that is its default, and never gets the
* response the test expects.
*/
async waitForNewLocalChatViewSession(previousSessionResource: string | undefined, retryCount?: number): Promise<void> {
await this.code.waitForElement(CHAT_VIEW_BOUND_SESSION, element => {
const sessionResource = element?.attributes['data-bound-chat-resource'];
return !!sessionResource && sessionResource !== previousSessionResource && sessionResource.startsWith(LOCAL_CHAT_SESSION_RESOURCE_PREFIX);
}, retryCount);
}

async waitForChatEditor(retryCount?: number): Promise<void> {
await this.code.waitForElement(CHAT_EDITOR, undefined, retryCount);
}
Expand Down
3 changes: 2 additions & 1 deletion test/smoke/src/areas/browserView/browserView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,9 @@ export function setup(logger: Logger): void {
await workbenchPage.locator('.tab', { hasText: 'Browser Smoke Sharing' }).click();
await unshareButton.waitFor();

const previousSessionResource = await app.workbench.chat.getChatViewSessionResource();
await app.workbench.quickaccess.runCommand('smoketest.openLocalChat');
await app.workbench.chat.waitForChatView();
await app.workbench.chat.waitForNewLocalChatViewSession(previousSessionResource, 600);
await app.workbench.chat.sendMessage('[scenario:browser-sharing-click-success]');
const successToolResult = await waitForScenarioToolResult(mockServer, 'browser-sharing-click-success');
assert.doesNotMatch(successToolResult, /not found/i);
Expand Down
3 changes: 2 additions & 1 deletion test/smoke/src/areas/chat/chatModelConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ export function setup(logger: Logger) {
// override is applied on the agent request path). Select the local
// harness explicitly since the panel default is Agent Host Copilot
// when the agent host is enabled.
const previousSessionResource = await chat.getChatViewSessionResource();
await app.workbench.quickaccess.runCommand('smoketest.openLocalChat');
await chat.waitForChatView();
await chat.waitForNewLocalChatViewSession(previousSessionResource, 600);

// Retry the warm-up send until the model actually replies, which
// confirms copilot-chat is active and the panel is usable.
Expand Down
3 changes: 2 additions & 1 deletion test/smoke/src/areas/chat/chatSandbox.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,9 @@ export function setup(logger: Logger): void {

before(async function () {
const app = this.app as Application;
const previousSessionResource = await app.workbench.chat.getChatViewSessionResource();
await app.workbench.quickaccess.runCommand('smoketest.openLocalChat');
await app.workbench.chat.waitForChatView();
await app.workbench.chat.waitForNewLocalChatViewSession(previousSessionResource, 600);
await warmUpChat(app.workbench.chat, mockServer, logger);
});

Expand Down
Loading