Skip to content

Fixed flaky staff password acceptance tests - #29378

Merged
9larsons merged 1 commit into
mainfrom
codex/fix-staff-password-test-focus
Jul 16, 2026
Merged

Fixed flaky staff password acceptance tests#29378
9larsons merged 1 commit into
mainfrom
codex/fix-staff-password-test-focus

Conversation

@9larsons

Copy link
Copy Markdown
Contributor

What changed

  • wait for the password form's intended field to receive focus before filling either password path
  • reuse the password field locators throughout the current-user scenario

Why

The password form applies focus 100 ms after it opens. Playwright fills password inputs in separate focus/select and text-insertion steps, so the delayed focus could land between those steps and redirect text into a different field. That caused the self-password validation assertion to intermittently observe the wrong validation state on main.

Failed run: https://github.com/TryGhost/Ghost/actions/runs/29460895269/job/87504062007

Validation

  • focused password acceptance spec: 6 consecutive passes, 12/12 tests
  • full Admin acceptance suite: 174/174 tests

no ref

The password form applies its intended focus after a short delay, which could race with Playwright filling another field and redirect the input. Waiting for the expected focus makes the interaction deterministic without retries or sleeps.
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

The staff password acceptance tests now verify that the new-password field is focused when opening another staff member’s password form. The own-password flow captures password and save controls, asserts focus on the old-password field, fills the new and confirmation passwords, verifies the validation message, and then fills the old password.

Possibly related PRs

  • TryGhost/Ghost#29374: Updates related staff-password acceptance test focus assertions in the same file.
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: fixing flaky staff password acceptance tests.
Description check ✅ Passed The description is directly related to the test flakiness fix and explains the focus-timing issue.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-staff-password-test-focus

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Jul 16, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 2cd3bcd

Command Status Duration Result
nx run @tryghost/admin:test:acceptance ✅ Succeeded 2m 38s View ↗
nx run-many -t test:unit -p @tryghost/admin ✅ Succeeded 2m 17s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 20s View ↗
nx run-many -t lint -p @tryghost/admin,ghost-mo... ✅ Succeeded 53s View ↗
nx run @tryghost/admin:build ✅ Succeeded 36s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded <1s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-16 12:31:40 UTC

@9larsons
9larsons marked this pull request as ready for review July 16, 2026 12:30
@9larsons
9larsons enabled auto-merge (squash) July 16, 2026 12:30
@9larsons
9larsons merged commit d9fa24e into main Jul 16, 2026
42 checks passed
@9larsons
9larsons deleted the codex/fix-staff-password-test-focus branch July 16, 2026 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant