bug 1529282: mozrunner: support searching for Nightly’s default path on macOS. r=ato
authorKriti Singh <kritisingh1.ks@gmail.com>
Fri, 15 Mar 2019 14:46:08 +0000
changeset 525100 b4485dab99763dafaf707a017ec3eaec43099c9d
parent 525099 9dcc555ea352f0dc8bdf58dc82bf57e4d0bfedd0
child 525101 bb5c5efcd205a133750d4494399ec42debaa8de9
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato
bugs1529282
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 1529282: mozrunner: support searching for Nightly’s default path on macOS. r=ato
testing/geckodriver/CHANGES.md
testing/geckodriver/doc/Capabilities.md
testing/mozbase/rust/mozrunner/src/runner.rs
--- a/testing/geckodriver/CHANGES.md
+++ b/testing/geckodriver/CHANGES.md
@@ -2,16 +2,32 @@ Change log
 ==========
 
 All notable changes to this program is documented in this file.
 
 
 Unreleased
 ----------
 
+### Added
+
+- Added support for searching for Nightly’s default path on macOS
+
+  If the location of the Firefox binary is not given, geckodriver
+  will from now also look for the location of Firefox Nightly in
+  the default locations.  The ordered list of search paths on macOS
+  is as follows:
+
+    1. `/Applications/Firefox.app/Contents/MacOS/firefox-bin`
+    2. `$HOME/Applications/Firefox.app/Contents/MacOS/firefox-bin`
+    3. `/Applications/Firefox Nightly.app/Contents/MacOS/firefox-bin`
+    4. `$HOME/Applications/Firefox Nightly.app/Contents/MacOS/firefox-bin`
+
+  Thanks to [Kriti Singh] for this patch.
+
 ### Removed
 
 - Dropped support for legacy Selenium web element references
 
   The legacy way of serialising web elements, using `{"ELEMENT": <UUID>}`,
   has been removed in this release.  This may break older Selenium
   clients and clients which are otherwise not compatible with the
   WebDriver standard.
@@ -1189,11 +1205,12 @@ 0.1.0 (2015-04-09)
 [Take Element Screenshot]: https://w3c.github.io/webdriver/webdriver-spec.html#take-element-screenshot
 [WebDriver errors]: https://w3c.github.io/webdriver/webdriver-spec.html#handling-errors
 
 [Bastien Orivel]: https://github.com/Eijebong
 [Jason Juang]: https://github.com/juangj
 [Jeremy Lempereur]: https://github.com/o0Ignition0o
 [Joshua Bruning]: https://github.com/joshbruning
 [Kalpesh Krishna]: https://github.com/martiansideofthemoon
+[Kriti Singh]: https://github.com/kritisingh1
 [Mike Pennisi]: https://github.com/jugglinmike
 [Sven Jost]: https://github/mythsunwind
 [Vlad Filippov]: https://github.com/vladikoff
--- a/testing/geckodriver/doc/Capabilities.md
+++ b/testing/geckodriver/doc/Capabilities.md
@@ -28,23 +28,26 @@ started and run. It may contain any of t
  <tr id=capability-binary>
   <td><code>binary</code>
   <td align="center">string
   <td><p>
    Absolute path of the Firefox binary
    to select which custom browser binary to use.
    If left undefined geckodriver will attempt
    to deduce the default location of Firefox
-   on the current system.
+   on the current system. If Firefox stable is
+   not installed, it will suggest the default
+   location of Firefox Nightly instead.
 
    <p>
    On macOS the path must be absolute to the browser binary,
-   e.g. <code>/Applications/Firefox.app/Contents/MacOS/firefox</code>.
+   e.g. <code>/Applications/Firefox.app/Contents/MacOS/firefox</code> or,
+   in case of Nightly, <code>/Applications/Firefox Nightly.app/Contents/MacOS/firefox</code>
    Specifying an application bundle such as <code>/Applications/Firefox.app</code>
-   will <em>not</em> work.
+   or <code>/Applications/Firefox Nightly.app</code> will <em>not</em> work.
  </tr>
 
  <tr id=capability-args>
   <td><code>args</code>
   <td align="center">array&nbsp;of&nbsp;strings
   <td><p>Command line arguments to pass to the Firefox binary.
    These must include the leading dash (<code>-</code>) where required,
    e.g. <code>["-devtools"]</code>.
--- a/testing/mozbase/rust/mozrunner/src/runner.rs
+++ b/testing/mozbase/rust/mozrunner/src/runner.rs
@@ -310,30 +310,30 @@ pub mod platform {
 
 #[cfg(target_os = "macos")]
 pub mod platform {
     use crate::path::{find_binary, is_binary};
     use dirs;
     use std::path::PathBuf;
 
     /// Searches the system path for `firefox-bin`, then looks for
-    /// `Applications/Firefox.app/Contents/MacOS/firefox-bin` under both `/`
-    /// (system root) and the user home directory.
+    /// `Applications/Firefox.app/Contents/MacOS/firefox-bin` as well
+    /// as `Applications/Firefox Nightly.app/Contents/MacOS/firefox-bin`
+    /// under both `/` (system root) and the user home directory.
     pub fn firefox_default_path() -> Option<PathBuf> {
         if let Some(path) = find_binary("firefox-bin") {
             return Some(path);
         }
 
         let home = dirs::home_dir();
         for &(prefix_home, trial_path) in [
-            (
-                false,
-                "/Applications/Firefox.app/Contents/MacOS/firefox-bin",
-            ),
+            (false, "/Applications/Firefox.app/Contents/MacOS/firefox-bin"),
             (true, "Applications/Firefox.app/Contents/MacOS/firefox-bin"),
+            (false, "/Applications/Firefox Nightly.app/Contents/MacOS/firefox-bin"),
+            (true, "Applications/Firefox Nightly.app/Contents/MacOS/firefox-bin"),
         ].iter()
         {
             let path = match (home.as_ref(), prefix_home) {
                 (Some(ref home_dir), true) => home_dir.join(trial_path),
                 (None, true) => continue,
                 (_, false) => PathBuf::from(trial_path),
             };
             if is_binary(&path) {