Package org.seleniuminspector.openfaces

Examples of org.seleniuminspector.openfaces.TreeTableInspector


    @Ignore
    public void testThereIsNoJSErrorOnAjaxTreeTableReloading() {
        Selenium selenium = getSelenium();
        liveDemoPage("/treetable/TreeTable_selectionAndKeyboard.jsf");
        assertTrue(selenium.getLocation().endsWith("/treetable/TreeTable_selectionAndKeyboard.jsf"));
        TreeTableInspector treeTable = treeTable("form1:requestsTreeTable");
        treeTable.bodyRow(1).click();
        treeTable.bodyRow(1).doubleClick();
        OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
        treeTable.bodyRow(2).clickAndWait(OpenFacesAjaxLoadingMode.getInstance());
    }
View Full Code Here


                getDriver().findElement(By.id("formID:multipleSelectionTreeTableID:0:categoryID")))
                .click();
        click.build().perform();
//        categoryOutput.click();

        TreeTableInspector multipleSelectionTreeTable = treeTable("formID:multipleSelectionTreeTableID");
        multipleSelectionTreeTable.focus();
        /*check keyboard navigation and selection*/
        //select root nodes
        for (int i = 0; i < 5; i++) {
            createEvent(multipleSelectionTreeTable, null, EventType.KEY, "keypress", KeyEvent.VK_DOWN, true);
        }
        ElementInspector emptyElement = element("empty");
        emptyElement.assertText("  0 1 2 3 4 5");

        for (int i = 0; i < 6; i++) {
            multipleSelectionTreeTable.getElementsByTagName("img").get(i).clickAndWait(OpenFacesAjaxLoadingMode.getInstance());
        }

        categoryOutput.click();
        for (int i = 0; i < 25; i++) {
            createEvent(multipleSelectionTreeTable, null, EventType.KEY, "keypress", KeyEvent.VK_DOWN, true);
        }


        emptyElement.assertText("  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24");
        for (int i = 0; i < 6; i++) {
            multipleSelectionTreeTable.getElementsByTagName("img").get(i).clickAndWait(OpenFacesAjaxLoadingMode.getInstance());
        }

        categoryOutput.click();
        for (int i = 0; i < 5; i++) {
            createEvent(element("formID:multipleSelectionTreeTableID"), null, EventType.KEY, "keypress", KeyEvent.VK_DOWN, true);
        }
        emptyElement.assertText("  0 3 15 18 20 23");

        /*check 'nodePaths' and 'nodeDatas' attributes*/
        //verify is attributes took right initial values
        ElementInspector nodePathsOutput = element("formID:nodePathsID");
        nodePathsOutput.assertText("Document BrowsingNetwork Access");
        ElementInspector nodeDataOutput = element("formID:nodeDatasID");
        nodeDataOutput.assertText("Document BrowsingDocument Deletion");
        ElementInspector selectionNodePathsDiv = element("selectionNodePathsID");
        selectionNodePathsDiv.assertText("  1 5");
        ElementInspector selectionNodeDataDiv = element("selectionNodeDatasID");
        selectionNodeDataDiv.assertText("  1 4");

        //check root nodes
        element("formID:multipleNodePathsSelectionTreeTableID:0:categoryID").click();
        TreeTableInspector multipleNodePathsTreeTable = treeTable("formID:multipleNodePathsSelectionTreeTableID");
        Actions down = new Actions(getDriver()).moveToElement(
                getDriver().findElement(By.xpath(multipleNodePathsTreeTable.getXPath())))
                .sendKeys(Keys.ARROW_DOWN);
        down.build().perform();
//        multipleNodePathsTreeTable.keyPress(Keys.ARROW_DOWN);
        element("formID:multipleNodeDatasSelectionTreeTableID:0:categoryID").click();
        TreeTableInspector multipleNodeDataTreeTable = treeTable("formID:multipleNodeDatasSelectionTreeTableID");
        down = new Actions(getDriver()).moveToElement(
                getDriver().findElement(By.xpath(multipleNodeDataTreeTable.getXPath())))
                .sendKeys(Keys.ARROW_DOWN);
        down.build().perform();
//        multipleNodeDataTreeTable.keyPress(Keys.ARROW_DOWN);

        //check root + expanded child nodes
        element("formID:multipleNodePathsSelectionTreeTableID:4:categoryID").click();

        //click right arrow
        Actions right = new Actions(getDriver()).moveToElement(
                getDriver().findElement(By.xpath(multipleNodeDataTreeTable.getXPath())))
                .sendKeys(Keys.ARROW_RIGHT);
        right.build().perform();
//        multipleNodePathsTreeTable.keyPress(Keys.ARROW_RIGHT);
        OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
        for (int i = 0; i < 3; i++) {
            createEvent(multipleNodePathsTreeTable, null, EventType.KEY, "keypress", KeyEvent.VK_DOWN, true);
        }

        click= new Actions(getDriver()).moveToElement(
                getDriver().findElement(By.id("formID:multipleNodeDatasSelectionTreeTableID:2:categoryID")))
                .click();
        click.build().perform();
//        element("formID:multipleNodeDatasSelectionTreeTableID:2:categoryID").click();
        multipleNodeDataTreeTable.keyPress(Keys.ARROW_RIGHT);
        OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
        for (int i = 0; i < 3; i++) {
            createEvent(multipleNodeDataTreeTable, null, EventType.KEY, "keypress", KeyEvent.VK_DOWN, true);
        }
        element("formID:submitID").clickAndWait();
View Full Code Here

     @Test
    public void testKeyboardNavigation() {
        testAppFunctionalPage("/components/treetable/treeTableKeyboardNavigation.jsf");

        TreeTableInspector treeTable = treeTable("formID:treeTableKeyboardNavigation");

        treeTable.focus();
//        Actions dpwn = new Actions(getDriver()).moveToElement(
//                getDriver().findElement(By.xpath(treeTable.bodyRow(0).getXPath())))
//                .sendKeys(getDriver().findElement(By.xpath(treeTable.bodyRow(0).getXPath())), Keys.ARROW_DOWN);
//        dpwn.build().perform();
        ElementInspector emptyElement = element("empty");
View Full Code Here

        testAppFunctionalPage("/components/treetable/treeTableStaticStructure.jsf");
        TabSetInspector loadingModes = tabSet("formID:loadingModes");
        if (loadingMode instanceof ServerLoadingMode) {
            loadingModes.tabs().get(1).clickAndWait(loadingMode);
        }
        TreeTableInspector treeTable = treeTable("formID:treeTableStaticStructureID");
        treeTable.bodyRow(0).cell(0).assertText("Colors");

        treeTable.bodyRow(0).expansionToggle().clickAndWait(loadingMode);
        treeTable.bodyRow(1).cell(0).assertText("Warm colors");
        treeTable.bodyRow(2).cell(0).assertText("Cold colors");

        treeTable.bodyRow(1).expansionToggle().clickAndWait(loadingMode);
        treeTable.bodyRow(2).cell(0).assertText("Red");
        treeTable.bodyRow(3).cell(0).assertText("Yellow");

        treeTable.bodyRow(4).expansionToggle().clickAndWait(loadingMode);
        treeTable.bodyRow(5).cell(0).assertText("Blue");
        treeTable.bodyRow(6).cell(0).assertText("Purple");

        if (loadingMode instanceof ServerLoadingMode) {
            // reset page index for further test to run correctly
            loadingModes.tabs().get(0).clickAndWait(loadingMode);
        }
View Full Code Here

        TabSetInspector loadingModes = tabSet("formID:loadingModes");
        if (loadingMode instanceof ServerLoadingMode) {
            loadingModes.tabs().get(1).clickAndWait(loadingMode);
        }

        TreeTableInspector treeTable1 = treeTable("formID:treeTableStaticStructureID");
        /* check simple sorting in static TreeTable */
        treeTable1.headerRow(0).cell(0).clickAndWait(loadingMode);
        treeTable1.toggleAllNodes(loadingMode);
        // verify TreeTable content after corting
        treeTable1.assertBodyRowTexts("Colors", "Cold colors", "Purple", "purple", "Warm colors", "Red", "Yellow");
        // perform sorting and content verification for expanded TreeTable
        treeTable1.headerRow(0).cell(0).clickAndWait(loadingMode);
        treeTable1.assertBodyRowTexts("Colors", "Warm colors", "Yellow", "Red", "Cold colors", "purple", "Purple");

        /* check dynamic sortable TreeTable with sortLevel = 0 */
        TreeTableInspector treeTable2 = treeTable("formID:sortLevelZero");
        treeTable2.headerRow(0).cell(0).clickAndWait(loadingMode);
        treeTable2.assertBodyRowTexts("Document Browsing", "Document Creation",
                "Document Deletion", "Document Modification", "Network Access", "User Management");
        treeTable2.toggleAllNodes(loadingMode);
        // verify TreeTable content after sorting
        treeTable2.assertBodyRowTexts("Document Browsing", "Guest", "Regular User 1", "Regular User 2", "Regular User 3", "Regular User 4",
                "Regular User 5", "Regular User 6", "Regular User 7", "Regular User 8", "Regular User 9", "Regular User 10", "Document Creation",
                "Administrator", "Ivan Ivanych", "Document Deletion", "Semen Semenych", "Ivan Ivanych", "Document Modification", "Ivan Ivanych",
                "Network Access", "Ivan Ivanych", "User Management", "Manager", "Administrator");
        // perform sorting and content verification for expanded TreeTable
        element("formID:sortLevelZero:sortLevelZero_header").clickAndWait(loadingMode);
        treeTable2.assertBodyRowTexts("User Management", "Manager", "Administrator", "Network Access", "Ivan Ivanych",
                "Document Modification", "Ivan Ivanych", "Document Deletion", "Semen Semenych", "Ivan Ivanych",
                "Document Creation", "Administrator", "Ivan Ivanych", "Document Browsing", "Guest", "Regular User 1",
                "Regular User 2", "Regular User 3", "Regular User 4", "Regular User 5", "Regular User 6", "Regular User 7",
                "Regular User 8", "Regular User 9", "Regular User 10");

        /* check dynamic sortable TreeTable with sortLevel = 1 */
        TreeTableInspector treeTable3 = treeTable("formID:sortLevelOne");
        treeTable3.headerRow(0).cell(0).clickAndWait(loadingMode);
        treeTable3.assertBodyRowTexts("User Management", "Document Browsing",
                "Document Creation", "Document Modification", "Document Deletion", "Network Access");
        treeTable3.toggleAllNodes(loadingMode);
        treeTable3.assertBodyRowTexts("User Management", "Administrator", "Manager", "Document Browsing",
                "Guest", "Regular User 1", "Regular User 10", "Regular User 2", "Regular User 3", "Regular User 4",
                "Regular User 5", "Regular User 6", "Regular User 7", "Regular User 8", "Regular User 9", "Document Creation",
                "Administrator", "Ivan Ivanych", "Document Modification", "Ivan Ivanych", "Document Deletion", "Ivan Ivanych",
                "Semen Semenych", "Network Access", "Ivan Ivanych");
        // perform sorting and content verification for expanded TreeTable
        treeTable3.headerRow(0).cell(0).clickAndWait(loadingMode);
        treeTable3.assertBodyRowTexts("User Management", "Manager", "Administrator",
                "Document Browsing", "Regular User 9", "Regular User 8", "Regular User 7", "Regular User 6", "Regular User 5",
                "Regular User 4", "Regular User 3", "Regular User 2", "Regular User 10", "Regular User 1", "Guest", "Document Creation",
                "Ivan Ivanych", "Administrator", "Document Modification", "Ivan Ivanych", "Document Deletion", "Semen Semenych",
                "Ivan Ivanych", "Network Access", "Ivan Ivanych");

        /* check TreeTable with binded ' sortingComparator' */
        TreeTableInspector treeTable4 = treeTable("formID:treeTableBindedSortingComparatorID");
        treeTable4.toggleAllNodes(loadingMode);

        treeTable4.headerRow(0).cell(0).clickAndWait(loadingMode);
        treeTable4.assertBodyRowTexts("Colors", "Middle", "Blue", "Green", "Cold colors", "Purple", "Blue Dark");

        treeTable4.headerRow(0).cell(0).clickAndWait(loadingMode);
        treeTable4.assertBodyRowTexts("Colors", "Cold colors", "Blue Dark", "Purple", "Middle", "Green", "Blue");

        /* check TreeTable with binded ' sortingComparator=caseInsensitiveText' */
        TreeTableInspector treeTable5 = treeTable("formID:treeTableSortingComparatorID");
        treeTable5.headerRow(0).cell(0).clickAndWait(loadingMode);
        treeTable5.toggleAllNodes(loadingMode);
        treeTable5.assertBodyRowTexts("Colors", "Cold colors", "purple", "Purple");

        treeTable5.headerRow(0).cell(0).clickAndWait(loadingMode);
        treeTable5.assertBodyRowTexts("Colors", "Cold colors", "purple", "Purple");

        if (loadingMode instanceof ServerLoadingMode) {
            // reset page index for further test to run correctly
            loadingModes.tabs().get(0).clickAndWait(loadingMode);
        }
View Full Code Here

        testAppFunctionalPage("/components/treetable/treeTableCellRowsEvents.jsf");

        String cellPath = "tbody[0]/tr[0]/td[0]";

        ElementInspector output = element("output");
        TreeTableInspector onclickTreeTable = treeTable("formID:onclickTT");
        //<o:cell> onclick
        createEvent(onclickTreeTable, cellPath, EventType.MOUSE, "click", 0, false);
        output.assertContainsText("onclick works");
        output.assertContainsText("click");

        //<o:cell> ondblclick
        createEvent(onclickTreeTable, cellPath, EventType.MOUSE, "dblclick", 0, false);
        output.assertContainsText("ondblclick works");
        output.assertContainsText("dblclick");

        ElementInspector output1 = element("output1");
        TreeTableInspector onMouseDownTreeTable = treeTable("formID:onmouseDownUpTT");
        //<o:cell> onmousedown
        createEvent(onMouseDownTreeTable, cellPath, EventType.MOUSE, "mousedown", 0, false);
        output1.assertContainsText("onmousedown works");
        output1.assertContainsText("mousedown");

        //<o:cell> onmouseup
        createEvent(onMouseDownTreeTable, cellPath, EventType.MOUSE, "mouseup", 0, false);
        output1.assertContainsText("onmouseup works");
        output1.assertContainsText("mouseup");

        ElementInspector cell = element("formID:onkeyTT").subElement(cellPath);
        ElementInspector output2 = element("output2");
        TreeTableInspector onkeyTreeTable = treeTable("formID:onkeyTT");
        //<o:cell> onkeydown
        cell.evalExpression("focus()");
        createEvent(onkeyTreeTable, cellPath, EventType.KEY, "keydown", 49, false);
        output2.assertContainsText("onkeydown works");
        output2.assertContainsText("keydown");

        //<o:cell> onkeypress
        cell.evalExpression("focus()");
        createEvent(onkeyTreeTable, cellPath, EventType.KEY, "keypress", 49, false);
        output2.assertContainsText("onkeypress works");
        output2.assertContainsText("keypress");

        //<o:cell> onkeyup
        cell.evalExpression("focus()");
        createEvent(onkeyTreeTable, cellPath, EventType.KEY, "keyup", 49, false);
        output2.assertContainsText("onkeyup works");
        output2.assertContainsText("keyup");

        ElementInspector output3 = element("output3");
        TreeTableInspector onMouseTreeTable = treeTable("formID:onMouseOverOutMoveTT");
        //<o:cell> onmouseover
        createEvent(onMouseTreeTable, cellPath, EventType.MOUSE, "mouseover", 0, false);
        output3.assertContainsText("onmouseover works");
        output3.assertContainsText("mouseover");

        //<o:cell> onmouseout
        createEvent(onMouseTreeTable, cellPath, EventType.MOUSE, "mouseout", 0, false);
        output3.assertContainsText("onmouseout works");
        output3.assertContainsText("mouseout");

        //<o:cell> onmousemove
        createEvent(onMouseTreeTable, cellPath, EventType.MOUSE, "mousemove", 0, false);
        output3.assertContainsText("onmousemove works");
        output3.assertContainsText("mousemove");

        String rowPath = "tbody[0]/tr[0]/td[0]";

        ElementInspector output01 = element("output01");
        TreeTableInspector rowOnclickTreeTable = treeTable("formID:rowOnclickTT");
        //<o:row> onclick
        createEvent(rowOnclickTreeTable, rowPath, EventType.MOUSE, "click", 0, false);
        output01.assertContainsText("row onclick works");
        output01.assertContainsText("row event type: click");

        //<o:row> ondblclick
        createEvent(rowOnclickTreeTable, rowPath, EventType.MOUSE, "dblclick", 0, false);
        output01.assertContainsText("row ondblclick works");
        output01.assertContainsText("row event type: dblclick");

        ElementInspector output11 = element("output11");
        TreeTableInspector rowOnmouseDownUp = treeTable("formID:rowOnmouseDownUpTT");
        //<o:row> onmousedown
        createEvent(rowOnmouseDownUp, rowPath, EventType.MOUSE, "mousedown", 0, false);
        output11.assertContainsText("row onmousedown works");
        output11.assertContainsText("row event type: mousedown");

        //<o:row> onmouseup
        createEvent(rowOnmouseDownUp, rowPath, EventType.MOUSE, "mouseup", 0, false);
        output11.assertContainsText("row onmouseup works");
        output11.assertContainsText("row event type: mouseup");

        ElementInspector output21 = element("output21");
        TreeTableInspector rowOnkeyTreeTable = treeTable("formID:rowOnkeyTT");
        //<o:row> onkeydown
        ElementInspector row = rowOnclickTreeTable.subElement(rowPath);
        row.evalExpression("focus()");
        createEvent(rowOnkeyTreeTable, rowPath, EventType.KEY, "keydown", 49, false);
        output21.assertContainsText("row onkeydown works");
        output21.assertContainsText("row event type: keydown");

        //<o:row> onkeypress
        row.evalExpression("focus()");
        createEvent(rowOnkeyTreeTable, rowPath, EventType.KEY, "keypress", 49, false);
        output21.assertContainsText("row onkeypress works");
        output21.assertContainsText("row event type: keypress");

        //<o:row> onkeyup
        row.evalExpression("focus()");
        createEvent(rowOnkeyTreeTable, rowPath, EventType.KEY, "keyup", 49, false);
        output21.assertContainsText("row onkeyup works");
        output21.assertContainsText("row event type: keyup");

        ElementInspector output31 = element("output31");
        TreeTableInspector rowOnMouseOverOutMove = treeTable("formID:rowOnMouseOverOutMoveTT");
        //<o:row> onmouseover
        createEvent(rowOnMouseOverOutMove, rowPath, EventType.MOUSE, "mouseover", 0, false);
        output31.assertContainsText("row onmouseover works");
        output31.assertContainsText("row event type: mouseover");
View Full Code Here

    //todo: selection test is absent
     @Test
    public void testTreeTableInside() {
        testAppFunctionalPage("/components/foldingpanel/treeTableIn.jsf");

        TreeTableInspector treeTable = treeTable("fn:treeTableID");
        treeTable.assertElementExists(false);
        foldingPanel("fn:treeTableFoldingPanel").toggle().clickAndWait(OpenFacesAjaxLoadingMode.getInstance());

        treeTable.assertElementExists(true);
        treeTable.assertVisible(true);

        for (int i = 1; i < 4; i++) {
            window().document().getElementsByTagName("img").get(i).clickAndWait(OpenFacesAjaxLoadingMode.getInstance());
        }

        treeTable.column(0).makeSorting();
        treeTable.column(0).filter(InputTextFilterInspector.class, "fn:treeTableID:filter1").makeFiltering("colors");
    }
View Full Code Here

TOP

Related Classes of org.seleniuminspector.openfaces.TreeTableInspector

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.