Skip to content

Instantly share code, notes, and snippets.

@manoj9788
Created January 23, 2019 04:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manoj9788/4861382c3debb26a2fd9ed5f3c7d5f4c to your computer and use it in GitHub Desktop.
Save manoj9788/4861382c3debb26a2fd9ed5f3c7d5f4c to your computer and use it in GitHub Desktop.
package com.applitools.seleniumJavaExamples;
import com.applitools.eyes.rendering.Eyes;
import com.applitools.eyes.rendering.Target;
import com.applitools.eyes.visualGridClient.model.RenderingConfiguration;
import com.applitools.eyes.visualGridClient.model.TestResultSummary;
import com.applitools.eyes.visualGridClient.services.VisualGridManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.safari.SafariDriver;
public class VisualGridExample {
private VisualGridManager VisualGrid = new VisualGridManager(10);
private RenderingConfiguration renderConfig = new RenderingConfiguration();
private Eyes eyes = new Eyes(VisualGrid);
private WebDriver driver;
public static String applitoolsKey = System.getenv("APPLITOOLS_API_KEY");
@Before
public void setUp() throws Exception {
renderConfig.setTestName("Vis-Grid");
renderConfig.setAppName("Rendering Grid Test");
renderConfig.addBrowser(800, 600, RenderingConfiguration.BrowserType.CHROME);
renderConfig.addBrowser(700, 500, RenderingConfiguration.BrowserType.FIREFOX);
renderConfig.addBrowser(1200, 800, RenderingConfiguration.BrowserType.CHROME);
eyes.setApiKey(applitoolsKey);
driver = new ChromeDriver();
driver.get("http://demo.applitools.com/app.html");
}
@Test
public void HomePage() throws Exception {
eyes.open(driver, renderConfig);
eyes.check("first check", Target.window());
eyes.close();
TestResultSummary allTestResults = VisualGrid.getAllTestResults();
System.out.println("Results: " + allTestResults);
//assertEquals(true, allTestResults);
}
@After
public void tearDown() throws Exception {
driver.quit();
eyes.abortIfNotClosed();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment