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

Cypress-to-electron version mapping #3228

Closed
jdoubleu opened this issue Jan 25, 2019 · 9 comments
Closed

Cypress-to-electron version mapping #3228

jdoubleu opened this issue Jan 25, 2019 · 9 comments

Comments

@jdoubleu
Copy link

jdoubleu commented Jan 25, 2019

Current behavior:

It is not straightforward to find out which electron version is used by Cypress.

There are also some issues with the current electron version (see #2559, #2069, 2516).
These errors can be resolved e.g. by using babel-preset-env and transpile the code to work with older versions of Chrome (as part of Electron).

Proposal

It would be nice if Cypress could provide a tool similar to electron-to-chrome which simply maps a given Cypress version to a Chrome version.

This Cypress version can then be used in conjunction with babel-preset-env in a .browserlistrc.

@jennifer-shehane jennifer-shehane added stage: proposal 💡 No work has been done of this issue browser: electron labels Jan 28, 2019
@jennifer-shehane
Copy link
Member

Comments on Cypress being coupled to Electron version today: #2761 (comment)

@dschuessler
Copy link

dschuessler commented Nov 22, 2019

This is especially important if binary dependencies have to be built against the matching Electron runtime as described here: #3649 (comment)

I'd like to use gRPC in my Cypress tests, but I'm totally stuck, because I simply can't find out the Electron version currently used.

EDIT: For everyone who comes after me: I found the current Electron version in the changelog: https://docs.cypress.io/guides/references/changelog.html#3-5-0 It's 5.0.10.

@jennifer-shehane
Copy link
Member

You can always find the current version of Electron in our electron package here: https://github.com/cypress-io/cypress/blob/develop/packages/electron/package.json#L27

@flotwig
Copy link
Contributor

flotwig commented Jun 29, 2020

There are two ways that I know of to find the current version of Electron from within Cypress:

  1. Use Cypress.browser.version while running in Electron to get the current Chromium version bundled with Electron. Then, use electron-to-chromium's chromiumToElectron to determine the earliest possible/all possible Electron versions.
  2. Use a cy.task (or other plugin event) to read the current value of process.versions.electron

@jennifer-shehane
Copy link
Member

Verified the ways suggested are working to get the current Electron version:

module.exports = (on, config) => {
  const ElectronVersion = process.versions.electron

  console.log(ElectronVersion)

  on('file:preprocessor', (file) => {
    // can use version here
  })

  on('task', {
    // can use version here
  })

  // or any other plugin event or custom code you have
}

I'm going to close this as resolved since there seems to be a reasonable workaround for the cases asked for here.

@inorganik
Copy link

I see the Electron version is somewhere around v11, but in the Cypress UI it shows "Electron 80" (I'm on cypress 4) - does "80" correspond to the version of chrome?

@flotwig
Copy link
Contributor

flotwig commented Mar 11, 2021

@inorganik that is correct. Electron is currently at 11.x in released versions of Cypress and will be bumped to 12.x when Cypress 7.0 is released.

@inorganik
Copy link

@flotwig Thanks! Is there anyway to pin a version of electron/chrome, e.g v87? Guessing not but wanted to check.

@flotwig
Copy link
Contributor

flotwig commented Mar 15, 2021

@inorganik no, each version of Cypress is pinned to the version of Electron it ships with. But you can install the desired version of Chrome on your CI system and run with --browser chrome: https://docs.cypress.io/guides/guides/launching-browsers.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants