@Test @Use(field = "direction", enumeration = true) public void testJointPoint() { int tolerance = 4; calendarAttributes.set(CalendarAttributes.jointPoint, direction.value); Locations inputLocations = calendar.getLocations(); Point locationInput = null; Point locationPopup = calendar.openPopup().getLocations().getTopLeft(); switch (direction) { case NULL: case AUTO: // auto (direction depends on browser/screen resolution) case BOTTOMLEFT: locationInput = inputLocations.getBottomLeft(); break; case BOTTOMRIGHT: locationInput = inputLocations.getBottomRight(); break; case TOPLEFT: locationInput = inputLocations.getTopLeft(); break; case TOPRIGHT: locationInput = inputLocations.getTopRight(); break; } tolerantAssertLocations(locationInput, locationPopup, tolerance); }
private void testOffset(boolean horizontal) { int offset = 15; int tolerance = 5; Locations before = calendar.openPopup().getLocations(); if (horizontal) { calendarAttributes.set(CalendarAttributes.horizontalOffset, offset); } else { calendarAttributes.set(CalendarAttributes.verticalOffset, offset); } new Actions(driver).moveToElement(page.fullPageRefreshIcon).build().perform(); Locations after = calendar.openPopup().getLocations(); Locations movedFromBefore = (horizontal ? before.moveAllBy(offset, 0) : before.moveAllBy(0, offset)); Iterator<Point> itAfter = after.iterator(); Iterator<Point> itMovedBefore = movedFromBefore.iterator(); // FIXME delete these logs after test method stabilized System.out.println(after); System.out.println(movedFromBefore); while (itAfter.hasNext()) { tolerantAssertLocations(itAfter.next(), itMovedBefore.next(), tolerance); } }