Bug 1332760 - Run mozscreenshots on non-Nightly mozilla-central builds. r=bgrins draft
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Fri, 20 Jan 2017 15:17:10 -0800
changeset 464520 ec456fb7ea64be6bb9508124e05594ddfc9cfe4f
parent 464519 4bfa82216639a496a20b05319d0c001ce1892e5f
child 542917 4a25a581fe45dd3de8fbe4bfbbfac60a1e65cef8
push id42350
push usermozilla@noorenberghe.ca
push dateFri, 20 Jan 2017 23:18:04 +0000
reviewersbgrins
bugs1332760
milestone53.0a1
Bug 1332760 - Run mozscreenshots on non-Nightly mozilla-central builds. r=bgrins MozReview-Commit-ID: KfnndANzfeW
browser/tools/mozscreenshots/head.js
--- a/browser/tools/mozscreenshots/head.js
+++ b/browser/tools/mozscreenshots/head.js
@@ -29,27 +29,34 @@ function* setup() {
       isnot(aAddon, null, "The mozscreenshots extension should be installed");
       AddonWatcher.ignoreAddonPermanently(aAddon.id);
       TestRunner = Cu.import("chrome://mozscreenshots/content/TestRunner.jsm", {}).TestRunner;
       resolve();
     });
   });
 }
 
+/**
+ * Used by pre-defined sets of configurations to decide whether to run for a build.
+ * @note This is not used by browser_screenshots.js which handles when MOZSCREENSHOTS_SETS is set.
+ * @return {bool} whether to capture screenshots.
+ */
 function shouldCapture() {
-  // Try pushes only capture in browser_screenshots.js with MOZSCREENSHOTS_SETS.
   if (env.get("MOZSCREENSHOTS_SETS")) {
     ok(true, "MOZSCREENSHOTS_SETS was specified so only capture what was " +
        "requested (in browser_screenshots.js)");
     return false;
   }
 
-  // Automation isn't able to schedule test jobs to only run on nightlies so we handle it here
-  // (see also: bug 1116275).
-  let capture = AppConstants.MOZ_UPDATE_CHANNEL == "nightly" ||
-                AppConstants.SOURCE_REVISION_URL == "";
+  if (AppConstants.MOZ_UPDATE_CHANNEL == "nightly") {
+    ok(true, "Screenshots aren't captured on Nightlies");
+    return false;
+  }
+
+  // Don't run pre-defined sets (e.g. primaryUI) on try, require MOZSCREENSHOTS_SETS.
+  let capture = !AppConstants.SOURCE_REVISION_URL.includes("/try/rev/");
   if (!capture) {
-    ok(true, "Capturing is disabled for this MOZ_UPDATE_CHANNEL or REPO");
+    ok(true, "Capturing is disabled for this REPO. You may need to use MOZSCREENSHOTS_SETS");
   }
   return capture;
 }
 
 add_task(setup);