Skip to content

Commit

Permalink
Bug 1671622 - [wdspec] Fix browser context checks for "Switch To Pare…
Browse files Browse the repository at this point in the history
…nt Frame" if current browsing context is already the top-level one. r=webdriver-reviewers,jgraham

Tests for proposed WebDriver changes:
w3c/webdriver#1544

Differential Revision: https://phabricator.services.mozilla.com/D93763
  • Loading branch information
whimboo committed Oct 20, 2020
1 parent 38752f6 commit 7246bb5
Showing 1 changed file with 21 additions and 2 deletions.
Expand Up @@ -21,7 +21,16 @@ def test_null_response_value(session):
assert value is None


def test_no_top_browsing_context(session, closed_window):
def test_no_top_browsing_context(session, url):
session.window_handle = session.new_window()

session.url = url("/webdriver/tests/support/html/frames.html")

subframe = session.find.css("#sub-frame", all=False)
session.switch_frame(subframe)

session.window.close()

response = switch_to_parent_frame(session)
assert_error(response, "no such window")

Expand Down Expand Up @@ -49,7 +58,12 @@ def test_no_browsing_context(session, closed_frame):
session.find.css("#delete", all=False)


def test_stale_element_from_iframe(session):
def test_no_browsing_context_when_already_top_level(session, closed_window):
response = switch_to_parent_frame(session)
assert_error(response, "no such window")


def test_switch_from_iframe(session):
session.url = inline(iframe("<p>foo"))
frame_element = session.find.css("iframe", all=False)
session.switch_frame(frame_element)
Expand All @@ -63,5 +77,10 @@ def test_stale_element_from_iframe(session):


def test_switch_from_top_level(session):
session.url = inline("<p>foo")
element = session.find.css("p", all=False)

result = switch_to_parent_frame(session)
assert_success(result)

assert element.text == "foo"

0 comments on commit 7246bb5

Please sign in to comment.