Bug 1316622 - Correct Marionette timeouts tests; r?automatedtester,whimboo draft
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 10 Nov 2016 21:06:00 +0000
changeset 442877 9d4cc03b120f75c5ff924252bea2789d65cd1a72
parent 442876 3f80ef0adb0db1ed0cb65c0ced08fdeedd42a8b3
child 442878 529b127db41dfa6fde3c3c728749863c8319a7f2
push id36854
push userbmo:ato@mozilla.com
push dateWed, 23 Nov 2016 13:38:54 +0000
reviewersautomatedtester, whimboo
bugs1316622
milestone53.0a1
Bug 1316622 - Correct Marionette timeouts tests; r?automatedtester,whimboo MozReview-Commit-ID: 48JLDwc2sw4
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
@@ -16,65 +16,77 @@ class TestTimeouts(MarionetteTestCase):
         self.marionette.reset_timeouts()
         MarionetteTestCase.tearDown(self)
 
     def test_page_timeout_notdefinetimeout_pass(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
 
     def test_page_timeout_fail(self):
-        self.marionette.set_page_load_timeout(0)
+        self.marionette.timeout.page_load = 0
         test_html = self.marionette.absolute_url("test.html")
         self.assertRaises(MarionetteException, self.marionette.navigate, test_html)
 
     def test_page_timeout_pass(self):
-        self.marionette.set_page_load_timeout(60000)
+        self.marionette.timeout.page_load = 60
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
 
     def test_search_timeout_notfound_settimeout(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
-        self.marionette.set_search_timeout(1000)
+        self.marionette.timeout.implicit = 1
         self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page")
-        self.marionette.set_search_timeout(0)
+        self.marionette.timeout.implicit = 0
         self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "I'm not on the page")
 
     def test_search_timeout_found_settimeout(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         button = self.marionette.find_element(By.ID, "createDivButton")
         button.click()
-        self.marionette.set_search_timeout(8000)
+        self.marionette.timeout.implicit = 8
         self.assertEqual(HTMLElement, type(self.marionette.find_element(By.ID, "newDiv")))
 
     def test_search_timeout_found(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
         button = self.marionette.find_element(By.ID, "createDivButton")
         button.click()
         self.assertRaises(NoSuchElementException, self.marionette.find_element, By.ID, "newDiv")
 
     def test_execute_async_timeout_settimeout(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
-        self.marionette.set_script_timeout(10000)
+        self.marionette.timeout.script = 1
         self.assertRaises(ScriptTimeoutException, self.marionette.execute_async_script, "var x = 1;")
 
     def test_no_timeout_settimeout(self):
         test_html = self.marionette.absolute_url("test.html")
         self.marionette.navigate(test_html)
-        self.marionette.set_script_timeout(10000)
+        self.marionette.timeout.script = 1
         self.assertTrue(self.marionette.execute_async_script("""
              var callback = arguments[arguments.length - 1];
              setTimeout(function() { callback(true); }, 500);
              """))
 
     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("setTimeouts", body)
 
     def test_deprecated_set_timeouts_command(self):
         body = {"implicit": 3000}
         self.marionette._send_message("timeouts", body)
+
+    def test_deprecated_set_search_timeout(self):
+        self.marionette.set_search_timeout(1000)
+        self.assertEqual(1, self.marionette.timeout.implicit)
+
+    def test_deprecated_set_script_timeout(self):
+        self.marionette.set_script_timeout(2000)
+        self.assertEqual(2, self.marionette.timeout.script)
+
+    def test_deprecated_set_page_load_timeout(self):
+        self.marionette.set_page_load_timeout(3000)
+        self.assertEqual(3, self.marionette.timeout.page_load)