Skip to content

e2e(FR-2173): add E2E tests for password expiry flow#5786

Merged
graphite-app[bot] merged 1 commit intomainfrom
e2e/FR-2173-add-e2e-tests-for-password-expiry-flow
Mar 10, 2026
Merged

e2e(FR-2173): add E2E tests for password expiry flow#5786
graphite-app[bot] merged 1 commit intomainfrom
e2e/FR-2173-add-e2e-tests-for-password-expiry-flow

Conversation

@ironAiken2
Copy link
Copy Markdown
Contributor

@ironAiken2 ironAiken2 commented Mar 6, 2026

Resolves #5785

Summary

  • Add 6 Playwright E2E tests for the password expiry modal flow (FR-2173)
  • Test plan document at e2e/.agent-output/test-plan-password-expiry-fr2173.md
  • Tests cover: modal appearance, non-blocking behavior, cancel flow, empty submission validation, same-password rejection, and full password change flow with real user creation

Test Scenarios

  1. Password change modal appears when password is expired
  2. Login modal does not block the password change modal
  3. User can cancel and return to login form
  4. Empty submission shows validation error
  5. Same-as-current password is rejected
  6. Full flow: admin creates user → mock expired login → password change → verify modal closes

Test plan

  • All 6 tests pass on Chromium (pnpm exec playwright test e2e/auth/password-expiry.spec.ts --project chromium)

🤖 Generated with Claude Code

Test Recordings

Test Recording
user sees the password change modal when their password has expired
the login modal does not block the password change modal when password has expired
user can cancel the password change modal and return to the login form
password change form shows a validation error when submitted empty
password change form rejects a new password that is the same as the current one
user can complete the password change flow with a real account and re-login is attempted

Copy link
Copy Markdown
Contributor Author

ironAiken2 commented Mar 6, 2026


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • flow:merge-queue - adds this PR to the back of the merge queue
  • flow:hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has required the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ironAiken2 ironAiken2 changed the base branch from 03-06-fix_fr-2228_add_email_input_field_to_password_change_modal to graphite-base/5786 March 6, 2026 09:28
@ironAiken2 ironAiken2 force-pushed the e2e/FR-2173-add-e2e-tests-for-password-expiry-flow branch from 8bc0e72 to baa6ad2 Compare March 6, 2026 09:28
@ironAiken2 ironAiken2 force-pushed the graphite-base/5786 branch from 302c82c to 4a8efd7 Compare March 6, 2026 09:28
@ironAiken2 ironAiken2 marked this pull request as ready for review March 6, 2026 09:39
Copilot AI review requested due to automatic review settings March 6, 2026 09:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Playwright E2E coverage for the FR-2173 password-expiry flow in the WebUI authentication experience, ensuring the reset-password modal is shown and remains interactive even when the login modal is open.

Changes:

  • Added a new Playwright spec with 6 scenarios covering password-expiry modal visibility, interactivity, validation, cancel behavior, and a full flow that creates/purges a real user.
  • Added an accompanying test plan document describing the flow, mocks, and assertions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
e2e/auth/password-expiry.spec.ts Implements password-expiry E2E scenarios using route interception and an admin-driven real-user flow with cleanup.
e2e/.agent-output/test-plan-password-expiry-fr2173.md Documents test scenarios, mock strategy, and implementation notes for the new E2E coverage.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread e2e/auth/password-expiry.spec.ts Outdated
Comment thread e2e/auth/password-expiry.spec.ts Outdated
Comment thread e2e/auth/password-expiry.spec.ts
@ironAiken2 ironAiken2 force-pushed the e2e/FR-2173-add-e2e-tests-for-password-expiry-flow branch from baa6ad2 to 364c96f Compare March 6, 2026 09:58
@ironAiken2 ironAiken2 changed the base branch from graphite-base/5786 to 02-26-fix_fr-2173_fix_password_change_modal_blocked_by_login_modal_on_password_expiry March 6, 2026 09:58
Comment thread e2e/.agent-output/test-plan-password-expiry-fr2173.md Outdated
@ironAiken2 ironAiken2 force-pushed the 02-26-fix_fr-2173_fix_password_change_modal_blocked_by_login_modal_on_password_expiry branch from 4a8efd7 to 19f377a Compare March 9, 2026 02:36
@ironAiken2 ironAiken2 force-pushed the e2e/FR-2173-add-e2e-tests-for-password-expiry-flow branch from 364c96f to fba8769 Compare March 9, 2026 02:36
@github-actions github-actions Bot added size:XL 500~ LoC and removed size:L 100~500 LoC labels Mar 9, 2026
@ironAiken2 ironAiken2 requested a review from nowgnuesLee March 9, 2026 02:36
Copy link
Copy Markdown
Contributor

@agatha197 agatha197 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — e2e(FR-2173)

Well-structured tests overall. Good mock strategy and scenario coverage.

MEDIUM

1. KeyPairModal Page Object not used (password-expiry.spec.ts)
A KeyPairModal class is already exported from UserSettingModal.ts. Currently the key pair dialog is handled with inline selectors — using the existing Page Object would improve maintainability.

2. afterEach UI-based cleanup is flakiness-prone
The real-account test (test 6) cleanup performs multi-step UI interactions (navigate → deactivate → purge). If cleanup itself fails, orphaned test users remain.
→ Consider using Backend.AI admin API calls directly for more reliable cleanup.

3. Empty catch block masks errors

} catch {
  // Key pair modal did not appear - continue
}

This silently swallows all errors, not just the "not visible" case. If the dialog appears but fails to close for a different reason, subsequent assertions will fail with misleading messages.
→ Check visibility first, then handle close failure separately.

LOW

4. Mock endpoint does not validate request payload
The update-password-no-auth mock always returns { result: 'ok' } without verifying the request body contains new_password. Adding a payload assertion would catch frontend regressions.

5. .ant-form-item-explain-error CSS class selector
Depends on Ant Design internal implementation. Consider getByRole('alert') or text-based selectors where possible.

6. Coverage report missing 6th test
Only 5 features were added to the table, but 6 tests exist. The "full password change flow" entry is missing.

7. Document loginCallCount late registration intent
Add a comment explaining why the mock is registered late (to avoid background requests consuming the first-call intercept).

@ironAiken2 ironAiken2 changed the base branch from 02-26-fix_fr-2173_fix_password_change_modal_blocked_by_login_modal_on_password_expiry to graphite-base/5786 March 9, 2026 09:57
@ironAiken2 ironAiken2 force-pushed the graphite-base/5786 branch from 19f377a to da2e727 Compare March 9, 2026 10:04
@ironAiken2 ironAiken2 force-pushed the e2e/FR-2173-add-e2e-tests-for-password-expiry-flow branch from fba8769 to 1b61bda Compare March 9, 2026 10:04
@ironAiken2 ironAiken2 changed the base branch from graphite-base/5786 to 02-26-fix_fr-2173_fix_password_change_modal_blocked_by_login_modal_on_password_expiry March 9, 2026 10:04
@ironAiken2 ironAiken2 requested a review from agatha197 March 9, 2026 10:14
@ironAiken2
Copy link
Copy Markdown
Contributor Author

Response to @agatha197's review

Thanks for the thorough review! Applied fixes in the latest commit:

MEDIUM

  1. KeyPairModal PO not used — Fixed. Now using the existing KeyPairModal class from UserSettingModal.ts instead of inline selectors.
  2. afterEach UI-based cleanup — Valid concern. Keeping UI-based cleanup for now as it exercises the same paths users would, but acknowledged as a future improvement to use admin API for more reliable cleanup.
  3. Empty catch block — Fixed. Replaced try/catch with a visibility check (isVisible().catch(() => false)) so only the "not visible" case is handled silently.

LOW

  1. Mock endpoint payload validation — Acknowledged as future improvement. Current focus is on the UI flow; adding payload assertions would be a good follow-up.
  2. .ant-form-item-explain-error CSS selector — Fixed. Replaced with getByRole('alert').
  3. Coverage report missing 6th test — Fixed. Added "Full password change flow (real account)" entry, updated counts to 77/279 (28%).
  4. Document loginCallCount late registration — Fixed. Added a comment explaining why the mock is registered after page load and form fill.

Comment thread e2e/auth/password-expiry.spec.ts
Comment thread e2e/auth/password-expiry.spec.ts
@ironAiken2 ironAiken2 force-pushed the e2e/FR-2173-add-e2e-tests-for-password-expiry-flow branch from 1b61bda to 4b0c66c Compare March 10, 2026 03:25
@ironAiken2 ironAiken2 force-pushed the 02-26-fix_fr-2173_fix_password_change_modal_blocked_by_login_modal_on_password_expiry branch from da2e727 to 2519da4 Compare March 10, 2026 03:25
@ironAiken2 ironAiken2 requested a review from agatha197 March 10, 2026 03:25
Copy link
Copy Markdown
Contributor

@agatha197 agatha197 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@graphite-app graphite-app Bot changed the base branch from 02-26-fix_fr-2173_fix_password_change_modal_blocked_by_login_modal_on_password_expiry to graphite-base/5786 March 10, 2026 04:17
Copy link
Copy Markdown
Contributor

@nowgnuesLee nowgnuesLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ironAiken2 ironAiken2 force-pushed the e2e/FR-2173-add-e2e-tests-for-password-expiry-flow branch from 4b0c66c to 32c4da3 Compare March 10, 2026 04:53
@ironAiken2 ironAiken2 changed the base branch from graphite-base/5786 to main March 10, 2026 04:53
@graphite-app
Copy link
Copy Markdown

graphite-app Bot commented Mar 10, 2026

Merge activity

Resolves #5785

## Summary
- Add 6 Playwright E2E tests for the password expiry modal flow (FR-2173)
- Test plan document at `e2e/.agent-output/test-plan-password-expiry-fr2173.md`
- Tests cover: modal appearance, non-blocking behavior, cancel flow, empty submission validation, same-password rejection, and full password change flow with real user creation

## Test Scenarios
1. Password change modal appears when password is expired
2. Login modal does not block the password change modal
3. User can cancel and return to login form
4. Empty submission shows validation error
5. Same-as-current password is rejected
6. Full flow: admin creates user → mock expired login → password change → verify modal closes

## Test plan
- [x] All 6 tests pass on Chromium (`pnpm exec playwright test e2e/auth/password-expiry.spec.ts --project chromium`)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

## Test Recordings

| Test | Recording |
|------|-----------|
| user sees the password change modal when their password has expired | ![](https://github.com/user-attachments/assets/b9ccadbc-3f0b-4ba0-b6b8-9c4a9ac275df) |
| the login modal does not block the password change modal when password has expired | ![](https://github.com/user-attachments/assets/d769fec9-ad6b-41e0-9efb-b207239ca96b) |
| user can cancel the password change modal and return to the login form | ![](https://github.com/user-attachments/assets/9451f29f-298b-45ee-b3c4-bb02b5db858d) |
| password change form shows a validation error when submitted empty | ![](https://github.com/user-attachments/assets/e11663a5-18c8-451a-af23-ed1a964b91bd) |
| password change form rejects a new password that is the same as the current one | ![](https://github.com/user-attachments/assets/71223e25-631c-4822-bb8a-94c7d05e6134) |
| user can complete the password change flow with a real account and re-login is attempted | ![](https://github.com/user-attachments/assets/0b9d0108-e2d4-4728-a901-a534239fe84a) |
@graphite-app graphite-app Bot force-pushed the e2e/FR-2173-add-e2e-tests-for-password-expiry-flow branch from 32c4da3 to 310287a Compare March 10, 2026 04:54
@graphite-app graphite-app Bot merged commit 310287a into main Mar 10, 2026
7 checks passed
@graphite-app graphite-app Bot deleted the e2e/FR-2173-add-e2e-tests-for-password-expiry-flow branch March 10, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add E2E tests for password expiry flow

4 participants