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.springframework.beans.factory.annotation.Autowired;
+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.test.web.reactive.server.WebTestClient;
+import org.springframework.boot.web.server.LocalServerPort;
/**
* Integration-Test for the {@link DemoController}.
* @author Kai Moritz
*/
-@SpringBootTest(webEnvironment = RANDOM_PORT, classes = DemoController.class)
+@SpringBootTest(webEnvironment = RANDOM_PORT)
+@ExtendWith(WebDriverExtension.class)
@Slf4j
public class DemoControllerIT
{
- @Autowired
- WebTestClient client;
+ @LocalServerPort
+ int port;
+ String baseUri;
+
+
+ @BeforeEach()
+ void generateBaseUri()
+ {
+ baseUri = "http://localhost:" + port;
+ }
@Test
- void testSubmit()
+ void testSubmit(RemoteWebDriver driver)
{
-
+ driver.get(baseUri + "/");
+
+ WebElement submit = driver.findElement(By.xpath("//div[@class='card-footer']/button"));
+ assertThat(submit).isNotNull();
}
}