Skip to content

Commit

Permalink
Merge pull request #20759 from cypress-io/10.0-release-merge-develop-…
Browse files Browse the repository at this point in the history
…03-22
  • Loading branch information
ZachJW34 authored Mar 23, 2022
2 parents b4da6e8 + 5a7da0a commit 8fd7422
Show file tree
Hide file tree
Showing 41 changed files with 2,851 additions and 1,874 deletions.
80 changes: 53 additions & 27 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,29 +1,55 @@
# Each line is a file pattern followed by one or more owners.

# Test Runner team are owners of code within root packages concerning e2e, cli, and other utils
/.github/ @cypress-io/test-runner
/browser-versions.json @cypress-io/test-runner
/cli/ @cypress-io/test-runner
/packages/coffee/ @cypress-io/test-runner
/packages/datetime-utils/ @cypress-io/test-runner
/packages/driver/ @cypress-io/test-runner
/packages/electron/ @cypress-io/test-runner
/packages/example/ @cypress-io/test-runner
/packages/extension/ @cypress-io/test-runner
/packages/https-proxy/ @cypress-io/test-runner
/packages/launcher/ @cypress-io/test-runner
/packages/net-stubbing/ @cypress-io/test-runner
/packages/network/ @cypress-io/test-runner
/packages/proxy/ @cypress-io/test-runner
/packages/reporter/ @cypress-io/test-runner
/packages/rewriter/ @cypress-io/test-runner
/packages/root/ @cypress-io/test-runner
/packages/runner/ @cypress-io/test-runner
/packages/runner-shared/ @cypress-io/test-runner
/packages/server/ @cypress-io/test-runner
/packages/socket/ @cypress-io/test-runner
/packages/static/ @cypress-io/test-runner
/packages/ts/ @cypress-io/test-runner
/packages/ui-components/ @cypress-io/test-runner
/packages/web-config/ @cypress-io/test-runner
/scripts/ @cypress-io/test-runner
# End-to-end team are owners of code within root packages concerning e2e testing, cli, and other utils
# Component-testing team are owners of code within packages concerning component testing

/.github/ @cypress-io/end-to-end
/browser-versions.json @cypress-io/end-to-end @cypress-io/component-testing

/cli/ @cypress-io/end-to-end

/guides/ @cypress-io/end-to-end

/npm/angular @cypress-io/component-testing
/npm/create-cypress-tests @cypress-io/component-testing
/npm/cypress-schematic @cypress-io/component-testing
/npm/design-system @cypress-io/component-testing
/npm/eslint-plugin-dev @cypress-io/end-to-end @cypress-io/component-testing
/npm/mount-utils @cypress-io/component-testing
/npm/react @cypress-io/component-testing
/npm/vue @cypress-io/component-testing
/npm/webpack-batteries-included-preprocessor @cypress-io/end-to-end @cypress-io/component-testing
/npm/webpack-dev-server @cypress-io/component-testing
/npm/webpack-preprocessor @cypress-io/end-to-end @cypress-io/component-testing

/packages/config/ @cypress-io/end-to-end
/packages/desktop-gui/ @cypress-io/end-to-end
/packages/driver/ @cypress-io/end-to-end
/packages/electron/ @cypress-io/end-to-end
/packages/errors/ @cypress-io/end-to-end @cypress-io/component-testing
/packages/example/ @cypress-io/end-to-end
/packages/extension/ @cypress-io/end-to-end
/packages/https-proxy/ @cypress-io/end-to-end
/packages/launcher/ @cypress-io/end-to-end
/packages/net-stubbing/ @cypress-io/end-to-end
/packages/network/ @cypress-io/end-to-end
/packages/proxy/ @cypress-io/end-to-end
/packages/reporter/ @cypress-io/end-to-end
/packages/resolve-dist/ @cypress-io/end-to-end
/packages/rewriter/ @cypress-io/end-to-end
/packages/root/ @cypress-io/end-to-end
/packages/runner/ @cypress-io/end-to-end
/packages/runner-ct/ @cypress-io/component-testing
/packages/runner-shared/ @cypress-io/end-to-end
/packages/server/ @cypress-io/end-to-end
/packages/socket/ @cypress-io/end-to-end
/packages/static/ @cypress-io/end-to-end
/packages/ts/ @cypress-io/end-to-end
/packages/ui-components/ @cypress-io/end-to-end
/packages/web-config/ @cypress-io/end-to-end

/patches/ @cypress-io/end-to-end

/scripts/ @cypress-io/end-to-end

/system-tests/ @cypress-io/end-to-end @cypress-io/component-testing
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ system-tests/fixtures/large-img

# Building app binary
scripts/support
package-lock.json
binary-url.json

# Allows us to dynamically create eslint rules that override the default for Decaffeinate scripts
Expand Down
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,6 @@
// These are commented out because they slow down node development
// "volar.autoCompleteRefs": false,
"volar.takeOverMode.enabled": true,

"editor.tabSize": 2,
}
1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ commands:
key: v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-deps-root-weekly-{{ checksum "cache_date" }}
paths:
- ~/.yarn
- ~/.cy-npm-cache

verify-build-setup:
description: Common commands run when setting up for build or yarn install
Expand Down
1 change: 1 addition & 0 deletions cli/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,7 @@ module.exports = {

require('./exec/open')
.start({ ...util.parseOpts(opts), testingType: 'component' })
.then(util.exit)
.catch(util.logErrorExit1)
})

Expand Down
4 changes: 2 additions & 2 deletions cli/types/cypress-npm-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ declare namespace CypressCommandLine {
interface CypressRunOptions extends CypressCommonOptions {
/**
* Specify browser to run tests in, either by name or by filesystem path
*/
*/
browser: string
/**
* Specify a unique identifier for a run to enable grouping or parallelization
Expand Down Expand Up @@ -114,7 +114,7 @@ declare namespace CypressCommandLine {
*/
interface CypressOpenOptions extends CypressCommonOptions {
/**
* Specify browser to run tests in, either by name or by filesystem path
* Specify browser to run tests in, either by name or by filesystem path
*/
browser: string
/**
Expand Down
36 changes: 36 additions & 0 deletions packages/driver/cypress/e2e/commands/files.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,42 @@ describe('src/cy/commands/files', () => {
cy.readFile('foo.json')
})

// https://github.com/cypress-io/cypress/issues/20683
it('has implicit existence assertion, retries and throws a specific error when file does not exist for null encoding', function (done) {
const err = new Error('ENOENT: no such file or directory, open \'foo.json\'')

err.name = 'ENOENT'
err.code = 'ENOENT'
err.filePath = '/path/to/foo.json'

Cypress.backend.rejects(err)
let retries = 0

cy.on('command:retry', () => {
retries += 1
})

cy.on('fail', (err) => {
const { lastLog } = this

assertLogLength(this.logs, 1)
expect(lastLog.get('error')).to.eq(err)
expect(lastLog.get('state')).to.eq('failed')

expect(err.message).to.eq(stripIndent`
Timed out retrying after 50ms: \`cy.readFile(\"foo.json\")\` failed because the file does not exist at the following path:
\`/path/to/foo.json\``)

expect(err.docsUrl).to.eq('https://on.cypress.io/readfile')
expect(retries).to.eq(2)

done()
})

cy.readFile('foo.json', null)
})

it('throws a specific error when file exists when it shouldn\'t', function (done) {
Cypress.backend.resolves(okResponse)

Expand Down
6 changes: 3 additions & 3 deletions packages/driver/src/cy/commands/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ export default (Commands, Cypress, cy, state) => {
}
}).then(({ filePath, contents }) => {
// https://github.com/cypress-io/cypress/issues/1558
// https://github.com/cypress-io/cypress/issues/20683
// We invoke Buffer.from() in order to transform this from an ArrayBuffer -
// which socket.io uses to transfer the file over the websocket - into a
// `Buffer`, which webpack polyfills in the browser.
if (options.encoding === null) {
// which socket.io uses to transfer the file over the websocket - into a `Buffer`.
if (options.encoding === null && contents !== null) {
contents = Buffer.from(contents)
}

Expand Down
Empty file modified packages/example/cypress/fixtures/example.json
100755 → 100644
Empty file.
Empty file modified packages/example/cypress/plugins/index.js
100755 → 100644
Empty file.
Empty file modified packages/example/cypress/support/commands.js
100755 → 100644
Empty file.
9 changes: 4 additions & 5 deletions packages/frontend-shared/cypress/e2e/e2ePluginSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ export type E2ETaskMap = ReturnType<typeof makeE2ETasks> extends Promise<infer U

interface FixturesShape {
scaffold (): void
scaffoldProject (project: string): void
scaffoldCommonNodeModules(): Promise<void>
scaffoldProjectNodeModules(project: string): Promise<void>
scaffoldProject (project: string): Promise<void>
scaffoldWatch (): void
remove (): void
removeProject (name): void
Expand All @@ -81,6 +79,7 @@ async function makeE2ETasks () {
const argUtils = require('@packages/server/lib/util/args')
const { makeDataContext } = require('@packages/server/lib/makeDataContext')
const Fixtures = require('@tooling/system-tests/lib/fixtures') as FixturesShape
const { scaffoldCommonNodeModules, scaffoldProjectNodeModules } = require('@tooling/system-tests/lib/dep-installer')

const cli = require('../../../../cli/lib/cli')
const cliOpen = require('../../../../cli/lib/exec/open')
Expand Down Expand Up @@ -116,9 +115,9 @@ async function makeE2ETasks () {

await Fixtures.scaffoldProject(projectName)

await Fixtures.scaffoldCommonNodeModules()
await scaffoldCommonNodeModules()

await Fixtures.scaffoldProjectNodeModules(projectName)
await scaffoldProjectNodeModules(projectName)

scaffoldedProjects.add(projectName)

Expand Down
3 changes: 2 additions & 1 deletion packages/server/test/integration/http_requests_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const resolve = require(`../../lib/util/resolve`)
const { fs } = require(`../../lib/util/fs`)
const CacheBuster = require(`../../lib/util/cache_buster`)
const Fixtures = require('@tooling/system-tests/lib/fixtures')
const { scaffoldCommonNodeModules } = require('@tooling/system-tests/lib/dep-installer')
/**
* @type {import('@packages/resolve-dist')}
*/
Expand Down Expand Up @@ -80,7 +81,7 @@ describe('Routes', () => {
require('mocha-banner').register()

beforeEach(async function () {
await Fixtures.scaffoldCommonNodeModules()
await scaffoldCommonNodeModules()
ctx = getCtx()
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'

Expand Down
3 changes: 2 additions & 1 deletion scripts/binary/smoke.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const Promise = require('bluebird')
const os = require('os')
const verify = require('../../cli/lib/tasks/verify')
const Fixtures = require('@tooling/system-tests/lib/fixtures')
const { scaffoldCommonNodeModules } = require('@tooling/system-tests/lib/dep-installer')

const fs = Promise.promisifyAll(fse)

Expand Down Expand Up @@ -160,7 +161,7 @@ const runFailingProjectTest = function (buildAppExecutable, e2e) {
}

const test = async function (buildAppExecutable) {
await Fixtures.scaffoldCommonNodeModules()
await scaffoldCommonNodeModules()
await Fixtures.scaffoldProject('e2e')
const e2e = Fixtures.projectPath('e2e')

Expand Down
12 changes: 6 additions & 6 deletions system-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,20 @@ SNAPSHOT_UPDATE=1 yarn test go_spec

Every folder in [`./projects`](./lib/projects) represents a self-contained Cypress project. When you pass the `project` property to `systemTests.it` or `systemTests.exec`, Cypress launches using this project.

If a test project has a `package.json` file, the `systemTests.exec` helper will attempt to install the correct `node_modules` by running `yarn install` against the project. This is cached in CI and locally to speed up test times.
If a test project has a `package.json` file, the `systemTests.exec` helper will attempt to install the correct `node_modules` by running `yarn install` or `npm install` (depending on which lockfile is present) against the project. This is cached in CI and locally to speed up test times.

`systemTests.exec` *copies* the project directory to a temporary folder outside of the monorepo root. This means that temporary projects will not inherit the `node_modules` from this package or the monorepo. So, you must add the dependencies required for your project in `dependencies` or `devDependencies`.

The exception is some commonly used packages that are scaffolded for all projects, like `lodash` and `debug`. You can see the list by looking at `scaffoldCommonNodeModules` in [`./lib/fixtures.ts`](./lib/fixtures.ts) These packages do not need to be added to a test project's `package.json`.

You can also set special properties in a test project's `package.json` to influence the helper's behavior when running `yarn`:
You can also set special properties in a test project's `package.json` to influence the helper's behavior when running `yarn` or `npm`:

`package.json` Property Name | Type | Description
--- | --- | ---
`_cySkipYarnInstall` | `boolean` | If `true`, skip the automatic `yarn install` for this package, even though it has a `package.json`.
`_cySkipDepInstall` | `boolean` | If `true`, skip the automatic `yarn install` or `npm install` for this package, even though it has a `package.json`.
`_cyYarnV311` | `boolean` | Run the yarn v3.1.1-style install command instead of yarn v1-style.
`_cyRunScripts` | `boolean` | By default, the automatic `yarn install` will not run postinstall scripts. This option, if set, will cause postinstall scripts to run for this project.
`_cyRunScripts` | `boolean` | By default, the automatic install will not run postinstall scripts. This option, if set, will cause postinstall scripts to run for this project.

Run `yarn projects:yarn:install` to run `yarn install` for all projects with a `package.json`.
Run `yarn projects:yarn:install` to run `yarn install`/`npm install` for all applicable projects.

Use the `UPDATE_YARN_LOCK=1` environment variable with `yarn test` or `yarn projects:yarn:install` to allow the `yarn.lock` to be updated and synced back to the monorepo from the temp dir.
Use the `UPDATE_LOCK_FILE=1` environment variable with `yarn test` or `yarn projects:yarn:install` to allow the `yarn.lock` or `package-lock.json` to be updated and synced back to the monorepo from the temp dir.
Loading

2 comments on commit 8fd7422

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 8fd7422 Mar 23, 2022

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/10.0.0/linux-x64/10.0-release-8fd7422d63bf652f309fda2296bab489f7ddece2/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 8fd7422 Mar 23, 2022

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/10.0.0/darwin-x64/10.0-release-8fd7422d63bf652f309fda2296bab489f7ddece2/cypress.tgz

Please sign in to comment.