Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(e2e): target current chat controls

Steven Enamakelabecd6b936e3
diff --git a/app/test/e2e/specs/chat-harness-cancel.spec.ts b/app/test/e2e/specs/chat-harness-cancel.spec.ts
index 46fdaf1d79..acb887ec94 100644
--- a/app/test/e2e/specs/chat-harness-cancel.spec.ts
+++ b/app/test/e2e/specs/chat-harness-cancel.spec.ts
@@ -72,7 +72,7 @@ let cancelAttempted = false;
async function clickComposerCancel(): Promise<boolean> {
return (await browser.execute(() => {
const stop = document.querySelector<HTMLButtonElement>(
- '[data-testid="stop-generation-button"]'
+ '[data-testid="stop-generation-button"], button[aria-label="Stop generating"]'
);
if (stop) {
stop.click();
@@ -159,9 +159,14 @@ describe('Chat harness — mid-stream cancel', () => {
browser.execute(() => {
const stop = document.querySelector('[data-testid="stop-generation-button"]');
const ta = document.querySelector(
- 'textarea[placeholder="Send a message..."]'
- ) as HTMLTextAreaElement | null;
- return !stop && !!ta && !ta.disabled;
+ 'textarea[placeholder="Send a message..."], [contenteditable="true"][role="textbox"][aria-label="Message input"]'
+ ) as HTMLTextAreaElement | HTMLElement | null;
+ return (
+ !stop &&
+ !!ta &&
+ !(ta as HTMLTextAreaElement).disabled &&
+ ta.getAttribute('aria-disabled') !== 'true'
+ );
}),
{ timeout: 20_000, timeoutMsg: 'composer did not settle after uncancellable turn' }
);
@@ -209,9 +214,11 @@ describe('Chat harness — mid-stream cancel', () => {
// The textarea must be re-enabled.
const composerEnabled = await browser.execute(() => {
const ta = document.querySelector(
- 'textarea[placeholder="Send a message..."]'
- ) as HTMLTextAreaElement | null;
- return !!ta && !ta.disabled;
+ 'textarea[placeholder="Send a message..."], [contenteditable="true"][role="textbox"][aria-label="Message input"]'
+ ) as HTMLTextAreaElement | HTMLElement | null;
+ return (
+ !!ta && !(ta as HTMLTextAreaElement).disabled && ta.getAttribute('aria-disabled') !== 'true'
+ );
});
expect(composerEnabled).toBe(true);
diff --git a/app/test/e2e/specs/chat-harness-scroll-render.spec.ts b/app/test/e2e/specs/chat-harness-scroll-render.spec.ts
index b20b14b785..20b0abd383 100644
--- a/app/test/e2e/specs/chat-harness-scroll-render.spec.ts
+++ b/app/test/e2e/specs/chat-harness-scroll-render.spec.ts
@@ -71,7 +71,17 @@ async function scrollMetrics(): Promise<{
found: boolean;
}> {
return (await browser.execute(() => {
- const el = document.querySelector('[data-testid="chat-messages-scroll"]') as HTMLElement | null;
+ const messageColumn = document.querySelector(
+ '[data-testid="chat-messages-scroll"]'
+ ) as HTMLElement | null;
+ // Wry can place the overflow owner on a layout ancestor (or the document)
+ // rather than directly on Conversation. Measure the element that is
+ // actually scrollable, while preferring Conversation when it owns scroll.
+ const candidates: HTMLElement[] = [];
+ for (let el = messageColumn; el; el = el.parentElement) candidates.push(el);
+ if (document.scrollingElement instanceof HTMLElement)
+ candidates.push(document.scrollingElement);
+ const el = candidates.find(node => node.scrollHeight > node.clientHeight) ?? messageColumn;
if (!el) return { scrollTop: 0, scrollHeight: 0, clientHeight: 0, found: false };
return {
scrollTop: el.scrollTop,
@@ -84,7 +94,14 @@ async function scrollMetrics(): Promise<{
async function scrollMessageColumn(top: number): Promise<void> {
await browser.execute((y: number) => {
- const el = document.querySelector('[data-testid="chat-messages-scroll"]') as HTMLElement | null;
+ const messageColumn = document.querySelector(
+ '[data-testid="chat-messages-scroll"]'
+ ) as HTMLElement | null;
+ const candidates: HTMLElement[] = [];
+ for (let node = messageColumn; node; node = node.parentElement) candidates.push(node);
+ if (document.scrollingElement instanceof HTMLElement)
+ candidates.push(document.scrollingElement);
+ const el = candidates.find(node => node.scrollHeight > node.clientHeight) ?? messageColumn;
if (el) el.scrollTo({ top: y, behavior: 'auto' });
}, top);
}
diff --git a/app/test/e2e/specs/chat-tool-error-recovery.spec.ts b/app/test/e2e/specs/chat-tool-error-recovery.spec.ts
index 022b5d7819..ce03cb70b6 100644
--- a/app/test/e2e/specs/chat-tool-error-recovery.spec.ts
+++ b/app/test/e2e/specs/chat-tool-error-recovery.spec.ts
@@ -155,9 +155,14 @@ describe('Chat tool-error recovery', () => {
'button[aria-label="Send message"]'
) as HTMLButtonElement | null;
const ta = document.querySelector(
- 'textarea[placeholder="Send a message..."]'
- ) as HTMLTextAreaElement | null;
- return (btn !== null && !btn.disabled) || (ta !== null && !ta.disabled);
+ 'textarea[placeholder="Send a message..."], [contenteditable="true"][role="textbox"][aria-label="Message input"]'
+ ) as HTMLTextAreaElement | HTMLElement | null;
+ return (
+ (btn !== null && !btn.disabled) ||
+ (ta !== null &&
+ !(ta as HTMLTextAreaElement).disabled &&
+ ta.getAttribute('aria-disabled') !== 'true')
+ );
});
if (composerEnabled) {
console.log(`${LOG_PREFIX} T3.2: composer re-enabled`);