I am looking for an option to get the name and the result (fail/pass) of each test to save this to an external file.
How can I get this information easily?
Currently, I can get only the title within the it()
section with:
cy.log(this.test.title)
however, I am not able to get the result there.
It would be ideal to have this option from afterEach()
section. So that in one place I can save the title and result.
I cannot do this.test.state
because Cannot read property 'test' of undefined
I am not able to use Cypress.on('test:after:run', (test)) because this part of code is not starting. I have no idea why.
Thanks!
Use the below snippet, it will work:
passed
orfailed
You can the above scripts like shown below: