diff --git a/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature b/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature index 50a29d320..ab9213cb9 100644 --- a/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature +++ b/e2e-tests/cypress/e2e/User.Authentication.ResetPassword.feature @@ -2,13 +2,27 @@ Feature: User Authentication - reset password As a user I want to reset my password from the sign in page - # TODO for these pre-conditions utilize seeding or API check, if user exists in test system - # Background: - # Given the following "users" are in the database: - # | email | password | name | - # | raeuber@hotzenplotz.de | Aa12345_ | Räuber Hotzenplotz | - + Scenario: Reset password as not registered user + Given the user navigates to page "/login" + And the user navigates to the forgot password page + When the user enters the e-mail address "not@registered.com" + And the user submits the e-mail form + Then the user receives no password reset e-mail + + Scenario: Reset password as deleted user + # Given the following "users" are in the database: + # | email | password | name | + # | stephen@hawking.uk | Aa12345_ | Stephen Hawking | + Given the user navigates to page "/login" + And the user navigates to the forgot password page + When the user enters the e-mail address "stephen@hawking.uk" + And the user submits the e-mail form + Then the user receives no password reset e-mail + Scenario: Reset password from signin page successfully + # Given the following "users" are in the database: + # | email | password | name | + # | raeuber@hotzenplotz.de | Aa12345_ | Räuber Hotzenplotz | Given the user navigates to page "/login" And the user navigates to the forgot password page When the user enters the e-mail address "raeuber@hotzenplotz.de" @@ -23,3 +37,6 @@ Feature: User Authentication - reset password And the user cannot login But the user submits the credentials "raeuber@hotzenplotz.de" "12345Aa_" And the user is logged in with username "Räuber Hotzenplotz" + + + diff --git a/e2e-tests/cypress/support/step_definitions/email_steps.ts b/e2e-tests/cypress/support/step_definitions/email_steps.ts index a2e6dbcb8..414490cda 100644 --- a/e2e-tests/cypress/support/step_definitions/email_steps.ts +++ b/e2e-tests/cypress/support/step_definitions/email_steps.ts @@ -55,6 +55,21 @@ Then('the user receives an e-mail containing the {string} link', (linkName: stri ) }) +Then('the user receives no password reset e-mail', () => { + cy.origin(Cypress.env('mailserverURL'), { args: { userEMailSite } }, ({ userEMailSite }) => { + cy.visit('/') + cy.wait(300) + cy.get(userEMailSite.emailInbox).should('be.visible') + + cy.get(userEMailSite.emailList).then(($emailList) => { + const emailItems = $emailList.find('.email-item') + if (emailItems.length > 0) { + expect(emailItems.filter(`:contains("asswor")`).length).to.equal(0) + } + }) + }) +}) + When( 'the user receives the transaction e-mail about {string} GDD from {string}', (amount: string, senderName: string) => {