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

Update browser types, adding channel and making names consistent #6243

Closed
flotwig opened this issue Jan 24, 2020 · 4 comments
Closed

Update browser types, adding channel and making names consistent #6243

flotwig opened this issue Jan 24, 2020 · 4 comments
Labels
pkg/launcher This is due to an issue in the packages/launcher directory topic: cross browser type: breaking change Requires a new major release version

Comments

@flotwig
Copy link
Contributor

flotwig commented Jan 24, 2020

Current behavior:

Browsers are defined like this:

export type Browser = {
  /** short browser name */
  name: BrowserName
  family: BrowserFamily
  /** ... **/
}

...which isn't well-suited to filtering out browsers based on behavior.

Desired behavior:

Browsers are defined like this:

export type Browser = {
  /** short browser name */
  name: BrowserName
  /** family is used to describe the underlying type of the browsr */
  family: BrowserFamily
  /** channel describes the stability of this browser **/
  channel: BrowserChannel
  /** ... **/
}

So this:

export const browsers: Browser[] = [
{
name: 'chrome',
family: 'chrome',
displayName: 'Chrome',
versionRegex: /Google Chrome (\S+)/,
profile: true,
binary: ['google-chrome', 'chrome', 'google-chrome-stable'],
},
{
name: 'chromium',
family: 'chrome',
displayName: 'Chromium',
versionRegex: /Chromium (\S+)/,
profile: true,
binary: ['chromium-browser', 'chromium'],
},
{
name: 'canary',
family: 'chrome',
displayName: 'Canary',
versionRegex: /Google Chrome Canary (\S+)/,
profile: true,
binary: 'google-chrome-canary',
},
{
name: 'firefox',
family: 'firefox',
displayName: 'Firefox',
info: firefoxInfo,
versionRegex: /Firefox (\S+)/,
profile: true,
binary: 'firefox',
},
{
name: 'firefoxDeveloperEdition',
family: 'firefox',
displayName: 'Firefox Developer Edition',
info: firefoxInfo,
versionRegex: /Firefox Developer Edition (\S+)/,
profile: true,
binary: 'firefox-developer-edition',
},
{
name: 'firefoxNightly',
family: 'firefox',
displayName: 'Firefox Nightly',
info: firefoxInfo,
versionRegex: /Firefox Nightly (\S+)/,
profile: true,
binary: 'firefox-nightly',
},
]

Would become this:

export const browsers: Browser[] = [
  {
    name: 'chrome',
    family: 'chromium',
    channel: 'stable',
    displayName: 'Chrome',
    versionRegex: /Google Chrome (\S+)/,
    profile: true,
    binary: ['google-chrome', 'chrome', 'google-chrome-stable'],
  },
  {
    name: 'chromium',
    family: 'chromium',
    channel: 'dev',
    displayName: 'Chromium',
    versionRegex: /Chromium (\S+)/,
    profile: true,
    binary: ['chromium-browser', 'chromium'],
  },
  {
    name: 'chrome',
    family: 'chromium',
    channel: 'canary',
    displayName: 'Canary',
    versionRegex: /Google Chrome Canary (\S+)/,
    profile: true,
    binary: 'google-chrome-canary',
  },
  {
    name: 'firefox',
    family: 'firefox',
    channel: 'stable',
    displayName: 'Firefox',
    info: firefoxInfo,
    versionRegex: /Firefox (\S+)/,
    profile: true,
    binary: 'firefox',
  },
  {
    name: 'firefox',
    family: 'firefox',
    channel: 'dev',
    displayName: 'Firefox Developer Edition',
    info: firefoxInfo,
    versionRegex: /Firefox Developer Edition (\S+)/,
    profile: true,
    binary: 'firefox-developer-edition',
  },
  {
    name: 'firefox',
    family: 'firefox',
    channel: 'nightly',
    displayName: 'Firefox Nightly',
    info: firefoxInfo,
    versionRegex: /Firefox Nightly (\S+)/,
    profile: true,
    binary: 'firefox-nightly',
  },
]

Microsoft Edge #5433 would look like this:

  {
    name: 'edge',
    family: 'chromium',
    channel: 'stable',
    displayName: 'Edge',
    versionRegex: /** ... **/,
    profile: /** ... **/,
    binary: /** ... **/,
  },

electron would it's family be set to chromium, and existing code will be updated to assert on name. Since it needs to be treated differently from normal Chromium-based browsers, but isChromiumBased would still be true.

This has the advantage of making filtering easy to do:

// not a real API
Cypress.isBrowser({ name: 'edge' })
Cypress.isBrowser({ family: 'firefox' })
Cypress.isBrowser("foo") // same as { name: 'foo' }
@flotwig flotwig added pkg/launcher This is due to an issue in the packages/launcher directory type: breaking change Requires a new major release version labels Jan 24, 2020
@cypress-bot cypress-bot bot added the stage: ready for work The issue is reproducible and in scope label Jan 24, 2020
@flotwig flotwig mentioned this issue Jan 27, 2020
9 tasks
@cypress-bot cypress-bot bot added stage: work in progress and removed stage: ready for work The issue is reproducible and in scope labels Jan 27, 2020
@flotwig
Copy link
Contributor Author

flotwig commented Jan 28, 2020

As part of this, the logic for selecting browsers to be launched will be updated.

  • --browser browserName launches browserName with channel = stable
  • --browser browserName:channel launches browserName with channel = channel
  • --browser canary has been aliased to chrome:canary for backwards compatibility

@cypress-bot cypress-bot bot added stage: needs review The PR code is done & tested, needs review stage: pending release and removed stage: work in progress stage: needs review The PR code is done & tested, needs review labels Jan 31, 2020
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jan 31, 2020

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

@flotwig
Copy link
Contributor Author

flotwig commented Jan 31, 2020

Weird, GitHub didn't pick up on the "closes" from the PR...

@flotwig flotwig closed this as completed Jan 31, 2020
@flotwig
Copy link
Contributor Author

flotwig commented Feb 6, 2020

Released in 4.0.0.

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Mar 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg/launcher This is due to an issue in the packages/launcher directory topic: cross browser type: breaking change Requires a new major release version
Projects
None yet
Development

No branches or pull requests

2 participants