And if you would try that on failure to just create a screenshot. This is an example that uses debugger but maybe you can also do a cy.screenshot.
Copy code
js
Cypress.on('fail', (error, runnable) => {
debugger
// we now have access to the err instance
// and the mocha runnable this failed on
throw error // throw error to have test still fail
})