Implement screenshot comparison

This change added the implementation of screenshot comparison with
ChromeWebDriver which will be used in the open-source code base.

This change also set a default window size(1200x2000) for each screenshot
test. This is to make the size of screenshot deterministic to help
build the screenshot comparison tests.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=235539713
This commit is contained in:
shicong 2019-02-25 09:04:42 -08:00 committed by Weimin Yu
parent 7ddd8b55d2
commit 756a3b41e1
24 changed files with 385 additions and 28 deletions

View file

@ -30,12 +30,11 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
/** Registrar Console Screenshot Differ tests. */
@RunWith(JUnit4.class)
@RunWith(RepeatableRunner.class)
public class RegistrarConsoleScreenshotTest {
@Rule
@ -56,7 +55,6 @@ public class RegistrarConsoleScreenshotTest {
@Test
public void index_owner() throws Throwable {
driver.manage().window().setSize(new Dimension(1200, 2000));
driver.get(server.getUrl("/registrar"));
driver.waitForElement(By.tagName("h1"));
driver.diffPage("page");
@ -66,7 +64,6 @@ public class RegistrarConsoleScreenshotTest {
@Test
public void index_adminAndOwner() throws Throwable {
server.setIsAdmin(true);
driver.manage().window().setSize(new Dimension(1200, 2000));
driver.get(server.getUrl("/registrar"));
driver.waitForElement(By.tagName("h1"));
driver.diffPage("page");
@ -76,7 +73,6 @@ public class RegistrarConsoleScreenshotTest {
@Test
public void index_admin() throws Throwable {
server.setIsAdmin(true);
driver.manage().window().setSize(new Dimension(1200, 2000));
// To make sure we're only ADMIN (and not also "OWNER"), we switch to the NewRegistrar we
// aren't in the contacts of
driver.get(server.getUrl("/registrar?clientId=NewRegistrar"));