@@ -130,56 +130,42 @@ def test_calibrate_activity_flow(self):
130130 simulate_click (coords ['center_x' ], coords ['center_y' ])
131131 wait_for_render (30 )
132132
133- # Verify activity loaded
133+ # Verify activity loaded and shows instructions
134134 screen = lv .screen_active ()
135+ print_screen_labels (screen )
135136 self .assertTrue (verify_text_present (screen , "IMU Calibration" ),
136137 "CalibrateIMUActivity title not found" )
138+ self .assertTrue (verify_text_present (screen , "Place device on flat" ),
139+ "Instructions not shown" )
137140
138141 # Capture initial state
139142 screenshot_path = f"{ self .screenshot_dir } /calibrate_imu_01_initial.raw"
140143 capture_screenshot (screenshot_path )
141144
142- # Step 1: Click "Check Quality" button
143- check_btn = find_button_with_text (screen , "Check Quality" )
144- self .assertIsNotNone (check_btn , "Could not find 'Check Quality' button" )
145- coords = get_widget_coords (check_btn )
146- simulate_click (coords ['center_x' ], coords ['center_y' ])
147- wait_for_render (10 )
148-
149- # Wait for quality check to complete (mock is fast)
150- time .sleep (2.5 ) # Allow thread to complete
151- wait_for_render (15 )
152-
153- # Verify quality check completed
154- screen = lv .screen_active ()
155- print_screen_labels (screen )
156- self .assertTrue (verify_text_present (screen , "Current calibration:" ),
157- "Quality check results not shown" )
158-
159- # Capture after quality check
160- screenshot_path = f"{ self .screenshot_dir } /calibrate_imu_02_quality.raw"
161- capture_screenshot (screenshot_path )
162-
163- # Step 2: Click "Calibrate Now" button
145+ # Click "Calibrate Now" button to start calibration
164146 calibrate_btn = find_button_with_text (screen , "Calibrate Now" )
165147 self .assertIsNotNone (calibrate_btn , "Could not find 'Calibrate Now' button" )
166148 coords = get_widget_coords (calibrate_btn )
167149 simulate_click (coords ['center_x' ], coords ['center_y' ])
168150 wait_for_render (10 )
169151
170152 # Wait for calibration to complete (mock takes ~3 seconds)
171- time .sleep (4.0 )
172- wait_for_render (15 )
153+ time .sleep (3.5 )
154+ wait_for_render (20 )
173155
174156 # Verify calibration completed
175157 screen = lv .screen_active ()
176158 print_screen_labels (screen )
177- self .assertTrue (verify_text_present (screen , "Calibration successful!" ) or
178- verify_text_present (screen , "Calibration complete!" ),
159+ self .assertTrue (verify_text_present (screen , "Calibration successful!" ),
179160 "Calibration completion message not found" )
180161
162+ # Verify offsets are shown
163+ self .assertTrue (verify_text_present (screen , "Accel offsets" ) or
164+ verify_text_present (screen , "offsets" ),
165+ "Calibration offsets not shown" )
166+
181167 # Capture completion state
182- screenshot_path = f"{ self .screenshot_dir } /calibrate_imu_03_complete .raw"
168+ screenshot_path = f"{ self .screenshot_dir } /calibrate_imu_02_complete .raw"
183169 capture_screenshot (screenshot_path )
184170
185171 print ("=== CalibrateIMUActivity flow test complete ===" )
@@ -203,18 +189,25 @@ def test_navigation_from_check_to_calibrate(self):
203189 simulate_click (coords ['center_x' ], coords ['center_y' ])
204190 wait_for_render (30 ) # Wait for real-time updates
205191
206- # Click "Calibrate" button
192+ # Verify Check activity loaded
207193 screen = lv .screen_active ()
194+ self .assertTrue (verify_text_present (screen , "IMU Calibration Check" ),
195+ "Check activity did not load" )
196+
197+ # Click "Calibrate" button to navigate to Calibrate activity
208198 calibrate_btn = find_button_with_text (screen , "Calibrate" )
209199 self .assertIsNotNone (calibrate_btn , "Could not find 'Calibrate' button" )
210200
211- coords = get_widget_coords ( calibrate_btn )
212- simulate_click ( coords [ 'center_x' ], coords [ 'center_y' ] )
213- wait_for_render (15 )
201+ # Use send_event instead of simulate_click (more reliable for navigation )
202+ calibrate_btn . send_event ( lv . EVENT . CLICKED , None )
203+ wait_for_render (30 )
214204
215205 # Verify CalibrateIMUActivity loaded
216206 screen = lv .screen_active ()
217- self .assertTrue (verify_text_present (screen , "Check Quality" ),
207+ print_screen_labels (screen )
208+ self .assertTrue (verify_text_present (screen , "Calibrate Now" ),
218209 "Did not navigate to CalibrateIMUActivity" )
210+ self .assertTrue (verify_text_present (screen , "Place device on flat" ),
211+ "CalibrateIMUActivity instructions not shown" )
219212
220213 print ("=== Navigation test complete ===" )
0 commit comments