Cypress: MacOS not detecting Microsoft Edge as a launch-able browser

Created on 6 Feb 2020  路  8Comments  路  Source: cypress-io/cypress

Current behavior:

Running cypress open fails to detect edge as selectable browser in the dropdown. Have tried using cypress run --browser edge (which tells me it can't detect an edge browser) as well as providing an absolute path of

cypress run --browser /Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge

That seems to run electron in the terminal instead of edge though this could just be because cypress hasn't been setup to run edge headlessly. I double checked that I had edge installed and the binary was in the place I expected it to be.

This file https://github.com/cypress-io/cypress/blob/develop/packages/launcher/lib/darwin/index.ts

indicates where cypress is looking so I am a bit stumped.

(Just noticed that the const detectEdge doesn't provide "Microsoft Edge.app" line like say the const detectFirefox does on line 27 of the link I provided above. Might that be the issue?

Desired behavior:

Edge binary should be automatically detected by cypress.

Test code to reproduce

Install edge(chromium) for MacOS
npm init
npm install cypress@latest
cypress open

Versions

MacOS Mojave 10.14.6, Microsoft Edge (non dev or canary builds), cypress 4.0.0, node 12.0.0

mac edge existing workaround bug v4.0.0

Most helpful comment

I am experiencing the same issue. I have Edge, Edge Beta, Edge Canary, and Edge Developer all installed on my system - none of which are detected.

Screen Shot 2020-02-07 at 11 47 05 AM

Workaround

Find the location that Microsoft Edge is installed in and run that with the --browser flag. It's a little tricky and I show how to do this in MacOS in the Gif below. (I'm not sure this drag and drop works on all terminals tbh, I'm using iTerm2)

My path was /Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge

This will pre-select the found browser and it's called Custom Edge 79.

Screen Shot 2020-02-07 at 12 02 03 PM

Similarly for cypress run --browser, this will launch and run the tests in Microsoft Edge.

For debugging

Logging the browser object after this launch gives the following object.

plugins/index.js

module.exports = (on, config) => {
  on('before:browser:launch', (browser = {}, launchOptions) => {
    console.log(browser)
  })
}
{
  name: 'edge',
  family: 'chromium',
  channel: 'stable',
  displayName: 'Custom Edge',
  versionRegex: {},
  profile: true,
  binary: 'edge',
  info: 'Loaded from /Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
  custom: true,
  path: '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
  version: '79.0.309.71',
  majorVersion: 79,
  isHeadless: false,
  isHeaded: true
}

All 8 comments

I am experiencing the same issue. I have Edge, Edge Beta, Edge Canary, and Edge Developer all installed on my system - none of which are detected.

Screen Shot 2020-02-07 at 11 47 05 AM

Workaround

Find the location that Microsoft Edge is installed in and run that with the --browser flag. It's a little tricky and I show how to do this in MacOS in the Gif below. (I'm not sure this drag and drop works on all terminals tbh, I'm using iTerm2)

My path was /Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge

This will pre-select the found browser and it's called Custom Edge 79.

Screen Shot 2020-02-07 at 12 02 03 PM

Similarly for cypress run --browser, this will launch and run the tests in Microsoft Edge.

For debugging

Logging the browser object after this launch gives the following object.

plugins/index.js

module.exports = (on, config) => {
  on('before:browser:launch', (browser = {}, launchOptions) => {
    console.log(browser)
  })
}
{
  name: 'edge',
  family: 'chromium',
  channel: 'stable',
  displayName: 'Custom Edge',
  versionRegex: {},
  profile: true,
  binary: 'edge',
  info: 'Loaded from /Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
  custom: true,
  path: '/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
  version: '79.0.309.71',
  majorVersion: 79,
  isHeadless: false,
  isHeaded: true
}

The above solution seems to be working ok for me so far. Thanks @jennifer-shehane

It looks like in the Info.plist file that the

    <key>CFBundleIdentifier</key>
    <string>com.microsoft.edgemac</string>

https://github.com/cypress-io/cypress/blob/f48e6fdae75968c5a29af13f8d1c180042518e15/packages/launcher/lib/darwin/index.ts#L60

instead of com.microsoft.Edge

Canary shows

    <key>CFBundleIdentifier</key>
    <string>com.microsoft.edgemac.Canary</string>

I think I have found the issue affecting firefox nightly, and edge builds.

These apps for chrome and firefox have 4 params in https://github.com/cypress-io/cypress/blob/develop/packages/launcher/lib/darwin/index.ts

const detectCanary = partial(findApp, [
  'Google Chrome Canary.app',
  'Contents/MacOS/Google Chrome Canary',
  'com.google.Chrome.canary',
  'KSVersion',
])
const detectChrome = partial(findApp, [
  'Google Chrome.app',
  'Contents/MacOS/Google Chrome',
  'com.google.Chrome',
  'KSVersion',
])
const detectChromium = partial(findApp, [
  'Chromium.app',
  'Contents/DMacOS/Chromium',
  'org.chromium.Chromium',
  'CFBundleShortVersionString',
])
const detectFirefox = partial(findApp, [
  'Firefox.app',
  'Contents/MacOS/firefox-bin',
  'org.mozilla.firefox',
  'CFBundleShortVersionString',
])
const detectFirefoxDeveloperEdition = partial(findApp, [
  'Firefox Developer Edition.app',
  'Contents/MacOS/firefox-bin',
  'org.mozilla.firefoxdeveloperedition',
  'CFBundleShortVersionString',
])

These for firefox nightly and edge have 3

const detectFirefoxNightly = partial(findApp, [
  'Firefox Nightly.app',
  'Contents/MacOS/firefox-bin',
  'org.mozilla.nightly',
])
const detectEdgeCanary = partial(findApp, [
  'Contents/MacOS/Microsoft Edge Canary',
  'com.microsoft.Edge.Canary',
  'CFBundleShortVersionString',
])
const detectEdgeBeta = partial(findApp, [
  'Contents/MacOS/Microsoft Edge Beta',
  'com.microsoft.Edge.Beta',
  'CFBundleShortVersionString',
])
const detectEdgeDev = partial(findApp, [
  'Contents/MacOS/Microsoft Edge Dev',
  'com.microsoft.Edge.Dev',
  'CFBundleShortVersionString',
])
const detectEdge = partial(findApp, [
  'Contents/MacOS/Microsoft Edge',
  'com.microsoft.Edge',
  'CFBundleShortVersionString',
])

There needs to be a 4th param for

detectFirefoxNightly

const detectFirefoxNightly = partial(findApp, [
  'Firefox Nightly.app',
  'Contents/MacOS/firefox-bin',
  'org.mozilla.nightly',
  'CFBundleShortVersionString'
])

For edge, it should be

const detectEdgeCanary = partial(findApp, [
'Microsoft Edge Canary.app',
  'Contents/MacOS/Microsoft Edge Canary',
  'com.microsoft.Edge.Canary',
  'CFBundleShortVersionString',
])
const detectEdgeBeta = partial(findApp, [
'Microsoft Edge Beta.app',
  'Contents/MacOS/Microsoft Edge Beta',
  'com.microsoft.Edge.Beta',
  'CFBundleShortVersionString',
])
const detectEdgeDev = partial(findApp, [
'Microsoft Edge Dev.app',
  'Contents/MacOS/Microsoft Edge Dev',
  'com.microsoft.Edge.Dev',
  'CFBundleShortVersionString',
])
const detectEdge = partial(findApp, [
'Microsoft Edge.app',
  'Contents/MacOS/Microsoft Edge',
  'com.microsoft.Edge',
  'CFBundleShortVersionString',
])

This is because findApp function in utils.ts (https://github.com/cypress-io/cypress/blob/develop/packages/launcher/lib/darwin/util.ts) takes 4 parameters

  appName: string,
  executable: string,
  appId: string,
  versionProperty: string

It also looks like the CFBundleIdentifier is different so is now

com.microsoft.edgemac
com.microsoft.edgemac.Beta
com.microsoft.edgemac.Canary
com.microsoft.edgemac.Dev

so edge should probably be

const detectEdgeCanary = partial(findApp, [
'Microsoft Edge Canary.app',
  'Contents/MacOS/Microsoft Edge Canary',
  'com.microsoft.edgemac.Canary',
  'CFBundleShortVersionString',
])
const detectEdgeBeta = partial(findApp, [
'Microsoft Edge Beta.app',
  'Contents/MacOS/Microsoft Edge Beta',
  'com.microsoft.edgemac.Beta',
  'CFBundleShortVersionString',
])
const detectEdgeDev = partial(findApp, [
'Microsoft Edge Dev.app',
  'Contents/MacOS/Microsoft Edge Dev',
  'com.microsoft.edgemac.Dev',
  'CFBundleShortVersionString',
])
const detectEdge = partial(findApp, [
'Microsoft Edge.app',
  'Contents/MacOS/Microsoft Edge',
  'com.microsoft.edgemac',
  'CFBundleShortVersionString',
])

The code for this is done in cypress-io/cypress#6364, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

Released in 4.0.1.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.0.1, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zbigniewkalinowski picture zbigniewkalinowski  路  3Comments

dkreft picture dkreft  路  3Comments

rbung picture rbung  路  3Comments

weskor picture weskor  路  3Comments

simonhaenisch picture simonhaenisch  路  3Comments