@@ -181,7 +181,7 @@ describe('E2E: Slash Commands', () => {
181181 )
182182
183183 test (
184- 'typing / displays autocomplete with slash in input ' ,
184+ 'typing / displays autocomplete with command suggestions ' ,
185185 async ( ) => {
186186 const session = await ctx . createSession ( )
187187
@@ -190,11 +190,13 @@ describe('E2E: Slash Commands', () => {
190190
191191 // Type / to trigger suggestions
192192 await session . cli . type ( '/' )
193- await session . cli . waitForText ( '/' , { timeout : 5000 } )
193+
194+ // Wait for autocomplete to show command names
195+ await session . cli . waitForText ( / n e w | e x i t | u s a g e | i n i t | l o g o u t / i, { timeout : 5000 } )
194196
195197 const text = await session . cli . text ( )
196- // Verify the slash appears in the input
197- expect ( text ) . toContain ( '/' )
198+ // Verify autocomplete shows at least one command name
199+ expect ( text . toLowerCase ( ) ) . toMatch ( / n e w | e x i t | u s a g e | i n i t | l o g o u t / )
198200 } ,
199201 TIMEOUT_MS ,
200202 )
@@ -230,7 +232,7 @@ describe('E2E: User Authentication', () => {
230232 )
231233
232234 test (
233- '/logout command is processed by CLI ' ,
235+ '/logout command triggers logout flow ' ,
234236 async ( ) => {
235237 const session = await ctx . createSession ( E2E_TEST_USERS . default )
236238
@@ -242,15 +244,12 @@ describe('E2E: User Authentication', () => {
242244 await session . cli . waitForText ( '/logout' , { timeout : 5000 } )
243245 await session . cli . press ( 'enter' )
244246
245- // Wait for the CLI to process the command - the UI should change
246- // Give the command time to execute
247- await sleep ( 2000 )
247+ // Wait for logout confirmation or login prompt to appear
248+ await session . cli . waitForText ( / l o g g e d o u t | l o g o u t | l o g i n | s i g n i n | g o o d b y e / i, { timeout : 10000 } )
248249
249- const textAfter = await session . cli . text ( )
250- // The command should have been processed (UI changed from before)
251- // We can't guarantee specific output text since /logout behavior may vary
252- // but we verify the command was accepted (didn't error or crash)
253- expect ( textAfter . length ) . toBeGreaterThan ( 0 )
250+ const text = await session . cli . text ( )
251+ // Verify logout-related UI appeared
252+ expect ( text . toLowerCase ( ) ) . toMatch ( / l o g g e d o u t | l o g o u t | l o g i n | s i g n i n | g o o d b y e / )
254253 } ,
255254 TIMEOUT_MS ,
256255 )
@@ -444,7 +443,7 @@ describe('E2E: Additional Slash Commands', () => {
444443 )
445444
446445 test (
447- '/exit command is processed by CLI ' ,
446+ '/exit command triggers graceful exit ' ,
448447 async ( ) => {
449448 const session = await ctx . createSession ( )
450449
@@ -456,13 +455,12 @@ describe('E2E: Additional Slash Commands', () => {
456455 await session . cli . waitForText ( '/exit' , { timeout : 5000 } )
457456 await session . cli . press ( 'enter' )
458457
459- // Wait for the CLI to process the command
460- await sleep ( 2000 )
458+ // Wait for exit/goodbye message to appear
459+ await session . cli . waitForText ( / g o o d b y e | e x i t i n g | c o n t i n u e t h i s s e s s i o n / i , { timeout : 10000 } )
461460
462461 const text = await session . cli . text ( )
463- // /exit should either show goodbye/exit message or the CLI should terminate
464- // Either outcome is valid - we verify the command was accepted
465- expect ( text . length ) . toBeGreaterThan ( 0 )
462+ // Verify exit message appeared
463+ expect ( text . toLowerCase ( ) ) . toMatch ( / g o o d b y e | e x i t i n g | c o n t i n u e t h i s s e s s i o n / )
466464 } ,
467465 TIMEOUT_MS ,
468466 )
@@ -516,18 +514,19 @@ describe('E2E: CLI Flags', () => {
516514 )
517515
518516 test (
519- '--agent flag starts CLI with specified agent' ,
517+ '--agent flag starts CLI with specified agent visible in UI ' ,
520518 async ( ) => {
521519 const session = await ctx . createSession ( E2E_TEST_USERS . default , [
522520 '--agent' ,
523521 'ask' ,
524522 ] )
525523
526- // CLI should start successfully and show main interface
527- await session . cli . waitForText ( / d i r e c t o r y / i, { timeout : 15000 } )
524+ // CLI should show the agent name in the UI
525+ await session . cli . waitForText ( / a s k / i, { timeout : 15000 } )
528526
529527 const text = await session . cli . text ( )
530- expect ( text . toLowerCase ( ) ) . toContain ( 'directory' )
528+ // Verify the agent name appears in the UI (mode indicator shows agent)
529+ expect ( text . toLowerCase ( ) ) . toContain ( 'ask' )
531530 } ,
532531 TIMEOUT_MS ,
533532 )
0 commit comments