Skip to content

Fixes #3998 and allows per test method screen recording#8617

Open
MartinAhrer wants to merge 5 commits into
testcontainers:mainfrom
MartinAhrer:main
Open

Fixes #3998 and allows per test method screen recording#8617
MartinAhrer wants to merge 5 commits into
testcontainers:mainfrom
MartinAhrer:main

Conversation

@MartinAhrer

Copy link
Copy Markdown

This pull request is related to issue #3998.

BrowserWebDriverContainer is designed to execute each test in a fresh container.
However this is slow and not an option especially when test execution can't be parallelized.

Instead of recreating a fresh BrowserWebDriverContainer instance it may be sufficient to just re-create the VncRecorderContainer for each test.

This pull request offers a new method reinitializeVncRecorderContainer that tears down the vncRecordingContainer and creates a fresh instance. So it comes with out side effects of breaking existing functions.

With that update it is fairly simple to create a subclass of BrowserWebDriverContainer to take care of re-creating the vnc recorder by overriding the afterTest method.

class VncRecordingPerTestMethodBrowserWebDriverContainer<T extends VncRecordingPerTestMethodBrowserWebDriverContainer<T>>
		extends BrowserWebDriverContainer<T> {
	@Override
	public void afterTest(TestDescription description, Optional<Throwable> throwable) {
		super.afterTest(description, throwable);
		reinitializeVncRecorderContainer();
	}
}

@MartinAhrer
MartinAhrer requested a review from a team May 13, 2024 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant