Add smoke test for anonymous chat access (#291953)

* Initial plan

* Add smoke test for anonymous chat access

Co-authored-by: bpasero <900690+bpasero@users.noreply.github.com>

* fix

* .

* .

* .

* .

* .

* .

* .

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: bpasero <900690+bpasero@users.noreply.github.com>
Co-authored-by: Benjamin Pasero <benjamin.pasero@microsoft.com>
This commit is contained in:
Copilot
2026-01-31 16:33:11 +00:00
committed by GitHub
parent d21910006a
commit b31c729a39
8 changed files with 74 additions and 33 deletions

View File

@@ -4,15 +4,17 @@
*--------------------------------------------------------------------------------------------*/
import { Code } from './code';
import { Notification } from './notification';
const CHAT_VIEW = 'div[id="workbench.panel.chat"]';
const CHAT_EDITOR = `${CHAT_VIEW} .monaco-editor[role="code"]`;
const CHAT_EDITOR_FOCUSED = `${CHAT_VIEW} .monaco-editor.focused[role="code"]`;
const CHAT_RESPONSE = `${CHAT_VIEW} .interactive-item-container.interactive-response`;
const CHAT_RESPONSE_COMPLETE = `${CHAT_RESPONSE}:not(.chat-response-loading)`;
const CHAT_FOOTER_DETAILS = `${CHAT_VIEW} .chat-footer-details`;
export class Chat {
constructor(private code: Code, private notification: Notification) { }
constructor(private code: Code) { }
private get chatInputSelector(): string {
return `${CHAT_EDITOR} ${!this.code.editContextEnabled ? 'textarea' : '.native-edit-context'}`;
@@ -27,9 +29,6 @@ export class Chat {
}
async sendMessage(message: string): Promise<void> {
if (await this.notification.isNotificationVisible()) {
throw new Error('Notification is visible');
}
// Click on the chat input to focus it
await this.code.waitAndClick(CHAT_EDITOR);
@@ -44,4 +43,22 @@ export class Chat {
// Submit the message
await this.code.dispatchKeybinding('enter', () => Promise.resolve());
}
async waitForResponse(retryCount?: number): Promise<void> {
// First wait for a response element to appear
await this.code.waitForElement(CHAT_RESPONSE, undefined, retryCount);
// Then wait for it to complete (not loading)
await this.code.waitForElement(CHAT_RESPONSE_COMPLETE, undefined, retryCount);
}
async waitForModelInFooter(modelName: string): Promise<void> {
await this.code.waitForElements(CHAT_FOOTER_DETAILS, false, el => {
return el.some(el => {
const text = el && typeof el.textContent === 'string' ? el.textContent : '';
return !!text && text.includes(modelName);
});
});
}
}