Skip to content

Commit

Permalink
Merge pull request #16831 from cypress-io/8.0-release
Browse files Browse the repository at this point in the history
BREAKING CHANGE: 8.0 release
  • Loading branch information
flotwig authored Jul 19, 2021
2 parents ae0c520 + 62f492b commit c2f91f6
Show file tree
Hide file tree
Showing 64 changed files with 447 additions and 1,051 deletions.
4 changes: 2 additions & 2 deletions cli/__snapshots__/cli_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ exports['shows help for run --foo 1'] = `
-e, --env <env> sets environment variables. separate multiple values with a comma. overrides any value in cypress.json or cypress.env.json
--group <name> a named group for recorded runs in the Cypress Dashboard
-k, --key <record-key> your secret Record Key. you can omit this if you set a CYPRESS_RECORD_KEY environment variable.
--headed displays the browser instead of running headlessly (defaults to true for Firefox and Chromium-family browsers)
--headless hide the browser instead of running headed (defaults to true for Electron)
--headed displays the browser instead of running headlessly
--headless hide the browser instead of running headed (default for cypress run)
--no-exit keep the browser open after tests finish
--parallel enables concurrent runs and automatic load balancing of specs across multiple machines or processes
-p, --port <port> runs Cypress on a specific port. overrides any value in cypress.json.
Expand Down
4 changes: 2 additions & 2 deletions cli/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ const descriptions = {
forceInstall: 'force install the Cypress binary',
global: 'force Cypress into global mode as if its globally installed',
group: 'a named group for recorded runs in the Cypress Dashboard',
headed: 'displays the browser instead of running headlessly (defaults to true for Firefox and Chromium-family browsers)',
headless: 'hide the browser instead of running headed (defaults to true for Electron)',
headed: 'displays the browser instead of running headlessly',
headless: 'hide the browser instead of running headed (default for cypress run)',
key: 'your secret Record Key. you can omit this if you set a CYPRESS_RECORD_KEY environment variable.',
parallel: 'enables concurrent runs and automatic load balancing of specs across multiple machines or processes',
port: 'runs Cypress on a specific port. overrides any value in cypress.json.',
Expand Down
2 changes: 1 addition & 1 deletion cli/types/cypress-npm-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ declare namespace CypressCommandLine {
/**
* Specify configuration
*/
config: Partial<Cypress.ResolvedConfigOptions>
config: Cypress.ConfigOptions
/**
* Path to the config file to be used.
*
Expand Down
100 changes: 56 additions & 44 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ declare namespace Cypress {
path: string
isHeaded: boolean
isHeadless: boolean
/**
* Informational text to accompany this browser. Shown in desktop-gui.
*/
info?: string
/**
* Warning text to accompany this browser. Shown in desktop-gui.
*/
warning?: string
/**
* The minimum majorVersion of this browser supported by Cypress.
*/
minSupportedVersion?: number
/**
* If `true`, this browser is too old to be supported by Cypress.
*/
unsupportedVersion?: boolean
}

interface LocalStorage {
Expand Down Expand Up @@ -341,15 +357,6 @@ declare namespace Cypress {
*/
env(object: ObjectLike): void

/**
* Firefox only: Get the current number of tests that will run between forced garbage collections.
*
* Returns undefined if not in Firefox, returns a null or 0 if forced GC is disabled.
*
* @see https://on.cypress.io/firefox-gc-issue
*/
getFirefoxGcInterval(): number | null | undefined

/**
* @returns the number of test retries currently enabled for the run
*/
Expand Down Expand Up @@ -1833,6 +1840,12 @@ declare namespace Cypress {
* @see https://on.cypress.io/then
*/
then<S>(options: Partial<Timeoutable>, fn: (this: ObjectLike, currentSubject: Subject) => PromiseLike<S>): Chainable<S>
/**
* Enables you to work with the subject yielded from the previous command / promise.
*
* @see https://on.cypress.io/then
*/
then<S extends string | number | boolean>(fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<S>
/**
* Enables you to work with the subject yielded from the previous command / promise.
*
Expand All @@ -1850,7 +1863,7 @@ declare namespace Cypress {
*
* @see https://on.cypress.io/then
*/
then<S extends object | any[] | string | number | boolean>(fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<S>
then<S extends any[] | object>(fn: (this: ObjectLike, currentSubject: Subject) => S): Chainable<S>
/**
* Enables you to work with the subject yielded from the previous command / promise.
*
Expand Down Expand Up @@ -2640,13 +2653,6 @@ declare namespace Cypress {
* @default 'top'
*/
scrollBehavior: scrollBehaviorOptions
/**
* Firefox version 79 and below only: The number of tests that will run between forced garbage collections.
* If a number is supplied, it will apply to `run` mode and `open` mode.
* Set the interval to `null` or 0 to disable forced garbage collections.
* @default { runMode: 1, openMode: null }
*/
firefoxGcInterval: Nullable<number | { runMode: Nullable<number>, openMode: Nullable<number> }>
/**
* Allows listening to the `before:run`, `after:run`, `before:spec`, and `after:spec` events in the plugins file during interactive mode.
* @default false
Expand Down Expand Up @@ -2678,17 +2684,46 @@ declare namespace Cypress {
*/
includeShadowDom: boolean

/**
* The list of hosts to be blocked
*/
blockHosts: null | string | string[]
/**
* Path to folder containing component test files.
*/
componentFolder: false | string
/**
* A unique ID for the project used for recording
*/
projectId: null | string
/**
* Path to the support folder.
*/
supportFolder: string
/**
* Glob pattern to determine what test files to load.
*/
testFiles: string | string[]
/**
* The user agent the browser sends in all request headers.
*/
userAgent: null | string
/**
* Polyfills `window.fetch` to enable Network spying and stubbing
*/
experimentalFetchPolyfill: boolean

/**
* Override default config options for Component Testing runner.
* @default {}
*/
component: ResolvedConfigOptions
component: Omit<ResolvedConfigOptions, 'e2e' | 'component'>

/**
* Override default config options for E2E Testing runner.
* @default {}
*/
e2e: ResolvedConfigOptions
e2e: Omit<ResolvedConfigOptions, 'e2e' | 'component'>
}

/**
Expand All @@ -2701,10 +2736,6 @@ declare namespace Cypress {
* @see https://nodejs.org/api/os.html#os_os_arch
*/
arch: string
/**
* The list of hosts to be blocked
*/
blockHosts: null | string | string[]
/**
* The browser Cypress is running on.
*/
Expand All @@ -2713,10 +2744,6 @@ declare namespace Cypress {
* Available browsers found on your system.
*/
browsers: Browser[]
/**
* Path to folder containing component test files.
*/
componentFolder: string
/**
* Hosts mappings to IP addresses.
*/
Expand All @@ -2736,22 +2763,6 @@ declare namespace Cypress {
* The platform Cypress is running on.
*/
platform: 'linux' | 'darwin' | 'win32'
/**
* A unique ID for the project used for recording
*/
projectId: null | string
/**
* Path to the support folder.
*/
supportFolder: string
/**
* Glob pattern to determine what test files to load.
*/
testFiles: string
/**
* The user agent the browser sends in all request headers.
*/
userAgent: null | string
/**
* The Cypress version being used.
*/
Expand Down Expand Up @@ -2798,7 +2809,8 @@ declare namespace Cypress {
/**
* All configuration items are optional.
*/
type ConfigOptions = Partial<ResolvedConfigOptions>
type CoreConfigOptions = Partial<Omit<ResolvedConfigOptions, 'e2e' | 'component'>>
type ConfigOptions = CoreConfigOptions & {e2e?: CoreConfigOptions, component?: CoreConfigOptions }

interface PluginConfigOptions extends ResolvedConfigOptions {
/**
Expand Down
9 changes: 9 additions & 0 deletions cli/types/tests/cypress-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,15 @@ describe('then', () => {
$p // $ExpectType JQuery<HTMLParagraphElement>
})
})

// https://github.com/cypress-io/cypress/issues/16669
it('any as default', () => {
cy.get('body')
.then(() => ({} as any))
.then(v => {
v // $ExpectType any
})
})
})

cy.wait(['@foo', '@bar'])
Expand Down
3 changes: 2 additions & 1 deletion packages/desktop-gui/cypress/fixtures/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@
"channel": "stable",
"version": "69.0.1",
"path": "/Applications/Firefox/Contents/MacOS/Firefox",
"majorVersion": "69"
"majorVersion": "69",
"unsupportedVersion": true
},
{
"name": "firefox",
Expand Down
32 changes: 31 additions & 1 deletion packages/desktop-gui/cypress/integration/project_nav_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,20 @@ describe('Project Nav', function () {
})
})

it('has unsupportedVersions styled and unselectable', function () {
cy.get('.browsers-list .dropdown-chosen').click()

cy.get('.browsers-list').find('.dropdown-menu')
.find('li').should('have.length', this.config.browsers.length - 1)
.contains('span', 'Firefox 69')
.should('have.class', 'unsupported-version')
.click()

cy.get('.browsers-list .dropdown-menu').should('be.visible')

cy.get('.browsers-list .dropdown-chosen').contains('Chromium')
})

it('saves chosen browser in local storage', () => {
expect(localStorage.getItem('chosenBrowser')).to.eq(JSON.stringify({ name: 'chromium', channel: 'stable' }))
})
Expand Down Expand Up @@ -255,7 +269,7 @@ describe('Project Nav', function () {
const browserArg = this.ipc.launchBrowser.getCall(0).args[0].browser

expect(browserArg).to.have.keys([
'family', 'name', 'path', 'profilePath', 'version', 'majorVersion', 'displayName', 'info', 'isChosen', 'custom', 'warning', 'channel',
'family', 'name', 'path', 'profilePath', 'version', 'majorVersion', 'displayName', 'info', 'isChosen', 'custom', 'warning', 'channel', 'unsupportedVersion',
])

expect(browserArg.path).to.include('/')
Expand Down Expand Up @@ -364,6 +378,22 @@ describe('Project Nav', function () {
})
})

describe('when browser saved in local storage has an unsupported version', function () {
beforeEach(function () {
localStorage.setItem('chosenBrowser', JSON.stringify({ name: 'firefox', channel: 'stable' }))

// sanity check: saved browser should be found in the config
expect(this.config.browsers.find((b) => b.name === 'firefox' && b.channel === 'stable' && b.unsupportedVersion)).to.exist

this.openProject.resolve(this.config)
})

it('defaults to first browser', () => {
cy.get('.browsers-list .dropdown-chosen')
.should('contain', 'Chrome')
})
})

describe('only one browser available', function () {
beforeEach(function () {
this.config.browsers = [{
Expand Down
7 changes: 7 additions & 0 deletions packages/desktop-gui/src/app/nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,13 @@
li {
padding: 9px 15px;
white-space: nowrap;

.unsupported-version {
color: #888;
img {
filter: opacity(0.5);
}
}
}

.dropdown-chosen {
Expand Down
2 changes: 2 additions & 0 deletions packages/desktop-gui/src/lib/browser-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default class Browser {
@observable info
@observable custom
@observable warning
@observable unsupportedVersion
@observable isChosen = false

constructor (browser) {
Expand All @@ -26,5 +27,6 @@ export default class Browser {
this.info = browser.info
this.custom = browser.custom
this.warning = browser.warning
this.unsupportedVersion = browser.unsupportedVersion
}
}
7 changes: 5 additions & 2 deletions packages/desktop-gui/src/project-nav/browsers.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { Component } from 'react'
import { observer } from 'mobx-react'
import cs from 'classnames'
import Tooltip from '@cypress/react-tooltip'
import { BrowserIcon, Dropdown } from '@packages/ui-components'

Expand Down Expand Up @@ -49,6 +50,8 @@ export default class Browsers extends Component {
}

_onSelect = (browser) => {
if (browser.unsupportedVersion) return true

this.props.project.setChosenBrowser(browser)
}

Expand All @@ -69,14 +72,14 @@ export default class Browsers extends Component {
}

return (
<>
<span className={cs({ 'unsupported-version': browser.unsupportedVersion })}>
{icon}{' '}
{prefixText}{' '}
{browser.displayName}{' '}
{browser.majorVersion}
{this._info(browser)}
{this._warn(browser)}
</>
</span>
)
}

Expand Down
10 changes: 7 additions & 3 deletions packages/desktop-gui/src/project/project-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,16 @@ export default class Project {
return _.filter(this.browsers, { isChosen: false })
}

@computed get supportedBrowsers () {
return _.filter(this.browsers, (browser) => !browser.unsupportedVersion)
}

@computed get chosenBrowser () {
return _.find(this.browsers, { isChosen: true })
}

@computed get defaultBrowser () {
return this.browsers[0]
return this.supportedBrowsers[0]
}

@computed get warnings () {
Expand Down Expand Up @@ -173,7 +177,7 @@ export default class Project {
// use a custom browser if one is supplied. or, if they already have
// a browser chosen that's been saved in localStorage, then select that
// otherwise just do the default.
const customBrowser = _.find(this.browsers, { custom: true })
const customBrowser = _.find(this.supportedBrowsers, { custom: true })

if (customBrowser) {
return this.setChosenBrowser(customBrowser, { save: false })
Expand Down Expand Up @@ -260,7 +264,7 @@ export default class Project {
filter.name = ls
}

const browser = _.find(this.browsers, filter) || this.defaultBrowser
const browser = _.find(this.supportedBrowsers, filter) || this.defaultBrowser

this.setChosenBrowser(browser)
}
Expand Down
Loading

4 comments on commit c2f91f6

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on c2f91f6 Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.0.0/circle-develop-c2f91f6364703cc6a354ba5b51a7d2acf22dde4b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on c2f91f6 Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 ia32 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.0.0/appveyor-develop-c2f91f6364703cc6a354ba5b51a7d2acf22dde4b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on c2f91f6 Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AppVeyor has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.0.0/appveyor-develop-c2f91f6364703cc6a354ba5b51a7d2acf22dde4b/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on c2f91f6 Jul 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/8.0.0/circle-develop-c2f91f6364703cc6a354ba5b51a7d2acf22dde4b/cypress.tgz

Please sign in to comment.