|
30 | 30 | class TestIMUCalibration(unittest.TestCase): |
31 | 31 | """Test suite for IMU calibration activities.""" |
32 | 32 |
|
33 | | - def _open_settings_item(self, title, timeout=2.0): |
34 | | - start = time.time() |
35 | | - label = None |
36 | | - while time.time() - start < timeout: |
37 | | - screen = lv.screen_active() |
38 | | - label = find_label_with_text(screen, title) |
39 | | - if label: |
40 | | - break |
41 | | - wait_for_render(iterations=5) |
42 | | - self.assertIsNotNone(label, f"Could not find {title} menu item") |
43 | | - container = None |
44 | | - try: |
45 | | - container = label.get_parent() |
46 | | - except Exception: |
47 | | - container = None |
48 | | - if container: |
49 | | - try: |
50 | | - container.scroll_to_view(True) |
51 | | - except Exception: |
52 | | - pass |
53 | | - else: |
54 | | - try: |
55 | | - label.scroll_to_view_recursive(True) |
56 | | - except Exception: |
57 | | - pass |
58 | | - wait_for_render(iterations=20) |
59 | | - target = container if container else label |
60 | | - coords = get_widget_coords(target) or get_widget_coords(label) |
61 | | - if coords: |
62 | | - simulate_click(coords["center_x"], coords["center_y"]) |
63 | | - wait_for_render(iterations=30) |
64 | | - |
65 | 33 | def _start_activity_from_settings_assets(self, filename, classname): |
66 | 34 | app_fullname = "com.micropythonos.settings" |
67 | 35 | entrypoint = f"builtin/apps/{app_fullname}/assets/{filename}" |
68 | 36 | cwd = f"builtin/apps/{app_fullname}/assets/" |
69 | 37 | result = AppManager.execute_script(entrypoint, True, classname, cwd, app_fullname=app_fullname) |
70 | 38 | self.assertTrue(result, f"Failed to start {classname} from {entrypoint}") |
71 | | - wait_for_render(iterations=20) |
| 39 | + wait_for_render(iterations=60) |
72 | 40 |
|
73 | 41 | def tearDown(self): |
74 | 42 | """Clean up after test.""" |
75 | 43 | # Navigate back to launcher |
76 | 44 | try: |
77 | 45 | for _ in range(3): # May need multiple backs |
78 | 46 | mpos.ui.back_screen() |
79 | | - wait_for_render(5) |
| 47 | + wait_for_render(10) |
80 | 48 | except: |
81 | 49 | pass |
82 | 50 |
|
@@ -115,11 +83,11 @@ def test_calibrate_activity_flow(self): |
115 | 83 | calibrate_btn = find_button_with_text(screen, "Calibrate Now") |
116 | 84 | self.assertIsNotNone(calibrate_btn, "Could not find 'Calibrate Now' button") |
117 | 85 | calibrate_btn.send_event(lv.EVENT.CLICKED, None) |
118 | | - wait_for_render(10) |
| 86 | + wait_for_render(25) |
119 | 87 |
|
120 | 88 | # Wait for calibration to complete (mock takes ~3 seconds) |
121 | 89 | time.sleep(4) |
122 | | - wait_for_render(40) |
| 90 | + wait_for_render(50) |
123 | 91 |
|
124 | 92 | # Verify calibration completed |
125 | 93 | screen = lv.screen_active() |
@@ -153,7 +121,7 @@ def test_navigation_from_check_to_calibrate(self): |
153 | 121 | added_path = True |
154 | 122 | try: |
155 | 123 | calibrate_btn.send_event(lv.EVENT.CLICKED, None) |
156 | | - wait_for_render(30) |
| 124 | + wait_for_render(60) |
157 | 125 | finally: |
158 | 126 | if added_path: |
159 | 127 | try: |
|
0 commit comments