Skip to content

Commit 4e59454

Browse files
authored
Merge pull request #1 from xdev-software/develop
Release
2 parents 5384af2 + 2d92f9b commit 4e59454

File tree

17 files changed

+1398
-31
lines changed

17 files changed

+1398
-31
lines changed

.github/workflows/checkBuild.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
cache: 'maven'
4444

4545
- name: Build with Maven
46-
run: ./mvnw -B clean package
46+
run: ./mvnw -B clean package -P run-integration-tests
4747

4848
- name: Check for uncommited changes
4949
run: |
@@ -63,13 +63,6 @@ jobs:
6363
exit 1
6464
fi
6565
66-
- name: Upload demo files
67-
uses: actions/upload-artifact@v4
68-
with:
69-
name: demo-files-java-${{ matrix.java }}
70-
path: ${{ env.DEMO_MAVEN_MODULE }}/target/${{ env.DEMO_MAVEN_MODULE }}.jar
71-
if-no-files-found: error
72-
7366
code-style:
7467
runs-on: ubuntu-latest
7568
if: ${{ github.event_name != 'pull_request' || !startsWith(github.head_ref, 'renovate/') }}

.run/Run Demo.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="Run Demo" type="Application" factoryName="Application">
33
<option name="MAIN_CLASS_NAME" value="software.xdev.Application" />
4-
<module name="standard-maven-template-demo" />
4+
<module name="testcontainers-java-selenium-demo" />
55
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
66
<extension name="coverage">
77
<pattern>

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 1.0.0
2+
<i>Initial release</i>

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ You should have the following things installed:
3333
* Ensure that the JDK/Java-Version is correct
3434

3535

36-
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/standard-maven-template/release.yml?branch=master)](https://github.com/xdev-software/standard-maven-template/actions/workflows/release.yml)
36+
## Releasing [![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/testcontainers-java-selenium/release.yml?branch=master)](https://github.com/xdev-software/testcontainers-java-selenium/actions/workflows/release.yml)
3737

3838
Before releasing:
39-
* Consider doing a [test-deployment](https://github.com/xdev-software/standard-maven-template/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
39+
* Consider doing a [test-deployment](https://github.com/xdev-software/testcontainers-java-selenium/actions/workflows/test-deploy.yml?query=branch%3Adevelop) before actually releasing.
4040
* Check the [changelog](CHANGELOG.md)
4141

4242
If the ``develop`` is ready for release, create a pull request to the ``master``-Branch and merge the changes

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@
187187
identification within third-party archives.
188188

189189
Copyright 2024 XDEV Software
190+
Copyright 2015-2024 Testcontainers contributors
190191

191192
Licensed under the Apache License, Version 2.0 (the "License");
192193
you may not use this file except in compliance with the License.

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/standard-maven-template?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/standard-maven-template)
2-
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/standard-maven-template/checkBuild.yml?branch=develop)](https://github.com/xdev-software/standard-maven-template/actions/workflows/checkBuild.yml?query=branch%3Adevelop)
3-
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_standard-maven-template&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_standard-maven-template)
1+
[![Latest version](https://img.shields.io/maven-central/v/software.xdev/testcontainers-java-selenium?logo=apache%20maven)](https://mvnrepository.com/artifact/software.xdev/testcontainers-java-selenium)
2+
[![Build](https://img.shields.io/github/actions/workflow/status/xdev-software/testcontainers-java-selenium/checkBuild.yml?branch=develop)](https://github.com/xdev-software/testcontainers-java-selenium/actions/workflows/checkBuild.yml?query=branch%3Adevelop)
3+
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=xdev-software_testcontainers-java-selenium&metric=alert_status)](https://sonarcloud.io/dashboard?id=xdev-software_testcontainers-java-selenium)
44

5-
# standard-maven-template
5+
# <img src="https://raw.githubusercontent.com/SeleniumHQ/seleniumhq.github.io/690acbad7b4bf4656f116274809765db64e6ccf7/website_and_docs/static/images/logos/webdriver.svg" height=24 /> testcontainers-java-selenium
66

7+
A re-implementation of [Testcontainer Selenium/WebDriver](https://java.testcontainers.org/modules/webdriver_containers/) with the following improvements:
8+
* It uses [Selenium's video recorder](https://github.com/SeleniumHQ/docker-selenium/blob/trunk/README.md#video-recording)
9+
* Doesn't require VNC
10+
* No VNC Server started in the browser container (unless explicitly stated) → Saves memory
11+
* Uses [Selenium's implementation](https://github.com/SeleniumHQ/docker-selenium/tree/trunk/Video) and isn't [based](https://github.com/testcontainers/vnc-recorder) on [some python code from 2010](https://pypi.org/project/vnc2flv/#history)
12+
* Way more customization options for e.g. ``framerate``, ``codec``, ``preset`` ...
13+
* Uses ``mp4`` as default recording format (wider support in comparison to ``flv``)
14+
* [Renders while saving the video](https://github.com/SeleniumHQ/docker-selenium/blob/4c572afd1173b5bd49fa2def3b54ea552fccee85/Video/video.sh#L126) (not when finished which takes additional time)
15+
* Stops the recorder before saving the file so that there is no way that [it runs forever](https://github.com/testcontainers/testcontainers-java/discussions/6229).
16+
* Automatically tries to select a alternative Selenium version for the docker image if it [doesn't exist](https://github.com/SeleniumHQ/docker-selenium/issues/1979).
17+
* Added support for [NoVNC](https://github.com/SeleniumHQ/docker-selenium/blob/trunk/README.md#using-your-browser-no-vnc-client-is-needed) so that no dedicated VNC client is required
18+
* Improve creation of video filenames
19+
* Removed hard dependency on Selenium-Java.<br/>Only required when using ``CapabilitiesBrowserWebDriverContainer``
20+
* Everything can be ``@Override``n if required
21+
* Caches "Selenium version detection via classpath" so that it's not invoked everytime you build a new container
722

823
## Installation
9-
[Installation guide for the latest release](https://github.com/xdev-software/standard-maven-template/releases/latest#Installation)
10-
24+
[Installation guide for the latest release](https://github.com/xdev-software/testcontainers-java-selenium/releases/latest#Installation)
1125

1226
## Support
1327
If you need support as soon as possible and you can't wait for any pull request, feel free to use [our support](https://xdev.software/en/services/support).
@@ -16,4 +30,6 @@ If you need support as soon as possible and you can't wait for any pull request,
1630
See the [contributing guide](./CONTRIBUTING.md) for detailed instructions on how to get started with our project.
1731

1832
## Dependencies and Licenses
19-
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/standard-maven-template/dependencies)
33+
View the [license of the current project](LICENSE) or the [summary including all dependencies](https://xdev-software.github.io/testcontainers-java-selenium/dependencies)
34+
35+
<sub>Disclaimer: This is not an official Testcontainers/Selenium product and not associated with them</sub>

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## Reporting a Vulnerability
44

5-
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/standard-maven-template/security/advisories/new).
5+
Please report a security vulnerability [on GitHub Security Advisories](https://github.com/xdev-software/testcontainers-java-selenium/security/advisories/new).

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>software.xdev</groupId>
8-
<artifactId>standard-maven-template-root</artifactId>
8+
<artifactId>testcontainers-java-selenium-root</artifactId>
99
<version>1.0.0-SNAPSHOT</version>
1010
<packaging>pom</packaging>
1111

@@ -15,8 +15,8 @@
1515
</organization>
1616

1717
<modules>
18-
<module>standard-maven-template</module>
19-
<module>standard-maven-template-demo</module>
18+
<module>testcontainers-java-selenium</module>
19+
<module>testcontainers-java-selenium-demo</module>
2020
</modules>
2121

2222
<licenses>

standard-maven-template-demo/pom.xml renamed to testcontainers-java-selenium-demo/pom.xml

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66

77
<groupId>software.xdev</groupId>
8-
<artifactId>standard-maven-template-demo</artifactId>
8+
<artifactId>testcontainers-java-selenium-demo</artifactId>
99
<version>1.0.0-SNAPSHOT</version>
1010
<packaging>jar</packaging>
1111

@@ -24,12 +24,76 @@
2424
<mainClass>software.xdev.Application</mainClass>
2525
</properties>
2626

27+
<dependencyManagement>
28+
<dependencies>
29+
<dependency>
30+
<groupId>org.seleniumhq.selenium</groupId>
31+
<artifactId>selenium-dependencies-bom</artifactId>
32+
<version>4.19.1</version>
33+
<type>pom</type>
34+
<scope>import</scope>
35+
</dependency>
36+
</dependencies>
37+
</dependencyManagement>
38+
2739
<dependencies>
2840
<dependency>
2941
<groupId>software.xdev</groupId>
30-
<artifactId>standard-maven-template</artifactId>
42+
<artifactId>testcontainers-java-selenium</artifactId>
3143
<version>${project.version}</version>
3244
</dependency>
45+
46+
<dependency>
47+
<groupId>org.slf4j</groupId>
48+
<artifactId>slf4j-simple</artifactId>
49+
<version>2.0.13</version>
50+
</dependency>
51+
52+
<dependency>
53+
<groupId>org.seleniumhq.selenium</groupId>
54+
<artifactId>selenium-remote-driver</artifactId>
55+
<exclusions>
56+
<!-- Tracing is not needed -->
57+
<exclusion>
58+
<groupId>io.opentelemetry</groupId>
59+
<artifactId>*</artifactId>
60+
</exclusion>
61+
<!-- No unused, beta-grade, RUST blobs -->
62+
<exclusion>
63+
<groupId>org.seleniumhq.selenium</groupId>
64+
<artifactId>selenium-manager</artifactId>
65+
</exclusion>
66+
</exclusions>
67+
</dependency>
68+
69+
<dependency>
70+
<groupId>org.seleniumhq.selenium</groupId>
71+
<artifactId>selenium-support</artifactId>
72+
</dependency>
73+
74+
<dependency>
75+
<groupId>org.seleniumhq.selenium</groupId>
76+
<artifactId>selenium-firefox-driver</artifactId>
77+
<exclusions>
78+
<!-- No unused, beta-grade, RUST blobs -->
79+
<exclusion>
80+
<groupId>org.seleniumhq.selenium</groupId>
81+
<artifactId>selenium-manager</artifactId>
82+
</exclusion>
83+
</exclusions>
84+
</dependency>
85+
86+
<dependency>
87+
<groupId>org.seleniumhq.selenium</groupId>
88+
<artifactId>selenium-chrome-driver</artifactId>
89+
<exclusions>
90+
<!-- No unused, beta-grade, RUST blobs -->
91+
<exclusion>
92+
<groupId>org.seleniumhq.selenium</groupId>
93+
<artifactId>selenium-manager</artifactId>
94+
</exclusion>
95+
</exclusions>
96+
</dependency>
3397
</dependencies>
3498

3599
<build>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
package software.xdev;
2+
3+
import java.io.IOException;
4+
import java.io.UncheckedIOException;
5+
import java.nio.file.Path;
6+
import java.util.List;
7+
import java.util.Optional;
8+
9+
import org.openqa.selenium.By;
10+
import org.openqa.selenium.Capabilities;
11+
import org.openqa.selenium.chrome.ChromeOptions;
12+
import org.openqa.selenium.firefox.FirefoxOptions;
13+
import org.openqa.selenium.remote.RemoteWebDriver;
14+
import org.testcontainers.lifecycle.TestDescription;
15+
16+
import software.xdev.testcontainers.selenium.containers.browser.BrowserWebDriverContainer;
17+
import software.xdev.testcontainers.selenium.containers.browser.CapabilitiesBrowserWebDriverContainer;
18+
19+
20+
public final class Application
21+
{
22+
@SuppressWarnings("resource") // It's getting closed...
23+
public static void main(final String[] args)
24+
{
25+
final Path recordingDir = Path.of("target/records");
26+
// noinspection ResultOfMethodCallIgnored
27+
recordingDir.toFile().mkdirs();
28+
29+
for(final Capabilities capabilities : List.of(new ChromeOptions(), new FirefoxOptions()))
30+
{
31+
try(final var browserContainer = new CapabilitiesBrowserWebDriverContainer<>(capabilities)
32+
.withRecordingMode(BrowserWebDriverContainer.RecordingMode.RECORD_ALL)
33+
.withRecordingDirectory(recordingDir))
34+
{
35+
browserContainer.start();
36+
final RemoteWebDriver remoteWebDriver =
37+
new RemoteWebDriver(browserContainer.getSeleniumAddressURI().toURL(), capabilities, false);
38+
39+
remoteWebDriver.manage().window().maximize();
40+
41+
remoteWebDriver.get(capabilities instanceof FirefoxOptions ? "about:support" : "chrome://version");
42+
Thread.sleep(1000); // Simulate Test work
43+
remoteWebDriver.findElements(By.tagName("body"));
44+
45+
remoteWebDriver.quit();
46+
47+
// Wait a moment until everything is safe on tape
48+
Thread.sleep(100);
49+
50+
browserContainer.afterTest(new TestDescription()
51+
{
52+
@Override
53+
public String getTestId()
54+
{
55+
return "demo-" + capabilities.getBrowserName();
56+
}
57+
58+
@Override
59+
public String getFilesystemFriendlyName()
60+
{
61+
return "demo-" + capabilities.getBrowserName();
62+
}
63+
}, Optional.empty());
64+
}
65+
catch(final InterruptedException ite)
66+
{
67+
Thread.currentThread().interrupt();
68+
}
69+
catch(final IOException ioe)
70+
{
71+
throw new UncheckedIOException(ioe);
72+
}
73+
}
74+
}
75+
76+
private Application()
77+
{
78+
}
79+
}

0 commit comments

Comments
 (0)