Bug 1470098 - [wdspec] Parametrize user prompt tests. draft
authorHenrik Skupin <mail@hskupin.info>
Wed, 04 Jul 2018 22:09:39 +0200
changeset 814474 621ee96b871ea35ea996b939e375ff10de77e403
parent 814473 5e5801a2afbbcae154a5cd5638701ebe3d6ad23c
child 814475 97f5f45ac957ba582a0c0abd45c38e0b69b06a09
child 814481 45292850c03ab9d2af261a03c06f6698c8986830
push id115223
push userbmo:hskupin@gmail.com
push dateThu, 05 Jul 2018 12:38:59 +0000
bugs1470098
milestone63.0a1
Bug 1470098 - [wdspec] Parametrize user prompt tests. To prevent code duplication each of the user prompt tests can be parametrized for "alert", "confirm", and "prompt". MozReview-Commit-ID: DtA5bKmfljt
testing/web-platform/meta/webdriver/tests/close_window/user_prompts.py.ini
testing/web-platform/meta/webdriver/tests/delete_cookie/user_prompts.py.ini
testing/web-platform/meta/webdriver/tests/element_send_keys/user_prompts.py.ini
testing/web-platform/meta/webdriver/tests/fullscreen_window/user_prompts.py.ini
testing/web-platform/meta/webdriver/tests/get_current_url/user_prompts.py.ini
testing/web-platform/meta/webdriver/tests/get_element_property/user_prompts.py.ini
testing/web-platform/meta/webdriver/tests/get_element_tag_name/user_prompts.py.ini
testing/web-platform/meta/webdriver/tests/get_title/user_prompts.py.ini
testing/web-platform/meta/webdriver/tests/get_window_rect/user_prompts.py.ini
testing/web-platform/meta/webdriver/tests/is_element_selected/user_prompts.py.ini
testing/web-platform/meta/webdriver/tests/minimize_window/user_prompts.py.ini
testing/web-platform/meta/webdriver/tests/set_window_rect/user_prompts.py.ini
testing/web-platform/tests/webdriver/tests/close_window/user_prompts.py
testing/web-platform/tests/webdriver/tests/delete_cookie/user_prompts.py
testing/web-platform/tests/webdriver/tests/element_send_keys/user_prompts.py
testing/web-platform/tests/webdriver/tests/fullscreen_window/user_prompts.py
testing/web-platform/tests/webdriver/tests/get_current_url/user_prompts.py
testing/web-platform/tests/webdriver/tests/get_element_property/user_prompts.py
testing/web-platform/tests/webdriver/tests/get_element_tag_name/user_prompts.py
testing/web-platform/tests/webdriver/tests/get_title/user_prompts.py
testing/web-platform/tests/webdriver/tests/get_window_rect/user_prompts.py
testing/web-platform/tests/webdriver/tests/is_element_selected/user_prompts.py
testing/web-platform/tests/webdriver/tests/maximize_window/user_prompts.py
testing/web-platform/tests/webdriver/tests/minimize_window/user_prompts.py
testing/web-platform/tests/webdriver/tests/set_window_rect/user_prompts.py
--- a/testing/web-platform/meta/webdriver/tests/close_window/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/close_window/user_prompts.py.ini
@@ -1,4 +1,8 @@
 [user_prompts.py]
-  [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
 
--- a/testing/web-platform/meta/webdriver/tests/delete_cookie/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/delete_cookie/user_prompts.py.ini
@@ -1,4 +1,9 @@
 [user_prompts.py]
-  [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
--- a/testing/web-platform/meta/webdriver/tests/element_send_keys/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/element_send_keys/user_prompts.py.ini
@@ -1,4 +1,9 @@
 [user_prompts.py]
-  [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
--- a/testing/web-platform/meta/webdriver/tests/fullscreen_window/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/fullscreen_window/user_prompts.py.ini
@@ -1,4 +1,9 @@
 [user_prompts.py]
-  [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
--- a/testing/web-platform/meta/webdriver/tests/get_current_url/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/get_current_url/user_prompts.py.ini
@@ -1,4 +1,9 @@
 [user_prompts.py]
-  [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
--- a/testing/web-platform/meta/webdriver/tests/get_element_property/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/get_element_property/user_prompts.py.ini
@@ -1,9 +1,20 @@
 [user_prompts.py]
   disabled:
     if webrender: bug 1425588
-  [test_handle_prompt_dismiss[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_accept[capabilities0\]]
+  [test_handle_prompt_dismiss[capabilities0-alert\]]
     expected: FAIL
 
+  [test_handle_prompt_dismiss[capabilities0-confirm\]]
+    expected: FAIL
+
+  [test_handle_prompt_dismiss[capabilities0-prompt\]]
+    expected: FAIL
--- a/testing/web-platform/meta/webdriver/tests/get_element_tag_name/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/get_element_tag_name/user_prompts.py.ini
@@ -1,9 +1,20 @@
 [user_prompts.py]
   disabled:
     if webrender: bug 1425588
-  [test_handle_prompt_dismiss[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_accept[capabilities0\]]
+  [test_handle_prompt_dismiss[capabilities0-alert\]]
     expected: FAIL
 
+  [test_handle_prompt_dismiss[capabilities0-confirm\]]
+    expected: FAIL
+
+  [test_handle_prompt_dismiss[capabilities0-prompt\]]
+    expected: FAIL
--- a/testing/web-platform/meta/webdriver/tests/get_title/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/get_title/user_prompts.py.ini
@@ -1,9 +1,20 @@
 [user_prompts.py]
   disabled:
     if webrender: bug 1425588
-  [test_title_handle_prompt_dismiss[capabilities0\]]
+  [test_title_handle_prompt_accept[capabilities0-alert\]]
+    expected: FAIL
+
+  [test_title_handle_prompt_accept[capabilities0-confirm\]]
+    expected: FAIL
+
+  [test_title_handle_prompt_accept[capabilities0-prompt\]]
     expected: FAIL
 
-  [test_title_handle_prompt_accept[capabilities0\]]
+  [test_title_handle_prompt_dismiss[capabilities0-alert\]]
     expected: FAIL
 
+  [test_title_handle_prompt_dismiss[capabilities0-confirm\]]
+    expected: FAIL
+
+  [test_title_handle_prompt_dismiss[capabilities0-prompt\]]
+    expected: FAIL
--- a/testing/web-platform/meta/webdriver/tests/get_window_rect/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/get_window_rect/user_prompts.py.ini
@@ -1,6 +1,11 @@
 [user_prompts.py]
   disabled:
     if not debug and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86_64") and (bits == 64): wpt-sync Bug 1446953
-  [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
--- a/testing/web-platform/meta/webdriver/tests/is_element_selected/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/is_element_selected/user_prompts.py.ini
@@ -1,7 +1,13 @@
 [user_prompts.py]
-  [test_handle_prompt_dismiss[capabilities0\]]
+  [test_handle_prompt_dismiss[capabilities0-alert\]]
+    expected: FAIL
+
+  [test_handle_prompt_dismiss[capabilities0-confirm\]]
     expected: FAIL
 
-  [test_handle_prompt_accept[capabilities0\]]
+  [test_handle_prompt_dismiss[capabilities0-prompt\]]
     expected: FAIL
 
+  [test_handle_prompt_accept[capabilities0-alert\]]
+    expected: FAIL
+
--- a/testing/web-platform/meta/webdriver/tests/minimize_window/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/minimize_window/user_prompts.py.ini
@@ -1,6 +1,12 @@
 [user_prompts.py]
   disabled:
     if not debug and not webrender and e10s and (os == "linux") and (version == "Ubuntu 16.04") and (processor == "x86") and (bits == 32): wpt-sync Bug 1449780
-  [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
+
--- a/testing/web-platform/meta/webdriver/tests/set_window_rect/user_prompts.py.ini
+++ b/testing/web-platform/meta/webdriver/tests/set_window_rect/user_prompts.py.ini
@@ -1,4 +1,10 @@
 [user_prompts.py]
-  [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
+
--- a/testing/web-platform/tests/webdriver/tests/close_window/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/close_window/user_prompts.py
@@ -1,12 +1,11 @@
 import pytest
 
-from tests.support.asserts import assert_error, assert_dialog_handled
-from tests.support.inline import inline
+from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
 
 
 def close(session):
     return session.transport.send(
         "DELETE", "session/{session_id}/window".format(**vars(session)))
 
 
 def test_handle_prompt_dismiss_and_notify():
@@ -17,70 +16,34 @@ def test_handle_prompt_accept_and_notify
     """TODO"""
 
 
 def test_handle_prompt_ignore():
     """TODO"""
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog, create_window):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, create_window, dialog_type):
     original_handle = session.window_handle
 
     session.window_handle = create_window()
-    session.url = inline("<title>WD doc title</title>")
-
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-    response = close(session)
-    assert response.status == 200
+    create_dialog(dialog_type, text="dialog")
 
-    # Asserting that the dialog was handled requires valid top-level browsing
-    # context, so we must switch to the original window.
-    session.window_handle = original_handle
-    assert_dialog_handled(session, "dismiss #1")
-
-    session.window_handle = create_window()
-    session.url = inline("<title>WD doc title</title>")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
     response = close(session)
-    assert response.status == 200
+    assert_success(response)
 
     # Asserting that the dialog was handled requires valid top-level browsing
     # context, so we must switch to the original window.
     session.window_handle = original_handle
-    assert_dialog_handled(session, "dismiss #2")
-
-    session.window_handle = create_window()
-    session.url = inline("<title>WD doc title</title>")
-
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-    response = close(session)
-    assert response.status == 200
-
-    # Asserting that the dialog was handled requires valid top-level browsing
-    # context, so we must switch to the original window.
-    session.window_handle = original_handle
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_handle_prompt_missing_value(session, create_dialog, create_window):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, create_window, dialog_type):
     session.window_handle = create_window()
 
-    session.url = inline("<title>WD doc title</title>")
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    response = close(session)
-
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
     response = close(session)
     assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    response = close(session)
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
--- a/testing/web-platform/tests/webdriver/tests/delete_cookie/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/delete_cookie/user_prompts.py
@@ -1,12 +1,11 @@
 import pytest
 
-from tests.support.asserts import assert_error, assert_dialog_handled
-from tests.support.inline import inline
+from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
 
 
 def delete_cookie(session, name):
     return session.transport.send("DELETE", "/session/%s/cookie/%s" % (session.session_id, name))
 
 
 def test_handle_prompt_dismiss_and_notify():
     """TODO"""
@@ -16,47 +15,26 @@ def test_handle_prompt_accept_and_notify
     """TODO"""
 
 
 def test_handle_prompt_ignore():
     """TODO"""
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog):
-    session.url = inline("<title>WD doc title</title>")
-
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-    response = delete_cookie(session, "foo")
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #1")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
+    create_dialog(dialog_type, text="dialog")
 
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
     response = delete_cookie(session, "foo")
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #2")
+    assert_success(response)
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-    response = delete_cookie(session, "foo")
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_handle_prompt_missing_value(session, create_dialog):
-    session.url = inline("<title>WD doc title</title>")
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    response = delete_cookie(session, "foo")
-
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, dialog_type):
+    create_dialog(dialog_type, text="dialog")
 
     response = delete_cookie(session, "foo")
     assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    response = delete_cookie(session, "foo")
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
--- a/testing/web-platform/tests/webdriver/tests/element_send_keys/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/element_send_keys/user_prompts.py
@@ -1,11 +1,11 @@
 import pytest
 
-from tests.support.asserts import assert_error, assert_dialog_handled
+from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
 from tests.support.inline import inline
 
 
 def element_send_keys(session, element, text):
     return session.transport.send(
         "POST", "/session/{session_id}/element/{element_id}/value".format(
             session_id=session.session_id,
             element_id=element.id),
@@ -20,47 +20,32 @@ def test_handle_prompt_accept_and_notify
     """TODO"""
 
 
 def test_handle_prompt_ignore():
     """TODO"""
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
     session.url = inline("<input>")
     element = session.find.css("input", all=False)
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-    response = element_send_keys(session, element, "foo")
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #1")
+    create_dialog(dialog_type, text="dialog")
 
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
     response = element_send_keys(session, element, "foo")
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #2")
+    assert_success(response)
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-    response = element_send_keys(session, element, "foo")
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_handle_prompt_missing_value(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, dialog_type):
     session.url = inline("<input>")
     element = session.find.css("input", all=False)
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
+    create_dialog(dialog_type, text="dialog")
 
     response = element_send_keys(session, element, "foo")
     assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
 
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
-    response = element_send_keys(session, element, "foo")
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
-
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-    response = element_send_keys(session, element, "foo")
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
--- a/testing/web-platform/tests/webdriver/tests/fullscreen_window/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/fullscreen_window/user_prompts.py
@@ -1,16 +1,11 @@
 import pytest
 
-from tests.support.asserts import assert_error, assert_dialog_handled
-from tests.support.inline import inline
-
-
-def read_global(session, name):
-    return session.execute_script("return %s;" % name)
+from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
 
 
 def fullscreen(session):
     return session.transport.send("POST", "session/%s/window/fullscreen" % session.session_id)
 
 
 def test_handle_prompt_dismiss_and_notify():
     """TODO"""
@@ -20,58 +15,26 @@ def test_handle_prompt_accept_and_notify
     """TODO"""
 
 
 def test_handle_prompt_ignore():
     """TODO"""
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog):
-    session.url = inline("<title>WD doc title</title>")
-    create_dialog("alert", text="accept #1", result_var="accept1")
-
-    fullscreen(session)
-
-    assert_dialog_handled(session, "accept #1")
-    assert read_global(session, "accept1") is None
-
-    read_global(session, "document.title")
-    create_dialog("confirm", text="accept #2", result_var="accept2")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
+    create_dialog(dialog_type, text="dialog")
 
-    fullscreen(session)
-
-    assert_dialog_handled(session, "accept #2")
-    assert read_global(session, "accept2"), True
+    response = fullscreen(session)
+    assert_success(response)
 
-    create_dialog("prompt", text="accept #3", result_var="accept3")
-
-    fullscreen(session)
-
-    assert_dialog_handled(session, "accept #3")
-    assert read_global(session, "accept3") == "" or read_global(session, "accept3") == "undefined"
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_handle_prompt_missing_value(session, create_dialog):
-    session.url = inline("<title>WD doc title</title>")
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    response = fullscreen(session)
-
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-    assert read_global(session, "dismiss1") is None
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, dialog_type):
+    create_dialog(dialog_type, text="dialog")
 
     response = fullscreen(session)
-
     assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
-    assert read_global(session, "dismiss2") is False
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    response = fullscreen(session)
-
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
-    assert read_global(session, "dismiss3") is None
+    assert_dialog_handled(session, expected_text="dialog")
--- a/testing/web-platform/tests/webdriver/tests/get_current_url/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/get_current_url/user_prompts.py
@@ -1,18 +1,14 @@
 import pytest
 
-from tests.support.asserts import assert_error, assert_dialog_handled
+from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
 from tests.support.inline import inline
 
 
-def read_global(session, name):
-    return session.execute_script("return %s;" % name)
-
-
 def get_current_url(session):
     return session.transport.send("GET", "session/%s/url" % session.session_id)
 
 
 def test_handle_prompt_dismiss_and_notify():
     """TODO"""
 
 
@@ -20,58 +16,31 @@ def test_handle_prompt_accept_and_notify
     """TODO"""
 
 
 def test_handle_prompt_ignore():
     """TODO"""
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
     session.url = inline("<title>WD doc title</title>")
-    create_dialog("alert", text="accept #1", result_var="accept1")
-
-    get_current_url(session)
-
-    assert_dialog_handled(session, "accept #1")
-    assert read_global(session, "accept1") is None
-
-    read_global(session, "document.title")
-    create_dialog("confirm", text="accept #2", result_var="accept2")
+    expected_url = session.url
 
-    get_current_url(session)
-
-    assert_dialog_handled(session, "accept #2")
-    assert read_global(session, "accept2"), True
+    create_dialog(dialog_type, text="dialog")
 
-    create_dialog("prompt", text="accept #3", result_var="accept3")
+    response = get_current_url(session)
+    assert_success(response, expected_url)
 
-    get_current_url(session)
-
-    assert_dialog_handled(session, "accept #3")
-    assert read_global(session, "accept3") == "" or read_global(session, "accept3") == "undefined"
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_handle_prompt_missing_value(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, dialog_type):
     session.url = inline("<title>WD doc title</title>")
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    response = get_current_url(session)
 
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-    assert read_global(session, "dismiss1") is None
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
     response = get_current_url(session)
-
     assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
-    assert read_global(session, "dismiss2") is False
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    response = get_current_url(session)
-
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
-    assert read_global(session, "dismiss3") is None
+    assert_dialog_handled(session, expected_text="dialog")
--- a/testing/web-platform/tests/webdriver/tests/get_element_property/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/get_element_property/user_prompts.py
@@ -1,85 +1,51 @@
 import pytest
 
 from tests.support.asserts import assert_error, assert_success, assert_dialog_handled
 from tests.support.inline import inline
 
 
-def read_global(session, name):
-    return session.execute_script("return %s;" % name)
-
-
 def get_property(session, element_id, name):
     return session.transport.send(
         "GET", "session/{session_id}/element/{element_id}/property/{name}".format(
             session_id=session.session_id, element_id=element_id, name=name))
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
-def test_handle_prompt_dismiss(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_dismiss(session, create_dialog, dialog_type):
     session.url = inline("<input id=foo>")
     element = session.find.css("#foo", all=False)
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = get_property(session, element.id, "id")
-    assert_success(result, "foo")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
-    result = get_property(session, element.id, "id")
-    assert_success(result, "foo")
-    assert_dialog_handled(session, "dismiss #2")
+    response = get_property(session, element.id, "id")
+    assert_success(response, "foo")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    result = get_property(session, element.id, "id")
-    assert_success(result, "foo")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
     session.url = inline("<input id=foo>")
     element = session.find.css("#foo", all=False)
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = get_property(session, element.id, "id")
-    assert_success(result, "foo")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
-    result = get_property(session, element.id, "id")
-    assert_success(result, "foo")
-    assert_dialog_handled(session, "dismiss #2")
+    response = get_property(session, element.id, "id")
+    assert_success(response, "foo")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    result = get_property(session, element.id, "id")
-    assert_success(result, "foo")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_handle_prompt_missing_value(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, dialog_type):
     session.url = inline("<input id=foo>")
     element = session.find.css("#foo", all=False)
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = get_property(session, element.id, "id")
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
-    result = get_property(session, element.id, "id")
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
+    response = get_property(session, element.id, "id")
+    assert_error(response, "unexpected alert open")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    result = get_property(session, element.id, "id")
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
--- a/testing/web-platform/tests/webdriver/tests/get_element_tag_name/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/get_element_tag_name/user_prompts.py
@@ -1,84 +1,50 @@
 import pytest
 
 from tests.support.asserts import assert_error, assert_success, assert_dialog_handled
 from tests.support.inline import inline
 
 
-def read_global(session, name):
-    return session.execute_script("return %s;" % name)
-
-
 def get_tag_name(session, element_id):
     return session.transport.send("GET", "session/{session_id}/element/{element_id}/name".format(
         session_id=session.session_id, element_id=element_id))
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
-def test_handle_prompt_dismiss(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_dismiss(session, create_dialog, dialog_type):
     session.url = inline("<input id=foo>")
     element = session.find.css("#foo", all=False)
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = get_tag_name(session, element.id)
-    assert_success(result, "input")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
-    result = get_tag_name(session, element.id)
-    assert_success(result, "input")
-    assert_dialog_handled(session, "dismiss #2")
+    response = get_tag_name(session, element.id)
+    assert_success(response, "input")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    result = get_tag_name(session, element.id)
-    assert_success(result, "input")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
     session.url = inline("<input id=foo>")
     element = session.find.css("#foo", all=False)
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = get_tag_name(session, element.id)
-    assert_success(result, "input")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
-    result = get_tag_name(session, element.id)
-    assert_success(result, "input")
-    assert_dialog_handled(session, "dismiss #2")
+    response = get_tag_name(session, element.id)
+    assert_success(response, "input")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    result = get_tag_name(session, element.id)
-    assert_success(result, "input")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_handle_prompt_missing_value(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, dialog_type):
     session.url = inline("<input id=foo>")
     element = session.find.css("#foo", all=False)
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = get_tag_name(session, element.id)
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
-    result = get_tag_name(session, element.id)
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
+    response = get_tag_name(session, element.id)
+    assert_error(response, "unexpected alert open")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    result = get_tag_name(session, element.id)
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
--- a/testing/web-platform/tests/webdriver/tests/get_title/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/get_title/user_prompts.py
@@ -1,103 +1,57 @@
 import pytest
 
-from tests.support.asserts import assert_error, assert_success, assert_dialog_handled
+from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
 from tests.support.inline import inline
 
 
-def read_global(session, name):
-    return session.execute_script("return %s;" % name)
-
-
 def get_title(session):
     return session.transport.send(
         "GET", "session/{session_id}/title".format(**vars(session)))
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
-def test_title_handle_prompt_dismiss(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_title_handle_prompt_dismiss(session, create_dialog, dialog_type):
     session.url = inline("<title>WD doc title</title>")
-
-    expected_title = read_global(session, "document.title")
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = get_title(session)
-    assert_success(result, expected_title)
-    assert_dialog_handled(session, "dismiss #1")
-    assert read_global(session, "dismiss1") is None
+    expected_title = session.title
 
-    expected_title = read_global(session, "document.title")
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
-
-    result = get_title(session)
-    assert_success(result, expected_title)
-    assert_dialog_handled(session, "dismiss #2")
-    assert read_global(session, "dismiss2") is False
+    create_dialog(dialog_type, text="dialog")
 
-    expected_title = read_global(session, "document.title")
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
+    response = get_title(session)
+    assert_success(response, expected_title)
 
-    result = get_title(session)
-    assert_success(result, expected_title)
-    assert_dialog_handled(session, "dismiss #3")
-    assert read_global(session, "dismiss3") is None
+    assert_dialog_handled(session, expected_text="dialog")
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_title_handle_prompt_accept(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_title_handle_prompt_accept(session, create_dialog, dialog_type):
     session.url = inline("<title>WD doc title</title>")
-    create_dialog("alert", text="accept #1", result_var="accept1")
-
-    expected_title = read_global(session, "document.title")
-
-    result = get_title(session)
-    assert_success(result, expected_title)
-    assert_dialog_handled(session, "accept #1")
-    assert read_global(session, "accept1") is None
+    expected_title = session.title
 
-    expected_title = read_global(session, "document.title")
-    create_dialog("confirm", text="accept #2", result_var="accept2")
-
-    result = get_title(session)
-    assert_success(result, expected_title)
-    assert_dialog_handled(session, "accept #2")
-    assert read_global(session, "accept2") is True
+    create_dialog(dialog_type, text="dialog")
 
-    expected_title = read_global(session, "document.title")
-    create_dialog("prompt", text="accept #3", result_var="accept3")
+    response = get_title(session)
+    assert_success(response, expected_title)
 
-    result = get_title(session)
-    assert_success(result, expected_title)
-    assert_dialog_handled(session, "accept #3")
-    assert read_global(session, "accept3") == "" or read_global(session, "accept3") == "undefined"
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_title_handle_prompt_missing_value(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_title_handle_prompt_missing_value(session, create_dialog, dialog_type):
     session.url = inline("<title>WD doc title</title>")
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = get_title(session)
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-    assert read_global(session, "dismiss1") is None
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
 
-    result = get_title(session)
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
-    assert read_global(session, "dismiss2") is False
+    create_dialog(dialog_type, text="dialog")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
+    response = get_title(session)
+    assert_error(response, "unexpected alert open")
 
-    result = get_title(session)
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
-    assert read_global(session, "dismiss3") is None
+    assert_dialog_handled(session, expected_text="dialog")
 
 
 # The behavior of the `window.print` function is platform-dependent and may not
 # trigger the creation of a dialog at all. Therefore, this test should only be
 # run in contexts that support the dialog (a condition that may not be
 # determined automatically).
 # def test_title_with_non_simple_dialog(session):
 #    document = "<title>With non-simple dialog</title><h2>Hello</h2>"
--- a/testing/web-platform/tests/webdriver/tests/get_window_rect/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/get_window_rect/user_prompts.py
@@ -1,15 +1,11 @@
 import pytest
 
-from tests.support.asserts import assert_error, assert_dialog_handled
-from tests.support.inline import inline
-
-
-alert_doc = inline("<script>window.alert()</script>")
+from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
 
 
 def get_window_rect(session):
     return session.transport.send(
         "GET", "session/{session_id}/window/rect".format(**vars(session)))
 
 
 def test_handle_prompt_dismiss_and_notify():
@@ -20,47 +16,26 @@ def test_handle_prompt_accept_and_notify
     """TODO"""
 
 
 def test_handle_prompt_ignore():
     """TODO"""
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog):
-    session.url = inline("<title>WD doc title</title>")
-
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-    response = get_window_rect(session)
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #1")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
+    create_dialog(dialog_type, text="dialog")
 
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
     response = get_window_rect(session)
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #2")
+    assert_success(response)
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-    response = get_window_rect(session)
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_handle_prompt_missing_value(session, create_dialog):
-    session.url = inline("<title>WD doc title</title>")
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    response = get_window_rect(session)
-
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, dialog_type):
+    create_dialog(dialog_type, text="dialog")
 
     response = get_window_rect(session)
     assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    response = get_window_rect(session)
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
--- a/testing/web-platform/tests/webdriver/tests/is_element_selected/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/is_element_selected/user_prompts.py
@@ -7,76 +7,46 @@ from tests.support.inline import inline
 def is_element_selected(session, element_id):
     return session.transport.send(
         "GET", "session/{session_id}/element/{element_id}/selected".format(
             session_id=session.session_id,
             element_id=element_id))
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "dismiss"})
-def test_handle_prompt_dismiss(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_dismiss(session, create_dialog, dialog_type):
     session.url = inline("<input id=foo>")
     element = session.find.css("#foo", all=False)
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = is_element_selected(session, element.id)
-    assert_success(result, False)
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
-    result = is_element_selected(session, element.id)
-    assert_success(result, False)
-    assert_dialog_handled(session, "dismiss #2")
+    response = is_element_selected(session, element.id)
+    assert_success(response, False)
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    result = is_element_selected(session, element.id)
-    assert_success(result, False)
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
     session.url = inline("<input id=foo>")
     element = session.find.css("#foo", all=False)
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = is_element_selected(session, element.id)
-    assert_success(result, False)
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
-    result = is_element_selected(session, element.id)
-    assert_success(result, False)
-    assert_dialog_handled(session, "dismiss #2")
+    response = is_element_selected(session, element.id)
+    assert_success(response, False)
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    result = is_element_selected(session, element.id)
-    assert_success(result, False)
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_handle_prompt_missing_value(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, dialog_type):
     session.url = inline("<input id=foo>")
     element = session.find.css("#foo", all=False)
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = is_element_selected(session, element.id)
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
-    result = is_element_selected(session, element.id)
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
+    response = is_element_selected(session, element.id)
+    assert_error(response, "unexpected alert open")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    result = is_element_selected(session, element.id)
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
--- a/testing/web-platform/tests/webdriver/tests/maximize_window/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/maximize_window/user_prompts.py
@@ -1,12 +1,11 @@
 import pytest
 
-from tests.support.asserts import assert_error, assert_dialog_handled
-from tests.support.inline import inline
+from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
 
 
 def maximize(session):
     return session.transport.send(
         "POST", "session/{session_id}/window/maximize".format(**vars(session)))
 
 
 def test_handle_prompt_dismiss_and_notify():
@@ -17,47 +16,26 @@ def test_handle_prompt_accept_and_notify
     """TODO"""
 
 
 def test_handle_prompt_ignore():
     """TODO"""
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog):
-    session.url = inline("<title>WD doc title</title>")
-
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-    response = maximize(session)
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #1")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
+    create_dialog(dialog_type, text="dialog")
 
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
     response = maximize(session)
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #2")
+    assert_success(response)
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-    response = maximize(session)
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_handle_prompt_missing_value(session, create_dialog):
-    session.url = inline("<title>WD doc title</title>")
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    response = maximize(session)
-
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, dialog_type):
+    create_dialog(dialog_type, text="dialog")
 
     response = maximize(session)
     assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    response = maximize(session)
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
--- a/testing/web-platform/tests/webdriver/tests/minimize_window/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/minimize_window/user_prompts.py
@@ -1,12 +1,11 @@
 import pytest
 
-from tests.support.asserts import assert_error, assert_dialog_handled
-from tests.support.inline import inline
+from tests.support.asserts import assert_dialog_handled, assert_error, assert_success
 
 
 def minimize(session):
     return session.transport.send(
         "POST", "session/{session_id}/window/minimize".format(**vars(session)))
 
 
 def test_handle_prompt_dismiss_and_notify():
@@ -17,47 +16,26 @@ def test_handle_prompt_accept_and_notify
     """TODO"""
 
 
 def test_handle_prompt_ignore():
     """TODO"""
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog):
-    session.url = inline("<title>WD doc title</title>")
-
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-    response = minimize(session)
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #1")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
+    create_dialog(dialog_type, text="dialog")
 
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
     response = minimize(session)
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #2")
+    assert_success(response)
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-    response = minimize(session)
-    assert response.status == 200
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
-def test_handle_prompt_missing_value(session, create_dialog):
-    session.url = inline("<title>WD doc title</title>")
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    response = minimize(session)
-
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, dialog_type):
+    create_dialog(dialog_type, text="dialog")
 
     response = minimize(session)
     assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    response = minimize(session)
-    assert_error(response, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
--- a/testing/web-platform/tests/webdriver/tests/set_window_rect/user_prompts.py
+++ b/testing/web-platform/tests/webdriver/tests/set_window_rect/user_prompts.py
@@ -9,66 +9,43 @@ def set_window_rect(session, rect):
         rect)
 
 
 def test_handle_prompt_dismiss():
     """TODO"""
 
 
 @pytest.mark.capabilities({"unhandledPromptBehavior": "accept"})
-def test_handle_prompt_accept(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_accept(session, create_dialog, dialog_type):
     original = session.window.rect
 
-    # step 2
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-    result = set_window_rect(session, {"x": original["x"],
-                                       "y": original["y"]})
-    assert result.status == 200
-    assert_dialog_handled(session, "dismiss #1")
+    create_dialog(dialog_type, text="dialog")
 
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
-    result = set_window_rect(session, {"x": original["x"],
-                                       "y": original["y"]})
-    assert result.status == 200
-    assert_dialog_handled(session, "dismiss #2")
+    response = set_window_rect(session, {"x": original["x"], "y": original["y"]})
+    assert_success(response)
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-    result = set_window_rect(session, {"x": original["x"],
-                                       "y": original["y"]})
-    assert_success(result)
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")
 
 
 def test_handle_prompt_dismiss_and_notify():
     """TODO"""
 
 
 def test_handle_prompt_accept_and_notify():
     """TODO"""
 
 
 def test_handle_prompt_ignore():
     """TODO"""
 
 
-def test_handle_prompt_missing_value(session, create_dialog):
+@pytest.mark.parametrize("dialog_type", ["alert", "confirm", "prompt"])
+def test_handle_prompt_missing_value(session, create_dialog, dialog_type):
     original = session.window.rect
 
-    create_dialog("alert", text="dismiss #1", result_var="dismiss1")
-
-    result = set_window_rect(session, {"x": original["x"],
-                                       "y": original["y"]})
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #1")
-
-    create_dialog("confirm", text="dismiss #2", result_var="dismiss2")
+    create_dialog(dialog_type, text="dialog")
 
-    result = set_window_rect(session, {"x": original["x"],
-                                       "y": original["y"]})
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #2")
+    response = set_window_rect(session, {"x": original["x"],
+                                         "y": original["y"]})
+    assert_error(response, "unexpected alert open")
 
-    create_dialog("prompt", text="dismiss #3", result_var="dismiss3")
-
-    result = set_window_rect(session, {"x": original["x"],
-                                       "y": original["y"]})
-    assert_error(result, "unexpected alert open")
-    assert_dialog_handled(session, "dismiss #3")
+    assert_dialog_handled(session, expected_text="dialog")