use of com.seleniumtests.driver.screenshots.SnapshotCheckType in project seleniumRobot by bhecquet.
the class TestSnapshotCheckType method testExcludeElementOutsideElement4.
/**
* Check element excluded from captured element but outside of it is not kept
* element to exclude 'y' is higher than enclosing top position
*/
@Test(groups = { "ut" })
public void testExcludeElementOutsideElement4() {
when(elementToExclude1.getRect()).thenReturn(new Rectangle(0, 101, 3, 4));
when(snapshotTarget.getElement()).thenReturn(element);
when(snapshotTarget.isPageTarget()).thenReturn(false);
when(snapshotTarget.isElementTarget()).thenReturn(true);
when(snapshotTarget.getSnapshotRectangle()).thenReturn(new Rectangle(0, 0, 100, 100));
SnapshotCheckType checkType = SnapshotCheckType.FULL.exclude(elementToExclude1);
checkType.check(snapshotTarget);
Assert.assertEquals(checkType.getExcludeElementsRect().size(), 0);
}
use of com.seleniumtests.driver.screenshots.SnapshotCheckType in project seleniumRobot by bhecquet.
the class TestSnapshotCheckType method testExcludeElementInsideElement.
/**
* Check element excluded from captured element is kept
*/
@Test(groups = { "ut" })
public void testExcludeElementInsideElement() {
when(elementToExclude1.getRect()).thenReturn(new Rectangle(1, 2, 3, 4));
when(snapshotTarget.getElement()).thenReturn(element);
when(snapshotTarget.isPageTarget()).thenReturn(false);
when(snapshotTarget.isElementTarget()).thenReturn(true);
when(snapshotTarget.getSnapshotRectangle()).thenReturn(new Rectangle(0, 0, 100, 100));
SnapshotCheckType checkType = SnapshotCheckType.FULL.exclude(elementToExclude1);
checkType.check(snapshotTarget);
Assert.assertEquals(checkType.getExcludeElementsRect().size(), 1);
Assert.assertEquals(checkType.getExcludeElementsRect().get(0), new Rectangle(1, 2, 3, 4));
}
use of com.seleniumtests.driver.screenshots.SnapshotCheckType in project seleniumRobot by bhecquet.
the class TestSnapshotCheckType method testExcludeElementFromPage.
@Test(groups = { "ut" })
public void testExcludeElementFromPage() {
when(elementToExclude1.getRect()).thenReturn(new Rectangle(1, 2, 3, 4));
when(snapshotTarget.isPageTarget()).thenReturn(true);
SnapshotCheckType checkType = SnapshotCheckType.FULL.exclude(elementToExclude1);
checkType.check(snapshotTarget);
Assert.assertEquals(checkType.getExcludeElementsRect().size(), 1);
Assert.assertEquals(checkType.getExcludeElementsRect().get(0), new Rectangle(1, 2, 3, 4));
}
use of com.seleniumtests.driver.screenshots.SnapshotCheckType in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method init.
@BeforeMethod(groups = { "ut" })
public void init(final ITestContext testNGCtx) {
when(element.getRect()).thenReturn(new Rectangle(10, 11, 12, 13));
SnapshotCheckType snapshotCheckType = SnapshotCheckType.FULL.exclude(element);
snapshotCheckType.check(SnapshotTarget.PAGE);
when(snapshot.getScreenshot()).thenReturn(screenshot);
when(snapshot.getName()).thenReturn("snapshot");
when(snapshot.getCheckSnapshot()).thenReturn(snapshotCheckType);
when(screenshot.getImagePath()).thenReturn("img.png");
when(screenshot.getFullImagePath()).thenReturn("/home/img.png");
}
use of com.seleniumtests.driver.screenshots.SnapshotCheckType in project seleniumRobot by bhecquet.
the class TestSnapshotCheckType method testExcludeElementFromScreen.
/**
* When capture is done on screen, no element can be excluded
*/
@Test(groups = { "ut" })
public void testExcludeElementFromScreen() {
when(elementToExclude1.getRect()).thenReturn(new Rectangle(1, 2, 3, 4));
when(snapshotTarget.isPageTarget()).thenReturn(false);
when(snapshotTarget.isElementTarget()).thenReturn(false);
SnapshotCheckType checkType = SnapshotCheckType.FULL.exclude(elementToExclude1);
checkType.check(snapshotTarget);
Assert.assertEquals(checkType.getExcludeElementsRect().size(), 0);
}
Aggregations