--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -408762,16 +408762,22 @@
]
],
"webdriver/tests/execute_async_script/collections.py": [
[
"/webdriver/tests/execute_async_script/collections.py",
{}
]
],
+ "webdriver/tests/execute_async_script/execute_async.py": [
+ [
+ "/webdriver/tests/execute_async_script/execute_async.py",
+ {}
+ ]
+ ],
"webdriver/tests/execute_async_script/user_prompts.py": [
[
"/webdriver/tests/execute_async_script/user_prompts.py",
{
"timeout": "long"
}
]
],
@@ -408782,16 +408788,22 @@
]
],
"webdriver/tests/execute_script/cyclic.py": [
[
"/webdriver/tests/execute_script/cyclic.py",
{}
]
],
+ "webdriver/tests/execute_script/execute.py": [
+ [
+ "/webdriver/tests/execute_script/execute.py",
+ {}
+ ]
+ ],
"webdriver/tests/execute_script/json_serialize_windowproxy.py": [
[
"/webdriver/tests/execute_script/json_serialize_windowproxy.py",
{}
]
],
"webdriver/tests/execute_script/user_prompts.py": [
[
@@ -552624,17 +552636,17 @@
"aece414b89e0fdea1030e4ca9011ab7d22f1b275",
"testharness"
],
"css/cssom/computed-style-004.html": [
"55010cf90dc7fc2ef8ec6cbd13d1ec947a823aed",
"testharness"
],
"css/cssom/computed-style-005.html": [
- "690ce1465de338f19b1e7282b4a221e7fe374a12",
+ "6bf8f129c83cb014918b3af9ccb296de4fa67577",
"testharness"
],
"css/cssom/computed-style-set-property.html": [
"cb05ff525eb659d43bf234d932fd860795959c9e",
"testharness"
],
"css/cssom/css-style-attr-decl-block.html": [
"1d68a3fd1560308c0d2f3478864d84f4361e4ab9",
@@ -622744,17 +622756,17 @@
"8eea7caf9f0bf8b9a87b5a6574a28b378054c8db",
"testharness"
],
"web-animations/timing-model/time-transformations/transformed-progress.html": [
"2e55f43def584a67eeb313f050154cd146002938",
"testharness"
],
"web-animations/timing-model/timelines/document-timelines.html": [
- "d0fcb390c19c9ede7288278dc11ea5b3d33671cb",
+ "44b64478e81fd9c7933b865cb6ad3d62f06bc993",
"testharness"
],
"web-animations/timing-model/timelines/timelines.html": [
"29d7fe91c355fc22f563ca17315d2ab493dc0566",
"testharness"
],
"web-animations/timing-model/timelines/update-and-send-events.html": [
"d3182b36255e4179db13c66d0bd0599af467370f",
@@ -624275,38 +624287,46 @@
"webdriver/tests/execute_async_script/__init__.py": [
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
"support"
],
"webdriver/tests/execute_async_script/collections.py": [
"f88643f6266714b078d161ee5039c689a937e0a3",
"wdspec"
],
+ "webdriver/tests/execute_async_script/execute_async.py": [
+ "bd982562266d49b71fc70944b8565ad9b8d62633",
+ "wdspec"
+ ],
"webdriver/tests/execute_async_script/user_prompts.py": [
- "900c47893fa2f506fc8275338c540725b5c3f2a6",
+ "09d4a1c77401f2e5e1aefa79f1c6134aeffb2d50",
"wdspec"
],
"webdriver/tests/execute_script/__init__.py": [
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
"support"
],
"webdriver/tests/execute_script/collections.py": [
"0ee4e340b38b6aa59043286755822460e76b2dbd",
"wdspec"
],
"webdriver/tests/execute_script/cyclic.py": [
"145a8a67226f31e0c1023aa0609947486be5c319",
"wdspec"
],
+ "webdriver/tests/execute_script/execute.py": [
+ "3b940aeb18c1939740ae3d903172004e8c8dc10d",
+ "wdspec"
+ ],
"webdriver/tests/execute_script/json_serialize_windowproxy.py": [
"20db10d82ed2b28a22674fcdc37cac0323d33c95",
"wdspec"
],
"webdriver/tests/execute_script/user_prompts.py": [
- "d4f627cda9669efc7fb8197bf6adde5d65b0aa1f",
+ "530c424e10cd0e7e065e97ceb14f690f65301d3f",
"wdspec"
],
"webdriver/tests/find_element/__init__.py": [
"da39a3ee5e6b4b0d3255bfef95601890afd80709",
"support"
],
"webdriver/tests/find_element/find.py": [
"9af0db4de0d09cbf68fa43bb40145cffc7b95635",
rename from testing/web-platform/meta/webdriver/tests/execute_async_script/user_prompts.py.ini
rename to testing/web-platform/meta/webdriver/tests/execute_async_script/execute_async.py.ini
--- a/testing/web-platform/meta/webdriver/tests/execute_async_script/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/execute_async_script/execute_async.py.ini
@@ -1,15 +1,12 @@
-[user_prompts.py]
- disabled:
- if webrender: bug 1425588
- [test_handle_prompt_twice[capabilities0-alert\]]
+[execute_async.py]
+ [test_abort_by_user_prompt_twice[alert\]]
expected: FAIL
disabled: Bug 1459118
- [test_handle_prompt_twice[capabilities0-confirm\]]
+ [test_abort_by_user_prompt_twice[confirm\]]
expected: FAIL
disabled: Bug 1459118
- [test_handle_prompt_twice[capabilities0-prompt\]]
+ [test_abort_by_user_prompt_twice[prompt\]]
expected: FAIL
disabled: Bug 1459118
-
rename from testing/web-platform/meta/webdriver/tests/execute_script/user_prompts.py.ini
rename to testing/web-platform/meta/webdriver/tests/execute_script/execute.py.ini
--- a/testing/web-platform/meta/webdriver/tests/execute_script/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/execute_script/execute.py.ini
@@ -1,15 +1,12 @@
-[user_prompts.py]
- disabled:
- if webrender: bug 1425588
- [test_handle_prompt_twice[capabilities0-alert\]]
+[execute.py]
+ [test_abort_by_user_prompt_twice[alert\]]
expected: FAIL
disabled: Bug 1459118
- [test_handle_prompt_twice[capabilities0-confirm\]]
+ [test_abort_by_user_prompt_twice[confirm\]]
expected: FAIL
disabled: Bug 1459118
- [test_handle_prompt_twice[capabilities0-prompt\]]
+ [test_abort_by_user_prompt_twice[prompt\]]
expected: FAIL
disabled: Bug 1459118
-
copy from testing/web-platform/tests/webdriver/tests/execute_async_script/user_prompts.py
copy to testing/web-platform/tests/webdriver/tests/execute_async_script/execute_async.py
--- a/testing/web-platform/tests/webdriver/tests/execute_async_script/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/execute_async_script/execute_async.py
@@ -1,100 +1,40 @@
-# META: timeout=long
-
import pytest
-from webdriver import error
-
from tests.support.asserts import assert_success
def execute_async_script(session, script, args=None):
if args is None:
args = []
body = {"script": script, "args": args}
return session.transport.send(
"POST", "/session/{session_id}/execute/async".format(**vars(session)),
body)
-@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
@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"})
-@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))
+def test_abort_by_user_prompt(session, dialog_type):
+ response = execute_async_script(
+ session,
+ "window.{}('Hello'); arguments[0](1);".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"})
-@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"})
-@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"})
-@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()
+ session.alert.accept()
@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))
+def test_abort_by_user_prompt_twice(session, dialog_type):
+ response = execute_async_script(
+ session,
+ "window.{0}('Hello'); window.{0}('Bye'); arguments[0](1);".format(dialog_type))
assert_success(response, None)
- with pytest.raises(error.UnexpectedAlertOpenException):
- session.title
- with pytest.raises(error.NoSuchAlertException):
- session.alert.dismiss()
-
+ session.alert.accept()
-@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-@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()
+
+ session.alert.accept()
--- 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
@@ -1,100 +1,73 @@
# META: timeout=long
import pytest
-from webdriver import error
-
-from tests.support.asserts import assert_success
+from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
def execute_async_script(session, script, args=None):
if args is None:
args = []
body = {"script": script, "args": args}
return session.transport.send(
"POST", "/session/{session_id}/execute/async".format(**vars(session)),
body)
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
@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)
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
+ create_dialog(dialog_type, text="dialog")
- session.title
- with pytest.raises(error.NoSuchAlertException):
- session.alert.accept()
+ response = execute_async_script(session, "arguments[0]()")
+ assert_success(response)
+
+ assert_dialog_handled(session, expected_text="dialog")
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
@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)
+def test_handle_prompt_accept_and_notify(session, create_dialog, dialog_type):
+ create_dialog(dialog_type, text="dialog")
- with pytest.raises(error.UnexpectedAlertOpenException):
- session.title
- with pytest.raises(error.NoSuchAlertException):
- session.alert.accept()
+ response = execute_async_script(session, "arguments[0]()")
+ assert_error(response, "unexpected alert open")
+
+ assert_dialog_handled(session, expected_text="dialog")
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
@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)
+def test_handle_prompt_dismiss(session, create_dialog, dialog_type):
+ create_dialog(dialog_type, text="dialog")
- session.title
- with pytest.raises(error.NoSuchAlertException):
- session.alert.dismiss()
+ response = execute_async_script(session, "arguments[0]()")
+ assert_success(response)
+
+ assert_dialog_handled(session, expected_text="dialog")
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
@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)
+def test_handle_prompt_dissmiss_and_notify(session, create_dialog, dialog_type):
+ create_dialog(dialog_type, text="dialog")
- with pytest.raises(error.UnexpectedAlertOpenException):
- session.title
- with pytest.raises(error.NoSuchAlertException):
- session.alert.dismiss()
+ response = execute_async_script(session, "arguments[0]()")
+ assert_error(response, "unexpected alert open")
+
+ assert_dialog_handled(session, expected_text="dialog")
-@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
-@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_ignore():
+ """TODO"""
@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()
-
+def test_handle_prompt_default(session, create_dialog, dialog_type):
+ create_dialog(dialog_type, text="dialog")
-@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-@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)
+ response = execute_async_script(session, "arguments[0]()")
+ assert_error(response, "unexpected alert open")
- 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()
+ assert_dialog_handled(session, expected_text="dialog")
copy from testing/web-platform/tests/webdriver/tests/execute_script/user_prompts.py
copy to testing/web-platform/tests/webdriver/tests/execute_script/execute.py
--- a/testing/web-platform/tests/webdriver/tests/execute_script/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/execute_script/execute.py
@@ -1,101 +1,39 @@
-# META: timeout=long
-
import pytest
-from webdriver import error
-
from tests.support.asserts import assert_success
def execute_script(session, script, args=None):
if args is None:
args = []
body = {"script": script, "args": args}
return session.transport.send(
"POST", "/session/{session_id}/execute/sync".format(
session_id=session.session_id),
body)
-@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
@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"})
-@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))
+def test_abort_by_user_prompt(session, dialog_type):
+ response = execute_script(
+ session, "window.{}('Hello'); return 1;".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"})
-@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"})
-@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"})
-@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()
+ session.alert.accept()
@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))
+def test_abort_by_user_prompt_twice(session, dialog_type):
+ response = execute_script(
+ session, "window.{0}('Hello'); window.{0}('Bye'); return 1;".format(dialog_type))
assert_success(response, None)
- with pytest.raises(error.UnexpectedAlertOpenException):
- session.title
- with pytest.raises(error.NoSuchAlertException):
- session.alert.dismiss()
-
+ session.alert.accept()
-@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-@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()
+
+ session.alert.accept()
--- a/testing/web-platform/tests/webdriver/tests/execute_script/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/execute_script/user_prompts.py
@@ -1,101 +1,74 @@
# META: timeout=long
import pytest
-from webdriver import error
-
-from tests.support.asserts import assert_success
+from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
def execute_script(session, script, args=None):
if args is None:
args = []
body = {"script": script, "args": args}
return session.transport.send(
"POST", "/session/{session_id}/execute/sync".format(
session_id=session.session_id),
body)
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
@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)
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
+ create_dialog(dialog_type, text="dialog")
- session.title
- with pytest.raises(error.NoSuchAlertException):
- session.alert.accept()
+ response = execute_script(session, "return")
+ assert_success(response)
+
+ assert_dialog_handled(session, expected_text="dialog")
@pytest.mark.capabilities({"unhandledPromptBehavior": "accept and notify"})
@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)
+def test_handle_prompt_accept_and_notify(session, create_dialog, dialog_type):
+ create_dialog(dialog_type, text="dialog")
- with pytest.raises(error.UnexpectedAlertOpenException):
- session.title
- with pytest.raises(error.NoSuchAlertException):
- session.alert.accept()
+ response = execute_script(session, "return")
+ assert_error(response, "unexpected alert open")
+
+ assert_dialog_handled(session, expected_text="dialog")
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
@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)
+def test_handle_prompt_dismiss(session, create_dialog, dialog_type):
+ create_dialog(dialog_type, text="dialog")
- session.title
- with pytest.raises(error.NoSuchAlertException):
- session.alert.dismiss()
+ response = execute_script(session, "return")
+ assert_success(response)
+
+ assert_dialog_handled(session, expected_text="dialog")
@pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss and notify"})
@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)
+def test_handle_prompt_dissmiss_and_notify(session, create_dialog, dialog_type):
+ create_dialog(dialog_type, text="dialog")
- with pytest.raises(error.UnexpectedAlertOpenException):
- session.title
- with pytest.raises(error.NoSuchAlertException):
- session.alert.dismiss()
+ response = execute_script(session, "return")
+ assert_error(response, "unexpected alert open")
+
+ assert_dialog_handled(session, expected_text="dialog")
-@pytest.mark.capabilities({"unhandledPromptBehavior": "ignore"})
-@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_ignore():
+ """TODO"""
@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()
-
+def test_handle_prompt_default(session, create_dialog, dialog_type):
+ create_dialog(dialog_type, text="dialog")
-@pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-@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)
+ response = execute_script(session, "return")
+ assert_error(response, "unexpected alert open")
- 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()
+ assert_dialog_handled(session, expected_text="dialog")