-
Notifications
You must be signed in to change notification settings - Fork 237
Do not persist a driver instance in the configuration object but in the browser #266
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
Conversation
b04a389
to
32e84f4
Compare
Hey! Thanks for working to contribute. I can see from CI (and from checking it out locally), that this breaks the To be clear, I think the problem you describe of driver objects getting recycled even when they definitely shouldn't be is a problem. I'm concerned, though, that the test failures indicate we'd actually be breaking a part of the API contract (even if it's only implicit). Can I ask a bit more about the scenarios where this problem pops up? I'm trying to wrap my head around what a "best fix" would be. |
Actually, this is kind of a multi-part regression, and I think this should indeed be the proper way to fix it. Before commit 6f2117e (i.e. version
This was how it is supposed to be. With the following commit 84466aa (i.e. version
With commit 08d1a0d (i.e. version
So currently with the built-in
For case 1 there is no difference with this PR merged, because whether you create new configuration objects or not is irrelevant. For case 2 there is no difference with this PR merged, because the Case 3 is where the difference is, because you configured that you do not want the Especially if you combine case 3 with My currently work-around for this is to effectively revert the geb/issues#660 performance boost by using my own base spec that uses Another case where behaviour changes is, if you try to follow the Book of Geb paragraph
While technically correct, the methods are currently effectively useless if you use the built-in integrations, because there is never a new "default driver" requested, as the I have no idea why the CI has test failures. Looking at |
Ah, ok, it did not do anything because you cannot run one of these tests alone, it forcibly waits until both are started to ensure they run in parallel. |
That problem is now fixed in #267. |
32e84f4
to
e455a1a
Compare
The local chrome tests should also work fine now. |
If I rebase this branch from master after the last merge, the test originally mentioned works. Happy to merge this now, though I'd like it to pass a CI check, just to make sure nothing new has cropped up. Trouble is, I think something might be wrong with the Build, test, and quality check workflow. The error reports from this run, which is ostensibly running Java 21, reports Java11 (see line 221). I can see a Java 17 build failing with the same error at https://github.com/apache/groovy-geb/actions/runs/14801195371/job/41560129100. Makes me think our actions/setup-java is misconfigured, but it looks correct at first blush. If you can rebase and re-push, I'll rerun... but I think you're right that something else is causing this flakiness. |
e455a1a
to
98ad355
Compare
Nah,
|
Ah, yeah, I see that. I believe the purpose of those multi-JVM builds is actually to ensure Geb's compatibility after the build when running on those Java versions, not necessarily to ensure you can compile with them. I expect the best thing to do would be to use the release flag to set cross-compile compatibility to Java 11, as in the guide on combining toolchains. Then we could either let the environment decide the Java version or continue using the toolchain to specify a version. Then we could override the toolchain at the task level to test different versions, as Gradle has documented. But this is really another issue altogether. I'll see if I can get a PR up to that effect. |
Before this PR the driver instance was persisted in the configuration object.
So if the same configuration object was used, the same driver was used.
This happens for example when using a
GebTestManager
which persists a configuration per threadand uses that in the browser creator if no custom one was set.
This causes for example the same driver to be used multiple times, even if
cacheDriver
is set to false.And more prominent, if
quitDriverOnBrowserReset
is enabled, then after the reset the driver is still used,but as it is quit already, throws exceptions.
With this PR, the driver is no longer persisted in the configuration instance,
but in the browser instance, and the configuration is only used to create new driver instances.