test(app): verify the Chat destination in the real app flow
This commit is contained in:
@@ -470,6 +470,28 @@ try {
|
|||||||
}
|
}
|
||||||
captures.push(await capture('settings-material-registered-phone'));
|
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('Runs');
|
||||||
await clickText('Fixture cancel run', { contains: true });
|
await clickText('Fixture cancel run', { contains: true });
|
||||||
await assertBody('Original prompt');
|
await assertBody('Original prompt');
|
||||||
|
|||||||
@@ -324,6 +324,15 @@ export async function startFixture({ root }) {
|
|||||||
const cancelRequests = [];
|
const cancelRequests = [];
|
||||||
let decisionAccepted = false;
|
let decisionAccepted = false;
|
||||||
const decisionRequests = [];
|
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 = () => {
|
const dropConnections = () => {
|
||||||
for (const connection of connections) connection.close();
|
for (const connection of connections) connection.close();
|
||||||
@@ -372,6 +381,8 @@ export async function startFixture({ root }) {
|
|||||||
getRun,
|
getRun,
|
||||||
cancelRequests,
|
cancelRequests,
|
||||||
decisionRequests,
|
decisionRequests,
|
||||||
|
chatSubscribed,
|
||||||
|
chatHistory,
|
||||||
}));
|
}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -463,6 +474,32 @@ export async function startFixture({ root }) {
|
|||||||
client.send({ id: request.id, type: 'run', run_detail: humanDetail(true) });
|
client.send({ id: request.id, type: 'run', run_detail: humanDetail(true) });
|
||||||
return;
|
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({
|
client.send({
|
||||||
id: request.id,
|
id: request.id,
|
||||||
type: 'error',
|
type: 'error',
|
||||||
|
|||||||
Reference in New Issue
Block a user