Bug 1302707 - Add test for Marionette:timeouts compat behaviour; r?automatedtester
The input type for the `ms` field when passing the old JSON schema that
puts Marionette into the backwards compatible behaviour, accepts string
types that are `parseInt`ed into an integer. This change adds a test
for this.
MozReview-Commit-ID: GJ3ibit7tyG
--- a/testing/marionette/harness/marionette/tests/unit/test_timeouts.py
+++ b/testing/marionette/harness/marionette/tests/unit/test_timeouts.py
@@ -69,8 +69,15 @@ class TestTimeouts(MarionetteTestCase):
"""))
def test_invalid_timeout_types(self):
for val in [3.14, True, [], {}, "foo"]:
print "testing %s" % type(val)
self.assertRaises(InvalidArgumentException, self.marionette.set_search_timeout, val)
self.assertRaises(InvalidArgumentException, self.marionette.set_script_timeout, val)
self.assertRaises(InvalidArgumentException, self.marionette.set_page_load_timeout, val)
+
+ def test_compat_input_types(self):
+ # When using the spec-incompatible input format which we have
+ # for backwards compatibility, it should be possible to send ms
+ # as a string type and have the server parseInt it to an integer.
+ body = {"type": "script", "ms": "30000"}
+ self.marionette._send_message("timeouts", body)