@@ -50,92 +50,27 @@ def test_ui_elements_exist(self):
5050 current_version_label = find_label_with_text (screen , "Installed OS version" )
5151 self .assertIsNotNone (current_version_label , "Current version label not found" )
5252
53- # Check for force update checkbox text (might be "Force" or "Update")
54- force_checkbox_found = verify_text_present (screen , "Force" ) or verify_text_present (screen , "force" )
55- self .assertTrue (force_checkbox_found , "Force checkbox text not found" )
56-
5753 # Check for update button text (case insensitive)
58- update_button_found = verify_text_present (screen , "Update" ) or verify_text_present (screen , "update" )
54+ # Button text will be "Update OS", "Reinstall\nsame version", or "Install\nolder version"
55+ update_button_found = verify_text_present (screen , "Update" ) or verify_text_present (screen , "update" ) or \
56+ verify_text_present (screen , "Reinstall" ) or verify_text_present (screen , "Install" )
5957 self .assertTrue (update_button_found , "Update button text not found" )
6058
61- def test_force_checkbox_initially_unchecked (self ):
62- """Test that force update checkbox starts unchecked."""
63- result = AppManager .start_app ("com.micropythonos.osupdate" )
64- self .assertTrue (result )
65- wait_for_render (15 )
66-
67- screen = lv .screen_active ()
68-
69- # Find checkbox - it's the first checkbox on the screen
70- checkbox = None
71- def find_checkbox (obj ):
72- nonlocal checkbox
73- if checkbox :
74- return
75- # Check if this object is a checkbox
76- try :
77- # In LVGL, checkboxes have specific flags/properties
78- if obj .get_child_count () >= 0 : # It's a valid object
79- # Try to get state - checkboxes respond to STATE.CHECKED
80- state = obj .get_state ()
81- # If it has checkbox-like text, it's probably our checkbox
82- for i in range (obj .get_child_count ()):
83- child = obj .get_child (i )
84- if hasattr (child , 'get_text' ):
85- text = child .get_text ()
86- if text and "Force Update" in text :
87- checkbox = obj .get_parent () if obj .get_parent () else obj
88- return
89- except :
90- pass
91-
92- # Recursively search children
93- for i in range (obj .get_child_count ()):
94- child = obj .get_child (i )
95- find_checkbox (child )
96-
97- find_checkbox (screen )
98-
99- if checkbox :
100- state = checkbox .get_state ()
101- is_checked = bool (state & lv .STATE .CHECKED )
102- self .assertFalse (is_checked , "Force Update checkbox should start unchecked" )
10359
104- def test_install_button_initially_disabled (self ):
105- """Test that install button starts in disabled state ."""
60+ def test_install_button_text_exists (self ):
61+ """Test that install button with update text exists on screen ."""
10662 result = AppManager .start_app ("com.micropythonos.osupdate" )
10763 self .assertTrue (result )
10864 wait_for_render (15 )
10965
11066 screen = lv .screen_active ()
11167
112- # Find the button
113- button = None
114- def find_button (obj ):
115- nonlocal button
116- if button :
117- return
118- # Check if this object contains "Update OS" text
119- for i in range (obj .get_child_count ()):
120- child = obj .get_child (i )
121- if hasattr (child , 'get_text' ):
122- text = child .get_text ()
123- if text and "Update OS" in text :
124- # Parent is likely the button
125- button = obj
126- return
127-
128- # Recursively search children
129- for i in range (obj .get_child_count ()):
130- child = obj .get_child (i )
131- find_button (child )
132-
133- find_button (screen )
134-
135- if button :
136- state = button .get_state ()
137- is_disabled = bool (state & lv .STATE .DISABLED )
138- self .assertTrue (is_disabled , "Install button should start disabled" )
68+ # Verify the button text is present - it will be "Update OS" initially
69+ # (or "Reinstall\nsame version" or "Install\nolder version" depending on version comparison)
70+ button_text_found = verify_text_present (screen , "Update OS" ) or \
71+ verify_text_present (screen , "Reinstall" ) or \
72+ verify_text_present (screen , "Install" )
73+ self .assertTrue (button_text_found , "Install button text should be present on screen" )
13974
14075 def test_current_version_displayed (self ):
14176 """Test that current OS version is displayed correctly."""
@@ -279,11 +214,11 @@ def test_capture_with_labels_visible(self):
279214
280215 # Verify key elements are visible before screenshot (case insensitive)
281216 has_version = verify_text_present (screen , "Installed" ) or verify_text_present (screen , "version" )
282- has_force = verify_text_present (screen , "Force" ) or verify_text_present (screen , "force" )
283- has_button = verify_text_present (screen , "Update" ) or verify_text_present (screen , "update" )
217+ # Button text can be "Update OS", "Reinstall\nsame version", or "Install\nolder version"
218+ has_button = verify_text_present (screen , "Update" ) or verify_text_present (screen , "update" ) or \
219+ verify_text_present (screen , "Reinstall" ) or verify_text_present (screen , "Install" )
284220
285221 self .assertTrue (has_version , "Version label should be visible" )
286- self .assertTrue (has_force , "Force checkbox should be visible" )
287222 self .assertTrue (has_button , "Update button should be visible" )
288223
289224
0 commit comments