I am using cypress with typescript for my current project, I am in a situation to get the name of a saved screenshot. the screenshot name is automatically saved by cypress which starts with the description given in the describe block.
for example
describe('Admin Portal', () => {
it('Login Test', () => {
});
});
the screenshot will be saved as 'Admin Portal login -- Login Test (failed).png'
Cypress.on('test:after:run', (test, runnable) => {
if (test.state === 'failed') {
const screenshotFileName = `${test.title} (failed).png`
addContext({ test }, `assets/${Cypress.spec.name}/${screenshotFileName}`)
}
the above line of code is actually retrieving the name defined in the It block, how to get the name defined in the describe block??
