@@ -174,9 +174,12 @@ class TestToolSelection:
174174 """Verify tool switching works."""
175175
176176 def test_select_rectangle_tool (self , app : Page ):
177+ """Clicking Rectangle tool makes it the active tool."""
177178 select_tool (app , "Rectangle" )
178179 btn = app .locator ("button[title^='Rectangle']" )
179180 expect (btn ).to_be_visible ()
181+ btn_class = btn .get_attribute ("class" )
182+ assert "text-orange-600" in btn_class , f"Rectangle should be active, class: { btn_class } "
180183
181184 def test_select_tool_via_keyboard (self , app : Page ):
182185 """Pressing number keys selects corresponding tools."""
@@ -455,14 +458,17 @@ def test_context_menu_appears(self, app: Page):
455458 press_key (app , "Escape" )
456459
457460 def test_duplicate_from_menu (self , app : Page ):
458- """Duplicating via Ctrl+D creates a copy."""
461+ """Duplicating via Ctrl+D creates a copy with same type ."""
459462 clear_canvas (app )
460463 draw_shape (app , "Rectangle" , S_X1 , S_Y1 , S_X2 , S_Y2 )
461464 wait_for_elements (app , 1 )
462465 select_tool (app , "Select" )
463466 click_canvas (app , S_CX , S_CY )
464467 press_key (app , "Control+d" )
465468 wait_for_elements (app , 2 )
469+ elements = get_elements (app )
470+ assert elements [0 ]["type" ] == "rectangle" , "Original should be rectangle"
471+ assert elements [1 ]["type" ] == "rectangle" , "Duplicate should also be rectangle"
466472
467473
468474# -- Zoom tests ----------------------------------------------------------------
@@ -472,13 +478,17 @@ class TestZoom:
472478 """Verify zoom controls work."""
473479
474480 def test_zoom_in_button (self , app : Page ):
475- """Clicking + zoom button increases zoom."""
481+ """Clicking + zoom button increases zoom above 100% ."""
476482 clear_canvas (app )
483+ press_key (app , "Control+0" ) # Reset to 100% first
477484 zoom_buttons = app .locator ("button" , has_text = "+" )
478485 zoom_buttons .last .click ()
479486 app .wait_for_timeout (ACTION_DELAY )
480- zoom_text = app .locator ("text=100%" )
481- expect (zoom_text ).not_to_be_visible ()
487+ # Zoom should now be above 100% (e.g., 110%)
488+ zoom_btn = app .locator ("button" , has_text = "%" )
489+ zoom_label = zoom_btn .text_content ()
490+ zoom_val = int (zoom_label .replace ("%" , "" ))
491+ assert zoom_val > 100 , f"Zoom should be above 100% after zoom in, got { zoom_val } %"
482492
483493 def test_zoom_reset (self , app : Page ):
484494 """Ctrl+0 resets zoom to 100%."""
@@ -730,12 +740,12 @@ def test_ungroup_elements(self, app: Page):
730740 canvas .click (position = {"x" : 450 , "y" : 115 }, button = "right" , force = True )
731741 app .wait_for_timeout (ACTION_DELAY )
732742 ungroup_btn = app .locator ("button" , has_text = "Ungroup" )
733- if ungroup_btn . is_visible ():
734- ungroup_btn .click ()
735- app .wait_for_timeout (1000 )
736- elements = get_elements (app )
737- gid0 = elements [0 ].get ("groupId" )
738- assert gid0 is None or gid0 == "" , f"Element 0 groupId should be cleared, got { gid0 } "
743+ expect ( ungroup_btn ). to_be_visible ( timeout = 3_000 )
744+ ungroup_btn .click ()
745+ app .wait_for_timeout (1000 )
746+ elements = get_elements (app )
747+ gid0 = elements [0 ].get ("groupId" )
748+ assert gid0 is None or gid0 == "" , f"Element 0 groupId should be cleared, got { gid0 } "
739749
740750 def test_move_grouped_elements (self , app : Page ):
741751 """Moving one element in a group moves all group members."""
0 commit comments