Created
January 23, 2019 04:50
-
-
Save manoj9788/4861382c3debb26a2fd9ed5f3c7d5f4c to your computer and use it in GitHub Desktop.
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
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