Search in sources :

Example 1 with SideBarController

use of org.mycore.iview.tests.controller.SideBarController 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 2 with SideBarController

use of org.mycore.iview.tests.controller.SideBarController 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 3 with SideBarController

use of org.mycore.iview.tests.controller.SideBarController 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)

Aggregations

Test (org.junit.Test)3 ImageViewerController (org.mycore.iview.tests.controller.ImageViewerController)3 SideBarController (org.mycore.iview.tests.controller.SideBarController)3 ToolBarController (org.mycore.iview.tests.controller.ToolBarController)3 UnsupportedCommandException (org.openqa.selenium.UnsupportedCommandException)2