Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Oct 25, 2021
2 parents 5caf72f + 2a7bfc9 commit 65458d6
Show file tree
Hide file tree
Showing 875 changed files with 49,116 additions and 1,881 deletions.
21 changes: 16 additions & 5 deletions .eslintignore
Expand Up @@ -14,6 +14,21 @@
**/support/fixtures/projects/**/static/*
**/support/fixtures/projects/**/*.jsx
**/support/fixtures/projects/**/fail.js

system-tests/fixtures/*
!system-tests/projects
system-tests/projects/**/_fixtures/*
system-tests/projects/**/static/*
system-tests/projects/**/*.jsx
system-tests/projects/**/fail.js
system-tests/lib/scaffold/plugins/index.js
system-tests/lib/scaffold/support/index.js
system-tests/lib/scaffold/support/commands.js
system-tests/test/support/projects/e2e/cypress/
system-tests/projects/e2e/cypress/integration/stdout_exit_early_failing_spec.js
system-tests/projects/e2e/cypress/integration/typescript_syntax_error_spec.ts


**/test/fixtures
**/vendor

Expand All @@ -23,11 +38,7 @@ cli/types
packages/example

packages/extension/test/helpers/background.js
packages/server/lib/scaffold/plugins/index.js
packages/server/lib/scaffold/support/index.js
packages/server/lib/scaffold/support/commands.js
packages/server/test/support/fixtures/projects/e2e/cypress/integration/stdout_exit_early_failing_spec.js
packages/server/test/support/fixtures/projects/e2e/cypress/integration/typescript_syntax_error_spec.ts
integration/stdout_exit_early_failing_spec.js

npm/webpack-preprocessor/cypress/tests/e2e/compile-error.js
npm/webpack-preprocessor/examples/use-babelrc/cypress/integration/spec.js
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Expand Up @@ -40,6 +40,10 @@ packages/server/support
packages/server/test/support/fixtures/server/imgs
packages/server/test/support/fixtures/server/libs

# from system-tests
system-tests/.projects
system-tests/fixtures/large-img

# from npm/react
/npm/react/bin/*
/npm/react/cypress/videos
Expand Down Expand Up @@ -335,7 +339,6 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk

/npm/react/bin/*
# End of https://www.gitignore.io/api/osx,git,node,windows,intellij,linux

# Circle cache artifacts
Expand Down
35 changes: 35 additions & 0 deletions .vscode/extensions.json
@@ -0,0 +1,35 @@
{
// To see these extensions in VS Code:
// 1. Open the Command Palette (Ctrl+Shift+P)
// 2. Select "Extensions: Show Recommended Extensions"

// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.

// List of extensions which are recommended for Cypress contributors using VS Code:
"recommendations": [
// Name: ESLint
// Description: Integrates ESLint JavaScript into VS Code.
"dbaeumer.vscode-eslint",
// Name: GitHub linker
// Description: Create links to fragments of code in GitHub
"gimenete.github-linker",
// Name: GitLens — Git supercharged
// Description: Supercharge the Git capabilities built into Visual Studio Code — Visualize code authorship at a glance via Git blame annotations and code lens, seamlessly navigate and explore Git repositories, gain valuable insights via powerful comparison commands, and so much more
"eamodio.gitlens",
// Name: Terminals Manager
// Description: An extension for setting-up multiple terminals at once, or just running some commands
// There are several Terminals defined in `.vscode/terminals.json` that can be used via this plugin.
"fabiospampinato.vscode-terminals",
// Name: Test Utils
// Description: Add, remove, and move .only in tests
"chrisbreiding.test-utils",
// Name: Toggle Quotes
// Description: Toggle cycle " -> ' -> `
"britesnow.vscode-toggle-quotes",
],

// List of extensions recommended by VS Code that should not be recommended for Cypress contributors using VS Code:
"unwantedRecommendations": [

]
}
14 changes: 11 additions & 3 deletions .vscode/terminals.json
Expand Up @@ -24,12 +24,20 @@
"command": "yarn cypress:run --project ../project"
},
{
"name": "packages/server test-e2e",
"name": "cypress open (CT)",
"focus": true,
"onlySingle": true,
"execute": true,
"cwd": "[cwd]/packages/server-ct",
"command": "yarn cypress:open"
},
{
"name": "system-tests test",
"focus": true,
"onlySingle": true,
"execute": false,
"cwd": "[cwd]/packages/server",
"command": "yarn test-e2e [fileBasename]"
"cwd": "[cwd]/system-tests",
"command": "yarn test [fileBasename]"
},
{
"name": "packages/server test-watch",
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Expand Up @@ -396,6 +396,7 @@ By default, top level tasks will execute for all packages. However, most scripts
| `test-unit` | Run unit tests |
| `test-integration` | Run integration tests |
| `test-e2e` | Run end-to-end tests |
| `test-system` | Run system tests |
| `test-watch` | Run unit tests and rebuild/rerun on file changes |

> Most of the time you will only want to run a task within a specific package; this can be done by providing the package name as a scope to the top level task.
Expand Down Expand Up @@ -428,7 +429,6 @@ Each package is responsible for building itself and testing itself and can do so
| `test` | Runs all tests once (this usually means running unit tests; via `yarn test-unit`) |
| `test-unit` | Run all unit tests within the package; `exit 0` if N/A |
| `test-integration` | Run all integration tests within the package; `exit 0` if N/A |
| `test-e2e` | Run all e2e tests within the package; `exit 0` if N/A |
| `test-watch` | Run all unit tests in the package in watch mode |

#### Debugging
Expand Down Expand Up @@ -486,11 +486,11 @@ This is to ensure that links do not go dead in older versions of Cypress when th

For most packages there are typically unit and integration tests.

Our true e2e tests are in [`packages/server`](packages/server), which test the full stack all together.
Please refer to each packages' `README.md` which documents how to run tests. It is not feasible to try to run all of the tests together. We run our entire test fleet across over a dozen containers in CI.

Additionally, we test the code by running it against various other example projects in CI. See CI badges and links at the top of this document.
There are also a set of system tests in [`system-tests`](system-tests) which attempt to test the entire Cypress App as close to real world as possible. See the [`README`](system-tests/README.md) for more information.

Please refer to each packages' `README.md` which documents how to run tests. It is not feasible to try to run all of the tests together. We run our entire test fleet across over a dozen containers in CI.
Additionally, we test the code by running it against various other example projects in CI. See CI badges and links at the top of this document.

If you're curious how we manage all of these tests in CI check out our [`circle.yml`](circle.yml) file found in the root `cypress` directory.

Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,5 +1,5 @@
<p align="center">
<img src="https://cloud.githubusercontent.com/assets/1268976/20607953/d7ae489c-b24a-11e6-9cc4-91c6c74c5e88.png"/>
<a href="https://www.cypress.io"><img src="https://cloud.githubusercontent.com/assets/1268976/20607953/d7ae489c-b24a-11e6-9cc4-91c6c74c5e88.png"/></a>
</p>
<p align="center">
<a href="https://on.cypress.io">Documentation</a> |
Expand Down
4 changes: 2 additions & 2 deletions browser-versions.json
@@ -1,4 +1,4 @@
{
"chrome:beta": "95.0.4638.40",
"chrome:stable": "94.0.4606.71"
"chrome:beta": "96.0.4664.18",
"chrome:stable": "95.0.4638.54"
}
42 changes: 23 additions & 19 deletions circle.yml
Expand Up @@ -112,6 +112,7 @@ commands:
mkdir -p /tmp/node_modules_cache
mv ~/cypress/node_modules /tmp/node_modules_cache/root_node_modules
mv ~/cypress/cli/node_modules /tmp/node_modules_cache/cli_node_modules
mv ~/cypress/system-tests/node_modules /tmp/node_modules_cache/system-tests_node_modules
mv ~/cypress/globbed_node_modules /tmp/node_modules_cache/globbed_node_modules
build-and-persist:
Expand Down Expand Up @@ -142,6 +143,7 @@ commands:
if [[ -d "/tmp/node_modules_cache" ]]; then
mv /tmp/node_modules_cache/root_node_modules ~/cypress/node_modules
mv /tmp/node_modules_cache/cli_node_modules ~/cypress/cli/node_modules
mv /tmp/node_modules_cache/system-tests_node_modules ~/cypress/system-tests/node_modules
mv /tmp/node_modules_cache/globbed_node_modules ~/cypress/globbed_node_modules
rm -rf /tmp/node_modules_cache
fi
Expand Down Expand Up @@ -194,6 +196,7 @@ commands:
paths:
- node_modules
- cli/node_modules
- system-tests/node_modules
- globbed_node_modules
- unless:
condition: <<parameters.is-mac>>
Expand Down Expand Up @@ -417,16 +420,17 @@ commands:
path: ./packages/runner-ct/cypress/videos
- store-npm-logs

run-e2e-tests:
run-system-tests:
parameters:
browser:
description: browser shortname to target
type: string
steps:
- restore_cached_workspace
- run:
name: Run system tests
command: |
ALL_SPECS=`circleci tests glob "/root/cypress/packages/server/test/e2e/*spec*"`
ALL_SPECS=`circleci tests glob "/root/cypress/system-tests/test/*spec*"`
SPECS=
for file in $ALL_SPECS; do
# filter out non_root tests, they have their own stage
Expand All @@ -438,7 +442,7 @@ commands:
done
SPECS=`echo $SPECS | xargs -n 1 | circleci tests split --split-by=timings`
echo SPECS=$SPECS
yarn workspace @packages/server test $SPECS --browser <<parameters.browser>>
yarn workspace @tooling/system-tests test:ci $SPECS --browser <<parameters.browser>>
- verify-mocha-results
- store_test_results:
path: /tmp/cypress
Expand Down Expand Up @@ -1080,37 +1084,37 @@ jobs:
path: /tmp/artifacts
- store-npm-logs

server-e2e-tests-chrome:
system-tests-chrome:
<<: *defaults
resource_class: medium
parallelism: 8
steps:
- run-e2e-tests:
- run-system-tests:
browser: chrome

server-e2e-tests-electron:
system-tests-electron:
<<: *defaults
resource_class: medium
parallelism: 8
steps:
- run-e2e-tests:
- run-system-tests:
browser: electron

server-e2e-tests-firefox:
system-tests-firefox:
<<: *defaults
resource_class: medium
parallelism: 8
steps:
- run-e2e-tests:
- run-system-tests:
browser: firefox

server-e2e-tests-non-root:
system-tests-non-root:
<<: *defaults
resource_class: medium
steps:
- restore_cached_workspace
- run:
command: yarn workspace @packages/server test ./test/e2e/non_root*spec* --browser electron
command: yarn workspace @tooling/system-tests test:ci "test/non_root*spec*" --browser electron
- verify-mocha-results
- store_test_results:
path: /tmp/cypress
Expand Down Expand Up @@ -2007,16 +2011,16 @@ linux-workflow: &linux-workflow
- server-performance-tests:
requires:
- build
- server-e2e-tests-chrome:
- system-tests-chrome:
requires:
- build
- server-e2e-tests-electron:
- system-tests-electron:
requires:
- build
- server-e2e-tests-firefox:
- system-tests-firefox:
requires:
- build
- server-e2e-tests-non-root:
- system-tests-non-root:
executor: non-root-docker-user
requires:
- build
Expand Down Expand Up @@ -2123,10 +2127,10 @@ linux-workflow: &linux-workflow
- driver-integration-tests-firefox
- driver-integration-tests-chrome
- driver-integration-tests-electron
- server-e2e-tests-non-root
- server-e2e-tests-firefox
- server-e2e-tests-electron
- server-e2e-tests-chrome
- system-tests-non-root
- system-tests-firefox
- system-tests-electron
- system-tests-chrome
- server-performance-tests
- server-integration-tests
- server-unit-tests
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Expand Up @@ -74,7 +74,7 @@
"@types/jquery": "3.3.31",
"@types/lodash": "4.14.168",
"@types/minimatch": "3.0.3",
"@types/mocha": "5.2.7",
"@types/mocha": "8.0.3",
"@types/sinon": "7.5.1",
"@types/sinon-chai": "3.2.5",
"chai": "3.5.0",
Expand Down
5 changes: 5 additions & 0 deletions cli/schema/cypress.schema.json
Expand Up @@ -44,6 +44,11 @@
"default": null,
"description": "The reporter options used. Supported options depend on the reporter. See https://on.cypress.io/reporters#Reporter-Options"
},
"slowTestThreshold": {
"type": "number",
"default": 10000,
"description": "Slow test threshold in milliseconds. Only affects the visual output of some reporters. For example, the spec reporter will display the test time in yellow if over the threshold. See https://on.cypress.io/configuration#Timeouts"
},
"testFiles": {
"type": [
"string",
Expand Down
21 changes: 21 additions & 0 deletions cli/scripts/post-install.js
Expand Up @@ -5,6 +5,7 @@

const { includeTypes } = require('./utils')
const shell = require('shelljs')
const fs = require('fs')
const { join } = require('path')
const resolvePkg = require('resolve-pkg')

Expand Down Expand Up @@ -72,3 +73,23 @@ shell.sed('-i', 'from \'sinon\';', 'from \'../sinon\';', sinonChaiFilename)
// copy experimental network stubbing type definitions
// so users can import: `import 'cypress/types/net-stubbing'`
shell.cp(resolvePkg('@packages/net-stubbing/lib/external-types.ts'), 'types/net-stubbing.ts')

// https://github.com/cypress-io/cypress/issues/18069
// To avoid type clashes, some files should be commented out entirely by patch-package
// and uncommented here.

const filesToUncomment = [
'mocha/index.d.ts',
'jquery/JQuery.d.ts',
'jquery/legacy.d.ts',
'jquery/misc.d.ts',
]

filesToUncomment.forEach((file) => {
const filePath = join(__dirname, '../types', file)
const str = fs.readFileSync(filePath).toString()

const result = str.split('\n').map((line) => line.substring(3)).join('\n')

fs.writeFileSync(filePath, result)
})
5 changes: 3 additions & 2 deletions cli/types/cy-bluebird.d.ts
@@ -1,11 +1,12 @@
// Shim definition to export a namespace. Cypress is actually a global module
// so import/export isn't allowed there. We import here and define a global module
// so that Cypress can get and use the Blob type
import BluebirdStatic = require('./bluebird')
import ImportedBluebird = require('./bluebird')

export = Bluebird
export as namespace Bluebird

declare namespace Bluebird {
type BluebirdStatic = typeof BluebirdStatic
type BluebirdStatic = typeof ImportedBluebird
interface Promise<T> extends ImportedBluebird<T> {}
}
4 changes: 4 additions & 0 deletions cli/types/cypress-npm-api.d.ts
Expand Up @@ -91,6 +91,10 @@ declare namespace CypressCommandLine {
* Specify mocha reporter options
*/
reporterOptions: any
/**
* Slow test threshold in milliseconds. Only affects the visual output of some reporters. For example, the spec reporter will display the test time in yellow if over the threshold.
*/
slowTestThreshold: number
/**
* Specify the specs to run
*/
Expand Down

4 comments on commit 65458d6

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 65458d6 Oct 25, 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.7.1/circle-develop-65458d6ac86ac8e4ba84844203c9177cee9904d8/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 65458d6 Oct 25, 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.7.1/appveyor-develop-65458d6ac86ac8e4ba84844203c9177cee9904d8/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 65458d6 Oct 25, 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.7.1/appveyor-develop-65458d6ac86ac8e4ba84844203c9177cee9904d8/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 65458d6 Oct 25, 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.7.1/circle-develop-65458d6ac86ac8e4ba84844203c9177cee9904d8/cypress.tgz

Please sign in to comment.