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

iterate through specs in parallel #2154

Merged
merged 51 commits into from
Aug 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
0fa2515
replace parallelId with ciBuildId in args whitelist
amirrustam Jul 14, 2018
25ac101
adds cli flags for accept --parallel, --ci-build-id, and --group
brian-mann Jul 17, 2018
7ffcdec
WIP iterations on parallel and grouped runs
brian-mann Jul 23, 2018
2f98e63
remove only
brian-mann Jul 23, 2018
9188827
Merge branch 'develop' into whitelist-ci-build-id
brian-mann Aug 1, 2018
5a8fb83
fixes tests from route version bump
brian-mann Aug 2, 2018
b1587a3
generate new browser profiles for electron + chrome* variants
brian-mann Aug 2, 2018
5b9cc26
fix failing tests and pass null for pullRequestId and defaultBranch f…
brian-mann Aug 2, 2018
209a8b6
updates snapshots for new arguments
brian-mann Aug 2, 2018
9eb49bc
set default resp object when null from API error and fixes tests
brian-mann Aug 2, 2018
d940196
Merge branch 'develop' into whitelist-ci-build-id
brian-mann Aug 4, 2018
c00eb92
fix merge conflicts
brian-mann Aug 4, 2018
6c39ee1
Merge branch 'develop' into whitelist-ci-build-id
brian-mann Aug 4, 2018
9fea83f
adds estimated duration, and record params to output
brian-mann Aug 5, 2018
c01561d
error when ciBuildId is passed explicitly without a group or parallel…
brian-mann Aug 5, 2018
c604462
bump snap-shot-it and snapshot integration cypress specs
brian-mann Aug 5, 2018
4073e28
move error message testing into cypress_spec for perf
brian-mann Aug 5, 2018
66aa398
throw if using record params without recording
brian-mann Aug 5, 2018
7230f1b
added more scenarios for record params without recording
brian-mann Aug 5, 2018
4abe162
refactor errors not to use state, check cypress errors without creati…
brian-mann Aug 5, 2018
4b5710a
error when using record params with indeterminate ciBuildId
brian-mann Aug 5, 2018
7dadbca
refactor displaying record param args
brian-mann Aug 6, 2018
21059e7
rename for adding more error specs
brian-mann Aug 6, 2018
c3abd82
automatically trim too many multiple new lines in errors
brian-mann Aug 6, 2018
f34184b
rename to synchronize with other dashboard prefixed errors
brian-mann Aug 6, 2018
e45fda5
renamed all existing snapshots
brian-mann Aug 6, 2018
42e4bff
missing new line trimmer
brian-mann Aug 6, 2018
e48561a
throw nice errors using the old snapshot env vars
brian-mann Aug 6, 2018
449e25b
update snapshots to confirm to latest snap-shot-it to avoid manually …
brian-mann Aug 6, 2018
d5e78ae
hack for older version of mocha so that snap-shot-it respects only
brian-mann Aug 6, 2018
3ae9ce4
add 422 errors for record mode for RUN_GROUP_NAME_NOT_UNIQUE
brian-mann Aug 6, 2018
fdec2a5
added DASHBOARD_PARALLEL_GROUP_PARAMS_MISMATCH error handling
brian-mann Aug 6, 2018
6a4bf32
remove stop-only temporarily
brian-mann Aug 6, 2018
82919e3
Merge branch 'develop' into whitelist-ci-build-id
brian-mann Aug 6, 2018
d90cf4e
added the current run url when groups are not unique
brian-mann Aug 6, 2018
fafc109
added parallel disabled error handling
brian-mann Aug 6, 2018
778864c
added parallel required error handling
brian-mann Aug 6, 2018
aad65c4
use @, not this
brian-mann Aug 6, 2018
af50ea0
added dashboard already complete error handling
brian-mann Aug 6, 2018
000dfb7
added dashboard stale run error handling
brian-mann Aug 6, 2018
d2f8c8d
display other parameter flags in errors for clarity
brian-mann Aug 6, 2018
5132f16
fixes failing tests with snapshot new line differences, and purged ol…
brian-mann Aug 6, 2018
2e8e72f
comment out skipped skip test
brian-mann Aug 6, 2018
5a96b4e
fixes failing snapshot tests with recording
brian-mann Aug 6, 2018
b1d31a4
added unknown 422 response from server handling
brian-mann Aug 6, 2018
419873d
ensure that 500 server errors on grouping does not hard stop
brian-mann Aug 6, 2018
136203c
exit error if creating run fails when in parallel
brian-mann Aug 6, 2018
3d22325
exit error if creating instance fails when in parallel
brian-mann Aug 6, 2018
a9bfd68
exit error if updating instance fails when in parallel
brian-mann Aug 6, 2018
d8ba18f
fix false group from showing up
brian-mann Aug 6, 2018
8a08a12
fixes failing snapshots due to newlines
brian-mann Aug 6, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ jobs:
paths:
- packages/ts/node_modules

- run: npm run stop-only
## TODO: this needs to be reenabled when
## we update stop-only
# - run: npm run stop-only
## now go build all of subpackages
- run: npm run build

Expand Down
19 changes: 11 additions & 8 deletions cli/__snapshots__/cli_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ exports['shows help for run --foo 1'] = `
-c, --config <config> sets configuration values. separate multiple values with a comma. overrides any value in cypress.json.
-b, --browser <browser-name> runs Cypress in the browser with the given name. note: using an external browser will not record a video.
-P, --project <project-path> path to the project
--parallel enables concurrent runs and automatic load balancing of specs across multiple machines or processes
--group <name> a named group for recorded runs in the Cypress dashboard
--ci-build-id <id> the unique identifier for a run on your CI provider. typically a "BUILD_ID" env var. this value is automatically detected for most CI providers
--no-exit keep the browser open after tests finish
--dev runs cypress in development and bypasses binary check
-h, --help output usage information
Expand Down Expand Up @@ -94,14 +97,14 @@ exports['cli help command shows help 1'] = `

Options:

-v, --version Prints Cypress version
-v, --version prints Cypress version
-h, --help output usage information


Commands:

help Shows CLI help and exits
version Prints Cypress version
version prints Cypress version
run [options] Runs Cypress tests from the CLI without the GUI
open [options] Opens Cypress in the interactive GUI.
install [options] Installs the Cypress executable matching this package's version
Expand Down Expand Up @@ -131,14 +134,14 @@ exports['cli help command shows help for -h 1'] = `

Options:

-v, --version Prints Cypress version
-v, --version prints Cypress version
-h, --help output usage information


Commands:

help Shows CLI help and exits
version Prints Cypress version
version prints Cypress version
run [options] Runs Cypress tests from the CLI without the GUI
open [options] Opens Cypress in the interactive GUI.
install [options] Installs the Cypress executable matching this package's version
Expand Down Expand Up @@ -168,14 +171,14 @@ exports['cli help command shows help for --help 1'] = `

Options:

-v, --version Prints Cypress version
-v, --version prints Cypress version
-h, --help output usage information


Commands:

help Shows CLI help and exits
version Prints Cypress version
version prints Cypress version
run [options] Runs Cypress tests from the CLI without the GUI
open [options] Opens Cypress in the interactive GUI.
install [options] Installs the Cypress executable matching this package's version
Expand Down Expand Up @@ -207,14 +210,14 @@ exports['cli unknown command shows usage and exits 1'] = `

Options:

-v, --version Prints Cypress version
-v, --version prints Cypress version
-h, --help output usage information


Commands:

help Shows CLI help and exits
version Prints Cypress version
version prints Cypress version
run [options] Runs Cypress tests from the CLI without the GUI
open [options] Opens Cypress in the interactive GUI.
install [options] Installs the Cypress executable matching this package's version
Expand Down
10 changes: 8 additions & 2 deletions cli/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const parseOpts = (opts) => {
'project', 'spec', 'reporter', 'reporterOptions', 'path', 'destination',
'port', 'env', 'cypressVersion', 'config', 'record', 'key',
'browser', 'detached', 'headed', 'global', 'dev', 'force', 'exit',
'cachePath', 'cacheList', 'cacheClear'
'cachePath', 'cacheList', 'cacheClear', 'parallel', 'group', 'ciBuildId'
)

if (opts.exit) {
Expand Down Expand Up @@ -56,14 +56,17 @@ const descriptions = {
detached: 'runs Cypress application in detached mode',
project: 'path to the project',
global: 'force Cypress into global mode as if its globally installed',
version: 'Prints Cypress version',
version: 'prints Cypress version',
headed: 'displays the Electron browser instead of running headlessly',
dev: 'runs cypress in development and bypasses binary check',
forceInstall: 'force install the Cypress binary',
exit: 'keep the browser open after tests finish',
cachePath: 'print the cypress binary cache path',
cacheList: 'list the currently cached versions',
cacheClear: 'delete the Cypress binary cache',
group: 'a named group for recorded runs in the Cypress dashboard',
parallel: 'enables concurrent runs and automatic load balancing of specs across multiple machines or processes',
ciBuildId: 'the unique identifier for a run on your CI provider. typically a "BUILD_ID" env var. this value is automatically detected for most CI providers',
}

const knownCommands = ['version', 'run', 'open', 'install', 'verify', '-v', '--version', 'help', '-h', '--help', 'cache']
Expand Down Expand Up @@ -134,6 +137,9 @@ module.exports = {
.option('-c, --config <config>', text('config'))
.option('-b, --browser <browser-name>', text('browser'))
.option('-P, --project <project-path>', text('project'))
.option('--parallel', text('parallel'))
.option('--group <name>', text('group'))
.option('--ci-build-id <id>', text('ciBuildId'))
.option('--no-exit', text('exit'))
.option('--dev', text('dev'), coerceFalse)
.action((opts) => {
Expand Down
12 changes: 12 additions & 0 deletions cli/lib/exec/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ const processRunOptions = (options = {}) => {
args.push('--record', options.record)
}

if (options.parallel) {
args.push('--parallel')
}

if (options.group) {
args.push('--group', options.group)
}

if (options.ciBuildId) {
args.push('--ci-build-id', options.ciBuildId)
}

if (options.outputPath) {
args.push('--output-path', options.outputPath)
}
Expand Down
14 changes: 14 additions & 0 deletions cli/test/lib/cli_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,20 @@ describe('cli', function () {
expect(run.start).to.be.calledWith({ exit: false })
})

it('calls run with --parallel', function () {
this.exec('run --parallel')
expect(run.start).to.be.calledWith({ parallel: true })
})

it('calls runs with --ci-build-id', function () {
this.exec('run --ci-build-id 123')
expect(run.start).to.be.calledWith({ ciBuildId: '123' })
})

it('calls runs with --group', function () {
this.exec('run --group staging')
expect(run.start).to.be.calledWith({ group: 'staging' })
})
})

context('cypress open', function () {
Expand Down
13 changes: 6 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@
"lint-coffee": "coffeelint scripts/**/*.coffee",
"lint": "npm run lint-js && npm run lint-coffee",
"pretest": "npm run lint && npm run all lint && npm run test-scripts",
"precommit": "lint-staged; npm run warn-only",
"precommit": "lint-staged",
"precommit-lint": "eslint --fix",
"prepush": "npm run stop-only",
"stop-only": "stop-only packages --exclude-dir .cy --exclude-dir .projects --exclude-dir node_modules --exclude-dir dist --exclude-dir dist-test --exclude-dir fixtures --exclude-dir lib --exclude-dir bower_components",
"warn-only": "stop-only --warn packages --exclude-dir .cy --exclude-dir .projects --exclude-dir node_modules --exclude-dir dist --exclude-dir dist-test --exclude-dir fixtures --exclude-dir lib --exclude-dir bower_components",
"stop-only": "stop-only --folder packages --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components,spec_helper.coffee",
"warn-only": "stop-only --warn packages --skip .cy,.publish,.projects,node_modules,dist,dist-test,fixtures,lib,bower_components,spec_helper.coffee",
"bump": "node ./scripts/binary.js bump",
"set-next-ci-version": "node ./scripts/binary.js setNextVersion",
"binary-build": "node ./scripts/binary.js build",
Expand Down Expand Up @@ -80,7 +79,7 @@
"execa": "^0.8.0",
"execa-wrap": "^1.1.0",
"filesize": "^3.5.10",
"fs-extra": "^2.1.2",
"fs-extra": "^7.0.0",
"gift": "^0.10.0",
"gulp": "^3.9.1",
"gulp-awspublish": "^3.3.0",
Expand Down Expand Up @@ -108,8 +107,8 @@
"print-arch": "^1.0.0",
"ramda": "^0.24.1",
"shelljs": "^0.7.8",
"snap-shot-it": "^4.0.1",
"stop-only": "1.2.1",
"snap-shot-it": "^5.0.1",
"stop-only": "2.1.0",
"terminal-banner": "^1.0.0",
"typescript": "^2.3.4",
"vagrant": "0.0.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
exports['e2e async timeouts failing1 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -67,5 +68,5 @@ exports['e2e async timeouts failing1 1'] = `
└────────────────────────────────────────────────────────────────────────────────────────────────┘
1 of 1 failed (100%) XX:XX 1 - 1 - -

`

`
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
exports['e2e baseUrl https passes 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -55,9 +56,11 @@ exports['e2e baseUrl https passes 1'] = `
└────────────────────────────────────────────────────────────────────────────────────────────────┘
All specs passed! XX:XX 1 1 - - -


`

exports['e2e baseUrl http passes 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -114,5 +117,5 @@ exports['e2e baseUrl http passes 1'] = `
└────────────────────────────────────────────────────────────────────────────────────────────────┘
All specs passed! XX:XX 1 1 - - -

`

`
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
exports['e2e blacklist passes 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -55,5 +56,5 @@ exports['e2e blacklist passes 1'] = `
└────────────────────────────────────────────────────────────────────────────────────────────────┘
All specs passed! XX:XX 1 1 - - -

`

`
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
exports['e2e browserify, babel, es2015 passes 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -57,9 +58,11 @@ exports['e2e browserify, babel, es2015 passes 1'] = `
└────────────────────────────────────────────────────────────────────────────────────────────────┘
All specs passed! XX:XX 3 3 - - -


`

exports['e2e browserify, babel, es2015 fails 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -88,7 +91,6 @@ SyntaxError: /foo/bar/.projects/e2e/lib/fail.js: Unexpected token (2:0)
> 2 |
| ^ while parsing file: /foo/bar/.projects/e2e/lib/fail.js


This occurred while Cypress was compiling and bundling your test code. This is usually caused by:

- A missing file or dependency
Expand Down Expand Up @@ -128,5 +130,5 @@ Fix the error in your code and re-run your tests.
└────────────────────────────────────────────────────────────────────────────────────────────────┘
1 of 1 failed (100%) XX:XX - - 1 - -

`

`
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
exports['e2e busted support file passes 1'] = `

====================================================================================================

(Run Starting)
Expand All @@ -22,7 +23,6 @@ The error was:

Error: Cannot find module './does/not/exist' from '/foo/bar/.projects/busted-support-file/cypress/support'


This occurred while Cypress was compiling and bundling your test code. This is usually caused by:

- A missing file or dependency
Expand Down Expand Up @@ -62,5 +62,5 @@ Fix the error in your code and re-run your tests.
└────────────────────────────────────────────────────────────────────────────────────────────────┘
1 of 1 failed (100%) XX:XX - - 1 - -

`

`
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
exports['e2e cache passes 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -58,5 +59,5 @@ exports['e2e cache passes 1'] = `
└────────────────────────────────────────────────────────────────────────────────────────────────┘
All specs passed! XX:XX 4 4 - - -

`

`
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
exports['e2e caught and uncaught hooks errors failing1 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -111,9 +112,11 @@ Because this error occurred during a 'before all' hook we are skipping the remai
└────────────────────────────────────────────────────────────────────────────────────────────────┘
1 of 1 failed (100%) XX:XX 11 5 3 - 3


`

exports['e2e caught and uncaught hooks errors failing2 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -198,9 +201,11 @@ Because this error occurred during a 'before each' hook we are skipping the rema
└────────────────────────────────────────────────────────────────────────────────────────────────┘
1 of 1 failed (100%) XX:XX 7 4 1 - 2


`

exports['e2e caught and uncaught hooks errors failing3 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -277,9 +282,11 @@ Because this error occurred during a 'before each' hook we are skipping all of t
└────────────────────────────────────────────────────────────────────────────────────────────────┘
1 of 1 failed (100%) XX:XX 4 - 1 - 3


`

exports['e2e caught and uncaught hooks errors failing4 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -362,5 +369,5 @@ Because this error occurred during a 'before each' hook we are skipping the rema
└────────────────────────────────────────────────────────────────────────────────────────────────┘
1 of 1 failed (100%) XX:XX 3 2 1 - -

`

`
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
exports['e2e commands outside of test fails 1'] = `

====================================================================================================

(Run Starting)
Expand Down Expand Up @@ -87,5 +88,5 @@ We dynamically generated a new test to display this failure.
└────────────────────────────────────────────────────────────────────────────────────────────────┘
1 of 1 failed (100%) XX:XX 1 - 1 - -

`

`
Loading