Repository navigation
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The validation assertion can pass on the old page’s existing last-name error, so the test must wait for the submitted form to become stale to resolve the invalid-then-valid submission race.
1 open issue
What changed in this PR
This PR addresses the Firefox flakiness reported in #55172 by tightening synchronization in the profile-validation test and the shared OAuth callback wait.
Changes:
- Adds a last-name validation-error assertion before resubmitting the profile form.
- Matches complete
codeanderrorparameter names sosession_codedoes not trigger the callback wait.
| File | Description |
|---|---|
tests/base/src/test/java/org/keycloak/tests/forms/VerifyProfileTest.java |
Checks for a validation error before the valid submission. |
test-framework/ui/src/main/java/org/keycloak/testframework/ui/webdriver/WaitUtils.java |
Tightens OAuth callback parameter matching. |
Review effort: Balanced
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.actions.TermsAndConditionsTest#termsAcceptedKeycloak CI - Forms IT (firefox) |
Closes keycloak#55172 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
839b180 to
e9a6c2b
Compare
Unreported flaky test detectedIf the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR. org.keycloak.testsuite.adapter.servlet.SAMLServletAdapterTest#employeeSigPostNoIdpKeyTestCertSubjectAsKeyNameInKeyInfo |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
| login("login-test"); | ||
|
|
||
| //submit with error | ||
| verifyProfilePage.assertCurrent(); | ||
| assertFalse(verifyProfilePage.isDepartmentPresent()); | ||
| verifyProfilePage.update("First", " "); | ||
|
|
||
| //submit OK | ||
| verifyProfilePage.assertCurrent(); |
There was a problem hiding this comment.
does this part need the same fix as well? Not a blocker, this PR LGTM
There was a problem hiding this comment.
Thanks for pointing that out; I just pushed a more comprehensive approve. Waiting for CI to be green.
Closes keycloak#55172 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
|
@gaoyikeshuer - ready for another review. Thanks! |
gaoyikeshuer
left a comment
There was a problem hiding this comment.
Thanks @ahus1 ! LGTM
Closes #55172
The failure had two independent causes, so both are fixed here: the shared OAuth callback wait matched
session_code=as if it werecode=, and the profile page object returned from a submit before the browser had replaced the page, so the next assertion or submit could act on the old page.Decisions and assumptions
WaitUtilsnow matches whole parameter names (?,&or#followed bycode=orerror=). This changes behavior for all tests callingparseLoginResponse(), which I assume is intended, as the old match could only succeed early by accident.LoginUpdateProfilePage.Update.submit()and not in the individual tests, so all callers benefit. It waits for the submitted button to go stale, treating Chrome's "does not belong to the document"WebDriverExceptionlike Firefox'sStaleElementReferenceException, and then fordocument.readyStateto becomplete. A stale element alone is not enough, as the new document can be committed but not yet parsed.OrganizationSharedIdpBrokerTest.testAuthNotePreservedOverridesEmailDomainon Firefox, which read the page source of a not yet loaded page and failed on every local run. It needed no change to the test.waitForOAuthCallback()andassertCurrent()as they assert the outcome, not only the timing.VerifyProfileTest,RequiredActionUpdateProfileTestandOrganizationSharedIdpBrokerTeston Firefox pass. On Chrome,OrganizationSharedIdpBrokerTestandOrganizationInvitationTokenTeststill fail with and without this change, due to similar races right after other page submits (for example readinggetCurrentUrl()immediately after the username submit). I left those out of scope.release/26.8is the only supported branch with the migrated test and the faulty wait, so only that backport is needed.