Package org.seleniuminspector

Examples of org.seleniuminspector.ElementInspector


        element("valueGetter").click();
        element("out1").assertText("Red");

        element("openDropDown").click();
        dropDownField.popup().assertVisible(true);
        ElementInspector out2Element = element("out2");
        out2Element.assertText("true");

        sleep(5500);
        dropDownField.popup().assertVisible(false);
        out2Element.assertText("false");

        element("formID:submit").clickAndWait();
        element("formID:valueDD").assertText("Value: Red");
    }
View Full Code Here


    }

    protected void checkValueChangeListener(String pageUrl) {
        testAppFunctionalPage(pageUrl);

        ElementInspector asAttributeOutput = element("formID:asAttributeOutput");
        ElementInspector asTagOutput = element("formID:asTagOutput");
        asAttributeOutput.assertText("0");
        asTagOutput.assertText("false");

        dropDownField("formID:asAttributeDD").field().type("Yellow");
        dropDownField("formID:asTagDD").field().type("Yellow");

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

        asAttributeOutput.assertText("1");
        asTagOutput.assertText("true");
    }
View Full Code Here

public class TabbedPaneTest extends OpenFacesTestCase {
     @Test
    public void testReRenderThroughA4J() {
        testAppFunctionalPage("/components/tabbedpane/tabbedPane_a4j.jsf");

        ElementInspector firstTab = element("formID:tab_first");
        String oldTabFirst = firstTab.text();
        ElementInspector secondTab = element("formID:tab_second");
        String oldTabSecond = secondTab.text();
        ElementInspector firstContent = element("formID:first_content");
        String oldContentFirst = firstContent.text();

        secondTab.clickAndWait(OpenFacesAjaxLoadingMode.getInstance());
        ElementInspector secondContent = element("formID:second_content");
        String oldContentSecond = secondContent.text();

        element("formID:refresher").click();

        RichFacesAjaxLoadingMode.getInstance().waitForLoad();

        String newTabFirst = firstTab.text();
        String newTabSecond = secondTab.text();
        String newContentSecond = secondContent.text();

        firstTab.clickAndWait(OpenFacesAjaxLoadingMode.getInstance());
        String newContentFirst = firstContent.text();
        assertFalse(newTabFirst.equals(oldTabFirst));
        assertFalse(newTabSecond.equals(oldTabSecond));
View Full Code Here

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

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

        //onmouseup
        test2.mouseUp();
        assertTrue(selenium.isTextPresent("onmouseup works"));
        assertTrue(selenium.isTextPresent("mouseup"));

        ElementInspector test3 = element("formID:test3");
        //onmouseover
        test3.mouseOver();
        assertTrue(selenium.isTextPresent("onmouseover works"));
        assertTrue(selenium.isTextPresent("mouseover"));

        //onmouseout
        test3.mouseOut();
        assertTrue(selenium.isTextPresent("onmouseout works"));
        assertTrue(selenium.isTextPresent("mouseout"));

        //onmousemove
        element("formID:test4").mouseMove();
View Full Code Here

        InputInspector firstTab = new InputInspector("formID:tab_first_a4j");
        String oldTabFirst = firstTab.value();
        InputInspector secondTab = new InputInspector("formID:tab_second_a4j");
        String oldTabSecond = secondTab.value();
        ElementInspector firstTabContent = element("formID:first_content_a4j");
        String oldContentFirst = firstTabContent.text();

        secondTab.clickAndWait(OpenFacesAjaxLoadingMode.getInstance());
        ElementInspector secondTabContent = element("formID:second_content_a4j");
        String oldContentSecond = secondTabContent.text();

        element("formID:refresher_a4j").click();

        RichFacesAjaxLoadingMode.getInstance().waitForLoad();

        String newTabFirst = firstTab.value();
        String newTabSecond = secondTab.value();
        String newContentSecond = secondTabContent.text();

        firstTab.clickAndWait(OpenFacesAjaxLoadingMode.getInstance());
        String newContentFirst = firstTabContent.text();
        assertFalse(newTabFirst.equals(oldTabFirst));
        assertFalse(newTabSecond.equals(oldTabSecond));
View Full Code Here

    }

    private void checkSelectionChangeListener(LoadingMode loadingMode) {
        testAppFunctionalPage("/components/tabbedpane/tabbedPaneSelectionChangeListener.jsf");

        ElementInspector asAttributeOutputText = element("formID:asAttributeOutput");
        boolean initialValueAsAttribute = Boolean.parseBoolean(asAttributeOutputText.text());
        ElementInspector asTagOutputText = element("formID:asTagOutput");
        boolean initialValueAsTag = Boolean.parseBoolean(asTagOutputText.text());

        TabSetInspector loadingModesTabSet = tabSet("formID:loadingModes");

        if (loadingMode instanceof ClientLoadingMode) {
            loadingModesTabSet.tabs().get(1).clickAndWait();
        } else if (loadingMode instanceof ServerLoadingMode) {
            loadingModesTabSet.tabs().get(2).clickAndWait();
        }

        tabbedPane("formID:asAttribute").tabSet().tabs().get(1).clickAndWait(loadingMode);
        tabbedPane("formID:asTag").tabSet().tabs().get(1).clickAndWait(loadingMode);

        if (loadingMode instanceof  ClientLoadingMode|| loadingMode instanceof OpenFacesAjaxLoadingMode) {
            element("formID:submit").clickAndWait();
        }

        boolean resultantValueAsAttribute = Boolean.parseBoolean(asAttributeOutputText.text());
        boolean resultantValueAsTag = Boolean.parseBoolean(asTagOutputText.text());

        assertEquals(initialValueAsAttribute, !resultantValueAsAttribute);
        assertEquals(initialValueAsTag, !resultantValueAsTag);
    }
View Full Code Here

    private void checkSelectionChange(LoadingMode loadingMode) {
        testAppFunctionalPage("/components/tabbedpane/tabbedPaneChangeSelectionStyling.jsf");

        TabbedPaneInspector tabbedPane = tabbedPane("formID:" + loadingMode + "TP");
        ElementInspector firstPane = tabbedPane.contentPanes().get(0);
        ElementInspector secondPane = tabbedPane.contentPanes().get(1);
        ElementInspector firstTab = tabbedPane.tabSet().tabs().get(0);
        ElementInspector secondTab = tabbedPane.tabSet().tabs().get(1);

        verifyStyles(tabbedPane, 0);

        ElementInspector getSelectedElement = element(loadingMode + "GetSelected");
        getSelectedElement.click();
        ElementInspector emptyElement = element("empty_" + loadingMode);
        emptyElement.assertText("0");
        firstPane.assertText("First tab content");

        secondTab.click();
        loadingMode.waitForLoad();

        verifyStyles(tabbedPane, 1);
        getSelectedElement.click();
        emptyElement.assertText("1");
        secondPane.assertText("Second tab content");

        firstTab.click();
        if (loadingMode instanceof ServerLoadingMode) {
            loadingMode.waitForLoad();
        }
        verifyStyles(tabbedPane, 0);
        getSelectedElement.click();
        emptyElement.assertText("0");
        firstPane.assertText("First tab content");
    }
View Full Code Here

        firstPane.assertText("First tab content");
    }

    private void verifyStyles(TabbedPaneInspector tabbedPane, int selectedTabIndex) {
        TabSetInspector tabSet = tabbedPane.tabSet();
        ElementInspector firstTab = tabSet.tabs().get(0);
        ElementInspector secondTab = tabSet.tabs().get(1);
        ElementInspector firstPane = tabbedPane.contentPanes().get(0);
        ElementInspector secondPane = tabbedPane.contentPanes().get(1);
        String emptySpacePath_0 = "tbody[0]/tr[0]/td[0]";
        String emptySpacePath_1 = "tbody[0]/tr[0]/td[2]";
        String emptySpacePath_2 = "tbody[0]/tr[0]/td[4]";
        String containerPath = "tbody[0]/tr[0]/td[0]";

        // frontBorderStyle="2px solid orange"
        if (selectedTabIndex == 0) {
            firstTab.assertStyle("border-right: 2px solid orange; border-top: 2px solid orange");
            secondTab.assertStyle("border-bottom: 2px solid orange");
        } else if (selectedTabIndex == 1) {
            secondTab.assertStyle("border-right: 2px solid orange; border-top: 2px solid orange");
            firstTab.assertStyle("border-bottom: 2px solid orange");
        }

        firstPane.parentNode().assertStyle("border-right: 2px solid orange; border-bottom: 2px solid orange");
        tabSet.subElement(emptySpacePath_0).assertStyle("border-bottom: 2px solid orange");
        tabSet.subElement(emptySpacePath_1).assertStyle("border-bottom: 2px solid orange");
        tabSet.subElement(emptySpacePath_2).assertStyle("border-bottom: 2px solid orange");

        // backBorderStyle="3px dashed magenta"
        if (selectedTabIndex == 0) {
            secondTab.assertStyle("border-top: 3px dashed magenta; border-right: 3px dashed magenta");
        } else if (selectedTabIndex == 1) {
            firstTab.assertStyle("border-top: 3px dashed magenta; border-right: 3px dashed magenta");
        }

        // tabGapWidth="15"
        tabSet.subElement(emptySpacePath_0).assertWidth(15, 0);
        tabSet.subElement(emptySpacePath_1).assertWidth(15, 0);

        // containerStyle="background: gray; text-decoration: underline; color: red;"
        if (selectedTabIndex == 0) {
            firstPane.subElement(containerPath).assertStyle("background: gray; text-decoration: underline; color: red");
        } else if (selectedTabIndex == 1) {
            secondPane.subElement(containerPath).assertStyle("background: gray; text-decoration: underline; color: red");
        }

        // selectedTabStyle="background: DarkGreen; font-weight: bold; color: white;"
        if (selectedTabIndex == 0) {
            firstTab.assertStyle("background: DarkGreen; font-weight: bold; color: white");
        } else if (selectedTabIndex == 1) {
            secondTab.assertStyle("background: DarkGreen; font-weight: bold; color: white");
        }

        // tabEmptySpaceStyle="background: LightBlue;"
        tabSet.subElement(emptySpacePath_0).assertStyle("background: LightBlue");
        tabSet.subElement(emptySpacePath_1).assertStyle("background: LightBlue");
        tabSet.subElement(emptySpacePath_2).assertStyle("background: LightBlue");

        // tabStyle="color: red;"
        if (selectedTabIndex == 0) {
            secondTab.assertStyle("color: red");
        } else if (selectedTabIndex == 1) {
            firstTab.assertStyle("color: red");
        }

        // rolloverContainerStyle="background: red; font-weight: bold; color: gray;"
        if (selectedTabIndex == 0) {
            firstPane.mouseOver();
            firstPane.subElement(containerPath).assertStyle("background: red; font-weight: bold; color: gray");
        } else if (selectedTabIndex == 1) {
            secondPane.mouseOver();
            secondPane.subElement(containerPath).assertStyle("background: red; font-weight: bold; color: gray");
        }

        // rolloverStyle="border: 2px dashed brown;"
        tabbedPane.assertStyle("border: 2px dashed brown");
        if (selectedTabIndex == 0)
            firstPane.mouseOut();
        else if (selectedTabIndex == 1)
            secondPane.mouseOut();

        //todo: uncomment if JSFC-2996 is in 'fixed' state
        //rolloverSelectedTabStyle="background: pink;"
/*
    if (selectedTabIndex == 0) {
View Full Code Here

     @Test
    public void testCalendarInside() {
        testAppFunctionalPage("/components/tabbedpane/calendarIn.jsf");
        tabSet("fn:loadingModes").setTabIndex(1, ServerLoadingMode.getInstance());

        ElementInspector firstCalendar = element("fn:firstCalendar");
        firstCalendar.assertElementExists();
        firstCalendar.assertVisible(true);

        element("fn:secondHeader").click();
        ElementInspector secondCalendar = element("fn:secondCalendar");
        secondCalendar.assertElementExists();
        secondCalendar.assertVisible(true);
    }
View Full Code Here

     @Test
    public void testDynamicImageInside() {
        testAppFunctionalPage("/components/tabbedpane/dynamicImageIn.jsf");
        tabSet("fn:loadingModes").setTabIndex(1, ServerLoadingMode.getInstance());

        ElementInspector firstDynamicImage = element("fn:firstDynamicImageID");
        firstDynamicImage.assertElementExists();
        firstDynamicImage.assertVisible(true);

        ElementInspector secondDynamicImage = element("fn:secondDynamicImageID");
        secondDynamicImage.assertElementExists();
        secondDynamicImage.assertVisible(false);

        element("fn:secondTabID").click();
        secondDynamicImage.assertVisible(true);
    }
View Full Code Here

TOP

Related Classes of org.seleniuminspector.ElementInspector

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.