webrecorder / wombat

Wombat.js client-side rewriting library
GNU Affero General Public License v3.0
81 stars 31 forks source link

Test runner fails to find Google Chrome on macOS #44

Closed robertknight closed 3 years ago

robertknight commented 3 years ago

Running yarn test fails on my system. The test runner reports that it is unable to find Google Chrome:


  2 hooks failed

  direct-custom-storage › before hook

  /Users/robert/other/wombat/node_modules/just-launch-chrome/lib/launcher.js:80

  Rejected promise returned by test. Reason:

  Error {
    message: 'Could not find any Chrome/Chromium executables on this system',
  }

  ensureArgs (node_modules/just-launch-chrome/lib/launcher.js:80:13)
  launch (node_modules/just-launch-chrome/lib/launcher.js:124:30)
  initChrome (test/helpers/initChrome.js:42:62)
  Function.init (test/helpers/testHelper.js:12:21)
  test/direct-custom-storage.js:10:12

My laptop is running macOS 11.1 with Google Chrome (Dev) installed to the default location: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome.

If I modify initChrome.js to explicitly specify the path to Chrome then the tests run successfully:

diff --git a/test/helpers/initChrome.js b/test/helpers/initChrome.js
index 72b5e73..cae7de1 100644
--- a/test/helpers/initChrome.js
+++ b/test/helpers/initChrome.js
@@ -40,7 +40,8 @@ const chromeArgs = [
  */
 async function initChrome() {
   const { browserWSEndpoint, closeBrowser, chromeProcess } = await launch({
-    args: chromeArgs
+    args: chromeArgs,
+    executable: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
   });
   const browser = await Browser.connect(browserWSEndpoint, {
     ignoreHTTPSErrors: true,
robertknight commented 3 years ago

Aside from the specific issue here, I have a broader question: What is the reason to use just-launch-chrome rather than https://github.com/GoogleChrome/chrome-launcher/? The chrome-launcher project has the advantage that it is actively maintained by the Chrome team.