@@ -668,9 +668,17 @@ describe('E2E: Keyboard Interactions', () => {
668668 await session . cli . press ( [ 'ctrl' , 'c' ] )
669669 await sleep ( 1500 )
670670
671- // CLI should have exited or show exit state
672- // Test passes if we got here without hanging
673- expect ( true ) . toBe ( true )
671+ // Either the CLI exits or remains responsive to further input
672+ await session . cli . type ( 'ping' )
673+ await sleep ( 500 )
674+ const text = await session . cli . text ( )
675+ const exited =
676+ text . toLowerCase ( ) . includes ( 'exit' ) ||
677+ text . toLowerCase ( ) . includes ( 'goodbye' ) ||
678+ text . toLowerCase ( ) . includes ( 'quit' ) ||
679+ text . trim ( ) . length === 0
680+ const responsive = text . toLowerCase ( ) . includes ( 'ping' )
681+ expect ( exited || responsive ) . toBe ( true )
674682 } ,
675683 TIMEOUT_MS ,
676684 )
@@ -725,9 +733,8 @@ describe('E2E: Keyboard Interactions', () => {
725733
726734 // Text should be modified ("hel" instead of "hello")
727735 text = await session . cli . text ( )
728- const hasModifiedText =
729- text . includes ( 'hel' ) || ! text . includes ( 'hello' ) || text . length > 0
730- expect ( hasModifiedText ) . toBe ( true )
736+ expect ( text . includes ( 'hel' ) ) . toBe ( true )
737+ expect ( text . includes ( 'hello' ) ) . toBe ( false )
731738 } ,
732739 TIMEOUT_MS ,
733740 )
@@ -747,10 +754,11 @@ describe('E2E: Keyboard Interactions', () => {
747754 await session . cli . press ( 'escape' )
748755 await sleep ( 500 )
749756
750- // Input should be cleared or escape should have an effect
757+ // Ensure input remains responsive after escape
758+ await session . cli . type ( 'x' )
759+ await sleep ( 300 )
751760 const text = await session . cli . text ( )
752- // The behavior depends on implementation - test passes if CLI is responsive
753- expect ( text . length ) . toBeGreaterThanOrEqual ( 0 )
761+ expect ( text ) . toContain ( 'x' )
754762 } ,
755763 TIMEOUT_MS ,
756764 )
@@ -811,15 +819,13 @@ describe('E2E: Error Scenarios', () => {
811819 await sleep ( 1500 )
812820
813821 const text = await session . cli . text ( )
814- // Should show error, unknown command message, or suggestions
815822 const hasErrorOrSuggestion =
816823 text . toLowerCase ( ) . includes ( 'unknown' ) ||
817824 text . toLowerCase ( ) . includes ( 'invalid' ) ||
818825 text . toLowerCase ( ) . includes ( 'error' ) ||
819826 text . toLowerCase ( ) . includes ( 'not found' ) ||
820827 text . toLowerCase ( ) . includes ( 'did you mean' ) ||
821- text . includes ( '/invalidcommandxyz' ) ||
822- text . length > 0 // At minimum, CLI should still be running
828+ text . includes ( '/invalidcommandxyz' )
823829 expect ( hasErrorOrSuggestion ) . toBe ( true )
824830 } ,
825831 TIMEOUT_MS ,
@@ -864,9 +870,7 @@ describe('E2E: Error Scenarios', () => {
864870
865871 const text = await session . cli . text ( )
866872 // CLI should handle long input without crashing
867- // May truncate or wrap, but should contain some of the message
868- const hasLongInput = text . includes ( 'a' ) || text . length > 0
869- expect ( hasLongInput ) . toBe ( true )
873+ expect ( text ) . toContain ( 'a' )
870874 } ,
871875 TIMEOUT_MS ,
872876 )
@@ -883,12 +887,8 @@ describe('E2E: Error Scenarios', () => {
883887 await sleep ( 500 )
884888
885889 const text = await session . cli . text ( )
886- // Should contain at least part of the message
887890 const hasSpecialChars =
888- text . includes ( 'Hello' ) ||
889- text . includes ( 'world' ) ||
890- text . includes ( 'test' ) ||
891- text . length > 0
891+ text . includes ( 'Hello' ) || text . includes ( 'world' ) || text . includes ( 'test' )
892892 expect ( hasSpecialChars ) . toBe ( true )
893893 } ,
894894 TIMEOUT_MS ,
0 commit comments