mirror of
https://github.com/servo/servo.git
synced 2025-08-20 12:55:33 +01:00
Update web-platform-tests to revision 4f22c5b19bae217799ce92c9df6dfdf2800c6d81
This commit is contained in:
parent
086e06b28b
commit
ae931fea9a
70 changed files with 1114 additions and 416 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_png, assert_success
|
||||
from tests.support.asserts import assert_dialog_handled, assert_error, assert_png, assert_success
|
||||
from tests.support.inline import inline
|
||||
|
||||
|
||||
|
@ -17,8 +17,8 @@ def take_element_screenshot(session, element_id):
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_without_exception(session, create_dialog):
|
||||
def check_user_prompt_not_closed_without_exception(dialog_type):
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
session.url = inline("<input/>")
|
||||
element = session.find.css("input", all=False)
|
||||
|
||||
|
@ -27,44 +27,96 @@ def check_user_prompt_not_closed_without_exception(session, create_dialog):
|
|||
response = take_element_screenshot(session, element.id)
|
||||
value = assert_success(response)
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert_png(value)
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
session.url = inline("<input/>")
|
||||
element = session.find.css("input", all=False)
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = take_element_screenshot(session, element.id)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
session.url = inline("<input/>")
|
||||
element = session.find.css("input", all=False)
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = take_element_screenshot(session, element.id)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
return check_user_prompt_not_closed_without_exception
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_accept(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_accept_and_notify(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_dismiss(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_dismiss_and_notify(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_default(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import pytest
|
||||
|
||||
from tests.support.asserts import assert_png, assert_success
|
||||
from tests.support.asserts import assert_dialog_handled, assert_error, assert_png, assert_success
|
||||
from tests.support.inline import inline
|
||||
|
||||
|
||||
|
@ -12,8 +12,8 @@ def take_screenshot(session):
|
|||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_without_exception(session, create_dialog):
|
||||
def check_user_prompt_not_closed_without_exception(dialog_type):
|
||||
def check_user_prompt_closed_without_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_without_exception(dialog_type, retval):
|
||||
session.url = inline("<input/>")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
@ -21,44 +21,94 @@ def check_user_prompt_not_closed_without_exception(session, create_dialog):
|
|||
response = take_screenshot(session)
|
||||
value = assert_success(response)
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
assert_png(value)
|
||||
|
||||
return check_user_prompt_closed_without_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_closed_with_exception(session, create_dialog):
|
||||
def check_user_prompt_closed_with_exception(dialog_type, retval):
|
||||
session.url = inline("<input/>")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = take_screenshot(session)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert_dialog_handled(session, expected_text=dialog_type, expected_retval=retval)
|
||||
|
||||
return check_user_prompt_closed_with_exception
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def check_user_prompt_not_closed_but_exception(session, create_dialog):
|
||||
def check_user_prompt_not_closed_but_exception(dialog_type):
|
||||
session.url = inline("<input/>")
|
||||
|
||||
create_dialog(dialog_type, text=dialog_type)
|
||||
|
||||
response = take_screenshot(session)
|
||||
assert_error(response, "unexpected alert open")
|
||||
|
||||
assert session.alert.text == dialog_type
|
||||
session.alert.dismiss()
|
||||
|
||||
return check_user_prompt_not_closed_without_exception
|
||||
return check_user_prompt_not_closed_but_exception
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_accept(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_accept_and_notify(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", True),
|
||||
("prompt", ""),
|
||||
])
|
||||
def test_accept_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_dismiss(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss(check_user_prompt_closed_without_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_without_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_dismiss_and_notify(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_dismiss_and_notify(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
||||
|
||||
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_ignore(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
def test_ignore(check_user_prompt_not_closed_but_exception, dialog_type):
|
||||
check_user_prompt_not_closed_but_exception(dialog_type)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
|
||||
def test_default(check_user_prompt_not_closed_without_exception, dialog_type):
|
||||
check_user_prompt_not_closed_without_exception(dialog_type)
|
||||
@pytest.mark.parametrize("dialog_type, retval", [
|
||||
("alert", None),
|
||||
("confirm", False),
|
||||
("prompt", None),
|
||||
])
|
||||
def test_default(check_user_prompt_closed_with_exception, dialog_type, retval):
|
||||
check_user_prompt_closed_with_exception(dialog_type, retval)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue