Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add feature to run Geb specs with Testcontainers #61

Merged
merged 14 commits into from
Oct 23, 2024

Conversation

matrei
Copy link
Contributor

@matrei matrei commented Oct 16, 2024

This PR add a ContainerGebSpec class that can be used in place of GebSpec and that will run the test browser in a container instead of directly on the host machine.

This feature enables easy running of geb tests in a container so you don't have to manage driver versions on the host machine.
The common package name used by grails plugins is `grails.plugin.{plugin-name}`.
The common package name used by grails plugins is `grails.plugin.{plugin-name}`.
For `ContainerGebSpec` to work, the serverPort needs to be set.
This is done by adding the `@Integration` annotation to the test class.
- Use Gradle testFixtures feature to make test dependencies available to downstream projects without leaking them to the wrong scopes
- Refactor `ContainerGebSpec` in co-operation with sbglasius to add more features and make it work without Docker Desktop.
@sbglasius
Copy link
Contributor

@matrei Looks great. I am apparently not committer on grails, so I cannot do approvals

@matrei matrei requested a review from jamesfredley October 16, 2024 16:11
@matrei
Copy link
Contributor Author

matrei commented Oct 16, 2024

I am apparently not committer on grails

Well, you should be. That is an easy fix 😄

@jamesfredley
Copy link
Contributor

@sbglasius I have submitted a request and you should see invites to a github team soon.

Copy link
Contributor

@jamesfredley jamesfredley left a comment

Choose a reason for hiding this comment

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

I suspect the servlet-api changes will likely change based on gpc/grails-mail#56 (comment)

@matrei matrei requested a review from sbglasius October 16, 2024 17:44
After this change this library needs to be referenced with `integrationTestImplementation testFixtures('org.grails.plugins:geb')`
but now we are not leaking any test dependencies to downstream projects non-test configurations.
@jamesfredley
Copy link
Contributor

grails/grails-core#13763

@matrei matrei changed the title ContainerGebSpec Add ContainerGebSpec feature Oct 23, 2024
@matrei matrei changed the title Add ContainerGebSpec feature Add feature to run Geb specs with Testcontainers Oct 23, 2024
@matrei matrei merged commit 5a302d0 into 5.0.x Oct 23, 2024
3 checks passed
@matrei matrei deleted the matrei/feat-container-geb-spec branch October 23, 2024 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants