Skip to content

Commit ad2efa0

Browse files
committed
test: add e2e tests for session continuity and deploy --plan
1 parent ec3d007 commit ad2efa0

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

e2e-tests/e2e-helper.ts

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,79 @@ export function createE2ESuite(cfg: E2EConfig) {
261261
},
262262
120000
263263
);
264+
265+
it.skipIf(!canRun)(
266+
'invoke maintains conversation continuity with session ID',
267+
async () => {
268+
const sessionId = `e2e-session-${randomUUID()}`;
269+
270+
// First turn: say something memorable
271+
await retry(
272+
async () => {
273+
const r1 = await run([
274+
'invoke',
275+
'--prompt',
276+
'Remember this word: pineapple',
277+
'--agent',
278+
agentName,
279+
'--session-id',
280+
sessionId,
281+
'--json',
282+
]);
283+
expect(r1.exitCode, `First turn failed (stdout: ${r1.stdout}, stderr: ${r1.stderr})`).toBe(0);
284+
},
285+
3,
286+
10000
287+
);
288+
289+
// Second turn: ask for it back
290+
const r2 = await run([
291+
'invoke',
292+
'--prompt',
293+
'What word did I ask you to remember?',
294+
'--agent',
295+
agentName,
296+
'--session-id',
297+
sessionId,
298+
'--json',
299+
]);
300+
expect(r2.exitCode, `Second turn failed: ${r2.stderr}`).toBe(0);
301+
302+
const json = parseJsonOutput(r2.stdout) as { success: boolean; response?: string };
303+
expect(json.success).toBe(true);
304+
expect(json.response?.toLowerCase(), 'Response should reference the word from the first turn').toContain(
305+
'pineapple'
306+
);
307+
},
308+
180000
309+
);
310+
311+
it.skipIf(!canRun)(
312+
'deploy --plan does not deploy pending changes',
313+
async () => {
314+
// Add a resource so there's a pending change
315+
const addResult = await run(['add', 'memory', '--name', 'PlanTestMemory', '--json']);
316+
expect(addResult.exitCode, `Add memory failed: ${addResult.stdout}`).toBe(0);
317+
318+
// Run plan — should succeed without deploying
319+
const planResult = await run(['deploy', '--plan', '--json']);
320+
expect(planResult.exitCode, `Deploy --plan failed: ${planResult.stderr}`).toBe(0);
321+
322+
// Verify the memory is still local-only (not deployed)
323+
const statusResult = await run(['status', '--type', 'memory', '--json']);
324+
expect(statusResult.exitCode).toBe(0);
325+
const json = parseJsonOutput(statusResult.stdout) as {
326+
resources: { name: string; deploymentState: string }[];
327+
};
328+
const memory = json.resources.find(r => r.name === 'PlanTestMemory');
329+
expect(memory, 'Memory should appear in status').toBeDefined();
330+
expect(memory!.deploymentState, 'Memory should still be local-only after --plan').toBe('local-only');
331+
332+
// Clean up: remove the memory so it doesn't affect teardown
333+
await run(['remove', 'memory', '--name', 'PlanTestMemory', '--json']);
334+
},
335+
120000
336+
);
264337
});
265338
}
266339

0 commit comments

Comments
 (0)