Bug 1342162 - Align pageLoad key with WebDriver. r=maja_zf, a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Thu, 23 Feb 2017 18:33:26 +0000
changeset 379273 8016d994c82a9b29a7865020fc52b7521b376b96
parent 379272 46d5fe92c82d36b922703faeb7dd3a17b5df55e1
child 379274 cd8a7b46639c04e6b89157d1283a0d34f8602889
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaja_zf, test-only
bugs1342162, 1316622
milestone53.0
Bug 1342162 - Align pageLoad key with WebDriver. r=maja_zf, a=test-only The WebDriver specification recently decided to use "pageLoad" instead of "page load" to identify the page load duration timeout in the session timeouts configuration object: https://github.com/w3c/webdriver/pull/796 This change aligns Marionette with WebDriver, and as long as this patch is uplifted to Aurora (53) and Beta (52) in reasonable time, we should be able to avoid the backwards compatibility dance with the Python client (for upgrade tests) because the original change to the data format landed on the current Firefox version: https://bugzilla.mozilla.org/show_bug.cgi?id=1316622 MozReview-Commit-ID: BzQeJku4AFS
testing/marionette/client/marionette_driver/timeout.py
testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
testing/marionette/session.js
testing/marionette/test_session.js
--- a/testing/marionette/client/marionette_driver/timeout.py
+++ b/testing/marionette/client/marionette_driver/timeout.py
@@ -58,25 +58,25 @@ class Timeouts(object):
 
     @property
     def page_load(self):
         """Get the session's page load timeout.  This specifies the time
         to wait for the page loading to complete.  It is by default 5
         minutes (or 300 seconds).
 
         """
-        return self._get("page load")
+        return self._get("pageLoad")
 
     @page_load.setter
     def page_load(self, sec):
         """Set the session's page load timeout.  This specifies the time
         to wait for the page loading to complete.
 
         """
-        self._set("page load", sec)
+        self._set("pageLoad", sec)
 
     @property
     def implicit(self):
         """Get the session's implicit wait timeout.  This specifies the
         time to wait for the implicit element location strategy when
         retrieving elements.  It is by default disabled (0 seconds).
 
         """
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
@@ -30,17 +30,17 @@ class TestCapabilities(MarionetteTestCas
 
         self.assertEqual(self.caps["browserName"], self.appinfo["name"].lower())
         self.assertEqual(self.caps["browserVersion"], self.appinfo["version"])
         self.assertEqual(self.caps["platformName"], self.os_name)
         self.assertEqual(self.caps["platformVersion"], self.os_version)
         self.assertFalse(self.caps["acceptInsecureCerts"])
         self.assertDictEqual(self.caps["timeouts"],
                              {"implicit": 0,
-                              "page load": 300000,
+                              "pageLoad": 300000,
                               "script": 30000})
 
     def test_supported_features(self):
         self.assertIn("rotatable", self.caps)
 
     def test_additional_capabilities(self):
         self.assertIn("moz:processID", self.caps)
         self.assertEqual(self.caps["moz:processID"], self.appinfo["processID"])
@@ -240,14 +240,14 @@ class TestCapabilityMatching(MarionetteT
 
     def test_proxy_required(self):
         self.marionette.start_session({"requiredCapabilities": {"proxy": {"proxyType": "manual"}}})
         self.assertIn("proxy", self.marionette.session_capabilities)
         self.assertEqual(self.marionette.session_capabilities["proxy"]["proxyType"], "manual")
         self.assertEqual(self.marionette.get_pref("network.proxy.type"), 1)
 
     def test_timeouts(self):
-        timeouts = {u"implicit": 123, u"page load": 456, u"script": 789}
+        timeouts = {u"implicit": 123, u"pageLoad": 456, u"script": 789}
         caps = {"desiredCapabilities": {"timeouts": timeouts}}
         self.marionette.start_session(caps)
         self.assertIn("timeouts", self.marionette.session_capabilities)
         self.assertDictEqual(self.marionette.session_capabilities["timeouts"], timeouts)
         self.assertDictEqual(self.marionette._send_message("getTimeouts"), timeouts)
--- a/testing/marionette/session.js
+++ b/testing/marionette/session.js
@@ -37,19 +37,19 @@ session.Timeouts = class {
     // 30 seconds
     this.script = 30000;
   }
 
   toString () { return "[object session.Timeouts]"; }
 
   toJSON () {
     return {
-      "implicit": this.implicit,
-      "page load": this.pageLoad,
-      "script": this.script,
+      implicit: this.implicit,
+      pageLoad: this.pageLoad,
+      script: this.script,
     };
   }
 
   static fromJSON (json) {
     assert.object(json);
     let t = new session.Timeouts();
 
     for (let [typ, ms] of Object.entries(json)) {
@@ -59,17 +59,17 @@ session.Timeouts = class {
         case "implicit":
           t.implicit = ms;
           break;
 
         case "script":
           t.script = ms;
           break;
 
-        case "page load":
+        case "pageLoad":
           t.pageLoad = ms;
           break;
 
         default:
           throw new InvalidArgumentError();
       }
     }
 
--- a/testing/marionette/test_session.js
+++ b/testing/marionette/test_session.js
@@ -24,31 +24,31 @@ add_test(function test_Timeouts_ctor() {
 add_test(function test_Timeouts_toString() {
   equal(new session.Timeouts().toString(), "[object session.Timeouts]");
 
   run_next_test();
 });
 
 add_test(function test_Timeouts_toJSON() {
   let ts = new session.Timeouts();
-  deepEqual(ts.toJSON(), {"implicit": 0, "page load": 300000, "script": 30000});
+  deepEqual(ts.toJSON(), {"implicit": 0, "pageLoad": 300000, "script": 30000});
 
   run_next_test();
 });
 
 add_test(function test_Timeouts_fromJSON() {
   let json = {
-    "implicit": 10,
-    "page load": 20,
-    "script": 30,
+    implicit: 10,
+    pageLoad: 20,
+    script: 30,
   };
   let ts = session.Timeouts.fromJSON(json);
-  equal(ts.implicit, json["implicit"]);
-  equal(ts.pageLoad, json["page load"]);
-  equal(ts.script, json["script"]);
+  equal(ts.implicit, json.implicit);
+  equal(ts.pageLoad, json.pageLoad);
+  equal(ts.script, json.script);
 
   run_next_test();
 });
 
 add_test(function test_PageLoadStrategy() {
   equal(session.PageLoadStrategy.None, "none");
   equal(session.PageLoadStrategy.Eager, "eager");
   equal(session.PageLoadStrategy.Normal, "normal");