Bug 1525829 - Add buildID to returned capabilities list for Marionette; r=ato
authorDavid Burns <dburns@mozilla.com>
Wed, 13 Feb 2019 10:23:30 +0000
changeset 458869 9092cd81ee1b
parent 458868 e381b765ee73
child 458870 5a45da4e35b2
push id35551
push usershindli@mozilla.com
push dateWed, 13 Feb 2019 21:34:09 +0000
treeherdermozilla-central@08f794a4928e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1525829
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1525829 - Add buildID to returned capabilities list for Marionette; r=ato Add buildID to returned list of capabilities when a new session is started with Marionette. This new capability will live in moz:buildID. Differential Revision: https://phabricator.services.mozilla.com/D18974
testing/marionette/capabilities.js
testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
testing/marionette/test/unit/test_capabilities.js
--- a/testing/marionette/capabilities.js
+++ b/testing/marionette/capabilities.js
@@ -403,16 +403,17 @@ class Capabilities extends Map {
       ["strictFileInteractability", false],
       ["unhandledPromptBehavior", UnhandledPromptBehavior.DismissAndNotify],
 
       // features
       ["rotatable", appinfo.name == "B2G"],
 
       // proprietary
       ["moz:accessibilityChecks", false],
+      ["moz:buildID", Services.appinfo.appBuildID],
       ["moz:headless", Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo).isHeadless],
       ["moz:processID", Services.appinfo.processID],
       ["moz:profile", maybeProfile()],
       ["moz:shutdownTimeout", Services.prefs.getIntPref("toolkit.asyncshutdown.crash_timeout")],
       ["moz:useNonSpecCompliantPointerOrigin", false],
       ["moz:webdriverClick", true],
     ]);
   }
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py
@@ -14,16 +14,17 @@ class TestCapabilities(MarionetteTestCas
         super(TestCapabilities, self).setUp()
         self.caps = self.marionette.session_capabilities
         with self.marionette.using_context("chrome"):
             self.appinfo = self.marionette.execute_script("""
                 return {
                   name: Services.appinfo.name,
                   version: Services.appinfo.version,
                   processID: Services.appinfo.processID,
+                  buildID: Services.appinfo.appBuildID,
                 }
                 """)
             self.os_name = self.marionette.execute_script("""
                 let name = Services.sysinfo.getProperty("name");
                 switch (name) {
                   case "Windows_NT":
                     return "windows";
                   case "Darwin":
@@ -98,16 +99,18 @@ class TestCapabilities(MarionetteTestCas
             else:
                 current_profile = self.marionette.profile_path
             # Bug 1438461 - mozprofile uses lower-case letters even on case-sensitive filesystems
             self.assertEqual(self.caps["moz:profile"].lower(), current_profile.lower())
 
         self.assertIn("moz:accessibilityChecks", self.caps)
         self.assertFalse(self.caps["moz:accessibilityChecks"])
 
+        self.assertIn("moz:buildID", self.caps)
+        self.assertEqual(self.caps["moz:buildID"], self.appinfo["buildID"])
         self.assertIn("moz:useNonSpecCompliantPointerOrigin", self.caps)
         self.assertFalse(self.caps["moz:useNonSpecCompliantPointerOrigin"])
 
         self.assertIn("moz:webdriverClick", self.caps)
         self.assertTrue(self.caps["moz:webdriverClick"])
 
     def test_disable_webdriver_click(self):
         self.marionette.delete_session()
@@ -227,9 +230,8 @@ class TestCapabilityMatching(MarionetteT
                          "dismiss and notify")
 
         # Invalid values
         self.delete_session()
         for behavior in [None, "", "ACCEPT", True, 42, {}, []]:
             print("invalid unhandled prompt behavior {}".format(behavior))
             with self.assertRaisesRegexp(SessionNotCreatedException, "InvalidArgumentError"):
                 self.marionette.start_session({"unhandledPromptBehavior": behavior})
-
--- a/testing/marionette/test/unit/test_capabilities.js
+++ b/testing/marionette/test/unit/test_capabilities.js
@@ -381,16 +381,17 @@ add_test(function test_Capabilities_ctor
   ok(caps.get("timeouts") instanceof Timeouts);
   ok(caps.get("proxy") instanceof Proxy);
   equal(caps.get("setWindowRect"), false); // xpcshell does not populate appinfo
   equal(caps.get("strictFileInteractability"), false);
 
   ok(caps.has("rotatable"));
 
   equal(false, caps.get("moz:accessibilityChecks"));
+  ok(caps.has("moz:buildID"));
   ok(caps.has("moz:processID"));
   ok(caps.has("moz:profile"));
   equal(false, caps.get("moz:useNonSpecCompliantPointerOrigin"));
   equal(true, caps.get("moz:webdriverClick"));
 
   run_next_test();
 });
 
@@ -413,16 +414,17 @@ add_test(function test_Capabilities_toJS
   deepEqual(caps.get("timeouts").toJSON(), json.timeouts);
   equal(undefined, json.proxy);
   equal(caps.get("setWindowRect"), json.setWindowRect);
   equal(caps.get("strictFileInteractability"), json.strictFileInteractability);
 
   equal(caps.get("rotatable"), json.rotatable);
 
   equal(caps.get("moz:accessibilityChecks"), json["moz:accessibilityChecks"]);
+  equal(caps.get("moz:buildID"), json["moz:buildID"]);
   equal(caps.get("moz:processID"), json["moz:processID"]);
   equal(caps.get("moz:profile"), json["moz:profile"]);
   equal(caps.get("moz:useNonSpecCompliantPointerOrigin"),
       json["moz:useNonSpecCompliantPointerOrigin"]);
   equal(caps.get("moz:webdriverClick"), json["moz:webdriverClick"]);
 
   run_next_test();
 });