webdriver test added
This commit is contained in:
parent
2e125a0da3
commit
0c231ed0e6
|
@ -83,11 +83,21 @@
|
||||||
<artifactId>postgresql </artifactId>
|
<artifactId>postgresql </artifactId>
|
||||||
<version>1.7.2</version>
|
<version>1.7.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.testcontainers</groupId>
|
||||||
|
<artifactId>selenium </artifactId>
|
||||||
|
<version>1.7.2</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.postgresql</groupId>
|
<groupId>org.postgresql</groupId>
|
||||||
<artifactId>postgresql</artifactId>
|
<artifactId>postgresql</artifactId>
|
||||||
<version>42.2.2</version>
|
<version>42.2.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.seleniumhq.selenium</groupId>
|
||||||
|
<artifactId>selenium-remote-driver</artifactId>
|
||||||
|
<version>3.12.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.baeldung.testconainers;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
|
import org.junit.ClassRule;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.openqa.selenium.By;
|
||||||
|
import org.openqa.selenium.remote.DesiredCapabilities;
|
||||||
|
import org.openqa.selenium.remote.RemoteWebDriver;
|
||||||
|
import org.testcontainers.DockerClientFactory;
|
||||||
|
import org.testcontainers.containers.BrowserWebDriverContainer;
|
||||||
|
import org.testcontainers.containers.GenericContainer;
|
||||||
|
|
||||||
|
import net.codestory.http.WebServer;
|
||||||
|
|
||||||
|
public class WebDriverContainerTests {
|
||||||
|
@Rule
|
||||||
|
public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer().withDesiredCapabilities(DesiredCapabilities.chrome());
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void when() {
|
||||||
|
RemoteWebDriver driver = chrome.getWebDriver();
|
||||||
|
driver.get("https://saucelabs.com/test/guinea-pig");
|
||||||
|
String heading = driver.findElement(By.xpath("/html/body/h1"))
|
||||||
|
.getText();
|
||||||
|
assertEquals("This page is a Selenium sandbox", heading);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue