@Slf4j @CompileStatic class WebDriverContainerHolder extends java.lang.Object
Responsible for initializing a BrowserWebDriverContainer per the Spec's ContainerGebConfiguration. This class will try to reuse the same container if the configuration matches the current container.
| Type | Name and description |
|---|---|
Browser |
browser |
BrowserWebDriverContainer |
container |
WebDriverContainerHolder.WebDriverContainerConfiguration |
containerConf |
GrailsGebSettings |
settings |
GebTestManager |
testManager |
| Constructor and description |
|---|
WebDriverContainerHolder(GrailsGebSettings settings) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected VncRecordingContainer |
createVncRecordingContainer()Creates the VNC recording container that restartVncRecordingContainer() starts for the next test. |
|
java.lang.String |
getHostNameFromHost()Returns the hostname that the server under test is available on from the host. |
|
boolean |
isInitialized() |
|
boolean |
isRecordingContainerAvailable()Whether the browser container currently has a VNC recording container to save recordings from. |
|
boolean |
matchesCurrentContainerConfiguration(WebDriverContainerHolder.WebDriverContainerConfiguration specConf) |
|
void |
restartVncRecordingContainer()Workaround for https://github.com/testcontainers/testcontainers-java/issues/3998 |
|
void |
setupBrowserUrl(org.spockframework.runtime.extension.IMethodInvocation methodInvocation) |
|
void |
stop() |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Creates the VNC recording container that restartVncRecordingContainer() starts for the next test.
Returns the hostname that the server under test is available on from the host.
This is useful when using any of the download*() methods as they will
connect from the host, and not from within the container.
Defaults to localhost. If the value returned by webDriverContainer.getHost()
is different from the default, this method will return the same value same as
webDriverContainer.getHost().
Whether the browser container currently has a VNC recording container to save
recordings from. This is false when recording is disabled, and after
restartVncRecordingContainer() failed to start a replacement.
Workaround for https://github.com/testcontainers/testcontainers-java/issues/3998
Restarts the VNC recording container to enable separate recording files for each test method. This method uses reflection to access the VNC recording container field in BrowserWebDriverContainer. Should be called BEFORE each test starts.
If a previous restart failed to start its replacement, there is no recording container left to stop, and a new one is started instead, so a single failure does not disable recording for every remaining test that runs against the same browser container.