Package org.seleniuminspector.openfaces

Examples of org.seleniuminspector.openfaces.InputTextInspector


        element("form1:link3").clickAndWait(OpenFacesAjaxLoadingMode.getInstance());
        counter.assertText("6"); // standalone invokation

        // check operation with <h:inputText> -- a non-default event, delay

        InputTextInspector inputText = inputText("form1:input1");
        inputText.typeKeys("1");
        sleep(100);
        inputText.typeKeys("2");
        OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
        counter.assertText("7"); // check direct embedding
        inputText = inputText("form1:input2");
        inputText.typeKeys("1");
        sleep(100);
        inputText.typeKeys("2");
        OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
        counter.assertText("8"); // check attaching with "for" attribute
        inputText = inputText("form1:input3");
        inputText.typeKeys("1");
        sleep(100);
        inputText.typeKeys("2");
        OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
        counter.assertText("9"); // standalone invokation

        // check operation with <h:graphicImage> -- a case for a typical JSF component without special implementation cases
        element("form1:image1").clickAndWait(OpenFacesAjaxLoadingMode.getInstance());
View Full Code Here


        ElementInspector value = element("formID:value");
        ElementInspector value2 = element("formID:value2");
        value.assertText("");
        value2.assertText("");
        InputTextInspector first = inputText("formID:first");
        InputTextInspector second = inputText("formID:second");
        first.assertValue("");
        second.assertValue("some prompt text");

        ElementInspector submit = element("formID:submit");

        // fill by empty values
        first.clear();
        second.clear();
        first.assertValue("");
        second.assertValue("");
//        second.fireEvent("onblur");
        value.click(); // onblur
        second.assertValue("some prompt text");
        submit.clickAndWait();
        value.assertText("");
        value2.assertText("");
        first.assertValue("");
        second.assertValue("some prompt text");

        // type own value
        // fill by empty values
        first.clear();
        second.clear();
        first.type("val1");
        first.assertValue("val1");
        second.type("val2");
        second.assertValue("val2");
        submit.clickAndWait();
        value.assertText("val1");
        value2.assertText("val2");
        first.assertValue("val1");
        second.assertValue("val2");
    }
View Full Code Here

        ElementInspector value = element("formID:value");
        ElementInspector value2 = element("formID:value2");
        value.assertText("");
        value2.assertText("");
        InputTextInspector first = inputText("formID:first");
        InputTextInspector second = inputText("formID:second");
        first.assertValue("");
        second.assertValue("some prompt text");

        first.focus();
        first.assertValue("");
        first.fireEvent("onblur");
        first.assertValue("");

        second.focus();
        second.assertValue("");
        second.fireEvent("onblur");
        second.assertValue("some prompt text");

        first.type("val1");
        first.assertValue("val1");
        first.fireEvent("onblur");
        first.assertValue("val1");

        second.type("val2");
        second.assertValue("val2");
        second.fireEvent("onblur");
        second.assertValue("val2");
    }
View Full Code Here

        element("formID:submit").clickAndWait();
        checkStyles();
    }

    private void checkStyles() {
        InputTextInspector firstInput = inputText("formID:first");
        InputTextInspector secondInput = inputText("formID:second");

        firstInput.assertStyle("background: yellow; border: 3px solid pink; color: brown; font-weight: lighter");
        firstInput.assertWidth(160, 6); // width: 160px in strict mode results in adding 3*2 border width to the resulting element width

        secondInput.assertStyle("background: beige; border: 3px solid pink; color: brown; font-weight: bold");
        secondInput.assertWidth(160, 6); // width: 160px in strict mode results in adding 3*2 border width to the resulting element width

        // focus elements
        // first input
        firstInput.fireEvent("onfocus");
        firstInput.assertStyle("background: beige; border: 1px solid green; color: brown; font-weight: bold");
        firstInput.assertWidth(160, 2);
        firstInput.fireEvent("onblur");

        // second input
        secondInput.fireEvent("onfocus");
        secondInput.assertStyle("background: beige; border: 1px solid green; color: brown; font-weight: bold");
        secondInput.assertWidth(160, 2);
        secondInput.fireEvent("onblur");

        // rollover elements
        // first input
        firstInput.mouseOver();
        firstInput.mouseMove();
        firstInput.assertStyle("background: red; border: 4px dotted darkblue; color: brown; font-weight: lighter");
        firstInput.assertWidth(160, 8);
        firstInput.mouseOut();

        // second input
        secondInput.mouseOver();
        secondInput.mouseMove();
        secondInput.assertStyle("background: red; border: 4px dotted darkblue; color: brown; font-weight: bold");
        secondInput.assertWidth(160, 8);
        secondInput.mouseOut();
    }
View Full Code Here

        // onmousedown
        element("formID:mouseupMousedown").mouseDown();
        assertTrue(selenium.isTextPresent("onmousedown works"));
        assertTrue(selenium.isTextPresent("mousedown"));

        InputTextInspector keyChangeInput = inputText("formID:keyChange");

        // onkeypress
        keyChangeInput.keyPress(KeyEvent.VK_O);
        assertTrue(selenium.isTextPresent("onkeypress works"));
        assertTrue(selenium.isTextPresent("keypress"));

        // onkeydown
        keyChangeInput.keyDown(KeyEvent.VK_P);
        assertTrue(selenium.isTextPresent("onkeydown works"));
        assertTrue(selenium.isTextPresent("keydown"));

        // onkeyup
        keyChangeInput.keyUp(KeyEvent.VK_E);
        assertTrue(selenium.isTextPresent("onkeyup works"));
        assertTrue(selenium.isTextPresent("keyup"));

        // onchange
        keyChangeInput.type("change");
        selenium.fireEvent("formID:keyChange", "blur");
        assertTrue(selenium.isTextPresent("onchange works"));
        assertTrue(selenium.isTextPresent("change"));

        // ondblclick
View Full Code Here

     @Test
    public void testReRenderingThroughA4J() {
        testAppFunctionalPage("/components/inputtext/inputText_a4j.jsf");

        InputTextInspector inputText = inputText("formID:inputTextID");
        inputText.assertValue("ajax4jsf");
        inputText.type("change value");
        element("formID:refresher").click();
        RichFacesAjaxLoadingMode.getInstance().waitForLoad();
        inputText.assertValue("ajax4jsf");
        inputText.assertWidth(230, 4);

        // check rollover style
        inputText.mouseOver();
        inputText.mouseMove();
        inputText.assertStyle("border: 2px dotted darkblue");
        inputText.assertWidth(230, 4);
        inputText.mouseOut();

//        inputText.type("");
        getDriver().findElement(By.xpath(inputText.getXPath())).clear();
        inputText.fireEvent("onblur");
        sleep(1000);
        inputText.assertValue("ajax4jsf prompt text");
        inputText.assertStyle("background: burlywood; color: #7e7e7e");
    }
View Full Code Here

     @Test
    public void testComponentWideValidation() throws InterruptedException {
        closeBrowser();
        testAppFunctionalPage("/components/validation/componentWideValidation.jsf");
        InputTextInspector doubleRangeInput = inputText("testForm:validDROnSubmit");
        doubleRangeInput.type("1");
        InputTextInspector urlInput = inputText("testForm:urlOnSubmit");
        urlInput.type("not url");
        ElementInspector submit = element("testForm:submitBt");

        submit.click();
        ElementInspector onSubmitMessage = element("testForm:inputOnSubmitMessage");
        onSubmitMessage.assertContainsText("Value is required.");
        ElementInspector dateChooserMessage = element("testForm:dchOnSubmitInput");
        dateChooserMessage.assertContainsText("Value is required.");
        ElementInspector doubleRangeMessage = element("testForm:ValidDROnSubmitMessage");
        doubleRangeMessage.assertContainsText("Validation Error");
        ElementInspector urlMessage = element("testForm:UrlOnSubmitMessage");
        urlMessage.assertText("Validation error occurs Entered value is not url");
        ElementInspector inputOffMessage = element("testForm:inputOffMessage");
        inputOffMessage.assertText("");
        ElementInspector dateChooserOffMessage = element("testForm:dchOffInput");
        dateChooserOffMessage.assertText("");
        ElementInspector dateRangeOffMessage = element("testForm:ValidDROffMessage");
        dateRangeOffMessage.assertText("");
        ElementInspector urlOffMessage = element("testForm:UrlOffMessage");
        urlOffMessage.assertText("");
        ElementInspector onDemandMessage = element("testForm:inputOnDemandMessage");
        onDemandMessage.assertText("");
        ElementInspector dateChooserOnDemandMessage = element("testForm:dchOnDemandInput");
        dateChooserOnDemandMessage.assertText("");
        ElementInspector doubleRangeOnDemandMessage = element("testForm:ValidDROnDemandMessage");
        doubleRangeOnDemandMessage.assertText("");
        ElementInspector urlOnDemandMessage = element("testForm:UrlOnDemandMessage");
        urlOnDemandMessage.assertText("");
        inputText("testForm:inputOnSubmit").clear();
        inputText("testForm:inputOnSubmit").type("Text");
        dateChooser("testForm:dchOnSubmit").field().type("Mar 20, 2007");
        doubleRangeInput.clear();
        doubleRangeInput.type("0.1");
        urlInput.clear();
        urlInput.type("http://www.teamdev.com");
        InputTextInspector doubleRangeOffInput = inputText("testForm:validDROff");
        doubleRangeOffInput.clear();
        doubleRangeOffInput.type("1");
        InputTextInspector urlOffInput = inputText("testForm:urlOff");
        urlOffInput.clear();
        urlOffInput.type("not url");
        InputTextInspector dobleRangeOnDemandInput = inputText("testForm:validDROnDemand");
        dobleRangeOnDemandInput.clear();
        dobleRangeOnDemandInput.type("1");
        InputTextInspector urlOnDemand = inputText("testForm:urlOnDemand");
        urlOnDemand.clear();
        urlOnDemand.type("not url");

        submit.click();
        waitForPageToLoad();
        onSubmitMessage.assertText("");
        dateChooserMessage.assertText("");
        doubleRangeMessage.assertText("");
        urlMessage.assertText("");
        inputOffMessage.assertContainsText("Value is required.");
        dateChooserOffMessage.assertContainsText("Value is required.");

        assertTrue(dateRangeOffMessage.text().contains("Validation Error: Specified attribute is not between the expected values of 0.001 and 0.999.") ||
                dateRangeOffMessage.text().contains("Validation Error"));

        urlOffMessage.assertContainsText("Validation error occurs Entered value is not url");
        onDemandMessage.assertContainsText("Value is required.");
        dateChooserOnDemandMessage.assertContainsText("Value is required.");

        assertTrue(doubleRangeOnDemandMessage.text().contains("Validation Error: Specified attribute is not between the expected values of 0.001 and 0.999.") ||
                doubleRangeOnDemandMessage.text().contains("Validation Error"));

        urlOnDemandMessage.assertText("Validation error occurs Entered value is not url");
        inputText("testForm:inputOff").clear();
        inputText("testForm:inputOff").type("Text");
        dateChooser("testForm:dchOff").field().clear();
        dateChooser("testForm:dchOff").field().type("Mar 20, 2007");
        doubleRangeOffInput.clear();
        doubleRangeOffInput.type("0.1");
        inputText("testForm:urlOff").clear();
        inputText("testForm:urlOff").type("http://www.teamdev.com");
        inputText("testForm:inputOnDemand").clear();
        inputText("testForm:inputOnDemand").type("Text");
        dateChooser("testForm:dchOnDemand").field().clear();
        dateChooser("testForm:dchOnDemand").field().type("Mar 20, 2007");
        dobleRangeOnDemandInput.clear();
        dobleRangeOnDemandInput.type("0.1");
        urlOnDemand.clear();
        urlOnDemand.type("http://www.teamdev.com");
        submit.click();
        waitForPageToLoad();
        onSubmitMessage.assertText("");
        dateChooserMessage.assertText("");
        doubleRangeMessage.assertText("");
View Full Code Here

        assertTrue(selenium.isTextPresent("onclick works"));
        assertTrue(selenium.isTextPresent("click"));

        //onkeydown
        element("formID:onkeydownShowID").click();
        InputTextInspector keyDownInput = inputText("formID:keydown_input");
        keyDownInput.keyDown(KeyEvent.VK_M);
        assertTrue(selenium.isTextPresent("onkeydown works"));
        assertTrue(selenium.isTextPresent("keydown"));

        //ondblclick
        element("formID:ondblclickShowID").click();
        element("formID:ondblclickPopup").doubleClick();
        assertTrue(selenium.isTextPresent("ondblclick works"));
        assertTrue(selenium.isTextPresent("dblclick"));

        //onmouseup
        element("formID:onmouseupShowID").click();
        element("formID:onmouseupPopup").mouseUp();
        assertTrue(selenium.isTextPresent("onmouseup works"));
        assertTrue(selenium.isTextPresent("mouseup"));

        //onmouseover
        element("formID:onmouseoverShowID").click();
        element("formID:onmouseoverPopup").mouseOver();
        assertTrue(selenium.isTextPresent("onmouseover works"));
        assertTrue(selenium.isTextPresent("mouseover"));

        //onmouseout
        element("formID:onmouseoutShowID").click();
        element("formID:onmouseoutPopup").mouseOut();
        assertTrue(selenium.isTextPresent("onmouseout works"));
        assertTrue(selenium.isTextPresent("mouseout"));

        //onmousemove
        element("formID:onmousemoveShowID").click();
        element("formID:onmousemovePopup").mouseMove();
        assertTrue(selenium.isTextPresent("onmousemove works"));
        assertTrue(selenium.isTextPresent("mousemove"));

        //onmousedown
        element("formID:onmousedownShowID").click();
        element("formID:onmousedownPopup").mouseDown();
        assertTrue(selenium.isTextPresent("onmousedown works"));
        assertTrue(selenium.isTextPresent("mousedown"));

        //onkeyup
        selenium.click("formID:onkeyupShowID");
        InputTextInspector keyUpInput = inputText("formID:keyup_input");
        keyUpInput.keyUp(KeyEvent.VK_M);
        assertTrue(selenium.isTextPresent("onkeyup works"));
        assertTrue(selenium.isTextPresent("keyup"));

        //onkeypress
        element("formID:onkeypressShowID").click();
        InputTextInspector keyPressInput = inputText("formID:keypress_input");
        keyPressInput.keyPress(KeyEvent.VK_M);
        assertTrue(selenium.isTextPresent("onkeypress works"));
        assertTrue(selenium.isTextPresent("keypress"));

        //todo: implement checking of this two client-side events
/*
 
View Full Code Here

        ForEachInspector forEach = forEach("formID:fe7");

        ElementInspector key0 = forEach.item(0, "hot1");
        ElementInspector key1 = forEach.item(1, "hot1");
        ElementInspector key2 = forEach.item(2, "hot1");
        InputTextInspector value0 = forEach.item(0, "qit1", InputTextInspector.class);
        InputTextInspector value1 = forEach.item(1, "qit1", InputTextInspector.class);
        InputTextInspector value2 = forEach.item(2, "qit1", InputTextInspector.class);

        key0.assertText("a. ");
        key1.assertText("b. ");
        key2.assertText("c. ");
        value0.assertValue("item A");
        value1.assertValue("item B");
        value2.assertValue("item C");

        value0.clear();
        value1.clear();
        value2.clear();
        value0.type("item F");
        value1.type("item E");
        value2.type("item D");
        selenium.submit("formID");
        waitForPageToLoad();

        key0.assertText("a. ");
        key1.assertText("b. ");
        key2.assertText("c. ");
        value0.assertValue("item F");
        value1.assertValue("item E");
        value2.assertValue("item D");
    }
View Full Code Here

TOP

Related Classes of org.seleniuminspector.openfaces.InputTextInspector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.