This is an automated email from the ASF dual-hosted git repository.

jamesfredley pushed a commit to branch fix/flaky-scaffolding-geb-tests
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit c59fe669f47ebfd74ae560e59da0e341de4fc988
Author: James Fredley <[email protected]>
AuthorDate: Mon Feb 16 22:24:39 2026 -0500

    test: stabilize flaky scaffolding Geb tests for slow CI environments
    
    Add waitFor assertions to UserControllerSpec and UserCommunityControllerSpec
    to prevent intermittent failures on slower CI runners (observed on JDK 25).
    
    Changes:
    - Add waitFor after login click to verify auth completes before proceeding
    - Wrap title assertions with waitFor for async page load handling
    - Add waitFor for logout button visibility before clicking
    - Remove redundant go '/' before to LoginPage navigation
    
    These specs were the only Geb tests missing waitFor usage, which was
    added to all other functional test specs in e8adf0143f.
---
 .../groovy/com/example/UserCommunityControllerSpec.groovy            | 5 +++--
 .../src/integrationTest/groovy/com/example/UserControllerSpec.groovy | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git 
a/grails-test-examples/scaffolding/src/integrationTest/groovy/com/example/UserCommunityControllerSpec.groovy
 
b/grails-test-examples/scaffolding/src/integrationTest/groovy/com/example/UserCommunityControllerSpec.groovy
index 0b058a9de4..2bfb0f5e78 100644
--- 
a/grails-test-examples/scaffolding/src/integrationTest/groovy/com/example/UserCommunityControllerSpec.groovy
+++ 
b/grails-test-examples/scaffolding/src/integrationTest/groovy/com/example/UserCommunityControllerSpec.groovy
@@ -28,16 +28,17 @@ import grails.testing.mixin.integration.Integration
 class UserCommunityControllerSpec extends ContainerGebSpec {
 
     void setup() {
-        go '/'
         to LoginPage
         username = '[email protected]'
         password = 'letmein'
         loginButton.click()
+        waitFor { title != 'Please sign in' }
     }
 
     void cleanup() {
         try {
             go 'logout'
+            waitFor { $('input', value: 'Log Out').displayed }
             $('input', value: 'Log Out').click()
         }
         catch (ignored) {
@@ -50,7 +51,7 @@ class UserCommunityControllerSpec extends ContainerGebSpec {
         go 'community/user/index'
 
         then:
-        title == 'User List'
+        waitFor { title == 'User List' }
 
         and:
         !$('table.scaffold')
diff --git 
a/grails-test-examples/scaffolding/src/integrationTest/groovy/com/example/UserControllerSpec.groovy
 
b/grails-test-examples/scaffolding/src/integrationTest/groovy/com/example/UserControllerSpec.groovy
index f028f3bd23..01f60468c5 100644
--- 
a/grails-test-examples/scaffolding/src/integrationTest/groovy/com/example/UserControllerSpec.groovy
+++ 
b/grails-test-examples/scaffolding/src/integrationTest/groovy/com/example/UserControllerSpec.groovy
@@ -28,16 +28,17 @@ import grails.testing.mixin.integration.Integration
 class UserControllerSpec extends ContainerGebSpec {
 
     void setup() {
-        go '/'
         to LoginPage
         username = '[email protected]'
         password = 'letmein'
         loginButton.click()
+        waitFor { title != 'Please sign in' }
     }
 
     void cleanup() {
         try {
             go 'logout'
+            waitFor { $('input', value: 'Log Out').displayed }
             $('input', value: 'Log Out').click()
         }
         catch (ignored) {
@@ -50,7 +51,7 @@ class UserControllerSpec extends ContainerGebSpec {
         go 'user/index'
 
         then:
-        title == 'User List'
+        waitFor { title == 'User List' }
 
         and:
         $('table.scaffold')

Reply via email to