jamesfredley opened a new pull request, #15394:
URL: https://github.com/apache/grails-core/pull/15394

   ## Summary
   
   Stabilizes flaky `UserControllerSpec` and `UserCommunityControllerSpec` Geb 
tests in `grails-test-examples/scaffolding` that intermittently fail on slower 
CI runners (observed on JDK 25 in [Functional Tests 
(25)](https://github.com/apache/grails-core/actions/runs/22083891105/job/63814394408?pr=15393)).
   
   ## Problem
   
   The test expects page title `User List` but intermittently gets `Please sign 
in` because:
   
   1. **No wait after login** — `setup()` clicks the login button then 
immediately proceeds to the feature method. On slower environments, the login 
POST hasn't completed, so the session cookie isn't set when `go 'user/index'` 
executes, causing Spring Security to redirect to the login page.
   2. **No waitFor on assertions** — `title == 'User List'` asserts immediately 
without waiting for async page load, unlike every other Geb spec in this repo.
   
   These were the **only two Geb specs** not updated with `waitFor` patterns 
during the stability improvements in e8adf0143f.
   
   ## Changes
   
   - Add `waitFor { title != 'Please sign in' }` after login click to verify 
auth completes before proceeding
   - Wrap `title == 'User List'` assertions with `waitFor { }` for async page 
load handling
   - Add `waitFor` for logout button visibility before clicking in `cleanup()`
   - Remove redundant `go '/'` before `to LoginPage` (the `to` command 
navigates directly)
   
   ## Evidence
   
   | Signal | Detail |
   |--------|--------|
   | Same test passed on `7.0.x` | [Run 
22018179657](https://github.com/apache/grails-core/actions/runs/22018179657) ✅ |
   | Same test passed on JDK 17 & 21 | Same CI run, only JDK 25 failed |
   | Failure pattern | Classic auth timing flake — `Please sign in` instead of 
`User List` |
   | Established pattern | All other Geb specs use `waitFor` extensively (see 
`ScaffoldingFunctionalSpec`, `FieldsValidationSpec`, `PaginationSpec`) |


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to