8000 Flaky test: RecoveryAuthnCodesAuthenticatorTest#test07SetupRecoveryAuthnCodes on Chrome · Issue #52868 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Flaky test: RecoveryAuthnCodesAuthenticatorTest#test07SetupRecoveryAuthnCodes on Chrome #52868

Closed

Description

@ahus1

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

testsuite

Describe the bug

RecoveryAuthnCodesAuthenticatorTest#test07SetupRecoveryAuthnCodes fails deterministically on Chrome (passes on Firefox). The test failed 3/3 attempts (original + 2 surefire reruns).

Forms IT Chrome (run 35119771343)

Error

java.lang.AssertionError
  at org.junit.Assert.assertFalse(Assert.java:65)
  at org.keycloak.testsuite.pages.LanguageComboboxAwarePage.assertAccountLinkAvailability(LanguageComboboxAwarePage.java:106)
  at org.keycloak.testsuite.forms.RecoveryAuthnCodesAuthenticatorTest.test07SetupRecoveryAuthnCodes(RecoveryAuthnCodesAuthenticatorTest.java:426)

Root cause

Two issues:

  1. SetupRecoveryAuthnCodesPage.clickSaveRecoveryAuthnCodesButton() uses UIUtils.clickLink() for the save button. On Chrome, clickLink emulates clicks via sendKeys(Keys.ENTER) (workaround for missed clicks since Chrome 128). For this <input type="submit" disabled> button — which is enabled dynamically by a JavaScript onchange handler on a checkbox outside the form — sendKeys(Keys.ENTER) does not reliably trigger form submission in Chrome. After clickSaveRecoveryAuthnCodesButton(), the browser stays on the required-action page instead of redirecting to the test application. The id="account" element (rendered by the test app) is therefore not found.

    On main, the test was rewritten for the new test framework (commits b447e08, 0b9e007) and uses plain .click() which works.

  2. The finally block has assertAccountLinkAvailability(true) before BrowserFlowTest.revertFlows(). When the assertion fails, revertFlows is never called, leaving the realm in a dirty state for reruns.

Fix

  • Change UIUtils.clickLink(saveRecoveryAuthnCodesButton) to UIUtils.click(saveRecoveryAuthnCodesButton) (uses real element.click(), matching the new test framework approach).
  • Move the login-success verification (assertEquals(AUTH_RESPONSE, appPage.getRequestType())) into the try block (consistent with test01/02/03) and keep only revertFlows in finally.

Version

26.4, 26.6, 26.7 (on main, the test was rewritten for the new test framework and is not affected)

Activity

  1. added theissue type on Sep 16, 2026
  2. self-assigned this
    on Sep 16, 2026
  3. added a commit that references this issue on Sep 17, 2026
    e5d4a85
  4. 2 remaining items

  5. added a commit that references this issue on Sep 17, 2026
    e947a34
  6. added a commit that references this issue on Sep 17, 2026
    b324d4a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Fields

No fields configured for bug.

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

0