test(app): verify composer send in the real app flow

This commit is contained in:
2026-10-22 00:19:36 +01:00
parent 2adecfff5e
commit 1e578985e0
3 changed files with 56 additions and 0 deletions
+10
View File
@@ -11,3 +11,13 @@ deliberately absent and recorded as open work.
The server defect is fixed with a regression and deployed separately; this app
slice needed no retry.
## Real-app verification
The normal-app browser probe now focuses the composer as an operator does, types,
sends through the primary control, and asserts exactly one `chat_prompt` with the
exact text, session id, operation id and native message id, plus the optimistic
message in the rendered thread (OCR). It passes with the existing run/changes/
artifacts/chat/settings steps in one flow. The Ctrl/Cmd+Enter shortcut stays
covered by the widget probe: a synthetic key event does not set the engine's
hardware-keyboard state reliably in headless Chrome.
+37
View File
@@ -521,6 +521,43 @@ try {
}
captures.push(await capture('decision-material-accepted'));
await clickText('Back to list');
await clickText('Chat');
await clickText('Probe conversation', { contains: true });
await assertBody('User message');
// The empty composer exposes a hint, not an accessible label, so focus it by
// clicking its visible strip above the navigation bar; JS focus alone is not
// Flutter's editing connection and would swallow the text.
for (const type of ['mousePressed', 'mouseReleased']) {
await send('Input.dispatchMouseEvent', {
type, x: 150, y: 700, button: 'left', clickCount: 1,
}, session);
}
await delay(400);
await send('Input.insertText', { text: 'Probe composed message' }, session);
await delay(500);
if (!(await semanticText()).includes('Probe composed message')) {
throw new Error('The composer field did not receive the typed text');
}
// Send through the primary control; the Ctrl/Cmd+Enter path is covered by the
// widget probe, and a synthetic key event is not a reliable stand-in for the
// engine's hardware-keyboard state in headless Chrome.
await clickText('Send');
await delay(900);
const afterSend = await (await fetch(`${fixture.url}/fixture/state`)).json();
if (afterSend.chatPrompts.length !== 1) {
throw new Error(`Composer did not send exactly one prompt: ${JSON.stringify(afterSend.chatPrompts)}`);
}
const sent = afterSend.chatPrompts[0];
if (sent.text !== 'Probe composed message' || sent.session_id !== 'ses_probechat' ||
!sent.operation_id || !sent.native_message_id) {
throw new Error(`Wrong prompt payload: ${JSON.stringify(sent)}`);
}
const composerCapture = await capture('chat-composer-material-sent');
captures.push(composerCapture);
await assertOcr(composerCapture, 'Probe composed message');
await clickText('Runs');
await delay(500);
await assertBody('Fixture cancel run');
await assertBody('canceled');
+9
View File
@@ -326,6 +326,7 @@ export async function startFixture({ root }) {
const decisionRequests = [];
let chatSubscribed = 0;
let chatHistory = 0;
const chatPrompts = [];
const searchRequests = [];
const CHAT_SESSION = {
id: 'ses_probechat',
@@ -384,6 +385,7 @@ export async function startFixture({ root }) {
decisionRequests,
chatSubscribed,
chatHistory,
chatPrompts,
searchRequests,
}));
return;
@@ -515,6 +517,13 @@ export async function startFixture({ root }) {
client.send({ id: request.id, type: 'chat_subscribe' });
return;
}
if (request.type === 'chat_prompt') {
const body = request.chat_prompt ?? {};
chatPrompts.push({ session_id: body.session_id, text: body.text,
operation_id: body.operation_id, native_message_id: body.native_message_id });
setTimeout(() => client.send({ id: request.id, type: 'chat_prompt' }), 300);
return;
}
if (request.type === 'chat_messages') {
chatHistory++;
client.send({