Skip to content

Commit

Permalink
Add wdspec tests for browsingContext.navigate to image.
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D146418

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1763132
gecko-commit: 1344380bb5fdef39d083b209267e013df9b4797a
gecko-reviewers: webdriver-reviewers, whimboo
  • Loading branch information
lutien authored and moz-wptsync-bot committed May 20, 2022
1 parent e422616 commit 0de2c3a
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
56 changes: 56 additions & 0 deletions webdriver/tests/bidi/browsing_context/navigate/image.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import pytest

from . import navigate_and_assert

pytestmark = pytest.mark.asyncio

PAGE_EMPTY = "/webdriver/tests/bidi/browsing_context/navigate/support/empty.html"
PNG_BLACK_DOT = "/webdriver/tests/bidi/browsing_context/navigate/support/black_dot.png"
PNG_RED_DOT = "/webdriver/tests/bidi/browsing_context/navigate/support/red_dot.png"
SVG = "/webdriver/tests/bidi/browsing_context/navigate/support/other.svg"


@pytest.mark.parametrize(
"url_before, url_after",
[
(PAGE_EMPTY, SVG),
(SVG, PAGE_EMPTY),
(PAGE_EMPTY, PNG_BLACK_DOT),
(PNG_BLACK_DOT, PNG_RED_DOT),
(PNG_RED_DOT, SVG),
(PNG_BLACK_DOT, PAGE_EMPTY),
],
ids=[
"document to svg",
"svg to document",
"document to png",
"png to png",
"png to svg",
"png to document",
],
)
async def test_navigate_between_img_and_html(
bidi_session, new_tab, url, url_before, url_after
):
await navigate_and_assert(bidi_session, new_tab, url(url_before))
await navigate_and_assert(bidi_session, new_tab, url(url_after))


@pytest.mark.parametrize(
"img",
[SVG, PNG_BLACK_DOT],
ids=[
"to svg",
"to png",
],
)
async def test_navigate_in_iframe(bidi_session, new_tab, inline, url, img):
frame_start_url = inline("frame")
url_before = inline(f"<iframe src='{frame_start_url}'></iframe>")
contexts = await navigate_and_assert(bidi_session, new_tab, url_before)

assert len(contexts[0]["children"]) == 1
frame = contexts[0]["children"][0]
assert frame["url"] == frame_start_url

await navigate_and_assert(bidi_session, frame, url(img))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0de2c3a

Please sign in to comment.