From d91da9b0be278ad2071d62bc6f49b880183c5d92 Mon Sep 17 00:00:00 2001 From: David Gwilliam Date: Sat, 25 Apr 2026 21:14:04 -0700 Subject: [PATCH] feat: add password reset feature test (issue #10) - Add password-reset.feature with 4 scenarios - Add step definition for password reset page assertion - Tests access page, valid email request, invalid email, and empty field --- e2e/cucumber/features/password-reset.feature | 32 +++++++++++++++++++ e2e/cucumber/step-definitions/common-steps.ts | 7 ++++ 2 files changed, 39 insertions(+) create mode 100644 e2e/cucumber/features/password-reset.feature diff --git a/e2e/cucumber/features/password-reset.feature b/e2e/cucumber/features/password-reset.feature new file mode 100644 index 0000000..bf9d777 --- /dev/null +++ b/e2e/cucumber/features/password-reset.feature @@ -0,0 +1,32 @@ +Feature: Password Reset + As a user who forgot my password + I want to reset my password + So that I can regain access to my account + + @happy-path @authentication @issue-10 + Scenario: User can access password reset page + Given I am on the login page + When I click the "Forgot password?" link + Then I should be on the password reset page + And I should see "Reset Password" + + @happy-path @authentication @issue-10 @wip + Scenario: User requests password reset with valid email + Given I am on the password reset page + When I fill in "email" with "existing-user@example.com" + And I click the "Send Reset Link" button + Then I should see "Password reset link sent" + And I should see "Check your email" + + @negative-test @authentication @issue-10 @wip + Scenario: User requests password reset with invalid email + Given I am on the password reset page + When I fill in "email" with "nonexistent@example.com" + And I click the "Send Reset Link" button + Then I should see an error message + + @negative-test @authentication @issue-10 @wip + Scenario: User submits empty email field + Given I am on the password reset page + When I click the "Send Reset Link" button + Then I should see "email is required" error diff --git a/e2e/cucumber/step-definitions/common-steps.ts b/e2e/cucumber/step-definitions/common-steps.ts index 7d23538..245ecb6 100644 --- a/e2e/cucumber/step-definitions/common-steps.ts +++ b/e2e/cucumber/step-definitions/common-steps.ts @@ -223,6 +223,13 @@ Then('I should be on the home page', async function () { expect(currentUrl).toContain('/'); }); +Then('I should be on the password reset page', async function () { + const currentUrl = world.page.url(); + + console.log(`🌍 Checking current URL: ${currentUrl}`); + expect(currentUrl).toContain('/auth/password-reset'); +}); + Then('I should be redirected to {string}', async function (path: string) { await world.page.waitForLoadState('networkidle'); const currentUrl = world.page.url();