Bug 1302707 - Add test for Marionette:timeouts compat behaviour. r=automatedtester, a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 26 Sep 2016 18:10:30 +0100
changeset 350520 908065fea4d140e70af22ed541de934446e2f1db
parent 350519 940456a3e1a658150c4ef23ec06e28c0657a7240
child 350521 b3cd57791e839f2f9a113e1d4ec55ccbad939c68
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester, test-only
bugs1302707
milestone50.0
Bug 1302707 - Add test for Marionette:timeouts compat behaviour. r=automatedtester, a=test-only 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)