springboot-testcontainer-selenium

Selenium test-container

License

License

Categories

Categories

IDE Development Tools Container
GroupId

GroupId

com.avides.springboot.testcontainer
ArtifactId

ArtifactId

springboot-testcontainer-selenium
Last Version

Last Version

1.0.0-RC2
Release Date

Release Date

Type

Type

jar
Description

Description

springboot-testcontainer-selenium
Selenium test-container
Project URL

Project URL

https://github.com/springboot-testcontainer/springboot-testcontainer-selenium
Project Organization

Project Organization

AVIDES Media AG
Source Code Management

Source Code Management

https://github.com/springboot-testcontainer/springboot-testcontainer-selenium

Download springboot-testcontainer-selenium

How to add to project

<!-- https://jarcasting.com/artifacts/com.avides.springboot.testcontainer/springboot-testcontainer-selenium/ -->
<dependency>
    <groupId>com.avides.springboot.testcontainer</groupId>
    <artifactId>springboot-testcontainer-selenium</artifactId>
    <version>1.0.0-RC2</version>
</dependency>
// https://jarcasting.com/artifacts/com.avides.springboot.testcontainer/springboot-testcontainer-selenium/
implementation 'com.avides.springboot.testcontainer:springboot-testcontainer-selenium:1.0.0-RC2'
// https://jarcasting.com/artifacts/com.avides.springboot.testcontainer/springboot-testcontainer-selenium/
implementation ("com.avides.springboot.testcontainer:springboot-testcontainer-selenium:1.0.0-RC2")
'com.avides.springboot.testcontainer:springboot-testcontainer-selenium:jar:1.0.0-RC2'
<dependency org="com.avides.springboot.testcontainer" name="springboot-testcontainer-selenium" rev="1.0.0-RC2">
  <artifact name="springboot-testcontainer-selenium" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.avides.springboot.testcontainer', module='springboot-testcontainer-selenium', version='1.0.0-RC2')
)
libraryDependencies += "com.avides.springboot.testcontainer" % "springboot-testcontainer-selenium" % "1.0.0-RC2"
[com.avides.springboot.testcontainer/springboot-testcontainer-selenium "1.0.0-RC2"]

Dependencies

compile (2)

Group / Artifact Type Version
com.avides.springboot.testcontainer : springboot-testcontainer-common jar 1.0.0-RC2
org.seleniumhq.selenium : selenium-remote-driver jar 3.141.59

provided (2)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.18.10
org.springframework.boot : spring-boot-autoconfigure jar 2.2.1.RELEASE

test (8)

Group / Artifact Type Version
org.assertj : assertj-core jar 3.14.0
org.easymock : easymock jar 4.1
org.powermock : powermock-module-junit4 jar 2.0.4
org.powermock : powermock-api-easymock jar 2.0.4
org.jacoco : org.jacoco.agent jar 0.8.5
org.springframework : spring-test jar 5.2.1.RELEASE
org.springframework.boot : spring-boot-test jar 2.2.1.RELEASE
ch.qos.logback : logback-classic jar 1.2.3

Project Modules

There are no modules declared in this project.

springtainer-selenium

Maven Central Build Nightly build Coverage report Quality Gate Technical dept

Attention

This project will only receive dependency updates so long no code changes needed!

Dependency

<dependency>
	<groupId>com.avides.springboot.springtainer</groupId>
	<artifactId>springtainer-selenium</artifactId>
	<version>1.2.0</version>
	<scope>test</scope>
</dependency>

Configuration

Properties consumed (in bootstrap.properties):

  • embedded.container.selenium.enabled (default is true)
  • embedded.container.selenium.startup-timeout (default is 30)
  • embedded.container.selenium.browser-name (default is chrome)
  • embedded.container.selenium.browser-docker-image-version (default is 3.141.59)

Example

import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;

import org.junit.runner.RunWith;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.web.server.LocalServerPort;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = RANDOM_PORT)
public class TestClass
{
    @Autowired
    private RemoteWebDriver embeddedSeleniumRemoteWebDriver;

    @LocalServerPort
    private int port;

    @Test
    public void testSomething()
    {
        String url = "http://" + ApplicationIpDetector.detect() + ":" + Integer.toString(port);
        embeddedSeleniumRemoteWebDriver.get(url);

        // ...
    }
}

Supported Browsers

Browser Name Docker-Image
Chrome selenium/standalone-chrome-debug

Logging

To reduce logging insert this into the logback-configuration:

<!-- Springtainer -->
<logger name="com.github.dockerjava.jaxrs" level="WARN" />
<logger name="com.github.dockerjava.core.command" level="WARN" />
<logger name="org.apache.http" level="WARN" />
<logger name="org.openqa.selenium" level="WARN" />

Labels

The container exports multiple labels to analyze running springtainers:

  • SPRINGTAINER_SERVICE=selenium
  • SPRINGTAINER_IMAGE=${embedded.container.selenium.docker-image}
  • SPRINGTAINER_STARTED=$currentTimestamp

Versions

Version
1.0.0-RC2
1.0.0-RC1
0.1.0-RC3
0.1.0-RC2
0.1.0-RC1
0.0.1-RC2
0.0.1-RC1