Repository navigation
Description
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:
-
SetupRecoveryAuthnCodesPage.clickSaveRecoveryAuthnCodesButton()usesUIUtils.clickLink()for the save button. On Chrome,clickLinkemulates clicks viasendKeys(Keys.ENTER)(workaround for missed clicks since Chrome 128). For this<input type="submit" disabled>button — which is enabled dynamically by a JavaScriptonchangehandler on a checkbox outside the form —sendKeys(Keys.ENTER)does not reliably trigger form submission in Chrome. AfterclickSaveRecoveryAuthnCodesButton(), the browser stays on the required-action page instead of redirecting to the test application. Theid="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. -
The
finallyblock hasassertAccountLinkAvailability(true)beforeBrowserFlowTest.revertFlows(). When the assertion fails,revertFlowsis never called, leaving the realm in a dirty state for reruns.
Fix
- Change
UIUtils.clickLink(saveRecoveryAuthnCodesButton)toUIUtils.click(saveRecoveryAuthnCodesButton)(uses realelement.click(), matching the new test framework approach). - Move the login-success verification (
assertEquals(AUTH_RESPONSE, appPage.getRequestType())) into thetryblock (consistent with test01/02/03) and keep onlyrevertFlowsinfinally.
Version
26.4, 26.6, 26.7 (on main, the test was rewritten for the new test framework and is not affected)
Metadata
Metadata
Assignees
Labels
Type
Fields
Projects
- StatusShow more project fieldsDone
Activity
Fix RecoveryAuthnCodesAuthenticatorTest flakiness in Chrome
2 remaining items
Fix RecoveryAuthnCodesAuthenticatorTest flakiness in Chrome
Fix RecoveryAuthnCodesAuthenticatorTest flakiness in Chrome