Bug 1455282 - [wdspec] Add tests for Close Window command. r=ato
☠☠ backed out by c4027f932a52 ☠ ☠
authorHenrik Skupin <mail@hskupin.info>
Fri, 20 Apr 2018 10:50:14 +0200
changeset 471333 295fd2df534f6a5f59f9d620be955a3e70ade74b
parent 471332 843cb0cb835e31fb6aa1719617e23770129e39ba
child 471334 c4027f932a5276de4d704103e0d0f0361b94d61a
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)
reviewersato
bugs1455282
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 1455282 - [wdspec] Add tests for Close Window command. r=ato MozReview-Commit-ID: 13j69lZhr1G
testing/web-platform/meta/MANIFEST.json
testing/web-platform/meta/webdriver/tests/close_window/user_prompts.py.ini
testing/web-platform/tests/webdriver/tests/close_window/close.py
testing/web-platform/tests/webdriver/tests/close_window/user_prompts.py
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -393704,16 +393704,28 @@
    "webdriver/tests/actions/special_keys.py": [
     [
      "/webdriver/tests/actions/special_keys.py",
      {
       "timeout": "long"
      }
     ]
    ],
+   "webdriver/tests/close_window/close.py": [
+    [
+     "/webdriver/tests/close_window/close.py",
+     {}
+    ]
+   ],
+   "webdriver/tests/close_window/user_prompts.py": [
+    [
+     "/webdriver/tests/close_window/user_prompts.py",
+     {}
+    ]
+   ],
    "webdriver/tests/contexts/json_serialize_windowproxy.py": [
     [
      "/webdriver/tests/contexts/json_serialize_windowproxy.py",
      {
       "timeout": "long"
      }
     ]
    ],
@@ -393854,16 +393866,28 @@
    "webdriver/tests/fullscreen_window.py": [
     [
      "/webdriver/tests/fullscreen_window.py",
      {
       "timeout": "long"
      }
     ]
    ],
+   "webdriver/tests/fullscreen_window/user_prompts.py": [
+    [
+     "/webdriver/tests/fullscreen_window/user_prompts.py",
+     {}
+    ]
+   ],
+   "webdriver/tests/get_active_element/user_prompts.py": [
+    [
+     "/webdriver/tests/get_active_element/user_prompts.py",
+     {}
+    ]
+   ],
    "webdriver/tests/get_window_rect.py": [
     [
      "/webdriver/tests/get_window_rect.py",
      {}
     ]
    ],
    "webdriver/tests/interaction/element_clear.py": [
     [
@@ -606307,16 +606331,24 @@
   "webdriver/tests/actions/support/refine.py": [
    "0d244bffe67ef57be68aad99f1cbc7440ff80e27",
    "support"
   ],
   "webdriver/tests/actions/support/test_actions_wdspec.html": [
    "95203777fcc012ab64465287737a89a4ba2c31dc",
    "support"
   ],
+  "webdriver/tests/close_window/close.py": [
+   "4138394adbccb06712b22a2f982e8638aa03629a",
+   "wdspec"
+  ],
+  "webdriver/tests/close_window/user_prompts.py": [
+   "6151fb105fafcfb462a580fc725b207eae725f6c",
+   "wdspec"
+  ],
   "webdriver/tests/conftest.py": [
    "c812269d034c9ca1b8c4f136dd5d0cea52f4d0f0",
    "support"
   ],
   "webdriver/tests/contexts/json_serialize_windowproxy.py": [
    "d29c82c48b3bd1e2b07c40798a774eb77d6178a5",
    "wdspec"
   ],
@@ -606427,16 +606459,24 @@
   "webdriver/tests/execute_script/user_prompts.py": [
    "901487f8270dcce693867ca090393e093d26f22b",
    "wdspec"
   ],
   "webdriver/tests/fullscreen_window.py": [
    "c244064c0595d9274ddef98c527d193355ba13fa",
    "wdspec"
   ],
+  "webdriver/tests/fullscreen_window/user_prompts.py": [
+   "8d6d68bb6bfa9956db5b33598ae3cf33f7022de4",
+   "wdspec"
+  ],
+  "webdriver/tests/get_active_element/user_prompts.py": [
+   "91043d10d035e89d04198e70b2fa41305b971b61",
+   "wdspec"
+  ],
   "webdriver/tests/get_window_rect.py": [
    "c9139c16aa950c734c776887d6a762b867790812",
    "wdspec"
   ],
   "webdriver/tests/interaction/element_clear.py": [
    "476fad0b4a5a38a9ac15ddeb1c26b0b18fd66e8c",
    "wdspec"
   ],
@@ -606540,17 +606580,17 @@
    "5a31a3917a5157516c10951a3b3d5ffb43b992d9",
    "support"
   ],
   "webdriver/tests/support/asserts.py": [
    "1b839404daaca1d059cba98377edb91691ef7e82",
    "support"
   ],
   "webdriver/tests/support/fixtures.py": [
-   "e787c0ef06fcdfc86f337be5af61e492be08ec9c",
+   "126e82c42568c9ecb240e735a2b1361882ecd9ba",
    "support"
   ],
   "webdriver/tests/support/http_request.py": [
    "cb40c781fea2280b98135522def5e6a116d7b946",
    "support"
   ],
   "webdriver/tests/support/inline.py": [
    "ffabd6a12d6e7928176fa00702214e0c8e0a25d7",
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/webdriver/tests/close_window/user_prompts.py.ini
@@ -0,0 +1,3 @@
+[user_prompts.py]
+  [test_handle_prompt_accept]
+    expected: FAIL
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webdriver/tests/close_window/close.py
@@ -0,0 +1,38 @@
+from tests.support.asserts import assert_error, assert_success
+
+
+def close(session):
+    return session.transport.send("DELETE", "session/%s/window" % session.session_id)
+
+
+def test_no_browsing_context(session, create_window):
+    new_handle = create_window()
+
+    session.window_handle = new_handle
+    session.close()
+    assert new_handle not in session.handles
+
+    response = close(session)
+    assert_error(response, "no such window")
+
+
+def test_close_browsing_context(session, create_window):
+    handles = session.handles
+
+    new_handle = create_window()
+    session.window_handle = new_handle
+
+    response = close(session)
+    value = assert_success(response, handles)
+    assert session.handles == handles
+    assert new_handle not in value
+
+
+def test_close_last_browsing_context(session):
+    assert len(session.handles) == 1
+    response = close(session)
+
+    assert_success(response, [])
+
+    # With no more open top-level browsing contexts, the session is closed.
+    session.session_id = None
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webdriver/tests/close_window/user_prompts.py
@@ -0,0 +1,66 @@
+from tests.support.asserts import assert_error, assert_dialog_handled
+from tests.support.fixtures import create_dialog, create_window
+from tests.support.inline import inline
+
+
+def close(session):
+    return session.transport.send("DELETE", "session/%s/window" % session.session_id)
+
+
+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_accept(new_session, add_browser_capabilites):
+    _, session = new_session({"capabilities": {
+        "alwaysMatch": add_browser_capabilites({"unhandledPromptBehavior": "accept"})}})
+    session.window_handle = create_window(session)()
+
+    session.url = inline("<title>WD doc title</title>")
+
+    create_dialog(session)("alert", text="dismiss #1", result_var="dismiss1")
+    response = close(session)
+    assert response.status == 200
+    assert_dialog_handled(session, "dismiss #1")
+
+    create_dialog(session)("confirm", text="dismiss #2", result_var="dismiss2")
+    response = close(session)
+    assert response.status == 200
+    assert_dialog_handled(session, "dismiss #2")
+
+    create_dialog(session)("prompt", text="dismiss #3", result_var="dismiss3")
+    response = close(session)
+    assert response.status == 200
+    assert_dialog_handled(session, "dismiss #3")
+
+
+def test_handle_prompt_missing_value(session, create_dialog, create_window):
+    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")
+
+    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")