@@ -15,11 +15,13 @@ mod choice_execution_debug_tests {
1515 tester. load_config ( "layouts/multi_stream_tabs_demo.yaml" )
1616 . expect ( "Failed to load multi_stream_tabs_demo layout" ) ;
1717
18- // Capture initial frame
18+ // Capture initial frame and extract initial tab count
1919 let initial_frame = tester. wait_for_frame ( )
2020 . expect ( "Failed to capture initial frame" ) ;
21+ let initial_tabs = count_tabs_in_frame ( & initial_frame, "multi_stream_box" ) ;
22+ drop ( initial_frame) ; // Release the frame reference
2123
22- println ! ( "Initial frame captured - multi_stream_box should be visible" ) ;
24+ println ! ( "Initial frame captured - multi_stream_box should be visible with {} tabs" , initial_tabs ) ;
2325
2426 // Wait for layout to stabilize
2527 std:: thread:: sleep ( Duration :: from_millis ( 1000 ) ) ;
@@ -58,6 +60,8 @@ mod choice_execution_debug_tests {
5860 std:: thread:: sleep ( Duration :: from_millis ( 2000 ) ) ;
5961 let after_external_frame = tester. wait_for_frame ( )
6062 . expect ( "Failed to capture frame after external choice click" ) ;
63+ let after_external_tabs = count_tabs_in_frame ( & after_external_frame, "multi_stream_box" ) ;
64+ drop ( after_external_frame) ;
6165
6266 println ! ( "External stream choice executed - checking for new tab in multi_stream_box" ) ;
6367
@@ -76,7 +80,7 @@ mod choice_execution_debug_tests {
7680 tester. send_mouse_event ( MouseEventKind :: Down ( MouseButton :: Left ) , multi_stream_click. column , multi_stream_click. row )
7781 . expect ( "Failed to click multi_stream_box" ) ;
7882
79- let after_multi_focus_frame = tester. wait_for_frame ( )
83+ let _after_multi_focus_frame = tester. wait_for_frame ( )
8084 . expect ( "Failed to capture frame after focusing multi_stream_box" ) ;
8185
8286 // Click on "Deploy App" choice (first choice in multi_stream_box)
@@ -95,6 +99,9 @@ mod choice_execution_debug_tests {
9599 std:: thread:: sleep ( Duration :: from_millis ( 3000 ) ) ;
96100 let after_deploy_frame = tester. wait_for_frame ( )
97101 . expect ( "Failed to capture frame after deploy choice click" ) ;
102+ let after_deploy_tabs = count_tabs_in_frame ( & after_deploy_frame, "multi_stream_box" ) ;
103+ let has_deployment_output = frame_contains_text ( & after_deploy_frame, "Starting deployment" ) ;
104+ drop ( after_deploy_frame) ;
98105
99106 println ! ( "Deploy App choice clicked - checking for execution" ) ;
100107
@@ -114,6 +121,9 @@ mod choice_execution_debug_tests {
114121 std:: thread:: sleep ( Duration :: from_millis ( 6000 ) ) ; // Longer wait for the loop script
115122 let after_monitor_frame = tester. wait_for_frame ( )
116123 . expect ( "Failed to capture frame after monitor choice click" ) ;
124+ let after_monitor_tabs = count_tabs_in_frame ( & after_monitor_frame, "multi_stream_box" ) ;
125+ let has_monitor_output = frame_contains_text ( & after_monitor_frame, "Monitoring application logs" ) ;
126+ drop ( after_monitor_frame) ;
117127
118128 println ! ( "Monitor Logs choice clicked - checking for execution" ) ;
119129
@@ -133,18 +143,17 @@ mod choice_execution_debug_tests {
133143 std:: thread:: sleep ( Duration :: from_millis ( 3000 ) ) ;
134144 let after_pty_frame = tester. wait_for_frame ( )
135145 . expect ( "Failed to capture frame after PTY choice click" ) ;
146+ let after_pty_tabs = count_tabs_in_frame ( & after_pty_frame, "multi_stream_box" ) ;
147+ let has_pty_output = frame_contains_text ( & after_pty_frame, "zenith" ) || frame_contains_text ( & after_pty_frame, "PTY" ) ;
148+ drop ( after_pty_frame) ;
136149
137150 println ! ( "Start PTY Process choice clicked - checking for execution" ) ;
138151
139152 // Analyze the frames to understand the differences
140153 println ! ( "\n === FRAME ANALYSIS ===" ) ;
141154
142155 // Check if any new tabs appeared in multi_stream_box
143- let initial_tabs = count_tabs_in_frame ( & initial_frame, "multi_stream_box" ) ;
144- let after_external_tabs = count_tabs_in_frame ( & after_external_frame, "multi_stream_box" ) ;
145- let after_deploy_tabs = count_tabs_in_frame ( & after_deploy_frame, "multi_stream_box" ) ;
146- let after_monitor_tabs = count_tabs_in_frame ( & after_monitor_frame, "multi_stream_box" ) ;
147- let after_pty_tabs = count_tabs_in_frame ( & after_pty_frame, "multi_stream_box" ) ;
156+ // initial_tabs, after_external_tabs, after_deploy_tabs, after_monitor_tabs, after_pty_tabs already calculated
148157
149158 println ! ( "Tab counts in multi_stream_box:" ) ;
150159 println ! ( " Initial: {}" , initial_tabs) ;
@@ -153,10 +162,7 @@ mod choice_execution_debug_tests {
153162 println ! ( " After monitor choice: {}" , after_monitor_tabs) ;
154163 println ! ( " After PTY choice: {}" , after_pty_tabs) ;
155164
156- // Check for content changes indicating script execution
157- let has_deployment_output = frame_contains_text ( & after_deploy_frame, "Starting deployment" ) ;
158- let has_monitor_output = frame_contains_text ( & after_monitor_frame, "Monitoring application logs" ) ;
159- let has_pty_output = frame_contains_text ( & after_pty_frame, "zenith" ) || frame_contains_text ( & after_pty_frame, "PTY" ) ;
165+ // has_deployment_output, has_monitor_output, has_pty_output already calculated above
160166
161167 println ! ( "\n Content analysis:" ) ;
162168 println ! ( " Has deployment output: {}" , has_deployment_output) ;
@@ -221,9 +227,9 @@ mod choice_execution_debug_tests {
221227
222228 /// Convert frame to string for text analysis
223229 fn frame_to_string ( frame : & crate :: tests:: visual_testing:: terminal_capture:: TerminalFrame ) -> String {
224- frame. cells . iter ( )
230+ frame. buffer . iter ( )
225231 . flat_map ( |row| row. iter ( ) )
226- . map ( |cell| cell. character . unwrap_or ( ' ' ) )
232+ . map ( |cell| cell. ch )
227233 . collect :: < String > ( )
228234 }
229235}
0 commit comments