use of com.seleniumtests.connectors.selenium.fielddetector.Label in project seleniumRobot by bhecquet.
the class TestUiElement method init.
@BeforeMethod(groups = { "ut" })
public void init() {
UiElement.resetPageInformation();
/*
* Create fields and labels
*
* field4
*
* label1Below
*
* field5 label1Right field1/labelInside label1Left field3
*
* label1Above
*
* field2
*
*/
// field to the left of "label1Left" and to the right of "label1Right"
field1 = new Field(200, 300, 100, 120, null, "field");
fieldWithLabel = new Field(100, 300, 100, 120, null, "field_with_label", field1);
// field above "label1Above"
field2 = new Field(200, 300, 300, 320, null, "field");
// field to the right of "label1Left"
field3 = new Field(600, 700, 100, 120, null, "field");
// field above "label1Below"
field4 = new Field(200, 300, 0, 20, null, "field");
// field to the left of "label1Right"
field5 = new Field(10, 60, 100, 120, null, "field");
label1Right = new Label(100, 150, 100, 120, "label_with_field_on_right");
label1Left = new Label(350, 400, 100, 120, "label_with_field_on_left");
// label longer than field
label1Above = new Label(200, 400, 200, 220, "label_with_field_above");
// label shorter than field
label1Below = new Label(200, 252, 70, 90, "label_with_field_below");
label2 = new Label(100, 150, 0, 20, "label_without_field");
labelInside = new Label(200, 250, 100, 120, "label_inside");
PowerMockito.mockStatic(CustomEventFiringWebDriver.class);
PowerMockito.mockStatic(WebUIDriver.class);
PowerMockito.when(WebUIDriver.getWebDriver(anyBoolean())).thenReturn(driver);
when(driver.getBrowserInfo()).thenReturn(new BrowserInfo(BrowserType.CHROME, "83.0"));
}
use of com.seleniumtests.connectors.selenium.fielddetector.Label in project seleniumRobot by bhecquet.
the class TestStepReferenceComparator method testCompareNoField.
@Test(groups = { "ut" })
public void testCompareNoField() throws Exception {
List<Label> stepLabels = new ArrayList<>();
stepLabels.add(new Label(0, 100, 0, 20, "a text"));
stepLabels.add(new Label(0, 100, 100, 120, "other text"));
List<Label> referenceLabels = new ArrayList<>();
referenceLabels.add(new Label(0, 100, 0, 20, "a text"));
referenceLabels.add(new Label(5, 105, 100, 120, "other text"));
PowerMockito.whenNew(ImageFieldDetector.class).withAnyArguments().thenReturn(stepImageFieldDetector, refImageFieldDetector);
when(stepImageFieldDetector.detectLabels()).thenReturn(stepLabels);
when(refImageFieldDetector.detectLabels()).thenReturn(referenceLabels);
StepReferenceComparator comparator = new StepReferenceComparator(File.createTempFile("img", ".png"), File.createTempFile("img", ".png"));
Assert.assertEquals(comparator.compare(), 100);
}
Aggregations