Search in sources :

Example 26 with Label

use of com.seleniumtests.connectors.selenium.fielddetector.Label in project seleniumRobot by bhecquet.

the class TestLabel method testMatchesNull.

@Test(groups = { "ut" })
public void testMatchesNull() {
    Label l1 = new Label(0, 100, 0, 20, "foobar");
    Assert.assertFalse(l1.match(null));
}
Also used : Label(com.seleniumtests.connectors.selenium.fielddetector.Label) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 27 with Label

use of com.seleniumtests.connectors.selenium.fielddetector.Label in project seleniumRobot by bhecquet.

the class TestLabel method testNoMatchByText.

@Test(groups = { "ut" })
public void testNoMatchByText() {
    Label l1 = new Label(0, 100, 0, 20, "foobar");
    Label l2 = new Label(0, 99, 0, 20, "barfoo");
    Assert.assertFalse(l1.match(l2));
}
Also used : Label(com.seleniumtests.connectors.selenium.fielddetector.Label) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 28 with Label

use of com.seleniumtests.connectors.selenium.fielddetector.Label in project seleniumRobot by bhecquet.

the class TestLabel method testMatchesEmptyText.

@Test(groups = { "ut" })
public void testMatchesEmptyText() {
    Label l1 = new Label(0, 100, 0, 20, "");
    Label l2 = new Label(0, 99, 0, 20, "");
    Assert.assertTrue(l1.match(l2));
}
Also used : Label(com.seleniumtests.connectors.selenium.fielddetector.Label) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 29 with Label

use of com.seleniumtests.connectors.selenium.fielddetector.Label in project seleniumRobot by bhecquet.

the class TestLabel method testMatches.

@Test(groups = { "ut" })
public void testMatches() {
    Label l1 = new Label(0, 100, 0, 20, "foobar");
    Label l2 = new Label(0, 99, 0, 20, "fooba");
    Assert.assertTrue(l1.match(l2));
}
Also used : Label(com.seleniumtests.connectors.selenium.fielddetector.Label) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Example 30 with Label

use of com.seleniumtests.connectors.selenium.fielddetector.Label in project seleniumRobot by bhecquet.

the class TestLabel method testFieldAndLabelNotAligned2.

/**
 * Field on the right, but not aligned horizontally
 *
 * 			------
 * 			Field
 * 			------
 *
 * 					-----
 * 					Label
 * 					-----
 */
@Test(groups = { "ut" })
public void testFieldAndLabelNotAligned2() {
    Label label = Label.fromJson(new JSONObject("{" + "		\"top\": 200," + "		\"left\": 300," + "		\"width\": 100," + "		\"height\": 20," + "		\"right\": 400," + "		\"bottom\": 220," + "		\"text\": \"My link Parent\"" + "	}"));
    Field field = Field.fromJson(new JSONObject("{" + "		\"class_id\": 3," + "		\"top\": 100," + "		\"left\": 200," + "		\"width\": 100," + "		\"height\": 20," + "		\"right\": 300," + "		\"bottom\": 120," + "		\"class_name\": \"radio_with_label\"," + "		\"text\": \"= Value 4\"," + "		\"related_field\": null," + "		\"with_label\": true" + "	}"));
    Assert.assertFalse(label.isInside(field));
    Assert.assertFalse(label.isFieldLeftOf(field));
    Assert.assertFalse(label.isFieldRightOf(field));
    Assert.assertFalse(label.isFieldAbove(field));
    Assert.assertFalse(label.isFieldBelow(field));
}
Also used : Field(com.seleniumtests.connectors.selenium.fielddetector.Field) JSONObject(kong.unirest.json.JSONObject) Label(com.seleniumtests.connectors.selenium.fielddetector.Label) Test(org.testng.annotations.Test) GenericTest(com.seleniumtests.GenericTest)

Aggregations

Label (com.seleniumtests.connectors.selenium.fielddetector.Label)37 Test (org.testng.annotations.Test)31 GenericTest (com.seleniumtests.GenericTest)26 Field (com.seleniumtests.connectors.selenium.fielddetector.Field)22 File (java.io.File)14 MockitoTest (com.seleniumtests.MockitoTest)13 JSONObject (kong.unirest.json.JSONObject)13 ArrayList (java.util.ArrayList)11 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)10 ErrorCause (com.seleniumtests.core.testanalysis.ErrorCause)8 ErrorCauseFinder (com.seleniumtests.core.testanalysis.ErrorCauseFinder)8 ITestResult (org.testng.ITestResult)8 ImageFieldDetector (com.seleniumtests.connectors.selenium.fielddetector.ImageFieldDetector)6 ConfigurationException (com.seleniumtests.customexception.ConfigurationException)4 SeleniumRobotServerException (com.seleniumtests.customexception.SeleniumRobotServerException)2 Snapshot (com.seleniumtests.reporter.logger.Snapshot)2 TestStep (com.seleniumtests.reporter.logger.TestStep)2 StepReferenceComparator (com.seleniumtests.util.imaging.StepReferenceComparator)2 Rectangle (java.awt.Rectangle)2 BrowserInfo (com.seleniumtests.browserfactory.BrowserInfo)1