Search in sources :

Example 16 with ImageSearchException

use of com.seleniumtests.customexception.ImageSearchException in project seleniumRobot by bhecquet.

the class TestPictureElement method testSendKeysOnPicture.

public void testSendKeysOnPicture() {
    try {
        DriverTestPageWithoutFixedPattern.logoText.clear();
        DriverTestPageWithoutFixedPattern.picture.sendKeys("hello", 0, 40);
    } catch (ImageSearchException e) {
        throw new SkipException("Image not found, we may be on screenless slave", e);
    }
    // in case of browser slowness
    WaitHelper.waitForMilliSeconds(500);
    Assert.assertEquals(DriverTestPageWithoutFixedPattern.logoText.getValue(), "hello");
}
Also used : ImageSearchException(com.seleniumtests.customexception.ImageSearchException) SkipException(org.testng.SkipException)

Example 17 with ImageSearchException

use of com.seleniumtests.customexception.ImageSearchException in project seleniumRobot by bhecquet.

the class TestPictureElement method testClickOnPicture.

public void testClickOnPicture() {
    try {
        DriverTestPageWithoutFixedPattern.picture.clickAt(0, -20);
    } catch (ImageSearchException e) {
        throw new SkipException("Image not found, we may be on screenless slave", e);
    }
    // in case of browser slowness
    WaitHelper.waitForMilliSeconds(500);
    Assert.assertEquals(DriverTestPageWithoutFixedPattern.logoText.getValue(), "ff logo");
}
Also used : ImageSearchException(com.seleniumtests.customexception.ImageSearchException) SkipException(org.testng.SkipException)

Example 18 with ImageSearchException

use of com.seleniumtests.customexception.ImageSearchException in project seleniumRobot by bhecquet.

the class TestPictureElement method testClickOnGooglePicture.

/**
 * test correction of issue #131 by clicking on element which does not have a "intoElement" parameter
 */
public void testClickOnGooglePicture() {
    try {
        DriverTestPageWithoutFixedPattern.googlePicture.click();
    } catch (ImageSearchException e) {
        throw new SkipException("Image not found, we may be on screenless slave", e);
    }
    // in case of browser slowness
    WaitHelper.waitForMilliSeconds(500);
    Assert.assertEquals(DriverTestPageWithoutFixedPattern.textElement.getValue(), "image");
}
Also used : ImageSearchException(com.seleniumtests.customexception.ImageSearchException) SkipException(org.testng.SkipException)

Example 19 with ImageSearchException

use of com.seleniumtests.customexception.ImageSearchException in project seleniumRobot by bhecquet.

the class TestScreenZone method testActionDurationIsLogged.

/**
 * test that an action changed actionDuration value
 */
@Test(groups = { "it" })
public void testActionDurationIsLogged() {
    Assert.assertEquals(DriverTestPageWithoutFixedPattern.googleForDesktopWithFile.getActionDuration(), 0);
    try {
        DriverTestPageWithoutFixedPattern.googleForDesktopWithFile.click();
    } catch (ImageSearchException e) {
        throw new SkipException("Image not found, we may be on screenless slave", e);
    }
    Assert.assertTrue(DriverTestPageWithoutFixedPattern.googleForDesktopWithFile.getActionDuration() > 0);
}
Also used : ImageSearchException(com.seleniumtests.customexception.ImageSearchException) SkipException(org.testng.SkipException) GenericMultiBrowserTest(com.seleniumtests.it.driver.support.GenericMultiBrowserTest) Test(org.testng.annotations.Test)

Example 20 with ImageSearchException

use of com.seleniumtests.customexception.ImageSearchException in project seleniumRobot by bhecquet.

the class TestUiElement method testSendKeysOnPicture.

public void testSendKeysOnPicture() {
    try {
        DriverTestPageWithoutFixedPattern.logoText.clear();
        DriverTestPageWithoutFixedPattern.picture.sendKeys("hello", 0, 40);
    } catch (ImageSearchException e) {
        throw new SkipException("Image not found, we may be on screenless slave", e);
    }
    // in case of browser slowness
    WaitHelper.waitForMilliSeconds(500);
    Assert.assertEquals(DriverTestPageWithoutFixedPattern.logoText.getValue(), "hello");
}
Also used : ImageSearchException(com.seleniumtests.customexception.ImageSearchException) SkipException(org.testng.SkipException)

Aggregations

ImageSearchException (com.seleniumtests.customexception.ImageSearchException)21 SkipException (org.testng.SkipException)17 GenericMultiBrowserTest (com.seleniumtests.it.driver.support.GenericMultiBrowserTest)6 Test (org.testng.annotations.Test)6 KeyPoint (org.opencv.core.KeyPoint)4 MatOfKeyPoint (org.opencv.core.MatOfKeyPoint)4 Point (org.opencv.core.Point)4 IOException (java.io.IOException)3 Mat (org.opencv.core.Mat)3 Rectangle (org.openqa.selenium.Rectangle)3 CustomEventFiringWebDriver (com.seleniumtests.driver.CustomEventFiringWebDriver)2 ScreenZone (com.seleniumtests.uipage.htmlelements.ScreenZone)2 Scalar (org.opencv.core.Scalar)2 ConfigurationException (com.seleniumtests.customexception.ConfigurationException)1 File (java.io.File)1 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedList (java.util.LinkedList)1 ExecutorService (java.util.concurrent.ExecutorService)1 MinMaxLocResult (org.opencv.core.Core.MinMaxLocResult)1