// 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); }
@Test public void testPopupLayerVisibleByPageLoad() { testAppFunctionalPage("/components/popuplayer/popupLayerVisibleByLoad.jsf"); PopupLayerInspector popupLayer = popupLayer("formID:visible"); popupLayer.assertVisible(true); element("formID:submit").clickAndWait(); popupLayer.assertVisible(true); }
// 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); }
// 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); }
// 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); }
@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)); }