matrei opened a new pull request, #16382:
URL: https://github.com/apache/grails-core/pull/16382
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 ignores `GebConfig.groovy`.
## 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.
- 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.
--
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]