|
24 | 24 | print_screen_labels, |
25 | 25 | simulate_click, |
26 | 26 | get_widget_coords, |
27 | | - find_button_with_text |
| 27 | + find_button_with_text, |
| 28 | + click_label, |
| 29 | + click_button, |
| 30 | + find_text_on_screen |
28 | 31 | ) |
29 | 32 |
|
30 | 33 |
|
@@ -68,16 +71,9 @@ def test_check_calibration_activity_loads(self): |
68 | 71 | simulate_click(10, 10) |
69 | 72 | wait_for_render(10) |
70 | 73 |
|
71 | | - # Find and click "Check IMU Calibration" setting |
72 | | - screen = lv.screen_active() |
73 | | - check_cal_label = find_label_with_text(screen, "Check IMU Calibration") |
74 | | - self.assertIsNotNone(check_cal_label, "Could not find 'Check IMU Calibration' setting") |
75 | | - |
76 | | - # Click on the setting container |
77 | | - coords = get_widget_coords(check_cal_label.get_parent()) |
78 | | - self.assertIsNotNone(coords, "Could not get coordinates of setting") |
79 | | - simulate_click(coords['center_x'], coords['center_y']) |
80 | | - wait_for_render(30) |
| 74 | + print("Clicking 'Check IMU Calibration' menu item...") |
| 75 | + self.assertTrue(click_label("Check IMU Calibration"), "Could not find Check IMU Calibration menu item") |
| 76 | + wait_for_render(iterations=20) |
81 | 77 |
|
82 | 78 | # Verify key elements are present |
83 | 79 | screen = lv.screen_active() |
@@ -110,15 +106,9 @@ def test_calibrate_activity_flow(self): |
110 | 106 | simulate_click(10, 10) |
111 | 107 | wait_for_render(10) |
112 | 108 |
|
113 | | - # Find and click "Calibrate IMU" setting |
114 | | - screen = lv.screen_active() |
115 | | - calibrate_label = find_label_with_text(screen, "Calibrate IMU") |
116 | | - self.assertIsNotNone(calibrate_label, "Could not find 'Calibrate IMU' setting") |
117 | | - |
118 | | - coords = get_widget_coords(calibrate_label.get_parent()) |
119 | | - self.assertIsNotNone(coords) |
120 | | - simulate_click(coords['center_x'], coords['center_y']) |
121 | | - wait_for_render(30) |
| 109 | + print("Clicking 'Calibrate IMU' menu item...") |
| 110 | + self.assertTrue(click_label("Calibrate IMU"), "Could not find Calibrate IMU item") |
| 111 | + wait_for_render(iterations=20) |
122 | 112 |
|
123 | 113 | # Verify activity loaded and shows instructions |
124 | 114 | screen = lv.screen_active() |
@@ -173,17 +163,12 @@ def test_navigation_from_check_to_calibrate(self): |
173 | 163 | simulate_click(10, 10) |
174 | 164 | wait_for_render(10) |
175 | 165 |
|
176 | | - screen = lv.screen_active() |
177 | | - check_cal_label = find_label_with_text(screen, "Check IMU Calibration") |
178 | | - coords = get_widget_coords(check_cal_label.get_parent()) |
179 | | - simulate_click(coords['center_x'], coords['center_y']) |
180 | | - wait_for_render(30) # Wait for real-time updates |
181 | | - |
182 | | - # Verify Check activity loaded |
183 | | - screen = lv.screen_active() |
184 | | - self.assertTrue(verify_text_present(screen, "on flat surface"), "Check activity did not load") |
| 166 | + print("Clicking 'Check IMU Calibration' menu item...") |
| 167 | + self.assertTrue(click_label("Check IMU Calibration"), "Could not find Check IMU Calibration menu item") |
| 168 | + wait_for_render(iterations=20) |
185 | 169 |
|
186 | 170 | # Click "Calibrate" button to navigate to Calibrate activity |
| 171 | + screen = lv.screen_active() |
187 | 172 | calibrate_btn = find_button_with_text(screen, "Calibrate") |
188 | 173 | self.assertIsNotNone(calibrate_btn, "Could not find 'Calibrate' button") |
189 | 174 |
|
|
0 commit comments