WIP
authorKai Moritz <kai@juplo.de>
Wed, 22 Jan 2020 11:37:12 +0000 (12:37 +0100)
committerKai Moritz <kai@juplo.de>
Fri, 7 Apr 2023 11:15:40 +0000 (13:15 +0200)
pom.xml
src/test/java/de/juplo/demo/WebDriverExtension.java [new file with mode: 0644]

diff --git a/pom.xml b/pom.xml
index 0ad8f78..43d51d0 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -15,6 +15,7 @@
 
        <properties>
                <java.version>1.8</java.version>
+               <testcontainers.version>1.12.4</testcontainers.version>
        </properties>
 
        <dependencies>
                        <artifactId>reactor-test</artifactId>
                        <scope>test</scope>
                </dependency>
+               <dependency>
+                       <groupId>org.seleniumhq.selenium</groupId>
+                       <artifactId>selenium-remote-driver</artifactId>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.testcontainers</groupId>
+                       <artifactId>selenium</artifactId>
+                       <version>${testcontainers.version}</version>
+                       <scope>test</scope>
+               </dependency>
 
                <dependency>
                        <groupId>org.springframework.boot</groupId>
diff --git a/src/test/java/de/juplo/demo/WebDriverExtension.java b/src/test/java/de/juplo/demo/WebDriverExtension.java
new file mode 100644 (file)
index 0000000..25de95f
--- /dev/null
@@ -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());
+  }
+}