Search in sources :

Example 6 with ImageViewerController

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!");
}
Also used : UnsupportedCommandException(org.openqa.selenium.UnsupportedCommandException) SideBarController(org.mycore.iview.tests.controller.SideBarController) ImageViewerController(org.mycore.iview.tests.controller.ImageViewerController) ToolBarController(org.mycore.iview.tests.controller.ToolBarController) Test(org.junit.Test)

Example 7 with ImageViewerController

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());
}
Also used : SideBarController(org.mycore.iview.tests.controller.SideBarController) ImageViewerController(org.mycore.iview.tests.controller.ImageViewerController) ToolBarController(org.mycore.iview.tests.controller.ToolBarController) Test(org.junit.Test)

Example 8 with ImageViewerController

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);
}
Also used : UnsupportedCommandException(org.openqa.selenium.UnsupportedCommandException) SideBarController(org.mycore.iview.tests.controller.SideBarController) ImageViewerController(org.mycore.iview.tests.controller.ImageViewerController) ToolBarController(org.mycore.iview.tests.controller.ToolBarController) Test(org.junit.Test)

Example 9 with ImageViewerController

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());
}
Also used : ImageViewerController(org.mycore.iview.tests.controller.ImageViewerController) ToolBarController(org.mycore.iview.tests.controller.ToolBarController) StructureOverviewController(org.mycore.iview.tests.controller.StructureOverviewController) Test(org.junit.Test)

Aggregations

ImageViewerController (org.mycore.iview.tests.controller.ImageViewerController)9 Test (org.junit.Test)8 ToolBarController (org.mycore.iview.tests.controller.ToolBarController)8 SideBarController (org.mycore.iview.tests.controller.SideBarController)3 UnsupportedCommandException (org.openqa.selenium.UnsupportedCommandException)2 BufferedImage (java.awt.image.BufferedImage)1 ApplicationController (org.mycore.iview.tests.controller.ApplicationController)1 ImageOverviewController (org.mycore.iview.tests.controller.ImageOverviewController)1 StructureOverviewController (org.mycore.iview.tests.controller.StructureOverviewController)1