Cypress -Delete Videos configuration

Cypress -Delete Video Recording for Passed Spec files

Step 1:  Need to install the "del" module as a dependency

Terminal  : npm i del --save-dev

Step 2: Check package.json file



Step 3: Go to plugins/index.js

//import 

const del = require('del')

 module.exports = (on, config) => {
  on('after:spec', (spec, results) => {
    if (results && results.stats.failures === 0 && results.video) {
      // `del()` returns a promise, so it's important to return it to ensure
      // deleting the video is finished before moving on
      return del(results.video)
    }
  })
}



Step 4: Run Spec folder from Terminal

For Example: npx cypress run --headless --browser chrome --spec cypress\integration\videoDelete\*

I have taken two spec files.


Test Suite Result:
             exxon.spec -Failed
             select.spec -Passed


             


Step 5: Spec file which is passed video recording will be auto deleted
     





No comments:

Post a Comment

Lets Start...............

Cypress

Syllabus Q & A Set -1 Q & A Set -2