8000 Stabilize test execution to work with and without users by ahus1 · Pull Request #52432 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Stabilize test execution to work with and without users - #52432

Closed
ahus1 wants to merge 1 commit into
keycloak:release/26.7from
ahus1:is-52430-fix-userprofile
Closed

ahus1 wants to merge 1 commit into
keycloak:release/26.7from
ahus1:is-52430-fix-userprofile

Conversation

@ahus1
@ahus1 ahus1 commented Sep 4, 2026 •
Copy link
Copy Markdown
Member

Closes #52430

Summary

Minimal backport of the clickCreateUser fix from PR #50995 to release/26.7. Replaces all 5 direct page.getByTestId("no-users-found-empty-action").click() calls in userprofile.spec.ts with a helper that handles both the empty-state and populated user list.

Decision: minimal backport vs full PR #50995

PR #50995 on main overhauled many test helpers (table.ts, form.ts) and restructured multiple test suites. Only the clickCreateUser portion is relevant to this failure. This PR extracts just that:

  • userprofile.ts: Added clickCreateUser(page) helper using .or().click() — simpler than the main implementation which uses if-statements
  • userprofile.spec.ts: Replaced all 5 raw no-users-found-empty-action clicks and added the import

Decision: .or().click() over if-statement branching

The main implementation checks emptyAction.count() and isVisible() then conditionally clicks one button or the other. This is a TOCTOU race (state can change between the check and the click).

Since ListEmptyState is a separate React component that replaces the table entirely, only one of the two buttons (no-users-found-empty-action or add-user) exists in the DOM at a time. This means .or() always matches exactly one element, and Playwright's .click() waits for it to be actionable. No branching needed.

Why the raw click fails

The test suite uses test.describe.serial, so tests share realm state. Earlier tests create users (testuser7–9), making the empty-state action disappear. Later tests that click no-users-found-empty-action directly will wait forever since only the add-user button is rendered.

Closes keycloak#52430

Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
@ahus1
ahus1 force-pushed the is-52430-fix-userprofile branch from 276cddf to 4648561 Compare September 4, 2026 10:42
@ahus1
ahus1 requested a balanced review from Copilot September 4, 2026 10:53
Copilot AI left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

All reviewed changes are focused, and no unresolved issues were identified.

Pull request overview

Stabilizes serial user-profile tests for both empty and populated user lists.

Changes:

  • Adds a resilient create-user helper using alternative Playwright locators.
  • Replaces five empty-state-only clicks with the helper.
File summaries
File Description
js/apps/admin-ui/test/realm-settings/userprofile.ts Adds the create-user helper.
js/apps/admin-ui/test/realm-settings/userprofile.spec.ts Uses the helper across five tests.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ahus1
ahus1 marked this pull request as ready for review September 4, 2026 11:09
@ahus1
ahus1 requested review from a team as code owners September 4, 2026 11:09
@stianst stianst self-assigned this Sep 4, 2026
@ahus1 ahus1 removed their assignment Sep 4, 2026
@stianst
stianst commented Sep 4, 2026
Copy link
Copy Markdown
Contributor

@stianst stianst closed this Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

0