forked from testcontainers/testcontainers-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Travis optimizations (testcontainers#366)
* Speed up Travis configuration * remove cache warmup * cache whole ~/.m2 folder * Update surefire plugin (better, colorful logging)
- Loading branch information
Showing
11 changed files
with
299 additions
and
288 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.3.9/apache-maven-3.3.9-bin.zip | ||
distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
modules/selenium/src/test/java/org/testcontainers/junit/LinkedContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.testcontainers.junit; | ||
|
||
import lombok.Cleanup; | ||
import org.junit.BeforeClass; | ||
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.containers.BrowserWebDriverContainer; | ||
import org.testcontainers.containers.NginxContainer; | ||
|
||
import java.io.*; | ||
|
||
import static org.rnorth.visibleassertions.VisibleAssertions.*; | ||
|
||
|
||
/** | ||
* @author richardnorth | ||
*/ | ||
public class LinkedContainerTest { | ||
|
||
private static File contentFolder = new File(System.getProperty("user.home") + "/.tmp-test-container"); | ||
|
||
@Rule | ||
public NginxContainer nginx = new NginxContainer() | ||
.withCustomContent(contentFolder.toString()); | ||
|
||
@Rule | ||
public BrowserWebDriverContainer chrome = new BrowserWebDriverContainer() | ||
.withDesiredCapabilities(DesiredCapabilities.chrome()) | ||
.withLinkToContainer(nginx, "nginx"); | ||
|
||
@BeforeClass | ||
public static void setupContent() throws FileNotFoundException { | ||
contentFolder.mkdir(); | ||
contentFolder.setReadable(true, false); | ||
contentFolder.setWritable(true, false); | ||
contentFolder.setExecutable(true, false); | ||
|
||
|
||
File indexFile = new File(contentFolder, "index.html"); | ||
indexFile.setReadable(true, false); | ||
indexFile.setWritable(true, false); | ||
indexFile.setExecutable(true, false); | ||
|
||
@Cleanup PrintStream printStream = new PrintStream(new FileOutputStream(indexFile)); | ||
printStream.println("<html><body>This worked</body></html>"); | ||
} | ||
|
||
@Test | ||
public void testWebDriverToNginxContainerAccessViaContainerLink() throws Exception { | ||
RemoteWebDriver driver = chrome.getWebDriver(); | ||
|
||
driver.get("http://nginx/"); | ||
|
||
assertEquals("Using selenium, an HTTP GET from the nginx server returns the index.html from the custom content directory", "This worked", driver.findElement(By.tagName("body")).getText()); | ||
} | ||
} |
Oops, something went wrong.