mirror of
https://github.com/google/nomulus.git
synced 2025-05-05 14:37:52 +02:00
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
78 lines
2.8 KiB
Java
78 lines
2.8 KiB
Java
// Copyright 2018 The Nomulus Authors. All Rights Reserved.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
package google.registry.webdriver;
|
|
|
|
import static google.registry.server.Fixture.BASIC;
|
|
import static google.registry.server.Route.route;
|
|
|
|
import com.googlecode.objectify.ObjectifyFilter;
|
|
import google.registry.model.ofy.OfyFilter;
|
|
import google.registry.module.frontend.FrontendServlet;
|
|
import google.registry.server.RegistryTestServer;
|
|
import org.junit.Rule;
|
|
import org.junit.Test;
|
|
import org.junit.runner.RunWith;
|
|
import org.openqa.selenium.By;
|
|
|
|
/** Registrar Console Screenshot Differ tests. */
|
|
@RunWith(RepeatableRunner.class)
|
|
public class OteSetupConsoleScreenshotTest {
|
|
|
|
@Rule
|
|
public final TestServerRule server =
|
|
new TestServerRule.Builder()
|
|
.setRunfiles(RegistryTestServer.RUNFILES)
|
|
.setRoutes(route("/registrar-ote-setup", FrontendServlet.class))
|
|
.setFilters(ObjectifyFilter.class, OfyFilter.class)
|
|
.setFixtures(BASIC)
|
|
.setEmail("Marla.Singer@google.com")
|
|
.build();
|
|
|
|
@Rule public final WebDriverRule driver = new WebDriverRule();
|
|
|
|
@Test
|
|
public void get_owner_fails() throws Throwable {
|
|
driver.get(server.getUrl("/registrar-ote-setup"));
|
|
driver.waitForElement(By.tagName("h1"));
|
|
driver.diffPage("unauthorized");
|
|
}
|
|
|
|
@Test
|
|
public void get_admin_succeeds() throws Throwable {
|
|
server.setIsAdmin(true);
|
|
driver.get(server.getUrl("/registrar-ote-setup"));
|
|
driver.waitForElement(By.tagName("h1"));
|
|
driver.diffPage("formEmpty");
|
|
driver.findElement(By.id("clientId")).sendKeys("acmereg");
|
|
driver.findElement(By.id("email")).sendKeys("acmereg@registry.example");
|
|
driver.findElement(By.id("password")).sendKeys("StRoNgPaSsWoRd");
|
|
driver.diffPage("formFilled");
|
|
driver.findElement(By.id("submit-button")).click();
|
|
driver.waitForElement(By.tagName("h1"));
|
|
driver.diffPage("oteResult");
|
|
}
|
|
|
|
@Test
|
|
public void get_admin_fails_badEmail() throws Throwable {
|
|
server.setIsAdmin(true);
|
|
driver.get(server.getUrl("/registrar-ote-setup"));
|
|
driver.waitForElement(By.tagName("h1"));
|
|
driver.findElement(By.id("clientId")).sendKeys("acmereg");
|
|
driver.findElement(By.id("email")).sendKeys("bad email");
|
|
driver.findElement(By.id("submit-button")).click();
|
|
driver.waitForElement(By.tagName("h1"));
|
|
driver.diffPage("oteResultFailed");
|
|
}
|
|
}
|