Bug 1470098 - [wdspec] Add tests for confirm, and prompt for the Execute (Async) Script commands.
MozReview-Commit-ID: 5VNykQGobtx
--- a/testing/web-platform/meta/webdriver/tests/execute_async_script/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/execute_async_script/user_prompts.py.ini
@@ -1,16 +1,41 @@
[user_prompts.py]
disabled:
if webrender: bug 1425588
- [test_handle_prompt_accept[capabilities0\]]
+ [test_handle_prompt_accept[capabilities0-alert\]]
+ expected: FAIL
+
+ [test_handle_prompt_accept[capabilities0-confirm\]]
+ expected: FAIL
+
+ [test_handle_prompt_accept[capabilities0-prompt\]]
+ expected: FAIL
+
+ [test_handle_prompt_dismiss[capabilities0-alert\]]
expected: FAIL
- [test_handle_prompt_dismiss[capabilities0\]]
+ [test_handle_prompt_dismiss[capabilities0-confirm\]]
+ expected: FAIL
+
+ [test_handle_prompt_dismiss[capabilities0-prompt\]]
expected: FAIL
- [test_handle_prompt_ignore[capabilities0\]]
+ [test_handle_prompt_ignore[capabilities0-alert\]]
expected: FAIL
- [test_handle_prompt_twice[capabilities0\]]
+ [test_handle_prompt_ignore[capabilities0-confirm\]]
+ expected: FAIL
+
+ [test_handle_prompt_ignore[capabilities0-prompt\]]
+ expected: FAIL
+
+ [test_handle_prompt_twice[capabilities0-alert\]]
expected: FAIL
disabled: Bug 1459118
+ [test_handle_prompt_twice[capabilities0-confirm\]]
+ expected: FAIL
+ disabled: Bug 1459118
+
+ [test_handle_prompt_twice[capabilities0-prompt\]]
+ expected: FAIL
+ disabled: Bug 1459118
--- a/testing/web-platform/meta/webdriver/tests/execute_script/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/execute_script/user_prompts.py.ini
@@ -1,16 +1,41 @@
[user_prompts.py]
disabled:
if webrender: bug 1425588
- [test_handle_prompt_accept[capabilities0\]]
+ [test_handle_prompt_accept[capabilities0-alert\]]
+ expected: FAIL
+
+ [test_handle_prompt_accept[capabilities0-confirm\]]
+ expected: FAIL
+
+ [test_handle_prompt_accept[capabilities0-prompt\]]
+ expected: FAIL
+
+ [test_handle_prompt_dismiss[capabilities0-alert\]]
expected: FAIL
- [test_handle_prompt_dismiss[capabilities0\]]
+ [test_handle_prompt_dismiss[capabilities0-confirm\]]
+ expected: FAIL
+
+ [test_handle_prompt_dismiss[capabilities0-prompt\]]
expected: FAIL
- [test_handle_prompt_ignore[capabilities0\]]
+ [test_handle_prompt_ignore[capabilities0-alert\]]
expected: FAIL
- [test_handle_prompt_twice[capabilities0\]]
+ [test_handle_prompt_ignore[capabilities0-confirm\]]
+ expected: FAIL
+
+ [test_handle_prompt_ignore[capabilities0-prompt\]]
+ expected: FAIL
+
+ [test_handle_prompt_twice[capabilities0-alert\]]
expected: FAIL
disabled: Bug 1459118
+ [test_handle_prompt_twice[capabilities0-confirm\]]
+ expected: FAIL
+ disabled: Bug 1459118
+
+ [test_handle_prompt_twice[capabilities0-prompt\]]
+ expected: FAIL
+ disabled: Bug 1459118
--- a/testing/web-platform/tests/webdriver/tests/execute_async_script/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/execute_async_script/user_prompts.py
@@ -13,80 +13,88 @@ def execute_async_script(session, script
body = {"script": script, "args": args}
return session.transport.send(
"POST", "/session/{session_id}/execute/async".format(**vars(session)),
body)
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session):
- response = execute_async_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, dialog_type):
+ response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
session.title
with pytest.raises(error.NoSuchAlertException):
session.alert.accept()
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
-def test_handle_prompt_accept_and_notify(session):
- response = execute_async_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept_and_notify(session, dialog_type):
+ response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
session.title
with pytest.raises(error.NoSuchAlertException):
session.alert.accept()
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
-def test_handle_prompt_dismiss(session):
- response = execute_async_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_dismiss(session, dialog_type):
+ response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
session.title
with pytest.raises(error.NoSuchAlertException):
session.alert.dismiss()
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
-def test_handle_prompt_dismiss_and_notify(session):
- response = execute_async_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_dismiss_and_notify(session, dialog_type):
+ response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
session.title
with pytest.raises(error.NoSuchAlertException):
session.alert.dismiss()
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
-def test_handle_prompt_ignore(session):
- response = execute_async_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_ignore(session, dialog_type):
+ response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
session.title
session.alert.dismiss()
-def test_handle_prompt_default(session):
- response = execute_async_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_default(session, dialog_type):
+ response = execute_async_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
session.title
with pytest.raises(error.NoSuchAlertException):
session.alert.dismiss()
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_twice(session):
- response = execute_async_script(session, "window.alert('Hello');window.alert('Bye');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_twice(session, dialog_type):
+ response = execute_async_script(
+ session, "window.{0}('Hello');window.{0}('Bye');".format(dialog_type))
assert_success(response, None)
session.alert.dismiss()
# The first alert has been accepted by the user prompt handler, the second one remains.
# FIXME: this is how browsers currently work, but the spec should clarify if this is the
# expected behavior, see https://github.com/w3c/webdriver/issues/1153.
assert session.alert.text == "Bye"
session.alert.dismiss()
--- a/testing/web-platform/tests/webdriver/tests/execute_script/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/execute_script/user_prompts.py
@@ -14,80 +14,88 @@ def execute_script(session, script, args
return session.transport.send(
"POST", "/session/{session_id}/execute/sync".format(
session_id=session.session_id),
body)
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session):
- response = execute_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, dialog_type):
+ response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
session.title
with pytest.raises(error.NoSuchAlertException):
session.alert.accept()
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
-def test_handle_prompt_accept_and_notify(session):
- response = execute_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept_and_notify(session, dialog_type):
+ response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
session.title
with pytest.raises(error.NoSuchAlertException):
session.alert.accept()
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
-def test_handle_prompt_dismiss(session):
- response = execute_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_dismiss(session, dialog_type):
+ response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
session.title
with pytest.raises(error.NoSuchAlertException):
session.alert.dismiss()
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
-def test_handle_prompt_dismiss_and_notify(session):
- response = execute_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_dismiss_and_notify(session, dialog_type):
+ response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
session.title
with pytest.raises(error.NoSuchAlertException):
session.alert.dismiss()
@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
-def test_handle_prompt_ignore(session):
- response = execute_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_ignore(session, dialog_type):
+ response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
session.title
session.alert.dismiss()
-def test_handle_prompt_default(session):
- response = execute_script(session, "window.alert('Hello');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_default(session, dialog_type):
+ response = execute_script(session, "window.{}('Hello');".format(dialog_type))
assert_success(response, None)
with pytest.raises(error.UnexpectedAlertOpenException):
session.title
with pytest.raises(error.NoSuchAlertException):
session.alert.dismiss()
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_twice(session):
- response = execute_script(session, "window.alert('Hello');window.alert('Bye');")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_twice(session, dialog_type):
+ response = execute_script(
+ session, "window.{0}('Hello');window.{0}('Bye');".format(dialog_type))
assert_success(response, None)
session.alert.dismiss()
# The first alert has been accepted by the user prompt handler, the second one remains.
# FIXME: this is how browsers currently work, but the spec should clarify if this is the
# expected behavior, see https://github.com/w3c/webdriver/issues/1153.
assert session.alert.text == "Bye"
session.alert.dismiss()