Merge pull request #8224 from w3c/sync_3f6bfc6fad9bac3e5ba732939e70140057e8760b
Display error when response is unsuccessful.
diff --git a/webdriver/tests/support/asserts.py b/webdriver/tests/support/asserts.py
index 21cc07b..c2cf84a 100644
--- a/webdriver/tests/support/asserts.py
+++ b/webdriver/tests/support/asserts.py
@@ -68,6 +68,7 @@
assert isinstance(response.body["value"]["message"], basestring)
assert isinstance(response.body["value"]["stacktrace"], basestring)
+
def assert_success(response, value=None):
"""Verify that the provided wdclient.Response instance described a valid
error response as defined by `dfn-send-an-error` and the provided error
@@ -77,11 +78,13 @@
:param value: Expected value of the response body, if any.
"""
- assert response.status == 200
+ assert response.status == 200, str(response.error)
+
if value is not None:
assert response.body["value"] == value
return response.body.get("value")
+
def assert_dialog_handled(session, expected_text):
result = session.transport.send("GET",
"session/%s/alert/text" % session.session_id)
@@ -97,6 +100,7 @@
result.body["value"] != expected_text), (
"Dialog with text '%s' was not handled." % expected_text)
+
def assert_same_element(session, a, b):
"""Verify that two element references describe the same element."""
assert isinstance(a, dict), "Actual value is not a dictionary"