diff --git a/tests/integration/menu_test.py b/tests/integration/menu_test.py index f122d888c..3d2224118 100644 --- a/tests/integration/menu_test.py +++ b/tests/integration/menu_test.py @@ -44,7 +44,7 @@ def on_click(): child_button = page_session.locator("text=child") page_session.wait_for_timeout(350) # Wait for any animations after click - expect(page_session.locator(".test-class-child")).to_be_visible + expect(page_session.locator(".test-class-child")).to_be_visible() child_button.click() page_session.wait_for_timeout(350) expect(text_el).to_contain_text("Works!") @@ -58,7 +58,7 @@ def test_menus_successive(test_type, solara_test, page_session: Page): @solara.component def Page(): - menu_activator = solara.Div(style="height: 200px; width: 400px;") + menu_activator = solara.Div(style="height: 200px; width: 400px;", classes=["test-class-activator"]) menu_child = solara.Div(classes=["test-class-menu"], style="height: 100px; width: 50px;") if test_type == "Menu": @@ -70,19 +70,21 @@ def Page(): solara.display(Page()) + activator_el = page_session.locator(".test-class-activator") expect(page_session.locator(".test-class-menu")).to_have_count(0) # Menu should not exist yet if test_type == "ContextMenu": - page_session.mouse.click(10, 10, button="right") + activator_el.click(button="right") else: - page_session.mouse.click(10, 10) + activator_el.click() page_session.wait_for_timeout(350) # Wait for any animations after click - expect(page_session.locator(".test-class-menu")).to_be_visible() # Menu should be visible now + expect(page_session.locator(".test-class-menu")).to_be_in_viewport() # Menu should be visible now + if test_type == "ContextMenu": - page_session.mouse.click(350, 10, button="right") + activator_el.click(button="right") page_session.wait_for_timeout(350) - expect(page_session.locator(".test-class-menu")).to_be_visible() + expect(page_session.locator(".test-class-menu")).to_be_in_viewport() else: - page_session.mouse.click(350, 10) + activator_el.click() page_session.wait_for_timeout(350) - expect(page_session.locator(".test-class-menu")).not_to_be_visible() # After second click, Menu and ClickMenu should disappear + expect(page_session.locator(".test-class-menu")).not_to_be_in_viewport() # After second click, Menu and ClickMenu should disappear