use of com.wikia.webdriver.common.core.imageutilities.ImageComparison in project selenium-tests by Wikia.
the class AdsSkinHelper method init.
private void init() {
this.adsComparison = new AdsComparison();
this.imageEditor = new ImageEditor();
this.shooter = new Shooter();
this.imageComparison = new ImageComparison();
WebElement wikiaArticle = driver.findElement(By.id("WikiaPageBackground"));
WebElement globalNavigation = driver.findElement(By.id("globalNavigation"));
this.viewPortWidth = globalNavigation.getSize().getWidth();
this.startSkinY = globalNavigation.getSize().getHeight();
this.articleLeftSideX = wikiaArticle.getLocation().x;
this.articleBottomY = wikiaArticle.getLocation().y + wikiaArticle.getSize().getHeight();
this.articleRightSideX = wikiaArticle.getLocation().x + wikiaArticle.getSize().getWidth();
}
use of com.wikia.webdriver.common.core.imageutilities.ImageComparison in project selenium-tests by Wikia.
the class CommonExpectedConditions method elementToHaveColor.
/**
* @param accuracy in percentage between 0 and 100.
*/
public static ExpectedCondition<Boolean> elementToHaveColor(final WebElement element, final Color color, final int accuracy) {
final Shooter shooter = new Shooter();
final ImageComparison imageComparison = new ImageComparison();
return new ExpectedCondition<Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
BufferedImage image = shooter.takeScreenshot(element, driver);
return imageComparison.isColorImage(image, color, accuracy);
}
@Override
public String toString() {
return String.format("At least %s percents of element does not have %s color", (100 - accuracy), color.toString());
}
};
}
use of com.wikia.webdriver.common.core.imageutilities.ImageComparison in project selenium-tests by Wikia.
the class SpecialPromotePageObject method verifyUploadedImage.
public void verifyUploadedImage(String fileName) {
File expectedImageFile = new File(PageContent.IMAGE_UPLOAD_RESOURCES_PATH + fileName);
File actualImageFile = getUploadedImage();
ImageComparison comparer = new ImageComparison();
Boolean ifEqual = comparer.areFilesTheSame(expectedImageFile, actualImageFile);
actualImageFile.delete();
Assertion.assertTrue(ifEqual);
}
Aggregations