diff --git a/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-004.html.ini b/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-004.html.ini deleted file mode 100644 index 4bfb0c2053a..00000000000 --- a/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-004.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[hit-test-floats-004.html] - [Miss float below something else] - expected: FAIL - diff --git a/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-005.html.ini b/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-005.html.ini deleted file mode 100644 index baa9f1a7541..00000000000 --- a/tests/wpt/metadata-layout-2020/css/CSS2/floats/hit-test-floats-005.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[hit-test-floats-005.html] - [Miss clipped float] - expected: FAIL - diff --git a/tests/wpt/metadata-layout-2020/css/css-backgrounds/border-radius-clipping-002.html.ini b/tests/wpt/metadata-layout-2020/css/css-backgrounds/border-radius-clipping-002.html.ini new file mode 100644 index 00000000000..2a83b8565ee --- /dev/null +++ b/tests/wpt/metadata-layout-2020/css/css-backgrounds/border-radius-clipping-002.html.ini @@ -0,0 +1,2 @@ +[border-radius-clipping-002.html] + expected: FAIL diff --git a/tests/wpt/metadata-layout-2020/css/cssom-view/CaretPosition-001.html.ini b/tests/wpt/metadata-layout-2020/css/cssom-view/CaretPosition-001.html.ini deleted file mode 100644 index 4c79907309b..00000000000 --- a/tests/wpt/metadata-layout-2020/css/cssom-view/CaretPosition-001.html.ini +++ /dev/null @@ -1,4 +0,0 @@ -[CaretPosition-001.html] - [Element at (400, 100)] - expected: FAIL - diff --git a/tests/wpt/metadata-layout-2020/css/cssom-view/elementFromPoint-001.html.ini b/tests/wpt/metadata-layout-2020/css/cssom-view/elementFromPoint-001.html.ini new file mode 100644 index 00000000000..e38782d8c85 --- /dev/null +++ b/tests/wpt/metadata-layout-2020/css/cssom-view/elementFromPoint-001.html.ini @@ -0,0 +1,4 @@ +[elementFromPoint-001.html] + [CSSOM View - 5 - extensions to the Document interface] + expected: FAIL + diff --git a/tests/wpt/metadata-layout-2020/css/cssom-view/matchMedia-display-none-iframe.html.ini b/tests/wpt/metadata-layout-2020/css/cssom-view/matchMedia-display-none-iframe.html.ini new file mode 100644 index 00000000000..e6e1f29e274 --- /dev/null +++ b/tests/wpt/metadata-layout-2020/css/cssom-view/matchMedia-display-none-iframe.html.ini @@ -0,0 +1,2 @@ +[matchMedia-display-none-iframe.html] + expected: ERROR diff --git a/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini b/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini index 6df87a1f1ec..9b495819fa1 100644 --- a/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini +++ b/tests/wpt/metadata-layout-2020/fetch/content-type/response.window.js.ini @@ -312,18 +312,21 @@ [Response: combined response Content-Type: text/html;" \\" text/plain ";charset=GBK] expected: NOTRUN - [ + + + diff --git a/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch.py b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch.py index f9b0e6fc1fc..723c48c3e85 100644 --- a/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch.py +++ b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch.py @@ -2,7 +2,7 @@ import pytest import webdriver.protocol as protocol -from webdriver import StaleElementReferenceException +from webdriver import NoSuchElementException, StaleElementReferenceException from webdriver.transport import Response from tests.support.asserts import assert_error, assert_same_element, assert_success @@ -43,12 +43,6 @@ def test_frame_id_invalid_types(session, value): assert_error(response, "invalid argument") -@pytest.mark.parametrize("value", [-1, 2**16]) -def test_frame_id_out_of_bounds(session, value): - response = switch_to_frame(session, value) - assert_error(response, "invalid argument") - - def test_no_browsing_context(session, closed_window): response = switch_to_frame(session, 1) assert_error(response, "no such window") @@ -59,91 +53,39 @@ def test_frame_id_null(session): frame1 = session.find.css("iframe", all=False) session.switch_frame(frame1) - frame1_element = session.find.css("div", all=False) + element1 = session.find.css("div", all=False) frame2 = session.find.css("iframe", all=False) session.switch_frame(frame2) - frame2_element = session.find.css("p", all=False) + element2 = session.find.css("p", all=False) # Switch to top-level browsing context response = switch_to_frame(session, None) assert_success(response) with pytest.raises(StaleElementReferenceException): - frame2_element.text + element2.text with pytest.raises(StaleElementReferenceException): - frame1_element.text + element1.text frame = session.find.css("iframe", all=False) assert_same_element(session, frame, frame1) -@pytest.mark.parametrize("index, value", [[0, "foo"], [1, "bar"]]) -def test_frame_id_number_index(session, index, value): - session.url = inline("{}{}".format(iframe("

foo"), iframe("

bar"))) - - response = switch_to_frame(session, index) - assert_success(response) - - frame_element = session.find.css("p", all=False) - assert frame_element.text == value - - -def test_frame_id_number_index_out_of_bounds(session): - session.url = inline(iframe("

foo")) - - response = switch_to_frame(session, 1) - assert_error(response, "no such frame") - - -@pytest.mark.parametrize("index, value", [[0, "foo"], [1, "bar"]]) -def test_frame_id_webelement_frame(session, index, value): - session.url = inline(frameset("

foo", "

bar")) - frames = session.find.css("frame") - assert len(frames) == 2 - - response = switch_to_frame(session, frames[index]) - assert_success(response) - - frame_element = session.find.css("p", all=False) - assert frame_element.text == value - - -@pytest.mark.parametrize("index, value", [[0, "foo"], [1, "bar"]]) -def test_frame_id_webelement_iframe(session, index, value): - session.url = inline("{}{}".format(iframe("

foo"), iframe("

bar"))) - frames = session.find.css("iframe") - assert len(frames) == 2 - - response = switch_to_frame(session, frames[index]) - assert_success(response) - - frame_element = session.find.css("p", all=False) - assert frame_element.text == value - - -def test_frame_id_webelement_no_element_reference(session): - session.url = inline(iframe("

foo")) - frame = session.find.css("iframe", all=False) - frame.id = "bar" - - response = switch_to_frame(session, frame) - assert_error(response, "no such element") - - -def test_frame_id_webelement_stale_reference(session): - session.url = inline(iframe("

foo")) +def test_frame_deleted(session, url): + session.url = url("/webdriver/tests/support/html/frames.html") frame = session.find.css("iframe", all=False) - session.switch_frame(frame) - response = switch_to_frame(session, frame) - assert_error(response, "stale element reference") + assert_success(response) + input = session.find.css("input", all=False) + input.click() -def test_frame_id_webelement_no_frame_element(session): - session.url = inline("

foo") - no_frame = session.find.css("p", all=False) + response = switch_to_frame(session, None) + assert_success(response) - response = switch_to_frame(session, no_frame) - assert_error(response, "no such frame") + with pytest.raises(NoSuchElementException): + session.find.css("iframe", all=False) + + session.find.css("#delete", all=False) diff --git a/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch_number.py b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch_number.py new file mode 100644 index 00000000000..77529544679 --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch_number.py @@ -0,0 +1,51 @@ +import pytest + +import webdriver.protocol as protocol + +from tests.support.asserts import assert_error, assert_success +from tests.support.inline import inline, iframe + + +def switch_to_frame(session, frame): + return session.transport.send( + "POST", "session/{session_id}/frame".format(**vars(session)), + {"id": frame}, + encoder=protocol.Encoder, decoder=protocol.Decoder, + session=session) + + +@pytest.mark.parametrize("value", [-1, 2**16]) +def test_frame_id_number_out_of_bounds(session, value): + response = switch_to_frame(session, value) + assert_error(response, "invalid argument") + + +@pytest.mark.parametrize("index", [1, 65535]) +def test_frame_id_number_index_out_of_bounds(session, index): + session.url = inline(iframe("

foo")) + + response = switch_to_frame(session, index) + assert_error(response, "no such frame") + + +@pytest.mark.parametrize("index, value", [[0, "foo"], [1, "bar"]]) +def test_frame_id_number_index(session, index, value): + session.url = inline("{}{}".format(iframe("

foo"), iframe("

bar"))) + + response = switch_to_frame(session, index) + assert_success(response) + + element = session.find.css("p", all=False) + assert element.text == value + + +def test_frame_id_number_index_nested(session): + session.url = inline(iframe("{}

foo".format(iframe("

bar")))) + + expected_text = ["foo", "bar"] + for i in range(0, len(expected_text)): + response = switch_to_frame(session, 0) + assert_success(response) + + element = session.find.css("p", all=False) + assert element.text == expected_text[i] diff --git a/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch_webelement.py b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch_webelement.py new file mode 100644 index 00000000000..89480b66b3a --- /dev/null +++ b/tests/wpt/web-platform-tests/webdriver/tests/switch_to_frame/switch_webelement.py @@ -0,0 +1,85 @@ +import pytest + +import webdriver.protocol as protocol + +from tests.support.asserts import assert_error, assert_success +from tests.support.inline import inline, iframe + + +def switch_to_frame(session, frame): + return session.transport.send( + "POST", "session/{session_id}/frame".format(**vars(session)), + {"id": frame}, + encoder=protocol.Encoder, decoder=protocol.Decoder, + session=session) + + +def frameset(*docs): + frames = list(map(lambda doc: "".format(inline(doc)), docs)) + return "\n{}".format(len(frames) * "*,", "\n".join(frames)) + + +@pytest.mark.parametrize("index, value", [[0, "foo"], [1, "bar"]]) +def test_frame_id_webelement_frame(session, index, value): + session.url = inline(frameset("

foo", "

bar")) + frames = session.find.css("frame") + assert len(frames) == 2 + + response = switch_to_frame(session, frames[index]) + assert_success(response) + + element = session.find.css("p", all=False) + assert element.text == value + + +@pytest.mark.parametrize("index, value", [[0, "foo"], [1, "bar"]]) +def test_frame_id_webelement_iframe(session, index, value): + session.url = inline("{}{}".format(iframe("

foo"), iframe("

bar"))) + frames = session.find.css("iframe") + assert len(frames) == 2 + + response = switch_to_frame(session, frames[index]) + assert_success(response) + + element = session.find.css("p", all=False) + assert element.text == value + + +def test_frame_id_webelement_nested(session): + session.url = inline(iframe("{}

foo".format(iframe("

bar")))) + + expected_text = ["foo", "bar"] + for i in range(0, len(expected_text)): + frame_element = session.find.css("iframe", all=False) + response = switch_to_frame(session, frame_element) + assert_success(response) + + element = session.find.css("p", all=False) + assert element.text == expected_text[i] + + +def test_frame_id_webelement_no_element_reference(session): + session.url = inline(iframe("

foo")) + frame = session.find.css("iframe", all=False) + frame.id = "bar" + + response = switch_to_frame(session, frame) + assert_error(response, "no such element") + + +def test_frame_id_webelement_stale_reference(session): + session.url = inline(iframe("

foo")) + frame = session.find.css("iframe", all=False) + + session.refresh() + + response = switch_to_frame(session, frame) + assert_error(response, "stale element reference") + + +def test_frame_id_webelement_no_frame_element(session): + session.url = inline("

foo") + no_frame = session.find.css("p", all=False) + + response = switch_to_frame(session, no_frame) + assert_error(response, "no such frame")