Skip to content

Commit

Permalink
[wdspec] Fix navigation tests for the perform action commands.
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D230965

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1922077
gecko-commit: 52ba62ee5d9ae130eeb69f00f99c7928e25bda88
gecko-reviewers: webdriver-reviewers, jdescottes
  • Loading branch information
whimboo authored and moz-wptsync-bot committed Dec 11, 2024
1 parent 9fe5f14 commit 0a6b1cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
15 changes: 7 additions & 8 deletions webdriver/tests/bidi/input/perform_actions/navigation.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import pytest
import webdriver.bidi.error as error
from webdriver.bidi.modules.input import Actions, get_element_origin

from . import get_element_rect
from .. import get_events

pytestmark = pytest.mark.asyncio
Expand All @@ -28,7 +26,7 @@
"""


async def test_key(bidi_session, inline, top_context, get_element):
async def test_key(bidi_session, inline, top_context):
await bidi_session.browsing_context.navigate(
context=top_context["context"],
url=inline(f"""
Expand All @@ -40,7 +38,6 @@ async def test_key(bidi_session, inline, top_context, get_element):
"""),
wait="complete"
)
input = await get_element("input")

actions = Actions()
(
Expand All @@ -56,8 +53,9 @@ async def test_key(bidi_session, inline, top_context, get_element):
actions=actions, context=top_context["context"]
)

with pytest.raises(error.NoSuchNodeException):
await get_element_rect(bidi_session, context=top_context, element=input)
# Check that the page was navigated
info = await bidi_session.browsing_context.get_tree(max_depth=1)
assert info[0]["url"] == inline(PAGE_CONTENT)

events = await get_events(bidi_session, top_context["context"])
assert len(events) == 1
Expand Down Expand Up @@ -87,8 +85,9 @@ async def test_pointer(bidi_session, inline, top_context, get_element):
actions=actions, context=top_context["context"]
)

with pytest.raises(error.NoSuchNodeException):
await get_element_rect(bidi_session, context=top_context, element=input)
# Check that the page was navigated
info = await bidi_session.browsing_context.get_tree(max_depth=1)
assert info[0]["url"] == inline(PAGE_CONTENT)

events = await get_events(bidi_session, top_context["context"])
assert len(events) == 1
Expand Down
10 changes: 2 additions & 8 deletions webdriver/tests/classic/perform_actions/navigation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import pytest
import webdriver.error as error

from tests.classic.perform_actions.support.refine import get_events

PAGE_CONTENT = """
Expand Down Expand Up @@ -32,7 +29,6 @@ def test_key(session, inline, key_chain):
input.focus();
</script>
""")
input = session.find.css("input", all=False)

key_chain \
.key_down("1") \
Expand All @@ -42,8 +38,7 @@ def test_key(session, inline, key_chain):
.key_up("2") \
.perform()

with pytest.raises(error.StaleElementReferenceException):
input.rect
assert session.url == inline(PAGE_CONTENT)

events = get_events(session)
assert len(events) == 1
Expand All @@ -63,8 +58,7 @@ def test_pointer(session, inline, mouse_chain):
.pointer_move(x=200, y=200) \
.perform()

with pytest.raises(error.StaleElementReferenceException):
input.rect
assert session.url == inline(PAGE_CONTENT)

events = get_events(session)
assert len(events) == 1
Expand Down

0 comments on commit 0a6b1cf

Please sign in to comment.