diff --git a/cypress/e2e/NotFoundView.cy.ts b/cypress/e2e/NotFoundView.cy.ts new file mode 100644 index 0000000000000000000000000000000000000000..9f8515e8250d43784702ed3e645e08976a70b43a --- /dev/null +++ b/cypress/e2e/NotFoundView.cy.ts @@ -0,0 +1,17 @@ +describe('NotFound Test', () => { + beforeEach(() => { + cy.visit('/login'); + cy.get('#emailInput input').type('user@example.com'); + cy.get('#passwordInput input').type('John1'); + cy.get('form').submit(); + cy.wait(1000); + cy.visit('/') + }) + it('redirects user when page is not found, then go home', () => { + cy.visit('/non-existent-page') + cy.get('[data-cy="404-error"]').should('exist') + cy.get('[data-cy="to-home"]').click() + cy.url().should('include', '/') + }) + +}) \ No newline at end of file diff --git a/src/views/NotFoundView.vue b/src/views/NotFoundView.vue index 7637014bf836c4e94a3526e503080990f93bab13..4e9d5ee0a7e631b0826455801da5861bcef2dc42 100644 --- a/src/views/NotFoundView.vue +++ b/src/views/NotFoundView.vue @@ -5,13 +5,13 @@ <div class="error-template text-center"> <!-- 'text-center' for centering text content --> <h1> Oops!</h1> - <h2> + <h2 data-cy="404-error"> 404 Not Found</h2> <div class="error-details"> Sorry, an error has occurred, Requested page not found! </div> <div class="error-actions"> - <Button1 button-text="Take Me Home" @click="home" /> + <Button1 data-cy="to-home" button-text="Take Me Home" @click="home" /> </div> </div> </div>