Bug 1453105 [wpt PR 10401] - Updating WebDriver execute[Async]Script tests for unhandled user prompts , a=testonly
authorSimon Stewart <shs96c@users.noreply.github.com>
Fri, 27 Apr 2018 20:35:58 +0000
changeset 472271 3f72c9dde8d6acf25d284f2fb6c63203441b0217
parent 472269 4f03582a853b24483df1b8927d4200fe54b7cab9
child 472272 31f6f6815fe12b96748a043ecec4508747617a0e
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1453105, 10401
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1453105 [wpt PR 10401] - Updating WebDriver execute[Async]Script tests for unhandled user prompts , a=testonly Automatic update from web-platform-testsMerge pull request #10401 from jimevans/script-user-prompts Updating WebDriver execute[Async]Script tests for unhandled user prompts -- wpt-commits: 32b05c81877aea609733d6c58eac2aefcfe02d5a wpt-pr: 10401
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/webdriver/tests/execute_async_script/user_prompts.py
testing/web-platform/tests/webdriver/tests/execute_script/user_prompts.py
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -607585,17 +607585,17 @@
    "29891e121def1917c47c70efd19b40ed5f2ea61d",
    "wdspec"
   ],
   "webdriver/tests/cookies/delete_cookie.py": [
    "dbb50588ba525f3ec27a7408eaa4c240614696d5",
    "wdspec"
   ],
   "webdriver/tests/cookies/get_named_cookie.py": [
-   "e6e265f417d17b4c9d349fbe9aa9fe3923dcfea0",
+   "a3116e826f4db0221224ccb9a0e0d71ecb1f9a85",
    "wdspec"
   ],
   "webdriver/tests/document_handling/page_source.py": [
    "5dddfce0a5e43f02b8a050afda8c9a07c43cf797",
    "wdspec"
   ],
   "webdriver/tests/element_click/__init__.py": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
@@ -607657,33 +607657,33 @@
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
   "webdriver/tests/execute_async_script/collections.py": [
    "b10e02dff5437ae2b6ed6cc17141e5643dc1b75d",
    "wdspec"
   ],
   "webdriver/tests/execute_async_script/user_prompts.py": [
-   "e31edd4537f9b7479a348465154381f5b18f938c",
+   "cf789bc7a329b78b7d61b894209d064d3d80b3b0",
    "wdspec"
   ],
   "webdriver/tests/execute_script/__init__.py": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
   "webdriver/tests/execute_script/collections.py": [
    "7162405055534f77fd7e57419b3cc2a210ddd4e0",
    "wdspec"
   ],
   "webdriver/tests/execute_script/cyclic.py": [
    "9d8a28b94b8cdac88650b675cb00bf21261444e8",
    "wdspec"
   ],
   "webdriver/tests/execute_script/user_prompts.py": [
-   "901487f8270dcce693867ca090393e093d26f22b",
+   "1cb98dd72664cfcfede1255484239f4505c06d20",
    "wdspec"
   ],
   "webdriver/tests/fullscreen_window.py": [
    "c244064c0595d9274ddef98c527d193355ba13fa",
    "wdspec"
   ],
   "webdriver/tests/get_window_rect.py": [
    "c9139c16aa950c734c776887d6a762b867790812",
--- 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
@@ -2,59 +2,73 @@ import pytest
 
 from webdriver import error
 
 
 # 15.2 Executing Script
 
 def test_handle_prompt_accept(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}})
-    session.execute_async_script("window.alert('Hello');")
+    value = session.execute_async_script("window.alert('Hello');")
+    assert value is None
+    title = session.title
     with pytest.raises(error.NoSuchAlertException):
         session.alert.accept()
 
 
 def test_handle_prompt_dismiss(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss"})}})
-    session.execute_async_script("window.alert('Hello');")
+    value = session.execute_async_script("window.alert('Hello');")
+    assert value is None
+    title = session.title
     with pytest.raises(error.NoSuchAlertException):
         session.alert.dismiss()
 
 
 def test_handle_prompt_dismiss_and_notify(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss and notify"})}})
+    value = session.execute_async_script("window.alert('Hello');")
+    assert value is None
     with pytest.raises(error.UnexpectedAlertOpenException):
-        session.execute_async_script("window.alert('Hello');")
+        title = session.title
     with pytest.raises(error.NoSuchAlertException):
         session.alert.dismiss()
 
 
 def test_handle_prompt_accept_and_notify(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept and notify"})}})
+    value = session.execute_async_script("window.alert('Hello');")
+    assert value is None
     with pytest.raises(error.UnexpectedAlertOpenException):
-        session.execute_async_script("window.alert('Hello');")
+        title = session.title
     with pytest.raises(error.NoSuchAlertException):
         session.alert.accept()
 
 
 def test_handle_prompt_ignore(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "ignore"})}})
+    value = session.execute_async_script("window.alert('Hello');")
+    assert value is None
     with pytest.raises(error.UnexpectedAlertOpenException):
-        session.execute_async_script("window.alert('Hello');")
+        title = session.title
     session.alert.dismiss()
 
 
 def test_handle_prompt_default(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}})
+    value = session.execute_async_script("window.alert('Hello');")
+    assert value is None
     with pytest.raises(error.UnexpectedAlertOpenException):
-        session.execute_async_script("window.alert('Hello');")
+        title = session.title
     with pytest.raises(error.NoSuchAlertException):
         session.alert.dismiss()
 
 
 def test_handle_prompt_twice(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}})
-    session.execute_async_script("window.alert('Hello');window.alert('Bye');")
+    value = session.execute_async_script("window.alert('Hello');window.alert('Bye');")
+    assert value is 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
@@ -2,59 +2,73 @@ import pytest
 
 from webdriver import error
 
 
 # 15.2 Executing Script
 
 def test_handle_prompt_accept(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}})
-    session.execute_script("window.alert('Hello');")
+    value = session.execute_script("window.alert('Hello');")
+    assert value is None
+    title = session.title
     with pytest.raises(error.NoSuchAlertException):
         session.alert.accept()
 
 
 def test_handle_prompt_dismiss(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss"})}})
-    session.execute_script("window.alert('Hello');")
+    value = session.execute_script("window.alert('Hello');")
+    assert value is None
+    title = session.title
     with pytest.raises(error.NoSuchAlertException):
         session.alert.dismiss()
 
 
 def test_handle_prompt_dismiss_and_notify(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "dismiss and notify"})}})
+    value = session.execute_script("window.alert('Hello');")
+    assert value is None
     with pytest.raises(error.UnexpectedAlertOpenException):
-        session.execute_script("window.alert('Hello');")
+        title = session.title
     with pytest.raises(error.NoSuchAlertException):
         session.alert.dismiss()
 
 
 def test_handle_prompt_accept_and_notify(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept and notify"})}})
+    value = session.execute_script("window.alert('Hello');")
+    assert value is None
     with pytest.raises(error.UnexpectedAlertOpenException):
-        session.execute_script("window.alert('Hello');")
+        title = session.title
     with pytest.raises(error.NoSuchAlertException):
         session.alert.accept()
 
 
 def test_handle_prompt_ignore(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "ignore"})}})
+    value = session.execute_script("window.alert('Hello');")
+    assert value is None
     with pytest.raises(error.UnexpectedAlertOpenException):
-        session.execute_script("window.alert('Hello');")
+        title = session.title
     session.alert.dismiss()
 
 
 def test_handle_prompt_default(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({})}})
+    value = session.execute_script("window.alert('Hello');")
+    assert value is None
     with pytest.raises(error.UnexpectedAlertOpenException):
-        session.execute_script("window.alert('Hello');")
+        title = session.title
     with pytest.raises(error.NoSuchAlertException):
         session.alert.dismiss()
 
 
 def test_handle_prompt_twice(new_session, add_browser_capabilites):
     _, session = new_session({"capabilities": {"alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}})
-    session.execute_script("window.alert('Hello');window.alert('Bye');")
+    value = session.execute_script("window.alert('Hello');window.alert('Bye');")
+    assert value is 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()