testcontainers / testcontainers/testcontainers-java

VNC Recording does not work with JUnit 5

Open
#1,341 20 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

resolution/acknowledged
Dominant language
Java
Stars
8.7k
Forks
1.9k
Avg merge
2d 17h
Merged PRs (30d)
9

Description

When I have a plain old JUnit 4 test where I am using @Rule :

    @Rule
    public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer()
            .withCapabilities(new ChromeOptions())
            .withRecordingMode(VncRecordingMode.RECORD_ALL, new File("./target/"))
            .withRecordingFileFactory(new DefaultRecordingFileFactory());

Everything works fine. I am getting this in the logs:

Selenium remote URL is: http://localhost:32873/wd/hub
VNC URL is: vnc://vnc:secret@localhost:32872
[main] INFO org.testcontainers.containers.BrowserWebDriverContainer - Screen recordings for test com.foo.bar.ChromeWebDriverContainerTest-simpleExploreTest will be stored at: .\target\PASSED-com.foo.bar.ChromeWebDriverContainerTest-simpleExploreTest-20190326-162333.flv
The file is there and that's ok.

But if I have JUnit 5 test where I am using @Testcontainers + @Container:

     @Container
     BrowserWebDriverContainer chrome = new BrowserWebDriverContainer()
            .withCapabilities(new ChromeOptions())
            .withRecordingMode(VncRecordingMode.RECORD_ALL, new File("./target/"))
            .withRecordingFileFactory(new DefaultRecordingFileFactory());

The test is ok (passed), but there is no recording file. Nothing on the logs, just:

Selenium remote URL is: http://localhost:32873/wd/hub
VNC URL is: vnc://vnc:secret@localhost:32872

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the JUnit 4 @Rule path with the JUnit 5 @Testcontainers and @Container path for BrowserWebDriverContainer. Reproduce the missing recording and trace the recording lifecycle and logs; done means a JUnit 5 test produces the expected recording file and a regression test covers it.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.