Cypress: get error message from DOM on test failure

Viewed 60

In cypress, how can I extract some information from DOM (like error code) on test-failure ? Is it even possible?

Following code wont work

Cypress.on('fail', (e, runnable) => {
     cy.contains(/[a-zA-Z0-9]{32}/).invoke('text').then((text) => {
       cy.PrintDebugInfo("Sentry-error: "+cy.wrap(text))
     });
})
0 Answers
Related