use of org.mycore.iview.tests.controller.ImageViewerController in project mycore by MyCoRe-Org.
the class SideBarIT method testSideBarResize.
@Test
public /**
* Ignored because https://github.com/mozilla/geckodriver/issues/233
*/
void testSideBarResize() throws Exception {
this.setTestName(getClassname() + "-testSideBarResize");
this.getDriver();
this.getAppController().openViewer(this.getDriver(), getTestDerivate());
ImageViewerController controller = this.getViewerController();
ToolBarController tbController = controller.getToolBarController();
SideBarController sbController = controller.getSideBarController();
tbController.pressButton(ToolBarController.BUTTON_ID_SIDEBAR_CONTROLL);
tbController.clickElementById(ImageOverviewController.IMAGE_OVERVIEW_SELECTOR);
int sbWidthStart = sbController.getSideBarWidth();
try {
// Firefox does not support actions so we just let the test pass.
sbController.dragAndDropByXpath("//div[contains(@class,\"sidebar\")]/span[@class=\"resizer\"]", 50, 0);
} catch (UnsupportedCommandException e) {
LOGGER.warn("Driver does not support Actions", e);
return;
}
int sbWidthEnd = sbController.getSideBarWidth();
assertLess(sbWidthEnd, sbWidthStart, "Sidebar width schould be increased!");
}
use of org.mycore.iview.tests.controller.ImageViewerController in project mycore by MyCoRe-Org.
the class SideBarIT method testSideBarPresent.
@Test
public void testSideBarPresent() throws Exception {
this.setTestName(getClassname() + "-testSideBarPresent");
this.getDriver();
this.getAppController().openViewer(this.getDriver(), getTestDerivate());
ImageViewerController controller = this.getViewerController();
ToolBarController tbController = controller.getToolBarController();
SideBarController sbController = controller.getSideBarController();
tbController.pressButton(ToolBarController.BUTTON_ID_SIDEBAR_CONTROLL);
tbController.clickElementById(ImageOverviewController.IMAGE_OVERVIEW_SELECTOR);
Assert.assertTrue("SideBar should be present!", sbController.assertSideBarPresent());
tbController.clickElementByXpath(SideBarController.SIDEBAR_CLOSE_SELECTOR);
Assert.assertFalse("SideBar should not be present!", sbController.assertSideBarPresent());
}
use of org.mycore.iview.tests.controller.ImageViewerController in project mycore by MyCoRe-Org.
the class SideBarIT method testOverviewLayout.
@Test
public void testOverviewLayout() throws InterruptedException {
this.setTestName(getClassname() + "-testOvervieLayout");
this.getDriver();
this.getAppController().openViewer(this.getDriver(), getTestDerivate());
ImageViewerController controller = this.getViewerController();
ToolBarController tbController = controller.getToolBarController();
SideBarController sbController = controller.getSideBarController();
tbController.pressButton(ToolBarController.BUTTON_ID_SIDEBAR_CONTROLL);
tbController.clickElementById(ImageOverviewController.IMAGE_OVERVIEW_SELECTOR);
int before = sbController.countThumbnails();
try {
sbController.dragAndDropByXpath("//div[contains(@class,'sidebar')]/span[@class='resizer']", 300, 0);
} catch (UnsupportedCommandException e) {
LOGGER.warn("Driver does not support Actions", e);
return;
}
Thread.sleep(1000);
int after = sbController.countThumbnails();
Assert.assertEquals(2 * before, after);
}
use of org.mycore.iview.tests.controller.ImageViewerController in project mycore by MyCoRe-Org.
the class StructureOverviewIT method testStructureOverview.
@Test
public /**
* Checks if the structure Overview loaded from mets.xml works!
* @throws IOException
* @throws InterruptedException
*/
void testStructureOverview() throws IOException, InterruptedException {
this.setTestName(getClassname() + "-testStructureOverview");
this.getDriver();
this.getAppController().openViewer(this.getDriver(), getTestDerivate());
ImageViewerController controller = this.getViewerController();
ToolBarController tbController = controller.getToolBarController();
StructureOverviewController soController = controller.getStructureOverviewController();
tbController.pressButton(ToolBarController.BUTTON_ID_SIDEBAR_CONTROLL);
Thread.sleep(1000);
tbController.clickElementById(StructureOverviewController.CHAPTER_OVERVIEW_SELECTOR);
int greenPixelCount = selectImgAndCountColor(soController, getGreenLabel(), Color.GREEN);
int redPixelCount = selectImgAndCountColor(soController, getRedLabel(), Color.RED);
int bluePixelCount = selectImgAndCountColor(soController, getBlueLabel(), Color.BLUE);
int redPixelCountRGB = selectImgAndCountColor(soController, getRgbLabel(), Color.RED);
int greenPixelCountRGB = selectImgAndCountColor(soController, getRgbLabel(), Color.GREEN);
int bluePixelCountRGB = selectImgAndCountColor(soController, getRgbLabel(), Color.BLUE);
String messagePattern = "There should be less red pixels in the rgb screenshot than in the red ({0} > {1})";
assertLess(redPixelCount, redPixelCountRGB, messagePattern);
messagePattern = "There should be less green pixels in the rgb screenshot than in the red ({0} > {1})";
assertLess(greenPixelCount, greenPixelCountRGB, messagePattern);
messagePattern = "There should be less blue pixels in the rgb screenshot than in the red ({0} > {1})";
assertLess(bluePixelCount, bluePixelCountRGB, messagePattern);
Assert.assertFalse("There should´nt be any 'undefined' page labels.", soController.hasUndefinedPageLabels());
}
Aggregations