diff --git a/tests/test_user_simulation.py b/tests/test_user_simulation.py index c179ebda9..2ccc77996 100644 --- a/tests/test_user_simulation.py +++ b/tests/test_user_simulation.py @@ -420,43 +420,40 @@ async def test_trigger_autocomplete(user: User) -> None: user.find('fruit').type('a').trigger('keydown.tab') await user.should_see('apple') -async def test_should_see_on_invisible_element(user: User) -> None: - lable = ui.label('Hello') - lable.visible = False - await user.open('/') - with pytest.raises(AssertionError): - await user.should_see('Hello') - lable.visible = True - await user.should_see('Hello') - - -async def test_should_not_see_on_invisible_element(user: User) -> None: - lable = ui.label('Hello') - lable.visible = True +async def test_seeing_invisible_elements(user: User) -> None: + visible_label = ui.label('Visible') + hidden_label = ui.label('Hidden') + hidden_label.visible = False await user.open('/') with pytest.raises(AssertionError): - await user.should_not_see('Hello') - lable.visible = False - await user.should_not_see('Hello') + await user.should_see('Hidden') + with pytest.raises(AssertionError): + await user.should_not_see('Visible') + visible_label.visible = False + hidden_label.visible = True + await user.should_see('Hidden') + await user.should_not_see('Visible') -async def test_find_on_invisible_element(user: User) -> None: + +async def test_finding_invisible_elements(user: User) -> None: button = ui.button('click me', on_click=lambda: ui.label('clicked')) button.visible = False await user.open('/') with pytest.raises(AssertionError): user.find('click me').click() + button.visible = True user.find('click me').click() await user.should_see('clicked') -async def test_page_to_sting_output_with_hidden_elements(user: User) -> None: - ui.label("Hello") - hidden_label = ui.label("Hidden Label") - hidden_label.visible = False + +async def test_page_to_string_output_for_invisible_elements(user: User) -> None: + ui.label('Visible') + ui.label('Hidden').set_visibility(False) await user.open('/') output = str(user.current_layout) @@ -465,6 +462,6 @@ async def test_page_to_sting_output_with_hidden_elements(user: User) -> None: q-page-container q-page div - Label [text=Hello] - Label [text=Hidden Label, visible=False] -'''.strip() \ No newline at end of file + Label [text=Visible] + Label [text=Hidden, visible=False] +'''.strip()