From b6dad0a674279936a9816939963bbf129647cee7 Mon Sep 17 00:00:00 2001 From: Lachlan Miller Date: Wed, 7 Sep 2022 10:21:02 +1000 Subject: [PATCH 1/3] fix: support type: module in Node.js 16.17.0+ and 18.6.0+ (#23637) * chore: bump ts-node version * debugging * update tests with docker images and docker script * Update system-tests/scripts/bootstrap-docker-container.sh Co-authored-by: Zach Bloomquist * use chown * Update system-tests/scripts/bootstrap-docker-container.sh Co-authored-by: Zach Bloomquist * Update bootstrap-docker-container.sh * Update bootstrap-docker-container.sh Co-authored-by: Zach Bloomquist --- npm/vite-dev-server/package.json | 2 +- npm/webpack-dev-server/package.json | 2 +- npm/webpack-preprocessor/package.json | 2 +- package.json | 2 +- .../data-context/src/data/ProjectConfigIpc.ts | 5 +++ packages/server/package.json | 2 +- packages/ts/package.json | 2 +- .../scripts/bootstrap-docker-container.sh | 5 ++- .../test-binary/node_versions_spec.ts | 17 ++++++++ yarn.lock | 43 ++++++++----------- 10 files changed, 51 insertions(+), 31 deletions(-) diff --git a/npm/vite-dev-server/package.json b/npm/vite-dev-server/package.json index 751a25976e4f..85b284f6ba68 100644 --- a/npm/vite-dev-server/package.json +++ b/npm/vite-dev-server/package.json @@ -26,7 +26,7 @@ "dedent": "^0.7.0", "mocha": "^9.2.2", "sinon": "^13.0.1", - "ts-node": "^10.2.1", + "ts-node": "^10.9.1", "vite": "3.0.3", "vite-plugin-inspect": "0.4.3" }, diff --git a/npm/webpack-dev-server/package.json b/npm/webpack-dev-server/package.json index f2e369047448..086e9880a07f 100644 --- a/npm/webpack-dev-server/package.json +++ b/npm/webpack-dev-server/package.json @@ -37,7 +37,7 @@ "proxyquire": "2.1.3", "sinon": "^13.0.1", "snap-shot-it": "^7.9.6", - "ts-node": "^10.2.1", + "ts-node": "^10.9.1", "webpack": "npm:webpack@^5", "webpack-4": "npm:webpack@^4", "webpack-dev-server-3": "npm:webpack-dev-server@^3" diff --git a/npm/webpack-preprocessor/package.json b/npm/webpack-preprocessor/package.json index 390f12d8f08b..894b78f5765f 100644 --- a/npm/webpack-preprocessor/package.json +++ b/npm/webpack-preprocessor/package.json @@ -58,7 +58,7 @@ "sinon": "^9.0.0", "sinon-chai": "^3.5.0", "snap-shot-it": "7.9.2", - "ts-node": "^10.2.1", + "ts-node": "^10.9.1", "webpack": "^4.44.2" }, "peerDependencies": { diff --git a/package.json b/package.json index 5fc4ad282b57..46d566a9c7c7 100644 --- a/package.json +++ b/package.json @@ -214,7 +214,7 @@ "through": "2.3.8", "through2": "^4.0.2", "tree-kill": "1.2.2", - "ts-node": "^10.2.1", + "ts-node": "^10.9.1", "typescript": "^4.7.4", "yarn-deduplicate": "3.1.0" }, diff --git a/packages/data-context/src/data/ProjectConfigIpc.ts b/packages/data-context/src/data/ProjectConfigIpc.ts index a2125ae9844f..3a96e89f9912 100644 --- a/packages/data-context/src/data/ProjectConfigIpc.ts +++ b/packages/data-context/src/data/ProjectConfigIpc.ts @@ -271,7 +271,9 @@ export class ProjectConfigIpc extends EventEmitter { // ts-node for CommonJS // ts-node/esm for ESM if (hasTypeScriptInstalled(this.projectRoot)) { + debug('found typescript in %s', this.projectRoot) if (isProjectUsingESModules) { + debug(`using --experimental-specifier-resolution=node with --loader ${tsNodeEsm}`) // Use the ts-node/esm loader so they can use TypeScript with `"type": "module". // The loader API is experimental and will change. // The same can be said for the other alternative, esbuild, so this is the @@ -294,6 +296,8 @@ export class ProjectConfigIpc extends EventEmitter { // so we need to load and evaluate the hook first using the `--require` module API. const tsNodeLoader = `--require "${tsNode}"` + debug(`using cjs with --require ${tsNode}`) + if (childOptions.env.NODE_OPTIONS) { childOptions.env.NODE_OPTIONS += ` ${tsNodeLoader}` } else { @@ -303,6 +307,7 @@ export class ProjectConfigIpc extends EventEmitter { } else { // Just use Node's built-in ESM support. // TODO: Consider using userland `esbuild` with Node's --loader API to handle ESM. + debug(`no typescript found, just use regular Node.js`) } return fork(CHILD_PROCESS_FILE_PATH, configProcessArgs, childOptions) diff --git a/packages/server/package.json b/packages/server/package.json index ad7c0456671a..e2b900f1a3ae 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -116,7 +116,7 @@ "tough-cookie": "4.0.0", "trash": "5.2.0", "tree-kill": "1.2.2", - "ts-node": "^10.2.1", + "ts-node": "^10.9.1", "tslib": "2.3.1", "underscore.string": "3.3.5", "url-parse": "1.5.9", diff --git a/packages/ts/package.json b/packages/ts/package.json index 3cbb75ce1f4b..b40bf5a5dcb6 100644 --- a/packages/ts/package.json +++ b/packages/ts/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "debug": "^4.3.2", - "ts-node": "^10.2.1", + "ts-node": "^10.9.1", "tslib": "2.3.1", "typescript-cached-transpile": "^0.0.6" }, diff --git a/system-tests/scripts/bootstrap-docker-container.sh b/system-tests/scripts/bootstrap-docker-container.sh index cca161f9475d..19bcda1bf8f9 100755 --- a/system-tests/scripts/bootstrap-docker-container.sh +++ b/system-tests/scripts/bootstrap-docker-container.sh @@ -36,6 +36,9 @@ export CYPRESS_CACHE_FOLDER=/tmp/CYPRESS_CACHE_FOLDER/ export npm_config_cache=/tmp/npm_config_cache/ export npm_config_package_lock=false +mkdir $npm_config_cache +chown -R 1000:1000 $npm_config_cache + npx npm@latest install --unsafe-perm --allow-root --force file:$CLI_PATH PATH=$PATH:./node_modules/.bin @@ -52,4 +55,4 @@ set -e cd - rm -rf $TEST_PROJECT_DIR -exit $EXIT_CODE \ No newline at end of file +exit $EXIT_CODE diff --git a/system-tests/test-binary/node_versions_spec.ts b/system-tests/test-binary/node_versions_spec.ts index d006b4b2730e..d62dd43db645 100644 --- a/system-tests/test-binary/node_versions_spec.ts +++ b/system-tests/test-binary/node_versions_spec.ts @@ -32,3 +32,20 @@ describe('binary node versions', () => { 'cypress/base:17.3.0', ].forEach(smokeTestDockerImage) }) + +describe('type: module', () => { + [ + 'cypress/base:16.17.0', + 'cypress/base:18.6.0', + ].forEach((dockerImage) => { + systemTests.it(`can run in ${dockerImage}`, { + withBinary: true, + project: 'config-cjs-and-esm/config-with-ts-module', + dockerImage, + testingType: 'e2e', + spec: 'app.cy.js', + browser: 'electron', + expectedExitCode: 0, + }) + }) +}) diff --git a/yarn.lock b/yarn.lock index 10546d39d8b1..833fbc9757b1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2293,17 +2293,12 @@ resolved "https://registry.yarnpkg.com/@coolaj86/urequest/-/urequest-1.3.7.tgz#66a1d66378dd6534e9c8e68948bf09acf32bab77" integrity sha512-PPrVYra9aWvZjSCKl/x1pJ9ZpXda1652oJrPBYy5rQumJJMkmTBN3ux+sK2xAUwVvv2wnewDlaQaHLxLwSHnIA== -"@cspotcode/source-map-consumer@0.8.0": - version "0.8.0" - resolved "https://registry.yarnpkg.com/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz#33bf4b7b39c178821606f669bbc447a6a629786b" - integrity sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg== - -"@cspotcode/source-map-support@0.7.0": - version "0.7.0" - resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz#4789840aa859e46d2f3173727ab707c66bf344f5" - integrity sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA== +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== dependencies: - "@cspotcode/source-map-consumer" "0.8.0" + "@jridgewell/trace-mapping" "0.3.9" "@csstools/convert-colors@^1.4.0": version "1.4.0" @@ -4150,10 +4145,10 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.10.tgz#baf57b4e2a690d4f38560171f91783656b7f8186" integrity sha512-Ht8wIW5v165atIX1p+JvKR5ONzUyF4Ac8DZIQ5kZs9zrb6M8SJNXpx1zn04rn65VjBMygRoMXcyYwNK0fT7bEg== -"@jridgewell/trace-mapping@^0.3.0": - version "0.3.4" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.4.tgz#f6a0832dffd5b8a6aaa633b7d9f8e8e94c83a0c3" - integrity sha512-vFv9ttIedivx0ux3QSjhgtCVjPZd5l46ZOMDSCwnH1yUO2e964gO8LZGyv2QkqcgR6TnBU1v+1IFqmeoG+0UJQ== +"@jridgewell/trace-mapping@0.3.9", "@jridgewell/trace-mapping@^0.3.0": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== dependencies: "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" @@ -32749,12 +32744,12 @@ ts-log@^2.2.3: resolved "https://registry.yarnpkg.com/ts-log/-/ts-log-2.2.3.tgz#4da5640fe25a9fb52642cd32391c886721318efb" integrity sha512-XvB+OdKSJ708Dmf9ore4Uf/q62AYDTzFcAdxc8KNML1mmAWywRFVt/dn1KYJH8Agt5UJNujfM3znU5PxgAzA2w== -ts-node@^10.2.1: - version "10.7.0" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.7.0.tgz#35d503d0fab3e2baa672a0e94f4b40653c2463f5" - integrity sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A== +ts-node@^10.9.1: + version "10.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== dependencies: - "@cspotcode/source-map-support" "0.7.0" + "@cspotcode/source-map-support" "^0.8.0" "@tsconfig/node10" "^1.0.7" "@tsconfig/node12" "^1.0.7" "@tsconfig/node14" "^1.0.0" @@ -32765,7 +32760,7 @@ ts-node@^10.2.1: create-require "^1.1.0" diff "^4.0.1" make-error "^1.1.1" - v8-compile-cache-lib "^3.0.0" + v8-compile-cache-lib "^3.0.1" yn "3.1.1" ts-node@^9: @@ -33656,10 +33651,10 @@ uuid@^3.0.0, uuid@^3.0.1, uuid@^3.3.2, uuid@^3.4.0: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -v8-compile-cache-lib@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz#0582bcb1c74f3a2ee46487ceecf372e46bce53e8" - integrity sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA== +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== v8-compile-cache@^2.0.2, v8-compile-cache@^2.0.3: version "2.0.3" From 35fe5b4e24653cc3e025efdad6c9438a1d26228b Mon Sep 17 00:00:00 2001 From: Lachlan Miller Date: Thu, 8 Sep 2022 04:23:00 +1000 Subject: [PATCH 2/3] chore: fix types for modifyObstructiveCode (#23694) * chore: fix types for modifyObstructiveCode * add test --- cli/types/cypress.d.ts | 14 +++++++------- cli/types/tests/cypress-npm-api-test.ts | 6 +++++- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index a9c7e65d5b92..0572d04f9b01 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -2720,6 +2720,13 @@ declare namespace Cypress { * @default 60000 */ pageLoadTimeout: number + /** + * Whether Cypress will search for and replace + * obstructive JS code in .js or .html files. + * + * @see https://on.cypress.io/configuration#modifyObstructiveCode + */ + modifyObstructiveCode: boolean /** * Time, in milliseconds, to wait for an XHR request to go out in a [cy.wait()](https://on.cypress.io/wait) command * @default 5000 @@ -2968,13 +2975,6 @@ declare namespace Cypress { * Whether Cypress was launched via 'cypress open' (interactive mode) */ isInteractive: boolean - /** - * Whether Cypress will search for and replace - * obstructive JS code in .js or .html files. - * - * @see https://on.cypress.io/configuration#modifyObstructiveCode - */ - modifyObstructiveCode: boolean /** * The platform Cypress is running on. */ diff --git a/cli/types/tests/cypress-npm-api-test.ts b/cli/types/tests/cypress-npm-api-test.ts index 4e968fc3ea75..3a0feebd7df6 100644 --- a/cli/types/tests/cypress-npm-api-test.ts +++ b/cli/types/tests/cypress-npm-api-test.ts @@ -1,6 +1,6 @@ // type tests for Cypress NPM module // https://on.cypress.io/module-api -import cypress from 'cypress' +import cypress, { defineConfig } from 'cypress' cypress.run // $ExpectType (options?: Partial | undefined) => Promise cypress.open // $ExpectType (options?: Partial | undefined) => Promise @@ -51,6 +51,10 @@ cypress.run().then(results => { } }) +const config = defineConfig({ + modifyObstructiveCode: true +}) + // component options const componentConfigNextWebpack: Cypress.ConfigOptions = { component: { From 38412925ba8f8aa826076b4ebeaa4dd0cdeb4e13 Mon Sep 17 00:00:00 2001 From: Emily Rohrbough Date: Wed, 7 Sep 2022 19:42:34 -0500 Subject: [PATCH 3/3] fix: correct dashboard result when successful spec run and videoUploadOnPasses=false (#23660) --- circle.yml | 4 +- packages/server/lib/modes/run.ts | 11 +- system-tests/__snapshots__/record_spec.js | 648 +++++++--------------- system-tests/test/record_spec.js | 79 ++- 4 files changed, 293 insertions(+), 449 deletions(-) diff --git a/circle.yml b/circle.yml index 74e25e1cdc4e..54562ebfa4f5 100644 --- a/circle.yml +++ b/circle.yml @@ -35,7 +35,7 @@ macWorkflowFilters: &darwin-workflow-filters when: or: - equal: [ develop, << pipeline.git.branch >> ] - - equal: [ 'tbiethman/22272-globbing-working-dir', << pipeline.git.branch >> ] + - equal: [ 'correct-dashboard-results', << pipeline.git.branch >> ] - equal: [ 'skip-or-fix-flaky-tests-2', << pipeline.git.branch >> ] - matches: pattern: "-release$" @@ -132,7 +132,7 @@ commands: - run: name: Check current branch to persist artifacts command: | - if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "tbiethman/23380-root-spec-pattern" ]]; then + if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "correct-dashboard-results" ]]; then echo "Not uploading artifacts or posting install comment for this branch." circleci-agent step halt fi diff --git a/packages/server/lib/modes/run.ts b/packages/server/lib/modes/run.ts index 8d7843ecc1b3..fa2ad8cf5b3d 100644 --- a/packages/server/lib/modes/run.ts +++ b/packages/server/lib/modes/run.ts @@ -621,6 +621,11 @@ async function waitForTestsToFinishRunning (options: { project: Project, screens results.shouldUploadVideo = shouldUploadVideo + if (!shouldUploadVideo) { + debug(`Spec run had no failures and config.videoUploadOnPasses=false. Skip processing video. Video path: ${videoName}`) + results.video = null + } + if (!quiet && !skippedSpec) { printResults.displayResults(results, estimated) } @@ -660,10 +665,15 @@ async function waitForTestsToFinishRunning (options: { project: Project, screens }, }) } catch (err) { + videoCaptureFailed = true warnVideoRecordingFailed(err) } } + if (videoCaptureFailed) { + results.video = null + } + return results } @@ -866,7 +876,6 @@ async function runSpec (config, spec: SpecWithRelativeRoot, options: { project: quiet: options.quiet, shouldKeepTabOpen: !isLastSpec, }), - waitForBrowserToConnect({ spec, project, diff --git a/system-tests/__snapshots__/record_spec.js b/system-tests/__snapshots__/record_spec.js index 7205428d0817..f2a339466b0f 100644 --- a/system-tests/__snapshots__/record_spec.js +++ b/system-tests/__snapshots__/record_spec.js @@ -156,7 +156,7 @@ plugin stdout │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -311,7 +311,7 @@ exports['e2e record api interaction errors update instance stdout warns but proc │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -390,81 +390,6 @@ Please log into the Dashboard to see the valid record keys. https://on.cypress.io/dashboard/projects/pid123 -` - -exports['e2e record video recording does not upload when not enabled 1'] = ` - -==================================================================================================== - - (Run Starting) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Cypress: 1.2.3 │ - │ Browser: FooBrowser 88 │ - │ Specs: 1 found (record_pass.cy.js) │ - │ Searched: cypress/e2e/record_pass* │ - │ Params: Tag: false, Group: false, Parallel: false │ - │ Run URL: https://dashboard.cypress.io/projects/cjvoj7/runs/12 │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - -──────────────────────────────────────────────────────────────────────────────────────────────────── - - Running: record_pass.cy.js (1 of 1) - Estimated: 8 seconds - - - record pass - ✓ passes - - is pending - - - 1 passing - 1 pending - - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 2 │ - │ Passing: 1 │ - │ Failing: 0 │ - │ Pending: 1 │ - │ Skipped: 0 │ - │ Screenshots: 1 │ - │ Video: false │ - │ Duration: X seconds │ - │ Estimated: 8 seconds │ - │ Spec Ran: record_pass.cy.js │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - - (Screenshots) - - - /XXX/XXX/XXX/cypress/screenshots/record_pass.cy.js/yay it passes.png (400x1022) - - - (Uploading Results) - - - Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/screenshots/record_pass.cy.js/yay it passes.png - -==================================================================================================== - - (Run Finished) - - - Spec Tests Passing Failing Pending Skipped - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ ✔ record_pass.cy.js XX:XX 2 1 - 1 - │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - ✔ All specs passed! XX:XX 2 1 - 1 - - - -─────────────────────────────────────────────────────────────────────────────────────────────────────── - - Recorded Run: https://dashboard.cypress.io/projects/cjvoj7/runs/12 - - ` exports['e2e record api interaction errors uploading assets warns but proceeds 1'] = ` @@ -602,75 +527,8 @@ This error will not alter the exit code. │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ - │ Duration: X seconds │ - │ Spec Ran: record_pass.cy.js │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - - (Screenshots) - - - /XXX/XXX/XXX/cypress/screenshots/record_pass.cy.js/yay it passes.png (400x1022) - - -==================================================================================================== - - (Run Finished) - - - Spec Tests Passing Failing Pending Skipped - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ ✔ record_pass.cy.js XX:XX 2 1 - 1 - │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - ✔ All specs passed! XX:XX 2 1 - 1 - - - -` - -exports['e2e record parallelization passes in parallel with group 1'] = ` - -==================================================================================================== - - (Run Starting) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Cypress: 1.2.3 │ - │ Browser: FooBrowser 88 │ - │ Specs: 4 found (record_error.cy.js, record_fail.cy.js, record_pass.cy.js, record_uncaught │ - │ .cy.js) │ - │ Searched: cypress/e2e/record* │ - │ Params: Tag: nightly, Group: prod-e2e, Parallel: true │ - │ Run URL: https://dashboard.cypress.io/projects/cjvoj7/runs/12 │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - -──────────────────────────────────────────────────────────────────────────────────────────────────── - - Running: record_pass.cy.js (1 of 4) - Estimated: 1 second - - - record pass - ✓ passes - - is pending - - - 1 passing - 1 pending - - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 2 │ - │ Passing: 1 │ - │ Failing: 0 │ - │ Pending: 1 │ - │ Skipped: 0 │ - │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ - │ Estimated: 1 second │ │ Spec Ran: record_pass.cy.js │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ @@ -680,10 +538,6 @@ exports['e2e record parallelization passes in parallel with group 1'] = ` - /XXX/XXX/XXX/cypress/screenshots/record_pass.cy.js/yay it passes.png (400x1022) - (Uploading Results) - - - Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/screenshots/record_pass.cy.js/yay it passes.png - ==================================================================================================== (Run Finished) @@ -693,227 +547,7 @@ exports['e2e record parallelization passes in parallel with group 1'] = ` ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ ✔ record_pass.cy.js XX:XX 2 1 - 1 - │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ - ✔ All specs passed! XX:XX 2 1 - 1 - - - -─────────────────────────────────────────────────────────────────────────────────────────────────────── - - Recorded Run: https://dashboard.cypress.io/projects/cjvoj7/runs/12 - - -` - -exports['e2e record parallelization passes in parallel with group 2'] = ` - -==================================================================================================== - - (Run Starting) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Cypress: 1.2.3 │ - │ Browser: FooBrowser 88 │ - │ Specs: 4 found (record_error.cy.js, record_fail.cy.js, record_pass.cy.js, record_uncaught │ - │ .cy.js) │ - │ Searched: cypress/e2e/record* │ - │ Params: Tag: nightly, Group: prod-e2e, Parallel: true │ - │ Run URL: https://dashboard.cypress.io/projects/cjvoj7/runs/12 │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - -──────────────────────────────────────────────────────────────────────────────────────────────────── - - Running: record_error.cy.js (2 of 4) - Estimated: 1 second - -Oops...we found an error preparing this test file: - - > cypress/e2e/record_error.cy.js - -The error was: - -Error: Webpack Compilation Error -./cypress/e2e/record_error.cy.js -Module not found: Error: Can't resolve '../it/does/not/exist' in '/foo/bar/.projects/e2e/cypress/e2e' -Looked for and couldn't find the file at the following paths: -[/foo/bar/.projects/e2e/cypress/it/does/not/exist] -[/foo/bar/.projects/e2e/cypress/it/does/not/exist.js] -[/foo/bar/.projects/e2e/cypress/it/does/not/exist.json] -[/foo/bar/.projects/e2e/cypress/it/does/not/exist.jsx] -[/foo/bar/.projects/e2e/cypress/it/does/not/exist.mjs] -[/foo/bar/.projects/e2e/cypress/it/does/not/exist.coffee] -[/foo/bar/.projects/e2e/cypress/it/does/not/exist.ts] -[/foo/bar/.projects/e2e/cypress/it/does/not/exist.tsx] - @ ./cypress/e2e/record_error.cy.js 3:0-31 - - [stack trace lines] - -This occurred while Cypress was compiling and bundling your test code. This is usually caused by: - -- A missing file or dependency -- A syntax error in the file or one of its dependencies - -Fix the error in your code and re-run your tests. - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 0 │ - │ Passing: 0 │ - │ Failing: 1 │ - │ Pending: 0 │ - │ Skipped: 0 │ - │ Screenshots: 0 │ - │ Video: true │ - │ Duration: X seconds │ - │ Estimated: 1 second │ - │ Spec Ran: record_error.cy.js │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - - (Video) - - - Started processing: Compressing to 32 CRF - - Finished processing: /XXX/XXX/XXX/cypress/videos/record_error.cy.js.mp4 (X second) - - - (Uploading Results) - - - Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/videos/record_error.cy.js.mp4 - -──────────────────────────────────────────────────────────────────────────────────────────────────── - - Running: record_fail.cy.js (3 of 4) - Estimated: 2 seconds - - - record fails - 1) "before each" hook for "fails 1" - - - 0 passing - 1 failing - - 1) record fails - "before each" hook for "fails 1": - Error: foo - -Because this error occurred during a \`before each\` hook we are skipping the remaining tests in the current suite: \`record fails\` - [stack trace lines] - - - - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 2 │ - │ Passing: 0 │ - │ Failing: 1 │ - │ Pending: 0 │ - │ Skipped: 1 │ - │ Screenshots: 1 │ - │ Video: true │ - │ Duration: X seconds │ - │ Estimated: 2 seconds │ - │ Spec Ran: record_fail.cy.js │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - - (Screenshots) - - - /XXX/XXX/XXX/cypress/screenshots/record_fail.cy.js/record fails -- fails 1 -- be (1280x720) - fore each hook (failed).png - - - (Video) - - - Started processing: Compressing to 32 CRF - - Finished processing: /XXX/XXX/XXX/cypress/videos/record_fail.cy.js.mp4 (X second) - - - (Uploading Results) - - - Done Uploading (*/2) /foo/bar/.projects/e2e/cypress/screenshots/record_fail.cy.js/record fails -- fails 1 -- before each hook (failed).png - - Done Uploading (*/2) /foo/bar/.projects/e2e/cypress/videos/record_fail.cy.js.mp4 - -──────────────────────────────────────────────────────────────────────────────────────────────────── - - Running: record_uncaught.cy.js (4 of 4) - Estimated: 3 seconds - - - 1) An uncaught error was detected outside of a test - - 0 passing - 1 failing - - 1) An uncaught error was detected outside of a test: - Error: The following error originated from your test code, not from Cypress. - - > instantly fails - -When Cypress detects uncaught errors originating from your test code it will automatically fail the current test. - -Cypress could not associate this error to any specific test. - -We dynamically generated a new test to display this failure. - [stack trace lines] - - - - - (Results) - - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 1 │ - │ Passing: 0 │ - │ Failing: 1 │ - │ Pending: 0 │ - │ Skipped: 0 │ - │ Screenshots: 1 │ - │ Video: true │ - │ Duration: X seconds │ - │ Estimated: 3 seconds │ - │ Spec Ran: record_uncaught.cy.js │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - - - (Screenshots) - - - /XXX/XXX/XXX/cypress/screenshots/record_uncaught.cy.js/An uncaught error was det (1280x720) - ected outside of a test (failed).png - - - (Video) - - - Started processing: Compressing to 32 CRF - - Finished processing: /XXX/XXX/XXX/cypress/videos/record_uncaught.cy.js.mp4 (X second) - - - (Uploading Results) - - - Done Uploading (*/2) /foo/bar/.projects/e2e/cypress/screenshots/record_uncaught.cy.js/An uncaught error was detected outside of a test (failed).png - - Done Uploading (*/2) /foo/bar/.projects/e2e/cypress/videos/record_uncaught.cy.js.mp4 - -==================================================================================================== - - (Run Finished) - - - Spec Tests Passing Failing Pending Skipped - ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ ✖ record_error.cy.js XX:XX - - 1 - - │ - ├────────────────────────────────────────────────────────────────────────────────────────────────┤ - │ ✖ record_fail.cy.js XX:XX 2 - 1 - 1 │ - ├────────────────────────────────────────────────────────────────────────────────────────────────┤ - │ ✖ record_uncaught.cy.js XX:XX 1 - 1 - - │ - └────────────────────────────────────────────────────────────────────────────────────────────────┘ - ✖ 3 of 3 failed (100%) XX:XX 3 - 3 - 1 - - -─────────────────────────────────────────────────────────────────────────────────────────────────────── - - Recorded Run: https://dashboard.cypress.io/projects/cjvoj7/runs/12 + ✔ All specs passed! XX:XX 2 1 - 1 - ` @@ -1034,7 +668,7 @@ exports['e2e record api interaction errors update instance 500 does not proceed │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 5 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -1129,7 +763,7 @@ StatusCodeError: 500 - "Internal Server Error" │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 5 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -1208,7 +842,7 @@ This error will not alter the exit code. │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Spec Ran: record_pass.cy.js │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ @@ -1331,7 +965,7 @@ https://on.cypress.io/dashboard/organizations/org-id-1234/billing │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -1411,7 +1045,7 @@ https://on.cypress.io/dashboard/organizations/org-id-1234/billing │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -1496,7 +1130,7 @@ Details: │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -1681,7 +1315,7 @@ exports['e2e record passing passes 2'] = [ } ], "exception": null, - "video": true, + "video": false, "screenshots": [ { "screenshotId": "some-random-id", @@ -1832,7 +1466,7 @@ https://on.cypress.io/dashboard/organizations/org-id-1234/billing │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -1914,7 +1548,7 @@ https://on.cypress.io/dashboard/organizations/org-id-1234/billing │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -1994,7 +1628,7 @@ https://on.cypress.io/dashboard/organizations/org-id-1234/billing │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -2074,7 +1708,7 @@ https://on.cypress.io/dashboard/organizations/org-id-1234/billing │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -2154,7 +1788,7 @@ https://on.cypress.io/dashboard/organizations/org-id-1234/billing │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -2360,7 +1994,7 @@ exports['e2e record api interaction errors postInstanceResults errors and exits │ Pending: 1 │ │ Skipped: 0 │ │ Screenshots: 1 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: record_pass.cy.js │ @@ -2574,7 +2208,7 @@ exports['e2e record empty specs succeeds when empty spec file 1'] = ` │ Pending: 0 │ │ Skipped: 0 │ │ Screenshots: 0 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: empty_suite.cy.js │ @@ -2603,7 +2237,7 @@ exports['e2e record empty specs succeeds when empty spec file 1'] = ` │ Pending: 0 │ │ Skipped: 0 │ │ Screenshots: 0 │ - │ Video: true │ + │ Video: false │ │ Duration: X seconds │ │ Estimated: 8 seconds │ │ Spec Ran: empty.cy.js │ @@ -2656,7 +2290,60 @@ Available browsers found on your system are: - browser3 ` -exports['e2e record metadata sends Studio usage metadata 1'] = ` +exports['e2e record quiet mode respects quiet mode 1'] = ` + + + record pass + ✓ passes + - is pending + + + 1 passing + 1 pending + + +` + +exports['e2e record api interaction errors create run 412 errors and exits when request schema is invalid 1'] = ` +Recording this run failed because the request was invalid. + +request should follow postRunRequest@2.0.0 schema + +Errors: + +[ + "data has additional properties: group, parallel, ciBuildId, tags, testingType, runnerCapabilities", + "data.platform is the wrong type" +] + +Request Sent: + +{ + "ci": null, + "specs": [ + "cypress/e2e/record_pass.cy.js" + ], + "commit": null, + "group": null, + "platform": null, + "parallel": null, + "ciBuildId": null, + "projectId": "pid123", + "recordKey": "f858a2bc-b469-4e48-be67-0876339ee7e1", + "specPattern": "cypress/e2e/record_pass*", + "tags": [ + "" + ], + "testingType": "e2e", + "runnerCapabilities": { + "dynamicSpecsInSerialMode": true, + "skipSpecAction": true + } +} + +` + +exports['e2e record video recording when videoUploadOnPasses=false does not upload when specs pass 1'] = ` ==================================================================================================== @@ -2665,8 +2352,8 @@ exports['e2e record metadata sends Studio usage metadata 1'] = ` ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ │ Cypress: 1.2.3 │ │ Browser: FooBrowser 88 │ - │ Specs: 1 found (studio_written.cy.js) │ - │ Searched: cypress/e2e/studio_written.cy.js │ + │ Specs: 2 found (record_fail.cy.js, record_pass.cy.js) │ + │ Searched: cypress/e2e/record_fail*, cypress/e2e/record_pass* │ │ Params: Tag: false, Group: false, Parallel: false │ │ Run URL: https://dashboard.cypress.io/projects/cjvoj7/runs/12 │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ @@ -2674,40 +2361,100 @@ exports['e2e record metadata sends Studio usage metadata 1'] = ` ──────────────────────────────────────────────────────────────────────────────────────────────────── - Running: studio_written.cy.js (1 of 1) + Running: record_fail.cy.js (1 of 2) Estimated: 8 seconds - suite - ✓ extended test - ✓ created test - nested suite - ✓ extended test - ✓ created test + record fails + 1) "before each" hook for "fails 1" + + + 0 passing + 1 failing + + 1) record fails + "before each" hook for "fails 1": + Error: foo + +Because this error occurred during a \`before each\` hook we are skipping the remaining tests in the current suite: \`record fails\` + [stack trace lines] - 4 passing (Results) ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ Tests: 4 │ - │ Passing: 4 │ - │ Failing: 0 │ + │ Tests: 2 │ + │ Passing: 0 │ + │ Failing: 1 │ │ Pending: 0 │ - │ Skipped: 0 │ - │ Screenshots: 0 │ + │ Skipped: 1 │ + │ Screenshots: 1 │ │ Video: true │ │ Duration: X seconds │ │ Estimated: 8 seconds │ - │ Spec Ran: studio_written.cy.js │ + │ Spec Ran: record_fail.cy.js │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ + (Screenshots) + + - /XXX/XXX/XXX/cypress/screenshots/record_fail.cy.js/record fails -- fails 1 -- be (1280x720) + fore each hook (failed).png + + + (Video) + + - Started processing: Compressing to 32 CRF + - Finished processing: /XXX/XXX/XXX/cypress/videos/record_fail.cy.js.mp4 (X second) + + (Uploading Results) - - Nothing to Upload + - Done Uploading (*/2) /foo/bar/.projects/e2e/cypress/screenshots/record_fail.cy.js/record fails -- fails 1 -- before each hook (failed).png + - Done Uploading (*/2) /foo/bar/.projects/e2e/cypress/videos/record_fail.cy.js.mp4 + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: record_pass.cy.js (2 of 2) + Estimated: 8 seconds + + + record pass +plugin stdout + ✓ passes + - is pending + + + 1 passing + 1 pending + + + (Results) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 2 │ + │ Passing: 1 │ + │ Failing: 0 │ + │ Pending: 1 │ + │ Skipped: 0 │ + │ Screenshots: 1 │ + │ Video: false │ + │ Duration: X seconds │ + │ Estimated: 8 seconds │ + │ Spec Ran: record_pass.cy.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + + (Screenshots) + + - /XXX/XXX/XXX/cypress/screenshots/record_pass.cy.js/yay it passes.png (400x1022) + + + (Uploading Results) + + - Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/screenshots/record_pass.cy.js/yay it passes.png ==================================================================================================== @@ -2716,9 +2463,11 @@ exports['e2e record metadata sends Studio usage metadata 1'] = ` Spec Tests Passing Failing Pending Skipped ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ - │ ✔ studio_written.cy.js XX:XX 4 4 - - - │ + │ ✖ record_fail.cy.js XX:XX 2 - 1 - 1 │ + ├────────────────────────────────────────────────────────────────────────────────────────────────┤ + │ ✔ record_pass.cy.js XX:XX 2 1 - 1 - │ └────────────────────────────────────────────────────────────────────────────────────────────────┘ - ✔ All specs passed! XX:XX 4 4 - - - + ✖ 1 of 2 failed (50%) XX:XX 4 1 1 1 1 ─────────────────────────────────────────────────────────────────────────────────────────────────────── @@ -2728,10 +2477,30 @@ exports['e2e record metadata sends Studio usage metadata 1'] = ` ` -exports['e2e record quiet mode respects quiet mode 1'] = ` +exports['e2e record video recording when video=false does not upload when not enabled 1'] = ` + +==================================================================================================== + + (Run Starting) + + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Cypress: 1.2.3 │ + │ Browser: FooBrowser 88 │ + │ Specs: 1 found (record_pass.cy.js) │ + │ Searched: cypress/e2e/record_pass* │ + │ Params: Tag: false, Group: false, Parallel: false │ + │ Run URL: https://dashboard.cypress.io/projects/cjvoj7/runs/12 │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + + +──────────────────────────────────────────────────────────────────────────────────────────────────── + + Running: record_pass.cy.js (1 of 1) + Estimated: 8 seconds record pass +plugin stdout ✓ passes - is pending @@ -2740,43 +2509,46 @@ exports['e2e record quiet mode respects quiet mode 1'] = ` 1 pending -` + (Results) -exports['e2e record api interaction errors create run 412 errors and exits when request schema is invalid 1'] = ` -Recording this run failed because the request was invalid. + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ Tests: 2 │ + │ Passing: 1 │ + │ Failing: 0 │ + │ Pending: 1 │ + │ Skipped: 0 │ + │ Screenshots: 1 │ + │ Video: false │ + │ Duration: X seconds │ + │ Estimated: 8 seconds │ + │ Spec Ran: record_pass.cy.js │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ -request should follow postRunRequest@2.0.0 schema -Errors: + (Screenshots) -[ - "data has additional properties: group, parallel, ciBuildId, tags, testingType, runnerCapabilities", - "data.platform is the wrong type" -] + - /XXX/XXX/XXX/cypress/screenshots/record_pass.cy.js/yay it passes.png (400x1022) -Request Sent: -{ - "ci": null, - "specs": [ - "cypress/e2e/record_pass.cy.js" - ], - "commit": null, - "group": null, - "platform": null, - "parallel": null, - "ciBuildId": null, - "projectId": "pid123", - "recordKey": "f858a2bc-b469-4e48-be67-0876339ee7e1", - "specPattern": "cypress/e2e/record_pass*", - "tags": [ - "" - ], - "testingType": "e2e", - "runnerCapabilities": { - "dynamicSpecsInSerialMode": true, - "skipSpecAction": true - } -} + (Uploading Results) + + - Done Uploading (1/1) /foo/bar/.projects/e2e/cypress/screenshots/record_pass.cy.js/yay it passes.png + +==================================================================================================== + + (Run Finished) + + + Spec Tests Passing Failing Pending Skipped + ┌────────────────────────────────────────────────────────────────────────────────────────────────┐ + │ ✔ record_pass.cy.js XX:XX 2 1 - 1 - │ + └────────────────────────────────────────────────────────────────────────────────────────────────┘ + ✔ All specs passed! XX:XX 2 1 - 1 - + + +─────────────────────────────────────────────────────────────────────────────────────────────────────── + + Recorded Run: https://dashboard.cypress.io/projects/cjvoj7/runs/12 + ` diff --git a/system-tests/test/record_spec.js b/system-tests/test/record_spec.js index 1531d8dee8b8..d33d634fa117 100644 --- a/system-tests/test/record_spec.js +++ b/system-tests/test/record_spec.js @@ -713,15 +713,78 @@ describe('e2e record', () => { }) context('video recording', () => { - setupStubbedServer(createRoutes()) + describe('when video=false', () => { + setupStubbedServer(createRoutes()) - it('does not upload when not enabled', function () { - return systemTests.exec(this, { - key: 'f858a2bc-b469-4e48-be67-0876339ee7e1', - configFile: 'cypress-with-project-id-without-video.config.js', - spec: 'record_pass*', - record: true, - snapshot: true, + it('does not upload when not enabled', async function () { + const { stdout } = await systemTests.exec(this, { + key: 'f858a2bc-b469-4e48-be67-0876339ee7e1', + configFile: 'cypress-with-project-id-without-video.config.js', + spec: 'record_pass*', + record: true, + snapshot: true, + config: { + env: { + 'TEST_STDIO': '1', + }, + }, + }) + + console.log(stdout) + + expect(stdout).to.include('Run URL:') + expect(stdout).to.include(runUrl) + + const postRun = requests[0] + + // ensure its relative to projectRoot + expect(postRun.body.specs).to.deep.eq([ + 'cypress/e2e/record_pass.cy.js', + ]) + + const runResults = requests[3] + + expect(runResults.body.video).to.be.false + }) + }) + + describe('when videoUploadOnPasses=false', () => { + setupStubbedServer(createRoutes()) + it('does not upload when specs pass', async function () { + const { stdout } = await systemTests.exec(this, { + key: 'f858a2bc-b469-4e48-be67-0876339ee7e1', + configFile: 'cypress-with-project-id.config.js', + spec: 'record_fail*,record_pass*', + record: true, + snapshot: true, + expectedExitCode: 1, + config: { + env: { + 'TEST_STDIO': '1', + }, + }, + }) + + console.log(stdout) + + expect(stdout).to.include('Run URL:') + expect(stdout).to.include(runUrl) + + const postRun = requests[0] + + // ensure its relative to projectRoot + expect(postRun.body.specs).to.deep.eq([ + 'cypress/e2e/record_fail.cy.js', + 'cypress/e2e/record_pass.cy.js', + ]) + + const recordFailSpecResults = requests[3] + + expect(recordFailSpecResults.body.video).to.be.true // failed spec has video + + const recordPassSpecResults = requests[9] + + expect(recordPassSpecResults.body.video).to.be.false // passing spec does not have video }) }) })