Skip to content

Commit

Permalink
Rename screenshot to screenshotOnRunFailure
Browse files Browse the repository at this point in the history
  • Loading branch information
laistomazz committed Jul 27, 2020
1 parent 35cb319 commit 7144224
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cli/schema/cypress.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cli/types/cypress.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion packages/driver/src/cy/commands/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions packages/server/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ viewportHeight responseTimeout
video taskTimeout
videoCompression
videoUploadOnPasses
screenshot
screenshotOnRunFailure
watchForFileChanges
waitForAnimations resolvedNodeVersion
nodeVersion resolvedNodePath
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions packages/server/test/unit/config_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
Expand Down Expand Up @@ -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' },
Expand Down Expand Up @@ -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' },
Expand Down

0 comments on commit 7144224

Please sign in to comment.