Bug 1378121 - Add Window Minimize wdspec tests; r=jgraham draft
authoryangyi_peng@htc.com
Mon, 17 Jul 2017 15:47:33 +0800
changeset 609690 a592f274040e
parent 608873 65ed548dee5d
child 637625 3ce43c8a755c
push id68637
push userbmo:yangyi_peng@htc.com
push dateMon, 17 Jul 2017 07:51:51 +0000
reviewersjgraham
bugs1378121
milestone56.0a1
Bug 1378121 - Add Window Minimize wdspec tests; r=jgraham MozReview-Commit-ID: 4P5oegznAvf
testing/web-platform/tests/webdriver/window_minimizing.py
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/webdriver/window_minimizing.py
@@ -0,0 +1,28 @@
+from support.inline import inline
+from support.asserts import assert_error, assert_success
+
+alert_doc = inline("<script>window.alert()</script>")
+
+# 10.7.4 Minimize Window
+def test_minimize_no_browsing_context(session, create_window):
+    session.window_handle = create_window()
+    session.close()
+    result = session.transport.send("POST", "session/%s/window/minimize" % session.session_id)
+
+    assert_error(result, "no such window")
+
+
+def test_minimize_rect_alert_prompt(session):
+    session.url = alert_doc
+
+    result = session.transport.send("POST", "session/%s/window/minimize" % session.session_id)
+
+    assert_error(result, "unexpected alert open")
+
+
+def test_minimize_payload(session):
+    result = session.transport.send("POST", "session/%s/window/minimize" % session.session_id)
+
+    assert result.status == 200
+    visible = str(session.execute_script("return window.document.visibilityState"))
+    assert visible == "hidden"