From 34ab6f0004b8c97d3c64aff845c102d262e3a5e3 Mon Sep 17 00:00:00 2001 From: laistomazz Date: Mon, 27 Jul 2020 14:54:55 +0200 Subject: [PATCH] Rename screenshot to screenshotOnRunFailure --- cli/schema/cypress.schema.json | 2 +- cli/types/cypress.d.ts | 2 +- .../cypress/integration/commands/screenshot_spec.js | 4 ++-- packages/driver/src/cy/commands/screenshot.js | 2 +- packages/server/lib/config.js | 6 +++--- packages/server/test/unit/config_spec.js | 10 +++++----- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cli/schema/cypress.schema.json b/cli/schema/cypress.schema.json index 629612730712..5b964c63df85 100644 --- a/cli/schema/cypress.schema.json +++ b/cli/schema/cypress.schema.json @@ -124,7 +124,7 @@ "default": "cypress/plugins/index.js", "description": "Path to plugins file. (Pass false to disable)" }, - "screenshot": { + "screenshotOnRunFailure": { "type": "boolean", "default": true, "description": "Whether Cypress will take a screenshot when a test fails during cypress run" diff --git a/cli/types/cypress.d.ts b/cli/types/cypress.d.ts index 01e12f832eb3..9daebefccd14 100644 --- a/cli/types/cypress.d.ts +++ b/cli/types/cypress.d.ts @@ -2425,7 +2425,7 @@ declare namespace Cypress { * Whether Cypress will take a screenshot when a test fails during cypress run. * @default true */ - screenshot: boolean + screenshotOnRunFailure: boolean /** * Path to folder where screenshots will be saved from [cy.screenshot()](https://on.cypress.io/screenshot) command or after a headless or CI run’s test failure * @default "cypress/screenshots" diff --git a/packages/driver/cypress/integration/commands/screenshot_spec.js b/packages/driver/cypress/integration/commands/screenshot_spec.js index 74ba9abc62e9..dcb584a8d9d3 100644 --- a/packages/driver/cypress/integration/commands/screenshot_spec.js +++ b/packages/driver/cypress/integration/commands/screenshot_spec.js @@ -94,9 +94,9 @@ describe('src/cy/commands/screenshot', () => { }) }) - it('is noop when screenshot is false', () => { + it('is noop when screenshotOnRunFailure is false', () => { Cypress.config('isInteractive', false) - Cypress.config('screenshot', false) + Cypress.config('screenshotOnRunFailure', false) cy.spy(Cypress, 'action').log(false) diff --git a/packages/driver/src/cy/commands/screenshot.js b/packages/driver/src/cy/commands/screenshot.js index 9e690f3dc382..708383cb6a96 100644 --- a/packages/driver/src/cy/commands/screenshot.js +++ b/packages/driver/src/cy/commands/screenshot.js @@ -388,7 +388,7 @@ module.exports = function (Commands, Cypress, cy, state, config) { Cypress.on('runnable:after:run:async', (test, runnable) => { const screenshotConfig = $Screenshot.getConfig() - if (!test.err || !screenshotConfig.screenshotOnRunFailure || config('isInteractive') || test.err.isPending || !config('screenshot')) { + if (!test.err || !screenshotConfig.screenshotOnRunFailure || config('isInteractive') || test.err.isPending || !config('screenshotOnRunFailure')) { return } diff --git a/packages/server/lib/config.js b/packages/server/lib/config.js index ac6900b471f1..73dd6f57db0c 100644 --- a/packages/server/lib/config.js +++ b/packages/server/lib/config.js @@ -76,7 +76,7 @@ viewportHeight responseTimeout video taskTimeout videoCompression videoUploadOnPasses -screenshot +screenshotOnRunFailure watchForFileChanges waitForAnimations resolvedNodeVersion nodeVersion resolvedNodePath @@ -143,7 +143,7 @@ const CONFIG_DEFAULTS = { video: true, videoCompression: 32, videoUploadOnPasses: true, - screenshot: true, + screenshotOnRunFailure: true, modifyObstructiveCode: true, chromeWebSecurity: true, waitForAnimations: true, @@ -214,7 +214,7 @@ const validationRules = { videoCompression: v.isNumberOrFalse, videosFolder: v.isString, videoUploadOnPasses: v.isBoolean, - screenshot: v.isBoolean, + screenshotOnRunFailure: v.isBoolean, viewportHeight: v.isNumber, viewportWidth: v.isNumber, waitForAnimations: v.isBoolean, diff --git a/packages/server/test/unit/config_spec.js b/packages/server/test/unit/config_spec.js index 285395d38f45..c4ac45aae0fd 100644 --- a/packages/server/test/unit/config_spec.js +++ b/packages/server/test/unit/config_spec.js @@ -593,15 +593,15 @@ describe('lib/config', () => { }) }) - context('screenshot', () => { + context('screenshotOnRunFailure', () => { it('passes if a boolean', function () { - this.setup({ screenshot: false }) + this.setup({ screenshotOnRunFailure: false }) return this.expectValidationPasses() }) it('fails if not a boolean', function () { - this.setup({ screenshot: 42 }) + this.setup({ screenshotOnRunFailure: 42 }) return this.expectValidationFails('be a boolean') }) @@ -1139,7 +1139,7 @@ describe('lib/config', () => { video: { value: true, from: 'default' }, videoCompression: { value: 32, from: 'default' }, videoUploadOnPasses: { value: true, from: 'default' }, - screenshot: { value: true, from: 'default' }, + screenshotOnRunFailure: { value: true, from: 'default' }, videosFolder: { value: 'cypress/videos', from: 'default' }, supportFile: { value: 'cypress/support', from: 'default' }, pluginsFile: { value: 'cypress/plugins', from: 'default' }, @@ -1216,7 +1216,7 @@ describe('lib/config', () => { video: { value: true, from: 'default' }, videoCompression: { value: 32, from: 'default' }, videoUploadOnPasses: { value: true, from: 'default' }, - screenshot: { value: true, from: 'default' }, + screenshotOnRunFailure: { value: true, from: 'default' }, videosFolder: { value: 'cypress/videos', from: 'default' }, supportFile: { value: 'cypress/support', from: 'default' }, pluginsFile: { value: 'cypress/plugins', from: 'default' },