diff --git a/webdriver/tests/bidi/input/perform_actions/key.py b/webdriver/tests/bidi/input/perform_actions/key.py index 7deb5f1fb9900b..730e42eed273f4 100644 --- a/webdriver/tests/bidi/input/perform_actions/key.py +++ b/webdriver/tests/bidi/input/perform_actions/key.py @@ -19,13 +19,13 @@ async def test_invalid_browsing_context(bidi_session): await bidi_session.input.perform_actions(actions=actions, context="foo") -async def test_key_down_closes_browsing_context( - bidi_session, configuration, new_tab, inline -): - url = inline(""" - close - - """) +async def test_browsing_context_closed_before_key_up(bidi_session, + configuration, new_tab, get_test_page): + """ + If the browsing context is closed during the action chain, the action + command should fail with `NoSuchFrame` error code. + """ + url = get_test_page() await bidi_session.browsing_context.navigate( context=new_tab["context"], @@ -41,10 +41,13 @@ async def test_key_down_closes_browsing_context( .key_up("w") ) + actions_command_future = bidi_session.input.perform_actions( + actions=actions, context=new_tab["context"]) + + await bidi_session.browsing_context.close(context=new_tab["context"]) + with pytest.raises(NoSuchFrameException): - await bidi_session.input.perform_actions( - actions=actions, context=new_tab["context"] - ) + await actions_command_future async def test_key_backspace(bidi_session, top_context, setup_key_test): diff --git a/webdriver/tests/bidi/input/perform_actions/pointer_mouse.py b/webdriver/tests/bidi/input/perform_actions/pointer_mouse.py index ab861a90937fad..7e3439fd1dd274 100644 --- a/webdriver/tests/bidi/input/perform_actions/pointer_mouse.py +++ b/webdriver/tests/bidi/input/perform_actions/pointer_mouse.py @@ -17,10 +17,14 @@ pytestmark = pytest.mark.asyncio -async def test_pointer_down_closes_browsing_context( - bidi_session, configuration, get_element, new_tab, inline +async def test_browsing_context_closed_before_pointer_up( + bidi_session, configuration, get_element, new_tab, get_test_page ): - url = inline("""close""") + """ + If the browsing context is closed during the action chain, the action + command should fail with `NoSuchFrame` error code. + """ + url = get_test_page() await bidi_session.browsing_context.navigate( context=new_tab["context"], url=url, @@ -39,10 +43,13 @@ async def test_pointer_down_closes_browsing_context( .pointer_up(button=0) ) + actions_command_future = bidi_session.input.perform_actions( + actions=actions, context=new_tab["context"]) + + await bidi_session.browsing_context.close(context=new_tab["context"]) + with pytest.raises(NoSuchFrameException): - await bidi_session.input.perform_actions( - actions=actions, context=new_tab["context"] - ) + await actions_command_future async def test_click_at_coordinates(bidi_session, top_context, load_static_test_page): diff --git a/webdriver/tests/bidi/input/perform_actions/pointer_pen.py b/webdriver/tests/bidi/input/perform_actions/pointer_pen.py index cfc6beaeb4b579..74769696ed7e30 100644 --- a/webdriver/tests/bidi/input/perform_actions/pointer_pen.py +++ b/webdriver/tests/bidi/input/perform_actions/pointer_pen.py @@ -14,10 +14,14 @@ pytestmark = pytest.mark.asyncio -async def test_pointer_down_closes_browsing_context( - bidi_session, configuration, get_element, new_tab, inline +async def test_browsing_context_closed_before_pointer_up( + bidi_session, configuration, get_element, new_tab, get_test_page ): - url = inline("""close""") + """ + If the browsing context is closed during the action chain, the action + command should fail with `NoSuchFrame` error code. + """ + url = get_test_page() await bidi_session.browsing_context.navigate( context=new_tab["context"], url=url, @@ -36,10 +40,13 @@ async def test_pointer_down_closes_browsing_context( .pointer_up(button=0) ) + actions_command_future = bidi_session.input.perform_actions( + actions=actions, context=new_tab["context"]) + + await bidi_session.browsing_context.close(context=new_tab["context"]) + with pytest.raises(NoSuchFrameException): - await bidi_session.input.perform_actions( - actions=actions, context=new_tab["context"] - ) + await actions_command_future @pytest.mark.parametrize("origin", ["element", "pointer", "viewport"]) diff --git a/webdriver/tests/bidi/input/perform_actions/pointer_touch.py b/webdriver/tests/bidi/input/perform_actions/pointer_touch.py index 4477162b322cbf..172922c0a43f9b 100644 --- a/webdriver/tests/bidi/input/perform_actions/pointer_touch.py +++ b/webdriver/tests/bidi/input/perform_actions/pointer_touch.py @@ -14,10 +14,14 @@ pytestmark = pytest.mark.asyncio -async def test_pointer_down_closes_browsing_context( - bidi_session, configuration, get_element, new_tab, inline +async def test_browsing_context_closed_before_pointer_up( + bidi_session, configuration, get_element, new_tab, get_test_page ): - url = inline("""close""") + """ + If the browsing context is closed during the action chain, the action + command should fail with `NoSuchFrame` error code. + """ + url = get_test_page() await bidi_session.browsing_context.navigate( context=new_tab["context"], url=url, @@ -36,10 +40,13 @@ async def test_pointer_down_closes_browsing_context( .pointer_up(button=0) ) + actions_command_future = bidi_session.input.perform_actions( + actions=actions, context=new_tab["context"]) + + await bidi_session.browsing_context.close(context=new_tab["context"]) + with pytest.raises(NoSuchFrameException): - await bidi_session.input.perform_actions( - actions=actions, context=new_tab["context"] - ) + await actions_command_future @pytest.mark.parametrize("origin", ["element", "pointer", "viewport"])