Skip to content

Forge: Fix the local-browser Geb feature and rename it to geb-with-local-browsers - #16382

Merged
jdaugherty merged 1 commit into
apache:7.0.xfrom
matrei:fix/forge-geb-local-browsers
Sep 23, 2026
Merged

jdaugherty merged 1 commit into
apache:7.0.xfrom
matrei:fix/forge-geb-local-browsers

Conversation

@matrei

@matrei matrei commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #16381

Summary

Apps generated with the geb-with-webdriver-binaries feature don't build. The feature applies org.ysb33r.webdriver-binaries 4.0.0, but the generated webdriverBinaries block still uses the pre-4.x String syntax:

Build file 'build.gradle' line: 85
> Could not find method chromedriver() for arguments [122.0.6260.0] on extension 'webdriverBinaries' of type org.ysb33r.gradle.webdriver.WebDriverBinariesPluginExtension.

Fixing the DSL alone wouldn't make the plugin do anything:

  • webdriver-binaries 4.x no longer configures Test tasks by itself, so the drivers never reach the test JVM.
  • The pinned versions are old (chromedriver 122, edgedriver 110, geckodriver 0.33.0). The plugin's driver metadata only goes up to chromedriver/edgedriver 141 and geckodriver 0.36.0, so useLatestVersion() doesn't help either. Once connected to the test tasks, the plugin would supply ChromeDriver and EdgeDriver versions older than current browsers, and they would take priority over Selenium Manager.

Selenium Manager (part of Selenium since 4.6) already downloads the driver that matches the installed browser. That's also why local-browser tests run today, even though the plugin isn't connected to anything.

The feature had two more problems:

  • GebConfig.groovy says to run ./gradlew -Dgeb.env=firefoxHeadless iT, but Gradle never passed geb.env to the forked test JVM, so the setting was ignored and tests always ran with the default browser.
  • geb-with-testcontainers is a default feature, so it was always added alongside geb-with-webdriver-binaries. The generated spec extended ContainerGebSpec, which runs the browser in a Testcontainers container. It reads GebConfig.groovy, but expects the driver there to create a RemoteWebDriver connected to the container. The generated environments create local drivers instead, so they only went unused because geb.env never reached the test JVM.

Changes

  • Drop the org.ysb33r.webdriver-binaries plugin, and its version entry in the forge pom.xml, from the feature. Selenium Manager now provides the drivers.
  • Rename the feature from geb-with-webdriver-binaries to geb-with-local-browsers, since it no longer uses the webdriver-binaries plugin. create-app --features geb-with-webdriver-binaries and Forge links that use the old name now fail with "The requested feature does not exist". The old name has generated a build that fails to evaluate ever since the switch to webdriver-binaries 4.0.0, so no working setup depends on it. Existing grails-forge-cli.yml files that list the old name are unaffected, because the CLI never looks those names up.
  • Pass geb.env from the Gradle invocation to all Test tasks when the feature is selected. This replaces the unused features.contains("geb") block in buildGradle.rocker.raw, because no feature is named geb.
  • Add a GebFeature one-of group for geb-with-testcontainers and geb-with-local-browsers. Selecting geb-with-local-browsers now replaces the Testcontainers default, and selecting both explicitly fails validation.
  • With geb-with-local-browsers, the generated functional spec extends geb.spock.GebSpec. The feature now adds grails-geb test fixtures itself, which provide GebSpec and the Chrome driver bindings.
  • Rename the ContainerGebSpec template from spock.rocker.raw to containerGebSpec.rocker.raw, next to the new gebSpec.rocker.raw. The old name dates from when Forge picked test templates by test framework.
  • Delete the unused groovyJunit.rocker.raw template, a Micronaut JUnit test left over from when Forge offered a choice of test framework. Nothing has referenced it since the test-framework option was removed.
  • Document both options, and the rename, in the functional testing section of the guide.

Testing

  • GebWithLocalBrowsersSpec (forge-core): no webdriver-binaries plugin or extension in the build, geb.env passthrough, GebSpec for web and web-plugin apps, replaces the Testcontainers default, and fails when combined with it.
  • GebWithTestcontainersSpec (forge-core): ContainerGebSpec is generated, geb.env isn't added, and the feature is a default for web apps only.
  • New test-core GebWithLocalBrowsersSpec: generates a web app with the feature and runs build compileIntegrationTestGroovy -x integrationTest on the generated project.
  • Manual: ran integrationTest -Dgeb.env=firefoxHeadless on a generated app. -Dgeb.env=firefoxHeadless reached the test JVM and the generated GebSpec passed against a local Firefox.

@matrei
matrei force-pushed the fix/forge-geb-local-browsers branch from 616df20 to fc10733 Compare September 23, 2026 10:23
@matrei
matrei marked this pull request as ready for review September 23, 2026 10:24
@matrei
matrei force-pushed the fix/forge-geb-local-browsers branch from fc10733 to 7b1bf1b Compare September 23, 2026 10:38
@matrei
matrei marked this pull request as draft September 23, 2026 10:39
…al-browsers

Apps generated with geb-with-webdriver-binaries failed to evaluate
build.gradle because the webdriverBinaries block used the pre-4.x
String syntax of the org.ysb33r.webdriver-binaries plugin. Version 4.x
also no longer connects itself to test tasks, and its driver metadata
lags behind current browsers, so the plugin is dropped and Selenium
Manager provides the matching drivers.

- Rename the feature to geb-with-local-browsers
- Pass -Dgeb.env from the Gradle invocation to the test tasks
- Make it replace geb-with-testcontainers and generate a GebSpec
- Document both Geb features in the functional testing guide

Fixes apache#16381
@matrei
matrei force-pushed the fix/forge-geb-local-browsers branch from 7b1bf1b to 95b71b9 Compare September 23, 2026 11:02
@matrei matrei changed the title Fix the Forge local-browser Geb feature and rename it to geb-with-local-browsers Forge: Fix the local-browser Geb feature and rename it to geb-with-local-browsers Sep 23, 2026
@matrei
matrei marked this pull request as ready for review September 23, 2026 11:06

@sbglasius sbglasius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@jdaugherty
jdaugherty merged commit 3a925a1 into apache:7.0.x Sep 23, 2026
57 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants