Skip to content

Commit a045e4f

Browse files
JessicaSachsbrian-mannflotwig
authored
chore: move server e2e tests to system-tests (#16354)
Co-authored-by: Brian Mann <[email protected]> Co-authored-by: Zach Bloomquist <[email protected]> Co-authored-by: Zach Bloomquist <[email protected]>
1 parent 6c423e5 commit a045e4f

File tree

752 files changed

+1556
-802
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

752 files changed

+1556
-802
lines changed

.eslintignore

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@
1414
**/support/fixtures/projects/**/static/*
1515
**/support/fixtures/projects/**/*.jsx
1616
**/support/fixtures/projects/**/fail.js
17+
18+
system-tests/fixtures/*
19+
!system-tests/projects
20+
system-tests/projects/**/_fixtures/*
21+
system-tests/projects/**/static/*
22+
system-tests/projects/**/*.jsx
23+
system-tests/projects/**/fail.js
24+
system-tests/lib/scaffold/plugins/index.js
25+
system-tests/lib/scaffold/support/index.js
26+
system-tests/lib/scaffold/support/commands.js
27+
system-tests/test/support/projects/e2e/cypress/
28+
system-tests/projects/e2e/cypress/integration/stdout_exit_early_failing_spec.js
29+
system-tests/projects/e2e/cypress/integration/typescript_syntax_error_spec.ts
30+
31+
1732
**/test/fixtures
1833
**/vendor
1934

@@ -23,11 +38,7 @@ cli/types
2338
packages/example
2439

2540
packages/extension/test/helpers/background.js
26-
packages/server/lib/scaffold/plugins/index.js
27-
packages/server/lib/scaffold/support/index.js
28-
packages/server/lib/scaffold/support/commands.js
29-
packages/server/test/support/fixtures/projects/e2e/cypress/integration/stdout_exit_early_failing_spec.js
30-
packages/server/test/support/fixtures/projects/e2e/cypress/integration/typescript_syntax_error_spec.ts
41+
integration/stdout_exit_early_failing_spec.js
3142

3243
npm/webpack-preprocessor/cypress/tests/e2e/compile-error.js
3344
npm/webpack-preprocessor/examples/use-babelrc/cypress/integration/spec.js

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ packages/server/support
4040
packages/server/test/support/fixtures/server/imgs
4141
packages/server/test/support/fixtures/server/libs
4242

43+
# from system-tests
44+
system-tests/.projects
45+
system-tests/fixtures/large-img
46+
4347
# from npm/react
4448
/npm/react/bin/*
4549
/npm/react/cypress/videos

.vscode/terminals.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,20 @@
2424
"command": "yarn cypress:run --project ../project"
2525
},
2626
{
27-
"name": "packages/server test-e2e",
27+
"name": "cypress open (CT)",
28+
"focus": true,
29+
"onlySingle": true,
30+
"execute": true,
31+
"cwd": "[cwd]/packages/server-ct",
32+
"command": "yarn cypress:open"
33+
},
34+
{
35+
"name": "system-tests test",
2836
"focus": true,
2937
"onlySingle": true,
3038
"execute": false,
31-
"cwd": "[cwd]/packages/server",
32-
"command": "yarn test-e2e [fileBasename]"
39+
"cwd": "[cwd]/system-tests",
40+
"command": "yarn test [fileBasename]"
3341
},
3442
{
3543
"name": "packages/server test-watch",

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ By default, top level tasks will execute for all packages. However, most scripts
396396
| `test-unit` | Run unit tests |
397397
| `test-integration` | Run integration tests |
398398
| `test-e2e` | Run end-to-end tests |
399+
| `test-system` | Run system tests |
399400
| `test-watch` | Run unit tests and rebuild/rerun on file changes |
400401
401402
> 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.
@@ -428,7 +429,6 @@ Each package is responsible for building itself and testing itself and can do so
428429
| `test` | Runs all tests once (this usually means running unit tests; via `yarn test-unit`) |
429430
| `test-unit` | Run all unit tests within the package; `exit 0` if N/A |
430431
| `test-integration` | Run all integration tests within the package; `exit 0` if N/A |
431-
| `test-e2e` | Run all e2e tests within the package; `exit 0` if N/A |
432432
| `test-watch` | Run all unit tests in the package in watch mode |
433433
434434
#### Debugging
@@ -486,11 +486,11 @@ This is to ensure that links do not go dead in older versions of Cypress when th
486486
487487
For most packages there are typically unit and integration tests.
488488
489-
Our true e2e tests are in [`packages/server`](packages/server), which test the full stack all together.
489+
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.
490490
491-
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.
491+
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.
492492
493-
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.
493+
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.
494494
495495
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.
496496

circle.yml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ commands:
112112
mkdir -p /tmp/node_modules_cache
113113
mv ~/cypress/node_modules /tmp/node_modules_cache/root_node_modules
114114
mv ~/cypress/cli/node_modules /tmp/node_modules_cache/cli_node_modules
115+
mv ~/cypress/system-tests/node_modules /tmp/node_modules_cache/system-tests_node_modules
115116
mv ~/cypress/globbed_node_modules /tmp/node_modules_cache/globbed_node_modules
116117
117118
build-and-persist:
@@ -142,6 +143,7 @@ commands:
142143
if [[ -d "/tmp/node_modules_cache" ]]; then
143144
mv /tmp/node_modules_cache/root_node_modules ~/cypress/node_modules
144145
mv /tmp/node_modules_cache/cli_node_modules ~/cypress/cli/node_modules
146+
mv /tmp/node_modules_cache/system-tests_node_modules ~/cypress/system-tests/node_modules
145147
mv /tmp/node_modules_cache/globbed_node_modules ~/cypress/globbed_node_modules
146148
rm -rf /tmp/node_modules_cache
147149
fi
@@ -194,6 +196,7 @@ commands:
194196
paths:
195197
- node_modules
196198
- cli/node_modules
199+
- system-tests/node_modules
197200
- globbed_node_modules
198201
- unless:
199202
condition: <<parameters.is-mac>>
@@ -417,16 +420,17 @@ commands:
417420
path: ./packages/runner-ct/cypress/videos
418421
- store-npm-logs
419422

420-
run-e2e-tests:
423+
run-system-tests:
421424
parameters:
422425
browser:
423426
description: browser shortname to target
424427
type: string
425428
steps:
426429
- restore_cached_workspace
427430
- run:
431+
name: Run system tests
428432
command: |
429-
ALL_SPECS=`circleci tests glob "/root/cypress/packages/server/test/e2e/*spec*"`
433+
ALL_SPECS=`circleci tests glob "/root/cypress/system-tests/test/*spec*"`
430434
SPECS=
431435
for file in $ALL_SPECS; do
432436
# filter out non_root tests, they have their own stage
@@ -438,7 +442,7 @@ commands:
438442
done
439443
SPECS=`echo $SPECS | xargs -n 1 | circleci tests split --split-by=timings`
440444
echo SPECS=$SPECS
441-
yarn workspace @packages/server test $SPECS --browser <<parameters.browser>>
445+
yarn workspace @tooling/system-tests test:ci $SPECS --browser <<parameters.browser>>
442446
- verify-mocha-results
443447
- store_test_results:
444448
path: /tmp/cypress
@@ -1080,37 +1084,37 @@ jobs:
10801084
path: /tmp/artifacts
10811085
- store-npm-logs
10821086

1083-
server-e2e-tests-chrome:
1087+
system-tests-chrome:
10841088
<<: *defaults
10851089
resource_class: medium
10861090
parallelism: 8
10871091
steps:
1088-
- run-e2e-tests:
1092+
- run-system-tests:
10891093
browser: chrome
10901094

1091-
server-e2e-tests-electron:
1095+
system-tests-electron:
10921096
<<: *defaults
10931097
resource_class: medium
10941098
parallelism: 8
10951099
steps:
1096-
- run-e2e-tests:
1100+
- run-system-tests:
10971101
browser: electron
10981102

1099-
server-e2e-tests-firefox:
1103+
system-tests-firefox:
11001104
<<: *defaults
11011105
resource_class: medium
11021106
parallelism: 8
11031107
steps:
1104-
- run-e2e-tests:
1108+
- run-system-tests:
11051109
browser: firefox
11061110

1107-
server-e2e-tests-non-root:
1111+
system-tests-non-root:
11081112
<<: *defaults
11091113
resource_class: medium
11101114
steps:
11111115
- restore_cached_workspace
11121116
- run:
1113-
command: yarn workspace @packages/server test ./test/e2e/non_root*spec* --browser electron
1117+
command: yarn workspace @tooling/system-tests test:ci "test/non_root*spec*" --browser electron
11141118
- verify-mocha-results
11151119
- store_test_results:
11161120
path: /tmp/cypress
@@ -2007,16 +2011,16 @@ linux-workflow: &linux-workflow
20072011
- server-performance-tests:
20082012
requires:
20092013
- build
2010-
- server-e2e-tests-chrome:
2014+
- system-tests-chrome:
20112015
requires:
20122016
- build
2013-
- server-e2e-tests-electron:
2017+
- system-tests-electron:
20142018
requires:
20152019
- build
2016-
- server-e2e-tests-firefox:
2020+
- system-tests-firefox:
20172021
requires:
20182022
- build
2019-
- server-e2e-tests-non-root:
2023+
- system-tests-non-root:
20202024
executor: non-root-docker-user
20212025
requires:
20222026
- build
@@ -2123,10 +2127,10 @@ linux-workflow: &linux-workflow
21232127
- driver-integration-tests-firefox
21242128
- driver-integration-tests-chrome
21252129
- driver-integration-tests-electron
2126-
- server-e2e-tests-non-root
2127-
- server-e2e-tests-firefox
2128-
- server-e2e-tests-electron
2129-
- server-e2e-tests-chrome
2130+
- system-tests-non-root
2131+
- system-tests-firefox
2132+
- system-tests-electron
2133+
- system-tests-chrome
21302134
- server-performance-tests
21312135
- server-integration-tests
21322136
- server-unit-tests

lerna.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"packages": [
44
"cli",
55
"packages/*",
6-
"npm/*"
6+
"npm/*",
7+
"system-tests"
78
],
89
"useWorkspaces": true,
910
"version": "0.0.0"

npm/webpack-preprocessor/index.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,11 @@ const preprocessor: WebpackPreprocessor = (options: PreprocessorOptions = {}): F
268268

269269
const jsonStats = stats.toJson()
270270

271+
// these stats are really only useful for debugging
272+
if (jsonStats.warnings.length > 0) {
273+
debug(`warnings for ${outputPath} %o`, jsonStats.warnings)
274+
}
275+
271276
if (stats.hasErrors()) {
272277
err = new Error('Webpack Compilation Error')
273278

@@ -279,17 +284,11 @@ const preprocessor: WebpackPreprocessor = (options: PreprocessorOptions = {}): F
279284

280285
err.message += `\n${errorsToAppend}`
281286

282-
debug('stats had error(s)')
287+
debug('stats had error(s) %o', jsonStats.errors)
283288

284289
return rejectWithErr(err)
285290
}
286291

287-
// these stats are really only useful for debugging
288-
if (jsonStats.warnings.length > 0) {
289-
debug(`warnings for ${outputPath}`)
290-
debug(jsonStats.warnings)
291-
}
292-
293292
debug('finished bundling', outputPath)
294293
if (debugStats.enabled) {
295294
/* eslint-disable-next-line no-console */

npm/webpack-preprocessor/test/e2e/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ exports.runTest = async (options = {}) => {
8383
VIDEO_COMPRESSION_THROTTLE: 120000,
8484

8585
// don't fail our own tests running from forked PR's
86-
CYPRESS_INTERNAL_E2E_TESTS: '1',
86+
CYPRESS_INTERNAL_SYSTEM_TESTS: '1',
8787
CYPRESS_ENV: 'test',
8888
})
8989

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@
4949
"test": "yarn lerna exec yarn test --scope cypress --scope \"'@packages/{electron,extension,https-proxy,launcher,net-stubbing,network,proxy,rewriter,runner,runner-shared,socket}'\"",
5050
"test-debug": "lerna exec yarn test-debug --ignore \"'@packages/{desktop-gui,driver,root,static,web-config}'\"",
5151
"pretest-e2e": "yarn ensure-deps",
52-
"test-e2e": "lerna exec yarn test-e2e --ignore \"'@packages/{desktop-gui,driver,root,static,web-config}'\"",
5352
"test-integration": "lerna exec yarn test-integration --ignore \"'@packages/{desktop-gui,driver,root,static,web-config}'\"",
5453
"test-mocha": "mocha --reporter spec scripts/spec.js",
5554
"test-mocha-snapshot": "mocha scripts/mocha-snapshot-spec.js",
5655
"test-npm-package-release-script": "npx lerna exec --scope \"@cypress/*\" -- npx --no-install semantic-release --dry-run",
5756
"test-s3-api": "node -r ./packages/ts/register scripts/binary/s3-api-demo.ts",
57+
"test-system": "yarn workspace @tooling/system-tests test",
5858
"test-scripts": "mocha -r packages/ts/register --reporter spec 'scripts/unit/**/*spec.js'",
5959
"test-scripts-watch": "yarn test-scripts --watch --watch-extensions 'ts,js'",
6060
"pretest-unit": "yarn ensure-deps",
@@ -224,7 +224,8 @@
224224
"packages": [
225225
"cli",
226226
"packages/*",
227-
"npm/*"
227+
"npm/*",
228+
"system-tests"
228229
],
229230
"nohoist": [
230231
"**/@ffmpeg-installer",

packages/runner/cypress/fixtures/errors/exceptions_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import './setup'
22

3-
const outsideError = require('../../../../server/test/support/fixtures/projects/todos/throws-error')
3+
const outsideError = require('@tooling/system-tests/projects/todos/throws-error')
44

55
describe('exception failures', () => {
66
it('in spec file', () => {

packages/server/README.md

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,13 @@ yarn workspace @packages/server build-prod
3939
* `yarn test-unit` executes unit tests in [`test/unit`](./test/unit)
4040
* `yarn test-integration` executes integration tests in [`test/integration`](./test/integration)
4141
* `yarn test-performance` executes performance tests in [`test/performance`](./test/performance)
42-
* `yarn test-e2e` executes the large (slow) end to end tests in [`test/e2e`](./test/e2e)
4342

4443
You can also use the `test-watch` command to rerun a test file whenever there is a change:
4544

4645
```bash
4746
yarn test-watch /test/path/to/spec.js
4847
```
4948

50-
When running e2e tests, some test projects output verbose logs. To see them run the test with `DEBUG=cypress:e2e` environment variable.
51-
5249
### Running individual unit tests
5350

5451
```bashtest-kitchensink
@@ -67,19 +64,9 @@ yarn test test/integration/cli_spec.js
6764
yarn test-integration cli_spec ## shorthand, uses globbing to find spec
6865
```
6966

70-
### Running individual e2e tests
67+
### Running e2e/system tests
7168

72-
```bash
73-
yarn test <path/to/test>
74-
yarn test test/e2e/1_async_timeouts_spec.js
75-
## or
76-
yarn test-e2e async_timeouts ## shorthand, uses globbing to find spec
77-
```
78-
79-
To keep the browser open after a spec run (for easier debugging and iterating on specs), you can pass the `--no-exit` flag to the e2e test command. Live reloading due to spec changes should also work:
80-
```sh
81-
yarn test test/e2e/go_spec.js --browser chrome --no-exit
82-
```
69+
> With the addition of Component Testing, `e2e` tests have been renamed to `system-tests` and moved to the [`system-tests`](../../system-tests) directory.
8370
8471
### Updating snaphots
8572

@@ -88,5 +75,4 @@ Prepend `SNAPSHOT_UPDATE=1` to any test command. See [`snap-shot-it` instruction
8875
```bash
8976
SNAPSHOT_UPDATE=1 yarn test test/unit/api_spec.js
9077
SNAPSHOT_UPDATE=1 yarn test test/integration/cli_spec.js
91-
SNAPSHOT_UPDATE=1 yarn test-e2e async_timeout
9278
```

packages/server/lib/modes/record.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const logException = (err) => {
3232
// dont yell about any errors either
3333

3434
const runningInternalTests = () => {
35-
return env.get('CYPRESS_INTERNAL_E2E_TESTS') === '1'
35+
return env.get('CYPRESS_INTERNAL_SYSTEM_TESTS') === '1'
3636
}
3737

3838
const haveProjectIdAndKeyButNoRecordOption = (projectId, options) => {

0 commit comments

Comments
 (0)