From: Kai Moritz Date: Wed, 22 Jan 2020 11:37:12 +0000 (+0100) Subject: WIP X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=ded79957c6d4bc388560ac37677cbf5323d7b314;p=demos%2Fspring-boot WIP --- diff --git a/pom.xml b/pom.xml index 0ad8f78..43d51d0 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,7 @@ 1.8 + 1.12.4 @@ -48,6 +49,17 @@ reactor-test test + + org.seleniumhq.selenium + selenium-remote-driver + test + + + org.testcontainers + selenium + ${testcontainers.version} + test + org.springframework.boot diff --git a/src/test/java/de/juplo/demo/WebDriverExtension.java b/src/test/java/de/juplo/demo/WebDriverExtension.java new file mode 100644 index 0000000..25de95f --- /dev/null +++ b/src/test/java/de/juplo/demo/WebDriverExtension.java @@ -0,0 +1,27 @@ +package de.juplo.demo; + + +import org.junit.jupiter.api.extension.BeforeEachCallback; +import org.junit.jupiter.api.extension.ExtensionContext; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.remote.DesiredCapabilities; +import org.testcontainers.containers.BrowserWebDriverContainer; + + +/** + * An Extension for JUnit Jupiter, that starts a {@link WebDriver} with the + * help of + * {@link https://www.testcontainers.org/modules/webdriver_containers/ Testcontainers}. + * @author Kai Moritz + */ +public class WebDriverExtension implements BeforeEachCallback +{ + BrowserWebDriverContainer chrome; + + + @Override + public void beforeEach(ExtensionContext context) throws Exception + { + chrome = new BrowserWebDriverContainer().withCapabilities(DesiredCapabilities.chrome()); + } +}