WIP
[demos/spring-boot] / src / test / java / de / juplo / demo / DemoControllerIT.java
index d8a4580..dc91846 100644 (file)
@@ -2,11 +2,16 @@ package de.juplo.demo;
 
 
 import lombok.extern.slf4j.Slf4j;
+import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
+import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
 import org.openqa.selenium.remote.RemoteWebDriver;
 import org.springframework.boot.test.context.SpringBootTest;
 import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
+import org.springframework.boot.web.server.LocalServerPort;
 
 
 /**
@@ -18,9 +23,24 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
 @Slf4j
 public class DemoControllerIT
 {
+  @LocalServerPort
+  int port;
+  String baseUri;
+
+
+  @BeforeEach()
+  void generateBaseUri()
+  {
+    baseUri = "http://localhost:" + port;
+  }
+
+
   @Test
   void testSubmit(RemoteWebDriver driver)
   {
-    
+    driver.get(baseUri + "/");
+
+    WebElement submit = driver.findElement(By.xpath(".card-footer/button"));
+    assertThat(submit).isNotNull();
   }
 }