Skip to content

Commit a4c7e98

Browse files
committed
test: add e2e tests for streaming, session continuity, user-id, and deploy --plan
1 parent ec3d007 commit a4c7e98

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

e2e-tests/e2e-helper.ts

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,94 @@ export function createE2ESuite(cfg: E2EConfig) {
261261
},
262262
120000
263263
);
264+
265+
it.skipIf(!canRun)(
266+
'invoke supports streaming',
267+
async () => {
268+
const result = await run(['invoke', '--prompt', 'Say hello', '--agent', agentName, '--stream', '--json']);
269+
270+
expect(result.exitCode, `Stream invoke failed: ${result.stderr}`).toBe(0);
271+
expect(result.stdout.length, 'Streaming invoke should produce output').toBeGreaterThan(0);
272+
},
273+
120000
274+
);
275+
276+
it.skipIf(!canRun)(
277+
'invoke maintains conversation continuity with session ID',
278+
async () => {
279+
const sessionId = `e2e-session-${randomUUID()}`;
280+
281+
// First turn: say something memorable
282+
await retry(
283+
async () => {
284+
const r1 = await run([
285+
'invoke',
286+
'--prompt',
287+
'Remember this word: pineapple',
288+
'--agent',
289+
agentName,
290+
'--session-id',
291+
sessionId,
292+
'--json',
293+
]);
294+
expect(r1.exitCode, `First turn failed (stdout: ${r1.stdout}, stderr: ${r1.stderr})`).toBe(0);
295+
},
296+
3,
297+
10000
298+
);
299+
300+
// Second turn: ask for it back
301+
const r2 = await run([
302+
'invoke',
303+
'--prompt',
304+
'What word did I ask you to remember?',
305+
'--agent',
306+
agentName,
307+
'--session-id',
308+
sessionId,
309+
'--json',
310+
]);
311+
expect(r2.exitCode, `Second turn failed: ${r2.stderr}`).toBe(0);
312+
313+
const json = parseJsonOutput(r2.stdout) as { success: boolean; response?: string };
314+
expect(json.success).toBe(true);
315+
expect(json.response?.toLowerCase(), 'Response should reference the word from the first turn').toContain(
316+
'pineapple'
317+
);
318+
},
319+
180000
320+
);
321+
322+
it.skipIf(!canRun)(
323+
'invoke accepts a user ID',
324+
async () => {
325+
const result = await run([
326+
'invoke',
327+
'--prompt',
328+
'Say hello',
329+
'--agent',
330+
agentName,
331+
'--user-id',
332+
'test-user-e2e',
333+
'--json',
334+
]);
335+
336+
expect(result.exitCode, `Invoke with user-id failed: ${result.stderr}`).toBe(0);
337+
const json = parseJsonOutput(result.stdout) as { success: boolean };
338+
expect(json.success).toBe(true);
339+
},
340+
120000
341+
);
342+
343+
it.skipIf(!canRun)(
344+
'deploy --plan previews without modifying infrastructure',
345+
async () => {
346+
const result = await run(['deploy', '--plan', '--json']);
347+
348+
expect(result.exitCode, `Deploy --plan failed: ${result.stderr}`).toBe(0);
349+
},
350+
120000
351+
);
264352
});
265353
}
266354

0 commit comments

Comments
 (0)