-
Notifications
You must be signed in to change notification settings - Fork 234
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
No Simple Way to Replace or Customize DownloadSupport
Implementation
#204
Comments
By delegating to a inner class extending |
@matrei Given your workaround, are you still suggesting a change? Or should we document the idea of your workaround as a hint? |
Since this issue has not come up before, it might be an edge case that doesn’t justify changes to Geb, especially considering that a workaround is available. That said, while exploring a solution, I found it surprising that there’s no straightforward way to plug in a custom implementation. With the current workaround, both Page and Module still use the original |
There should be fixes and changes to Geb here. The workaround only covers the DownloadSupport, and even that shouldn't be necessary. It is a common enough use-case to be testing something far away with the RemoteWebDriver, either if its because TestContainers are in use or some kind of browser farm like Browser Stack. The workaround only addresses the container case and doesn't do anything to make customizing/replacing the other Support classes in Page/Module, either, where Geb is currently demonstrating poor and user-hostile library behaviour. The first change should be to make the Support fields in Page and Module protected rather than private. This allows sub-classes to implement their own Next, I think that the GebConfig should allow users to define common configuration properties for the Support objects, or supply custom factories for replacing them without having to implement their own Then later on I think a TestContainers extension should join Geb's existing Browser Stack and Sauce Labs built-in extensions (which should be improved, as a quick glance suggests that these have the same problem) so that some common-sense configurations are applied automatically when using certain extensions or Driver types. |
I need to use a custom implementation of
DownloadSupport
in aGebSpec
, but I found it quite difficult to replace the default implementation.The best approach I could come up with was to create a
Trait
that implementsDownloadSupport
, essentially duplicating most of the functionality fromDefaultDownloadSupport
while modifying just one detail: theprivate URL resolveUrl(Map)
method.If
resolveUrl(Map)
wasn't private, or if there were a more straightforward way to override or swap theDownloadSupport
implementation, this process would be much simpler and more flexible.The text was updated successfully, but these errors were encountered: