diff --git a/cypress/integration/todo-app-v2.spec.js b/cypress/integration/todo-app-v2.spec.js index ba268a3..4e02342 100644 --- a/cypress/integration/todo-app-v2.spec.js +++ b/cypress/integration/todo-app-v2.spec.js @@ -27,4 +27,16 @@ describe('TodoApp', () => { 'do lunch and learn about Cypress' ); }); + + describe('Nesting', () => { + it('should work', () => { + cy.get('.todo-list li').should('have.length', 3); + + cy.getFirstTodoItem().should( + 'be.equal', + 'do lunch and learn about Cypress' + ); + }); + }); + }); diff --git a/cypress/support/index.js b/cypress/support/index.js index 9c9e918..96432a1 100644 --- a/cypress/support/index.js +++ b/cypress/support/index.js @@ -3,9 +3,8 @@ import addContext from 'mochawesome/addContext'; Cypress.on('test:after:run', (test, runnable) => { if (test.state === 'failed') { - const screenshot = `${Cypress.config('screenshotsFolder')}/${ - Cypress.spec.name - }/${runnable.parent.title} -- ${test.title} (failed).png`; + const screenshotDir = `${Cypress.config('screenshotsFolder')}/${Cypress.spec.name}` + const screenshot = `${screenshotDir}/${runnable.titlePath().join(' -- ')} (failed).png`; addContext({ test }, screenshot); } });