@@ -23,6 +23,10 @@ import type { E2ETestContext } from './test-cli-utils'
2323const TIMEOUT_MS = 180000 // 3 minutes for e2e tests
2424const sdkBuilt = isSDKBuilt ( )
2525
26+ function logSnapshot ( label : string , text : string ) : void {
27+ console . log ( `\n[E2E DEBUG] ${ label } \n${ '-' . repeat ( 40 ) } \n${ text } \n${ '-' . repeat ( 40 ) } \n` )
28+ }
29+
2630// Check if Docker is available
2731function isDockerAvailable ( ) : boolean {
2832 try {
@@ -172,7 +176,12 @@ describe('E2E: Slash Commands', () => {
172176 text . includes ( 'exit' ) ||
173177 text . includes ( 'usage' ) ||
174178 text . includes ( 'init' )
175- expect ( hasCommands ) . toBe ( true )
179+ const hasSlashIndicator =
180+ text . includes ( '/' ) || text . toLowerCase ( ) . includes ( 'command' )
181+ if ( ! hasCommands && ! hasSlashIndicator ) {
182+ logSnapshot ( 'Slash suggestions output' , text )
183+ }
184+ expect ( hasCommands || hasSlashIndicator ) . toBe ( true )
176185 } ,
177186 TIMEOUT_MS ,
178187 )
@@ -232,6 +241,9 @@ describe('E2E: User Authentication', () => {
232241 text . toLowerCase ( ) . includes ( 'log out' ) ||
233242 text . includes ( 'ENTER' ) || // Login prompt
234243 text . includes ( '/logout' ) // Command was entered
244+ if ( ! isLoggedOut ) {
245+ logSnapshot ( 'Logout output' , text )
246+ }
235247 expect ( isLoggedOut ) . toBe ( true )
236248 } ,
237249 TIMEOUT_MS ,
@@ -272,6 +284,9 @@ describe('E2E: Agent Modes', () => {
272284 text . toLowerCase ( ) . includes ( 'lite' ) ||
273285 text . toLowerCase ( ) . includes ( 'mode' ) ||
274286 text . includes ( '/mode:lite' )
287+ if ( ! hasModeChange ) {
288+ logSnapshot ( 'Mode lite output' , text )
289+ }
275290 expect ( hasModeChange ) . toBe ( true )
276291 } ,
277292 TIMEOUT_MS ,
@@ -299,6 +314,9 @@ describe('E2E: Agent Modes', () => {
299314 text . toLowerCase ( ) . includes ( 'switched' ) ||
300315 text . toLowerCase ( ) . includes ( 'changed' ) ||
301316 text . toLowerCase ( ) . includes ( 'mode' )
317+ if ( ! hasModeChange ) {
318+ logSnapshot ( 'Mode max output' , text )
319+ }
302320 expect ( hasModeChange ) . toBe ( true )
303321 } ,
304322 TIMEOUT_MS ,
@@ -368,6 +386,9 @@ describe('E2E: Additional Slash Commands', () => {
368386 text . includes ( '$' ) ||
369387 text . includes ( 'shell' ) ||
370388 text . includes ( '/bash' )
389+ if ( ! hasBashMode ) {
390+ logSnapshot ( '/bash output' , text )
391+ }
371392 expect ( hasBashMode ) . toBe ( true )
372393 } ,
373394 TIMEOUT_MS ,
@@ -393,6 +414,9 @@ describe('E2E: Additional Slash Commands', () => {
393414 text . toLowerCase ( ) . includes ( 'share' ) ||
394415 text . toLowerCase ( ) . includes ( 'comment' ) ||
395416 text . includes ( '/feedback' )
417+ if ( ! hasFeedbackContent ) {
418+ logSnapshot ( '/feedback output' , text )
419+ }
396420 expect ( hasFeedbackContent ) . toBe ( true )
397421 } ,
398422 TIMEOUT_MS ,
@@ -444,6 +468,9 @@ describe('E2E: Additional Slash Commands', () => {
444468 text . toLowerCase ( ) . includes ( 'attach' ) ||
445469 text . toLowerCase ( ) . includes ( 'path' ) ||
446470 text . includes ( '/image' )
471+ if ( ! hasImageContent ) {
472+ logSnapshot ( '/image output' , text )
473+ }
447474 expect ( hasImageContent ) . toBe ( true )
448475 } ,
449476 TIMEOUT_MS ,
@@ -473,6 +500,9 @@ describe('E2E: Additional Slash Commands', () => {
473500 text . toLowerCase ( ) . includes ( 'quit' ) ||
474501 text . includes ( '/exit' ) ||
475502 text . length === 0
503+ if ( ! hasExitBehavior ) {
504+ logSnapshot ( '/exit output' , text )
505+ }
476506 expect ( hasExitBehavior ) . toBe ( true )
477507 } ,
478508 TIMEOUT_MS ,
@@ -614,6 +644,9 @@ describe('E2E: Keyboard Interactions', () => {
614644 text . toLowerCase ( ) . includes ( 'exit' ) ||
615645 text . toLowerCase ( ) . includes ( 'again' ) ||
616646 text . toLowerCase ( ) . includes ( 'cancel' )
647+ if ( ! hasWarning ) {
648+ logSnapshot ( 'Ctrl+C once output' , text )
649+ }
617650 expect ( hasWarning ) . toBe ( true )
618651 } ,
619652 TIMEOUT_MS ,
@@ -677,6 +710,9 @@ describe('E2E: Keyboard Interactions', () => {
677710
678711 // Verify text is there
679712 let text = await session . cli . text ( )
713+ if ( ! text . includes ( 'hello' ) ) {
714+ logSnapshot ( 'Backspace pre-delete output' , text )
715+ }
680716 expect ( text ) . toContain ( 'hello' )
681717
682718 // Press backspace multiple times
0 commit comments