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

breaking: remove the shouldUploadVideoOnPass configuration #27010

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ _Released 08/1/2023 (PENDING)_
- The [`cy.readFile()`](/api/commands/readfile) command is now retry-able as a [query command](https://on.cypress.io/retry-ability). This should not affect any tests using it; the functionality is unchanged. However, it can no longer be overwritten using [`Cypress.Commands.overwrite()`](/api/cypress-api/custom-commands#Overwrite-Existing-Commands). Addressed in [#25595](https://github.com/cypress-io/cypress/pull/25595).
- The [`video`](https://docs.cypress.io/guides/references/configuration#Videos) configuration option now defaults to `false`. Addresses [#26157](https://github.com/cypress-io/cypress/issues/26157).
- The [`videoCompression`](https://docs.cypress.io/guides/references/configuration#Videos) configuration option now defaults to `false`. Addresses [#26160](https://github.com/cypress-io/cypress/issues/26160).
- The [`videoUploadOnPasses`](https://docs.cypress.io/guides/references/configuration#Videos) configuration option has been removed. Please see our [screenshots & videos guide](https://docs.cypress.io/guides/guides/screenshots-and-videos#Delete-videos-for-specs-without-failing-or-retried-tests) on how to accomplish similar functionality. Addresses [#26899](https://github.com/cypress-io/cypress/issues/26899).

- The deprecated configuration option, `nodeVersion` has been removed. Addresses [#27016](https://github.com/cypress-io/cypress/issues/27016).

Expand Down
1 change: 0 additions & 1 deletion cli/types/cypress-npm-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ declare namespace CypressCommandLine {
absolute: string
relativeToCommonRoot: string
}
shouldUploadVideo: boolean
skippedSpec: boolean
}

Expand Down
5 changes: 0 additions & 5 deletions cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3011,11 +3011,6 @@ declare namespace Cypress {
* @default false
*/
video: boolean
/**
* Whether Cypress will upload the video to Cypress Cloud even if all tests are passing. This applies only when recording your runs to Cypress Cloud. Turn this off if you'd like the video uploaded only when there are failing tests.
* @default true
*/
videoUploadOnPasses: boolean
/**
* Whether Chrome Web Security for same-origin policy and insecure mixed content is enabled. Read more about this here
* @default true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,6 @@
"from": "default",
"field": "videosFolder"
},
{
"value": true,
"from": "default",
"field": "videoUploadOnPasses"
},
{
"value": 500,
"from": "default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,6 @@
"from": "default",
"field": "videosFolder"
},
{
"value": true,
"from": "default",
"field": "videoUploadOnPasses"
},
{
"value": 500,
"from": "default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -669,11 +669,6 @@
"from": "default",
"field": "videosFolder"
},
{
"value": true,
"from": "default",
"field": "videoUploadOnPasses"
},
{
"value": 500,
"from": "default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,6 @@
"from": "default",
"field": "videosFolder"
},
{
"value": true,
"from": "default",
"field": "videoUploadOnPasses"
},
{
"value": 500,
"from": "default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,6 @@
"from": "default",
"field": "videosFolder"
},
{
"value": true,
"from": "default",
"field": "videoUploadOnPasses"
},
{
"value": 500,
"from": "default",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1670,11 +1670,6 @@
"from": "default",
"field": "videosFolder"
},
{
"value": true,
"from": "default",
"field": "videoUploadOnPasses"
},
{
"value": 500,
"from": "default",
Expand Down
3 changes: 0 additions & 3 deletions packages/config/__snapshots__/index.spec.ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ exports['config/src/index .getDefaultValues returns list of public config keys 1
'video': false,
'videoCompression': false,
'videosFolder': 'cypress/videos',
'videoUploadOnPasses': true,
'viewportHeight': 660,
'viewportWidth': 1000,
'waitForAnimations': true,
Expand Down Expand Up @@ -165,7 +164,6 @@ exports['config/src/index .getDefaultValues returns list of public config keys f
'video': false,
'videoCompression': false,
'videosFolder': 'cypress/videos',
'videoUploadOnPasses': true,
'viewportHeight': 660,
'viewportWidth': 1000,
'waitForAnimations': true,
Expand Down Expand Up @@ -247,7 +245,6 @@ exports['config/src/index .getPublicConfigKeys returns list of public config key
'video',
'videoCompression',
'videosFolder',
'videoUploadOnPasses',
'viewportHeight',
'viewportWidth',
'waitForAnimations',
Expand Down
4 changes: 0 additions & 4 deletions packages/config/src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,6 @@ const driverConfigOptions: Array<DriverConfigOption> = [
defaultValue: 'cypress/videos',
validation: validate.isString,
isFolder: true,
}, {
name: 'videoUploadOnPasses',
defaultValue: true,
validation: validate.isBoolean,
}, {
name: 'viewportHeight',
defaultValue: (options: Record<string, any> = {}) => options.testingType === 'component' ? 500 : 660,
Expand Down
6 changes: 0 additions & 6 deletions packages/config/test/project/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,6 @@ describe('config/src/project/utils', () => {
return this.defaults('videoCompression', false)
})

it('videoUploadOnPasses=true', function () {
return this.defaults('videoUploadOnPasses', true)
})

it('trashAssetsBeforeRuns=32', function () {
return this.defaults('trashAssetsBeforeRuns', true)
})
Expand Down Expand Up @@ -1079,7 +1075,6 @@ describe('config/src/project/utils', () => {
video: { value: false, from: 'default' },
videoCompression: { value: false, from: 'default' },
videosFolder: { value: 'cypress/videos', from: 'default' },
videoUploadOnPasses: { value: true, from: 'default' },
viewportHeight: { value: 660, from: 'default' },
viewportWidth: { value: 1000, from: 'default' },
waitForAnimations: { value: true, from: 'default' },
Expand Down Expand Up @@ -1197,7 +1192,6 @@ describe('config/src/project/utils', () => {
video: { value: false, from: 'default' },
videoCompression: { value: false, from: 'default' },
videosFolder: { value: 'cypress/videos', from: 'default' },
videoUploadOnPasses: { value: true, from: 'default' },
viewportHeight: { value: 660, from: 'default' },
viewportWidth: { value: 1000, from: 'default' },
waitForAnimations: { value: true, from: 'default' },
Expand Down
5 changes: 0 additions & 5 deletions packages/frontend-shared/cypress/fixtures/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,6 @@
"from": "default",
"field": "videosFolder"
},
{
"value": true,
"from": "default",
"field": "videoUploadOnPasses"
},
{
"value": 850,
"from": "config",
Expand Down
7 changes: 3 additions & 4 deletions packages/server/lib/modes/record.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ const getSpecRelativePath = (spec) => {
}

const uploadArtifacts = (options = {}) => {
const { protocolManager, video, screenshots, videoUploadUrl, captureUploadUrl, shouldUploadVideo, screenshotUploadUrls, quiet } = options
const { protocolManager, video, screenshots, videoUploadUrl, captureUploadUrl, screenshotUploadUrls, quiet } = options

const uploads = []
const uploadReport = {
Expand Down Expand Up @@ -196,7 +196,7 @@ const uploadArtifacts = (options = {}) => {
)
}

if (videoUploadUrl && shouldUploadVideo) {
if (videoUploadUrl) {
send(video, videoUploadUrl, 'video')
}

Expand Down Expand Up @@ -796,7 +796,7 @@ const createRunAndRecordSpecs = (options = {}) => {
return
}

const { video, shouldUploadVideo, screenshots } = results
const { video, screenshots } = results
const { videoUploadUrl, captureUploadUrl, screenshotUploadUrls } = resp

return uploadArtifacts({
Expand All @@ -807,7 +807,6 @@ const createRunAndRecordSpecs = (options = {}) => {
videoUploadUrl,
captureUploadUrl,
protocolManager,
shouldUploadVideo,
screenshotUploadUrls,
quiet,
})
Expand Down
32 changes: 8 additions & 24 deletions packages/server/lib/modes/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -332,14 +332,14 @@ const warnVideoCompressionFailed = (err) => {
errors.warning('VIDEO_COMPRESSION_FAILED', err)
}

async function compressRecording (options: { quiet: boolean, videoCompression: number | boolean, shouldUploadVideo: boolean, processOptions: Omit<ProcessOptions, 'videoCompression'> }) {
async function compressRecording (options: { quiet: boolean, videoCompression: number | boolean, processOptions: Omit<ProcessOptions, 'videoCompression'> }) {
debug('ending the video recording %o', options)

// once this ended promises resolves
// then begin compressing the file
// don't compress anything if videoCompress is off
// or we've been told not to upload the video
if (options.videoCompression === false || options.videoCompression === 0 || options.shouldUploadVideo === false) {
if (options.videoCompression === false || options.videoCompression === 0) {
debug('skipping compression')

return
Expand Down Expand Up @@ -574,10 +574,10 @@ function waitForSocketConnection (project: Project, id: string) {
})
}

async function waitForTestsToFinishRunning (options: { project: Project, screenshots: ScreenshotMetadata[], videoCompression: number | boolean, videoUploadOnPasses: boolean, exit: boolean, spec: SpecWithRelativeRoot, estimated: number, quiet: boolean, config: Cfg, shouldKeepTabOpen: boolean, testingType: TestingType, videoRecording?: VideoRecording }) {
async function waitForTestsToFinishRunning (options: { project: Project, screenshots: ScreenshotMetadata[], videoCompression: number | boolean, exit: boolean, spec: SpecWithRelativeRoot, estimated: number, quiet: boolean, config: Cfg, shouldKeepTabOpen: boolean, testingType: TestingType, videoRecording?: VideoRecording }) {
if (globalThis.CY_TEST_MOCK?.waitForTestsToFinishRunning) return Promise.resolve(globalThis.CY_TEST_MOCK.waitForTestsToFinishRunning)

const { project, screenshots, videoRecording, videoCompression, videoUploadOnPasses, exit, spec, estimated, quiet, config, shouldKeepTabOpen, testingType } = options
const { project, screenshots, videoRecording, videoCompression, exit, spec, estimated, quiet, config, shouldKeepTabOpen, testingType } = options

const results = await listenForProjectEnd(project, exit)

Expand Down Expand Up @@ -617,7 +617,7 @@ async function waitForTestsToFinishRunning (options: { project: Project, screens

results.spec = spec

const { tests, stats } = results
const { tests } = results
const attempts = _.flatMap(tests, (test) => test.attempts)

let videoCaptureFailed = false
Expand Down Expand Up @@ -659,18 +659,6 @@ async function waitForTestsToFinishRunning (options: { project: Project, screens
results.video = null
}

const hasFailingTests = _.get(stats, 'failures') > 0
// we should upload the video if we upload on passes (by default)
// or if we have any failures and have started the video
const shouldUploadVideo = !skippedSpec && videoUploadOnPasses === true || Boolean((/* startedVideoCapture */ videoExists && hasFailingTests))

results.shouldUploadVideo = shouldUploadVideo

if (!shouldUploadVideo) {
debug(`Spec run had no failures and config.videoUploadOnPasses=false. Skip compressing video. Video path: ${videoName}`)
results.videoCompression = false
}

if (!quiet && !skippedSpec) {
printResults.displayResults(results, estimated)
}
Expand Down Expand Up @@ -711,7 +699,6 @@ async function waitForTestsToFinishRunning (options: { project: Project, screens
})

await compressRecording({
shouldUploadVideo,
quiet,
videoCompression,
processOptions: {
Expand All @@ -734,8 +721,7 @@ async function waitForTestsToFinishRunning (options: { project: Project, screens
printResults.printVideoPath(videoName)
}

// if capture or compressing has failed, or the test passed and videoUploadOnPasses=false
if (videoCaptureFailed || videoCompressionFailed || !shouldUploadVideo) {
if (videoCaptureFailed || videoCompressionFailed) {
results.video = null
}

Expand All @@ -756,7 +742,7 @@ function screenshotMetadata (data, resp) {
}
}

async function runSpecs (options: { config: Cfg, browser: Browser, sys: any, headed: boolean, outputPath: string, specs: SpecWithRelativeRoot[], specPattern: string | RegExp | string[], beforeSpecRun?: BeforeSpecRun, afterSpecRun?: AfterSpecRun, runUrl?: string, parallel?: boolean, group?: string, tag?: string, autoCancelAfterFailures?: number | false, testingType: TestingType, quiet: boolean, project: Project, onError: (err: Error) => void, exit: boolean, socketId: string, webSecurity: boolean, projectRoot: string, protocolManager?: ProtocolManager } & Pick<Cfg, 'video' | 'videoCompression' | 'videosFolder' | 'videoUploadOnPasses'>) {
async function runSpecs (options: { config: Cfg, browser: Browser, sys: any, headed: boolean, outputPath: string, specs: SpecWithRelativeRoot[], specPattern: string | RegExp | string[], beforeSpecRun?: BeforeSpecRun, afterSpecRun?: AfterSpecRun, runUrl?: string, parallel?: boolean, group?: string, tag?: string, autoCancelAfterFailures?: number | false, testingType: TestingType, quiet: boolean, project: Project, onError: (err: Error) => void, exit: boolean, socketId: string, webSecurity: boolean, projectRoot: string, protocolManager?: ProtocolManager } & Pick<Cfg, 'video' | 'videoCompression' | 'videosFolder'>) {
if (globalThis.CY_TEST_MOCK?.runSpecs) return globalThis.CY_TEST_MOCK.runSpecs

const { config, browser, sys, headed, outputPath, specs, specPattern, beforeSpecRun, afterSpecRun, runUrl, parallel, group, tag, autoCancelAfterFailures, protocolManager } = options
Expand Down Expand Up @@ -923,7 +909,7 @@ async function runSpecs (options: { config: Cfg, browser: Browser, sys: any, hea
return results
}

async function runSpec (config, spec: SpecWithRelativeRoot, options: { project: Project, browser: Browser, onError: (err: Error) => void, config: Cfg, quiet: boolean, exit: boolean, testingType: TestingType, socketId: string, webSecurity: boolean, projectRoot: string, protocolManager?: ProtocolManager } & Pick<Cfg, 'video' | 'videosFolder' | 'videoCompression' | 'videoUploadOnPasses'>, estimated, isFirstSpec, isLastSpec) {
async function runSpec (config, spec: SpecWithRelativeRoot, options: { project: Project, browser: Browser, onError: (err: Error) => void, config: Cfg, quiet: boolean, exit: boolean, testingType: TestingType, socketId: string, webSecurity: boolean, projectRoot: string, protocolManager?: ProtocolManager } & Pick<Cfg, 'video' | 'videosFolder' | 'videoCompression'>, estimated, isFirstSpec, isLastSpec) {
const { project, browser, onError } = options

const { isHeadless } = browser
Expand Down Expand Up @@ -974,7 +960,6 @@ async function runSpec (config, spec: SpecWithRelativeRoot, options: { project:
exit: options.exit,
testingType: options.testingType,
videoCompression: options.videoCompression,
videoUploadOnPasses: options.videoUploadOnPasses,
quiet: options.quiet,
shouldKeepTabOpen: !isLastSpec,
}),
Expand Down Expand Up @@ -1112,7 +1097,6 @@ async function ready (options: { projectRoot: string, record: boolean, key: stri
videosFolder: config.videosFolder,
video: config.video,
videoCompression: config.videoCompression,
videoUploadOnPasses: config.videoUploadOnPasses,
headed: options.headed,
quiet: options.quiet,
outputPath: options.outputPath,
Expand Down
1 change: 0 additions & 1 deletion packages/server/test/integration/cypress_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,6 @@ describe('lib/cypress', () => {
tests: [],
hooks: [],
video: 'path/to/video',
shouldUploadVideo: true,
screenshots: [],
config: {},
spec: {},
Expand Down
14 changes: 0 additions & 14 deletions packages/server/test/unit/config_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -655,20 +655,6 @@ describe('lib/config', () => {
})
})

context('videoUploadOnPasses', () => {
it('passes if a boolean', function () {
this.setup({ videoUploadOnPasses: false })

return this.expectValidationPasses()
})

it('fails if not a boolean', function () {
this.setup({ videoUploadOnPasses: 99 })

return this.expectValidationFails('be a boolean')
})
})

context('videosFolder', () => {
it('passes if a string', function () {
this.setup({ videosFolder: '_videos' })
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface FullConfig extends Partial<Cypress.RuntimeConfigOptions & Cypre
// and are required when creating a project.
export type ReceivedCypressOptions =
Pick<Cypress.RuntimeConfigOptions, 'hosts' | 'projectName' | 'clientRoute' | 'devServerPublicPathRoute' | 'namespace' | 'report' | 'socketIoCookie' | 'configFile' | 'isTextTerminal' | 'isNewProject' | 'proxyUrl' | 'browsers' | 'browserUrl' | 'socketIoRoute' | 'arch' | 'platform' | 'spec' | 'specs' | 'browser' | 'version' | 'remote'>
& Pick<Cypress.ResolvedConfigOptions, 'chromeWebSecurity' | 'supportFolder' | 'experimentalSourceRewriting' | 'fixturesFolder' | 'reporter' | 'reporterOptions' | 'screenshotsFolder' | 'supportFile' | 'baseUrl' | 'viewportHeight' | 'viewportWidth' | 'port' | 'experimentalInteractiveRunEvents' | 'userAgent' | 'downloadsFolder' | 'env' | 'excludeSpecPattern' | 'specPattern' | 'experimentalModifyObstructiveThirdPartyCode' | 'experimentalSkipDomainInjection' | 'video' | 'videoCompression' | 'videosFolder' | 'videoUploadOnPasses' | 'resolvedNodeVersion' | 'resolvedNodePath' | 'trashAssetsBeforeRuns' | 'experimentalWebKitSupport'> // TODO: Figure out how to type this better.
& Pick<Cypress.ResolvedConfigOptions, 'chromeWebSecurity' | 'supportFolder' | 'experimentalSourceRewriting' | 'fixturesFolder' | 'reporter' | 'reporterOptions' | 'screenshotsFolder' | 'supportFile' | 'baseUrl' | 'viewportHeight' | 'viewportWidth' | 'port' | 'experimentalInteractiveRunEvents' | 'userAgent' | 'downloadsFolder' | 'env' | 'excludeSpecPattern' | 'specPattern' | 'experimentalModifyObstructiveThirdPartyCode' | 'experimentalSkipDomainInjection' | 'video' | 'videoCompression' | 'videosFolder' | 'resolvedNodeVersion' | 'resolvedNodePath' | 'trashAssetsBeforeRuns' | 'experimentalWebKitSupport'> // TODO: Figure out how to type this better.

export interface SettingsOptions {
testingType?: 'component' |'e2e'
Expand Down
Loading