use of com.seleniumtests.customexception.ImageSearchException in project seleniumRobot by bhecquet.
the class TestScreenZone method testClickOnGooglePictureWithCaptureSnapshotFalse.
/**
* Check that "captureSnapshot=false" do not prevent to use ScreenZone
*/
@Test(groups = { "it" })
public void testClickOnGooglePictureWithCaptureSnapshotFalse() {
try {
SeleniumTestsContextManager.getThreadContext().setCaptureSnapshot(false);
DriverTestPageWithoutFixedPattern.googleForDesktop.click();
} catch (ImageSearchException e) {
throw new SkipException("Image not found, we may be on screenless slave", e);
} finally {
SeleniumTestsContextManager.getThreadContext().setCaptureSnapshot(SeleniumTestsContext.DEFAULT_CAPTURE_SNAPSHOT);
}
Assert.assertEquals(DriverTestPageWithoutFixedPattern.textElement.getValue(), "image");
}
use of com.seleniumtests.customexception.ImageSearchException in project seleniumRobot by bhecquet.
the class TestScreenZone method testDoubleClickAtCoordinates.
/**
* Clic at given coordinate on screen without picture reference
*/
@Test(groups = { "it" })
public void testDoubleClickAtCoordinates() {
try {
// search zone to click
DriverTestPageWithoutFixedPattern.googleForDesktop.findElement();
Rectangle rectangle = DriverTestPageWithoutFixedPattern.googleForDesktop.getDetectedObjectRectangle();
// clic with a new ScreenZone
new ScreenZone("image").doubleClickAt(rectangle.x + 10, rectangle.y + 10);
} catch (ImageSearchException e) {
throw new SkipException("Image not found, we may be on screenless slave", e);
}
Assert.assertEquals(DriverTestPageWithoutFixedPattern.textElement.getValue(), "double click image");
}
use of com.seleniumtests.customexception.ImageSearchException in project seleniumRobot by bhecquet.
the class TestScreenZone method testSendKeyboardKeysOnPicture.
@Test(groups = { "it" })
public void testSendKeyboardKeysOnPicture() {
try {
DriverTestPageWithoutFixedPattern.logoText.clear();
((CustomEventFiringWebDriver) driver).scrollToElement(DriverTestPageWithoutFixedPattern.table, 200);
DriverTestPageWithoutFixedPattern.firefoxForDesktop.sendKeys(0, 40, KeyEvent.VK_A, KeyEvent.VK_B);
} catch (ImageSearchException e) {
throw new SkipException("Image not found, we may be on screenless slave", e);
}
Assert.assertEquals(DriverTestPageWithoutFixedPattern.logoText.getValue(), "ab");
}
use of com.seleniumtests.customexception.ImageSearchException in project seleniumRobot by bhecquet.
the class TestScreenZone method testClickAtCoordinates.
/**
* Clic at given coordinate on screen without picture reference
*/
@Test(groups = { "it" })
public void testClickAtCoordinates() {
try {
// search zone to click
DriverTestPageWithoutFixedPattern.googleForDesktop.findElement();
Rectangle rectangle = DriverTestPageWithoutFixedPattern.googleForDesktop.getDetectedObjectRectangle();
// clic with a new ScreenZone
new ScreenZone("image").clickAt(rectangle.x + 10, rectangle.y + 10);
} catch (ImageSearchException e) {
throw new SkipException("Image not found, we may be on screenless slave", e);
}
Assert.assertEquals(DriverTestPageWithoutFixedPattern.textElement.getValue(), "image");
}
use of com.seleniumtests.customexception.ImageSearchException in project seleniumRobot by bhecquet.
the class TestScreenZone method testSendKeysOnPicture.
@Test(groups = { "it" })
public void testSendKeysOnPicture() {
try {
DriverTestPageWithoutFixedPattern.logoText.clear();
((CustomEventFiringWebDriver) driver).scrollToElement(DriverTestPageWithoutFixedPattern.table, 200);
DriverTestPageWithoutFixedPattern.firefoxForDesktop.sendKeys(0, 40, "hello");
} catch (ImageSearchException e) {
throw new SkipException("Image not found, we may be on screenless slave", e);
}
Assert.assertEquals(DriverTestPageWithoutFixedPattern.logoText.getValue(), "hello");
}
Aggregations