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

[WebDriver BiDi] browsingContext.traverseHistory only for top-level navigables #48260

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
27 changes: 0 additions & 27 deletions webdriver/tests/bidi/browsing_context/traverse_history/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,3 @@ async def test_top_level_contexts(

await wait_for_url(top_context["context"], pages[1])
await wait_for_url(new_tab["context"], pages[0])


@pytest.mark.parametrize("domain", ["", "alt"], ids=["same_origin", "cross_origin"])
async def test_iframe(bidi_session, current_url, wait_for_url, new_tab, inline, domain):
iframe_url_1 = inline("page 1")
page_url = inline(f"<iframe src='{iframe_url_1}'></iframe>", domain=domain)

await bidi_session.browsing_context.navigate(
context=new_tab["context"], url=page_url, wait="complete"
)
assert await current_url(new_tab["context"]) == page_url

contexts = await bidi_session.browsing_context.get_tree(root=new_tab["context"])
iframe_context = contexts[0]["children"][0]

iframe_url_2 = inline("page 2")
await bidi_session.browsing_context.navigate(
context=iframe_context["context"], url=iframe_url_2, wait="complete"
)
assert await current_url(iframe_context["context"]) == iframe_url_2

await bidi_session.browsing_context.traverse_history(
context=iframe_context["context"], delta=-1
)

await wait_for_url(new_tab["context"], page_url)
await wait_for_url(iframe_context["context"], iframe_url_1)
18 changes: 18 additions & 0 deletions webdriver/tests/bidi/browsing_context/traverse_history/invalid.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,21 @@ async def test_delta_invalid_value(bidi_session, current_url, new_tab, inline, v
await bidi_session.browsing_context.traverse_history(
context=new_tab["context"], delta=value
)


async def test_iframe(bidi_session, current_url, wait_for_url, new_tab, inline):
iframe_url_1 = inline("page 1")
page_url = inline(f"<iframe src='{iframe_url_1}'></iframe>")

await bidi_session.browsing_context.navigate(
context=new_tab["context"], url=page_url, wait="complete"
)

contexts = await bidi_session.browsing_context.get_tree(
root=new_tab["context"])
iframe_context = contexts[0]["children"][0]

with pytest.raises(error.InvalidArgumentException):
await bidi_session.browsing_context.traverse_history(
context=iframe_context["context"], delta=-1
)