8000 Stabilize flaky test PasskeysUsernameFormTest by ahus1 · Pull Request #52077 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Stabilize flaky test PasskeysUsernameFormTest - #52077

Merged
ahus1 merged 1 commit into
keycloak:mainfrom
ahus1:is-52074-stabilize-test
Aug 27, 2026
Merged

ahus1 merged 1 commit into
keycloak:mainfrom
ahus1:is-52074-stabilize-test

Conversation

@ahus1
@ahus1 ahus1 commented Aug 26, 2026
Copy link
Copy Markdown
Member

Summary

  • Add WaitUtils.waitForPageReload() that detects actual page navigation by waiting for the current <body> element to become stale before returning
  • Update submit() in LoginPage, LoginUsernamePage, and PasswordPage to use waitForPageReload(), ensuring the browser has completed the page reload before the test proceeds

The root cause of the flaky StaleElementReferenceException is that submit() returned immediately after clicking, and the subsequent assertCurrent() could match the old page's data-page-id (since it's the same login page after an invalid login), allowing element access before the DOM was fully swapped.

Closes #52074

🤖 Generated with Claude Code

…bleCredential

Closes keycloak#52074

Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
@ahus1
ahus1 requested a review from a team as a code owner August 26, 2026 12:07
Copilot AI balanced review requested due to automatic review settings August 26, 2026 12:07
@ahus1
ahus1 requested review from lhanusov and vaceksimon August 26, 2026 12:07
@ahus1 ahus1 self-assigned this Aug 26, 2026
@ahus1
ahus1 commented Aug 26, 2026
Copy link
Copy Markdown
Member Author

Looking for a reviewer. Adding @rmartinc as this is part of the authorization team's scope. Adding @vaceksimon and @lhanusov for visibility of the new test suite.

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.

Pull request overview

Adds reliable navigation synchronization to stabilize login-related UI tests.

Changes:

  • Adds a body-staleness-based page reload wait.
  • Applies it to username, password, and combined login submissions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
WaitUtils.java Adds waitForPageReload.
PasswordPage.java Waits after password submission.
LoginUsernamePage.java Waits after username submission.
LoginPage.java Waits after combined login submission.

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

@lhanusov
Copy link
Copy Markdown
Contributor

@ahus1 I am checking it now.

@ahus1
ahus1 enabled auto-merge (squash) August 26, 2026 15:09
@rmartinc rmartinc 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.

Thanks @ahus1 and @lhanusov!

@ahus1
ahus1 merged commit 7974e7a into keycloak:main Aug 27, 2026
94 checks passed
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.

Flaky test: PasskeysUsernameFormTest.passwordLoginWithNonDiscoverableCredential

4 participants

0