Skip to content

Commit

Permalink
✅ : integrate percy.io
Browse files Browse the repository at this point in the history
  • Loading branch information
juwit committed Dec 12, 2019
1 parent ada0909 commit e209d9d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
24 changes: 18 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,6 @@
<groupId>com.spotify</groupId>
<artifactId>docker-client</artifactId>
<version>8.16.0</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
Expand Down Expand Up @@ -219,8 +213,26 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.percy</groupId>
<artifactId>percy-java-selenium</artifactId>
<version>0.1.3</version>
<scope>test</scope>
</dependency>

</dependencies>

<dependencyManagement>
<!-- we need this as selenium needs guava 25, and docker-client embeds guava 20 -->
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.0-jre</version>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<pluginManagement>
<plugins>
Expand Down
15 changes: 15 additions & 0 deletions src/test/java/io/codeka/gaia/e2e/SeleniumIT.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.codeka.gaia.e2e;

import io.codeka.gaia.test.MongoContainer;
import io.percy.selenium.Percy;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.*;
import org.openqa.selenium.Dimension;
Expand All @@ -9,6 +10,8 @@
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.pagefactory.AjaxElementLocatorFactory;
import org.springframework.boot.test.context.SpringBootTest;
Expand Down Expand Up @@ -41,6 +44,8 @@ public class SeleniumIT {

private static WebDriver driver;

private static Percy percy;

@BeforeAll
public static void openServerAndBrowser() throws IOException {
ChromeOptions options = new ChromeOptions();
Expand All @@ -51,6 +56,8 @@ public static void openServerAndBrowser() throws IOException {
"--ignore-certificate-errors");
driver = new ChromeDriver(options);

percy = new Percy(driver);

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
}

Expand All @@ -72,6 +79,8 @@ void loginPage() throws IOException {

LoginPage page = PageFactory.initElements(driver, LoginPage.class);

percy.snapshot("Login Page");

page.login("admin", "admin123");
}

Expand All @@ -84,6 +93,8 @@ void dashboardPage_showsModuleCount() throws IOException {
assertEquals(3, page.modulesCount());
assertEquals(0, page.stacksCount());
assertEquals(0, page.stacksToUpdateCount());

percy.snapshot("Dashboard");
}

@Test
Expand All @@ -92,6 +103,8 @@ void modulesPage_showsModules() throws IOException {

var page = PageFactory.initElements(driver, ModulesPage.class);
assertEquals(3, page.modulesCount());

percy.snapshot("Modules");
}

@Test
Expand All @@ -104,6 +117,8 @@ void modulePage_showsModuleDetails() throws IOException {
assertThat(page.moduleName()).isEqualTo("terraform-docker-mongo");
assertThat(page.moduleDescription()).contains("A sample terraform");
assertThat(page.cliVersion()).isEqualTo("0.11.14");

percy.snapshot("Module Details");
}

void takeScreenshot() throws IOException {
Expand Down

0 comments on commit e209d9d

Please sign in to comment.