From ded79957c6d4bc388560ac37677cbf5323d7b314 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Wed, 22 Jan 2020 12:37:12 +0100 Subject: [PATCH] WIP --- pom.xml | 12 +++++++++ .../de/juplo/demo/WebDriverExtension.java | 27 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/test/java/de/juplo/demo/WebDriverExtension.java 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()); + } +} -- 2.20.1