Beispiel #1
0
  @Test
  public void testPopupLayerVisibleByPageLoad() {
    testAppFunctionalPage("/components/popuplayer/popupLayerVisibleByLoad.jsf");

    PopupLayerInspector popupLayer = popupLayer("formID:visible");
    popupLayer.assertVisible(true);
    element("formID:submit").clickAndWait();
    popupLayer.assertVisible(true);
  }
Beispiel #2
0
  // showPopupLayerAtXY
  @Test
  public void testShowPopupLayerAtXYJSFunction() {
    testAppFunctionalPage("/components/popuplayer/popupLayerJSFunctions.jsf");

    PopupLayerInspector popupLayer = popupLayer("formID:showAtXY");

    element("showPopupLayerAtXY").click();
    popupLayer.assertVisible(true);

    element("formID:submit").clickAndWait();
    popupLayer.assertVisible(true);
    popupLayer.assertPosition(250, 250);
  }
Beispiel #3
0
  @Test
  public void testStyling() {
    testAppFunctionalPage("/components/popuplayer/popupLayerStyling.jsf");
    PopupLayerInspector popupLayer = popupLayer("formID:styled");

    popupLayer.assertStyle(
        "width: 400px; height: 200px; border: 2px solid crimson; background: mistyrose; "
            + "text-decoration: underline; font-weight: bold; text-align:center; left: 200px; top: 200px;");

    popupLayer.mouseOver();
    popupLayer.mouseMove();

    popupLayer.assertStyle(
        "width: 450px; height: 250px; border: 3px dashed springgreen; background: azure; "
            + "text-decoration: overline; font-weight: lighter;");
  }
Beispiel #4
0
  // showPopupLayer, hidePopupLayer
  @Test
  public void testShowHideJSFunctions() {
    testAppFunctionalPage("/components/popuplayer/popupLayerJSFunctions.jsf");

    PopupLayerInspector popupLayer = popupLayer("formID:showHide");
    // show PopupLayer
    popupLayer.assertVisible(false);
    element("showPopupLayer").click();
    popupLayer.assertVisible(true);

    // make submit and check is PopupLayer in 'visible' state
    element("formID:submit").clickAndWait();
    popupLayer.assertVisible(true);

    // hide PopupLayer
    element("hidePopupLayer").click();
    popupLayer.assertVisible(false);
  }
Beispiel #5
0
  // showCentered
  @Test
  public void testShowPopupLayerCenteredJSFunction() {
    testAppFunctionalPage("/components/popuplayer/popupLayerJSFunctions.jsf");

    PopupLayerInspector popupLayer = popupLayer("formID:centered");
    element("showCentered").click();

    int popupLayerWidth = 200;
    int popupLayerHeight = 200;
    Dimension windowSize = window().size();

    Point popupLayerPos = popupLayer.position();
    assertTrue(Math.abs(popupLayerPos.x - (windowSize.width - popupLayerWidth) / 2) <= 3);
    assertTrue(Math.abs(popupLayerPos.y - (windowSize.height - popupLayerHeight) / 2) <= 3);

    popupLayer.assertVisible(true);
    element("formID:submit").clickAndWait();
    popupLayer.assertVisible(true);
  }
Beispiel #6
0
 @Test
 public void testReRenderThroughA4J() {
   testAppFunctionalPage("/components/popuplayer/popupLayer_a4j.jsf");
   PopupLayerInspector popupLayer = popupLayer("formID:popupLayerID");
   popupLayer.assertElementExists();
   popupLayer.assertVisible(false);
   element("formID:buttonID").click();
   String oldValue = popupLayer.text();
   popupLayer.assertVisible(true);
   element("formID:popupCloser").click();
   popupLayer.assertVisible(false);
   element("formID:refresher").click();
   RichFacesAjaxLoadingMode.getInstance().waitForLoad();
   element("formID:buttonID").click();
   String newValue = popupLayer.text();
   popupLayer.assertVisible(true);
   element("formID:popupCloser").click();
   popupLayer.assertVisible(false);
   popupLayer.assertElementExists();
   assertFalse(newValue.equals(oldValue));
 }
Beispiel #7
0
  // setPopupLayerLeft, setPopupLayerTop
  @Test
  public void testSetTopAndLeftJSFunctions() {
    testAppFunctionalPage("/components/popuplayer/popupLayerJSFunctions.jsf");

    PopupLayerInspector popupLayer = popupLayer("formID:setLeftTop");

    popupLayer.assertVisible(false);
    InputInspector leftCoordinateInput = new InputInspector("leftCoodinate");
    leftCoordinateInput.type("100");
    InputInspector topCoordinateInput = new InputInspector("topCoodinate");
    topCoordinateInput.type("200");
    ElementInspector topLeftButton = element("setPopupLayerTopLeft");
    topLeftButton.click();

    popupLayer.assertVisible(true);
    element("formID:submit").clickAndWait();
    popupLayer.assertVisible(true);

    popupLayer.assertPosition(100, 200);

    leftCoordinateInput.type("300");
    topCoordinateInput.type("500");
    topLeftButton.click();

    popupLayer.assertPosition(300, 500);
  }