test(app): verify the Chat destination in the real app flow

This commit is contained in:
2026-10-21 23:07:31 +01:00
parent 2de1c90730
commit e2b1464b04
2 changed files with 59 additions and 0 deletions
+22
View File
@@ -470,6 +470,28 @@ try {
}
captures.push(await capture('settings-material-registered-phone'));
// The registered Chat destination opens a real conversation over the shared
// socket: list row -> session route -> stored turn, then Back to the list.
await clickText('Chat');
await assertBody('Probe conversation');
captures.push(await capture('chat-material-list'));
await clickText('Probe conversation', { contains: true });
await assertBody('User message');
await assertBody('Assistant message');
if ((await path()) !== '/chat/ses_probechat') {
throw new Error(`Chat selection did not update the route: ${await path()}`);
}
await delay(900);
const threadCapture = await capture('chat-material-thread');
captures.push(threadCapture);
await assertOcr(threadCapture, 'Read-only probe question.');
await assertOcr(threadCapture, 'Stored probe answer.');
await clickText('Back', { contains: true });
await assertBody('Probe conversation');
if ((await path()) !== '/chat') {
throw new Error(`Chat Back left the route at ${await path()}`);
}
await clickText('Runs');
await clickText('Fixture cancel run', { contains: true });
await assertBody('Original prompt');
+37
View File
@@ -324,6 +324,15 @@ export async function startFixture({ root }) {
const cancelRequests = [];
let decisionAccepted = false;
const decisionRequests = [];
let chatSubscribed = 0;
let chatHistory = 0;
const CHAT_SESSION = {
id: 'ses_probechat',
title: 'Probe conversation',
kind: 'operator',
directory: '/srv/probe',
updated_at: '2026-10-21T12:00:00Z',
};
const dropConnections = () => {
for (const connection of connections) connection.close();
@@ -372,6 +381,8 @@ export async function startFixture({ root }) {
getRun,
cancelRequests,
decisionRequests,
chatSubscribed,
chatHistory,
}));
return;
}
@@ -463,6 +474,32 @@ export async function startFixture({ root }) {
client.send({ id: request.id, type: 'run', run_detail: humanDetail(true) });
return;
}
if (request.type === 'chat_sessions') {
client.send({ id: request.id, type: 'chat_sessions',
chat_sessions: [CHAT_SESSION] });
return;
}
if (request.type === 'chat_subscribe') {
chatSubscribed++;
client.send({ id: request.id, type: 'chat_subscribe' });
return;
}
if (request.type === 'chat_messages') {
chatHistory++;
client.send({
id: request.id, type: 'chat_history',
chat_history: {
messages: [
{ id: 'm1', session_id: CHAT_SESSION.id, role: 'user',
parts: [{ type: 'text', text: 'Read-only probe question.' }] },
{ id: 'm2', session_id: CHAT_SESSION.id, role: 'assistant',
parts: [{ type: 'text', text: 'Stored probe answer.' }] },
],
next_cursor: '', has_more: false,
},
});
return;
}
client.send({
id: request.id,
type: 'error',