Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wdspec] change test_..._closes_browsing_context #49759

Merged
merged 3 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions webdriver/tests/bidi/input/perform_actions/key.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("""
<input onkeydown="window.close()">close</input>
<script>document.querySelector("input").focus();</script>
""")
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"],
Expand All @@ -41,10 +41,13 @@ async def test_key_down_closes_browsing_context(
.key_up("w")
)

actions_command_future = bidi_session.input.perform_actions(
OrKoN marked this conversation as resolved.
Show resolved Hide resolved
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):
Expand Down
19 changes: 13 additions & 6 deletions webdriver/tests/bidi/input/perform_actions/pointer_mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("""<input onpointerdown="window.close()">close</input>""")
"""
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,
Expand All @@ -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):
Expand Down
19 changes: 13 additions & 6 deletions webdriver/tests/bidi/input/perform_actions/pointer_pen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("""<input onpointerdown="window.close()">close</input>""")
"""
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,
Expand All @@ -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"])
Expand Down
19 changes: 13 additions & 6 deletions webdriver/tests/bidi/input/perform_actions/pointer_touch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("""<input onpointerdown="window.close()">close</input>""")
"""
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,
Expand All @@ -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"])
Expand Down