mirror of
https://github.com/google/nomulus.git
synced 2025-05-05 22:47:51 +02:00
This change does a few things: 1. Partially externalized WebDriver tests by using ChromeDriver as an implementation of WebDriver API in the external build. 2. Refactored WebDriverRule.java to decouple the creation and using of WebDriver related stuff so we can have different implementations in internal and external builds. 3. Refactored the usage of some internal libraries to have a central place to store all of them to make it easier to remove them in the external build. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=233661757
58 lines
2.4 KiB
Java
58 lines
2.4 KiB
Java
// Copyright 2019 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 org.openqa.selenium.WebDriver;
|
|
import org.openqa.selenium.WebElement;
|
|
|
|
/**
|
|
* Interface to provide the implementation of {@link org.openqa.selenium.WebDriver} and APIs to
|
|
* compare screenshots for visual regression tests.
|
|
*/
|
|
interface WebDriverPlusScreenDiffer {
|
|
|
|
/** Gets the implementation of {@link org.openqa.selenium.WebDriver}. */
|
|
WebDriver getWebDriver();
|
|
|
|
/**
|
|
* Checks that the screenshot of the element matches the golden image by pixel comparison. {@link
|
|
* #verifyAndQuit()} needs to be invoked to actually trigger the comparison.
|
|
*
|
|
* <p>On mismatch, the test will continue until the end of the test (and then fail). This is so
|
|
* other screenshot matches can be executed in the same function - allowing you to approve /
|
|
* reject all at once.
|
|
*
|
|
* @param imageKey a unique name such that by prepending the calling class name and method name in
|
|
* the format of ClassName_MethodName_<imageKey> will uniquely identify golden image.
|
|
* @param element the element on the page to be compared
|
|
*/
|
|
void diffElement(String imageKey, WebElement element);
|
|
|
|
/**
|
|
* Checks that the screenshot matches the golden image by pixel comparison. {@link
|
|
* #verifyAndQuit()} needs to be invoked to actually trigger the comparison.
|
|
*
|
|
* <p>On mismatch, the test will continue until the end of the test (and then fail). This is so
|
|
* other screenshot matches can be executed in the same function - allowing you to approve /
|
|
* reject all at once.
|
|
*
|
|
* @param imageKey a unique name such that by prepending the calling class name and method name in
|
|
* the format of ClassName_MethodName_<imageKey> will uniquely identify golden image.
|
|
*/
|
|
void diffPage(String imageKey);
|
|
|
|
/** Asserts that all diffs up to this point have PASSED. */
|
|
void verifyAndQuit();
|
|
}
|