cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
47.12k stars 3.19k forks source link

Chrome for Testing - we can't run your tests #28554

Open alexsch01 opened 11 months ago

alexsch01 commented 11 months ago

Current behavior

npx cypress run --browser ~/chrome120/chrome --headed --no-exit

image image

Chrome for Testing version: 120.0.6099.109 from https://alexsch01.github.io/chromefortesting/

Test code to reproduce

cypress/e2e/spec.cy.js

$ mkdir cypress
$ mkdir cypress/e2e
$ touch cypress/e2e/spec.cy.js

cypress.config.js

const { defineConfig } = require('cypress')

module.exports = defineConfig({
    e2e: {
        supportFile: false,
    },
})

Cypress Version

13.6.1 See Other**

Node version

v20.10.0

Operating System

Linux 6.1.60 x86_64 GNU/Linux

Other

Same result testing with Cypress Version=10.0.0

alexsch01 commented 11 months ago

Related: https://github.com/cypress-io/cypress/issues/28123

Definitely caused by the browser.majorVersion being equal to "for"

{
  name: 'chrome',
  family: 'chromium',
  channel: 'stable',
  displayName: 'Custom Chrome',
  version: 'for',
  path: 'PATH TO Chrome for Testing',
  minSupportedVersion: 64,
  majorVersion: 'for'
}

This allows user to launch browser with cypress open

const { defineConfig } = require("cypress");

module.exports = defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      config.browsers.push({
        name: 'chrome',
        family: 'chromium',
        channel: 'stable',
        displayName: 'Custom Chrome',
        version: 'for',
        path: 'PATH TO Chrome for Testing',
        minSupportedVersion: 64,
        majorVersion: '120',
      })
      return config
    },
  },
});
MikeMcC399 commented 11 months ago

@alexsch01

I was able to reproduce your issue on Ubuntu 22.04.

Cypress running under Windows 11 does not have a problem to test using Chrome for Testing, and the name of the browser is parsed differently:

image

So it seems you have put your finger on the cause of the issue on Linux when you note that the browser name and version is incorrectly parsed.

Compare to Ubuntu where the version number is missing

image

MikeMcC399 commented 11 months ago
alexsch01 commented 10 months ago
const { defineConfig } = require("cypress");

module.exports = defineConfig({
  e2e: {
    setupNodeEvents(on, config) {
      config.browsers.push({
        name: 'cft',
        family: 'chromium',
        channel: 'stable',
        displayName: 'Custom Chrome',
        version: 'for',
        path: 'PATH TO Chrome for Testing',
        minSupportedVersion: 64,
        majorVersion: '120',
      })
      return config
    },
  },
});

With the above, you can use npx cypress run --browser cft and it will launch correctly

cypress-app-bot commented 4 months ago

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

alexsch01 commented 4 months ago

Still happening

MikeMcC399 commented 4 months ago
Roemer commented 4 months ago

Pitty, I am now running into the same issue.

lancefaler commented 2 months ago

I am running into this issue as well.

MikeMcC399 commented 1 week ago

This issue prevents using browser-actions/setup-chrome in GitHub Actions to install an alternate version of Chrome, since the action installs Chrome for Testing, which fails to run with Cypress.