Bug 1302707 - Add test for Marionette:timeouts compat behaviour; r?automatedtester draft
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 26 Sep 2016 18:10:30 +0100
changeset 418527 6c2cfb4d71561373360d01cab85f909ecbc1534f
parent 418526 94a13a4b82a73c73a48687d2be2553018c08531a
child 418528 cf77a6fe9b6a54b429677fa99239d0239369af16
push id30699
push userbmo:ato@mozilla.com
push dateWed, 28 Sep 2016 16:44:24 +0000
reviewersautomatedtester
bugs1302707
milestone52.0a1
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
testing/marionette/harness/marionette/tests/unit/test_timeouts.py
--- 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)