Repository navigation
fix: fill the login form until the values stay filled (does not fix #16217) - #16215
codeconsole wants to merge 1 commit into
Conversation
UserControllerSpec fails now and then with a thirty second wait for a login page that never goes away. The report Geb writes at the failure shows why: the browser is on a login page whose fields are empty, with the focus ring still on the first one where autofocus put it, and no error - so the page was loaded after the credentials were typed, and nothing was ever submitted. Both fields are required, so a form left empty is one the browser refuses to send. The wait then has nothing to wait for. The page is rendered because a protected page asked for it, and the document that was typed into can be replaced by one that was still on its way. Filling it again until the values stay makes the click work with what it needs, rather than assuming the typing landed on the document that will be submitted. Three page objects are reached that way and fill without checking: this one, and the two in the misc functional test application, whose specifications also arrive by being redirected from a secured page. Those two set the fields rather than appending to them now, since a second attempt would otherwise double the text. The ldap and acl applications fill without checking too and are left alone: they navigate to their login page directly rather than being sent to it, and every call site follows the login with an at-check, which waits. Nothing there has failed this way.
🚨 TestLens detected 1 failed test 🚨Here is what you can do:
Test SummaryCI / Functional Tests (Java 21, indy=true) > :grails-test-examples-scaffolding:integrationTest
🏷️ Commit: 509180f Test FailuresUserControllerSpec > User list (:grails-test-examples-scaffolding:integrationTest in CI / Functional Tests (Java 21, indy=true))Rerun ControlsSelect tests to mute in this pull request:
Reuse successful test results:
Click the checkbox to trigger a rerun:
Learn more about TestLens at testlens.app/docs. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #16215 +/- ##
==================================================
- Coverage 54.1238% 54.1169% -0.0069%
+ Complexity 20307 20302 -5
==================================================
Files 2107 2107
Lines 101144 101144
Branches 17921 17921
==================================================
- Hits 54743 54736 -7
- Misses 38595 38601 +6
- Partials 7806 7807 +1 🚀 New features to boost your workflow:
|
|
Closing. This does not fix #16217, and the mechanism it was opened on turned out to be wrong - the failure reproduced on this very branch, at the wait after the click, with the form verified as filled. What is left here guards against a document being replaced while the form is filled. That can happen in principle, and an empty The evidence is recorded in #16217: the form reaches the server without a session cookie, established by comparing the captured page against injected faults. Anyone picking that up should start there rather than from this branch. The one piece worth doing separately is the diagnostic that issue asks for - capturing the browser's cookies and url into the Geb report when the wait fails - which would settle the open question on the next occurrence. |
What this claimed, and why it was wrong
It claimed
UserControllerSpec > User listfails because the login page is replaced under the driver while the form is being filled, leaving two emptyrequiredfields that the browser refuses to submit.That was asserted from the captured page rather than tested, and this branch's own CI disproved it: the same test failed here, at
login_closure2- the wait after the click. The fill retry added by this branch had already passed, so the form was filled and the click did submit. The failure is downstream of anything this changes.What is actually known
Established afterwards by injecting faults locally and comparing the captured page with CI's, byte for byte (see #16217):
_csrfoverwritten with a stale valueThe form reaches the server without a session cookie. Why is not known. Resubmitting is not a fix either: without the session the saved request is gone too, so a successful retry lands on
/and the test then fails onat(UserListPage).What is still in this branch
Two things that stand or fall on their own merits, neither of which addresses the failure above:
requiredform is silently unsubmittable - but it has not been observed happening in this application.Both are hardening against something unobserved. On the evidence available they should not be merged as a fix for #16217, and arguably not at all.