Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS not detecting Microsoft Edge as a launch-able browser #6354

Closed
jordandlaman opened this issue Feb 6, 2020 · 8 comments · Fixed by #6364
Closed

MacOS not detecting Microsoft Edge as a launch-able browser #6354

jordandlaman opened this issue Feb 6, 2020 · 8 comments · Fixed by #6364

Comments

@jordandlaman
Copy link

jordandlaman commented Feb 6, 2020

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

@jennifer-shehane jennifer-shehane added browser: edge stage: needs investigating Someone from Cypress needs to look at this v4.0.0 🐛 Issue present since 4.0.0 labels Feb 7, 2020
@jennifer-shehane
Copy link
Member

jennifer-shehane commented Feb 7, 2020

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
}

@jennifer-shehane jennifer-shehane changed the title 4.0.0 on MacOS not detecting Microsoft Edge as a launchable browser MacOS not detecting Microsoft Edge as a launch-able browser Feb 7, 2020
@ezra-m
Copy link

ezra-m commented Feb 7, 2020

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

@YOU54F
Copy link
Contributor

YOU54F commented Feb 7, 2020

It looks like in the Info.plist file that the

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

'com.microsoft.Edge',

instead of com.microsoft.Edge

Canary shows

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

@YOU54F
Copy link
Contributor

YOU54F commented Feb 7, 2020

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

@YOU54F
Copy link
Contributor

YOU54F commented Feb 7, 2020

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',
])

@YOU54F
Copy link
Contributor

YOU54F commented Feb 7, 2020

Please see #6364

@cypress-bot cypress-bot bot added stage: pending release and removed stage: needs investigating Someone from Cypress needs to look at this labels Feb 7, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Feb 7, 2020

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.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Feb 8, 2020

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.

@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Feb 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants