Package org.seleniuminspector.openfaces

Examples of org.seleniuminspector.openfaces.TabSetInspector


        emptyElement.assertText("0");
        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) {
View Full Code Here


    }

    private void pagination(LoadingMode loadingMode) {
        Selenium selenium = getSelenium();
        testAppFunctionalPage("/components/datatable/datatablePagination.jsf");
        TabSetInspector loadingModes = tabSet("formID:loadingModes");

        if (loadingMode instanceof ServerLoadingMode) {
            loadingModes.tabs().get(1).clickAndWait();
        }

        List<DataTableUtils.TestDataTableItem> referenceDataTableValues = DataTableUtils.TWO_STRING_COLUMN_LIST;
        final String firstColumnHeaderContent = "first column header";
        final String secondColumnHeaderContent = "second column header";
        final String firstColumnFooterContent = "first column footer";
        final String secondColumnFooterContent = "second column footer";

        DataTablePaginatorInspector clientPaginator = dataTablePaginator("formID:paginableDataTable:paginableDataTablePaginator");

        ElementInspector firstColumnHeader = element("formID:paginableDataTable:paginableDataTable_firstColumnHeader");
        ElementInspector secondColumnHeader = element("formID:paginableDataTable:paginableDataTable_secondColumnHeader");
        ElementInspector firstColumnFooter = element("formID:paginableDataTable:paginableDataTable_firstColumnFooter");
        ElementInspector secondColumnFooter = element("formID:paginableDataTable:paginableDataTable_secondColumnFooter");

        for (int i = 1; i < 3; i++) {
            firstColumnHeader.assertText(firstColumnHeaderContent);
            secondColumnHeader.assertText(secondColumnHeaderContent);
            firstColumnFooter.assertText(firstColumnFooterContent);
            secondColumnFooter.assertText(secondColumnFooterContent);

            checkDataTableContents(selenium, referenceDataTableValues, i);
            clientPaginator.nextPage().clickAndWait(loadingMode);
        }
        for (int i = 3; i > 1; i--) {
            firstColumnHeader.assertText(firstColumnHeaderContent);
            secondColumnHeader.assertText(secondColumnHeaderContent);
            firstColumnFooter.assertText(firstColumnFooterContent);
            secondColumnFooter.assertText(secondColumnFooterContent);

            checkDataTableContents(selenium, referenceDataTableValues, i);
            element("formID:paginableDataTable").click();
            //go to the previous page using keyboard
            selenium.getEval("var el = O$('formID:paginableDataTable'); var evObj = document.createEvent('KeyEvents'); evObj.initKeyEvent('keypress', true, true, window, false, false, false, false, 33, 0); el.dispatchEvent(evObj);");

            loadingMode.waitForLoad();
        }

        clientPaginator.lastPage().clickAndWait(loadingMode);
        checkDataTableContents(selenium, referenceDataTableValues, 3);
        clientPaginator.firstPage().clickAndWait(loadingMode);
        checkDataTableContents(selenium, referenceDataTableValues, 1);
        if (loadingMode instanceof ServerLoadingMode) {
            // reset tab index for possible further tests
            loadingModes.tabs().get(0).clickAndWait();
        }

    }
View Full Code Here

    }

    private void filteringComboBox(LoadingMode loadingMode) {
        testAppFunctionalPage("/components/datatable/datatableFilteringComboBox.jsf");

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

        DataTableInspector filterableDataTable = dataTable("formID:filterableDataTable_comboBox");
        if (loadingMode instanceof ServerLoadingMode) {
            loadingModes.tabs().get(1).clickAndWait();
        }

        filterableDataTable.setLoadingMode(loadingMode);
        filterableDataTable.column(0).filter(ComboBoxFilterInspector.class, "formID:filterableDataTable_comboBox:filter1").makeFiltering("col3_row1");

        element("formID:filterableDataTable_comboBox:filterableDataTable_comboBox_firstHeader")
                .assertText("first column header");
        element("formID:filterableDataTable_comboBox:filterableDataTable_comboBox_secondHeader")
                .assertText("second column header");
        element("formID:filterableDataTable_comboBox:filterableDataTable_comboBox_firstFooter")
                .assertText("first column footer");
        element("formID:filterableDataTable_comboBox:filterableDataTable_comboBox_secondFooter")
                .assertText("second column footer");

        DataTableUtils.TestDataTableItem referenceFilteredRow = DataTableUtils.TWO_STRING_COLUMN_LIST.get(0);

        //check is right row appeared after filtering and other rows is non-visible
        ElementInspector firstBody = element("formID:filterableDataTable_comboBox:0:filterableDataTable_comboBox_firstBody");
        firstBody.assertVisible(true);
        ElementInspector secondBody = element("formID:filterableDataTable_comboBox:0:filterableDataTable_comboBox_secondBody");
        secondBody.assertVisible(true);

        //compare filtered row with the reference values
        firstBody.assertText(referenceFilteredRow.getFirstColumn());
        secondBody.assertText(referenceFilteredRow.getSecondColumn());

        for (int i = 1; i < 9; i++) {
            element("formID:filterableDataTable_comboBox:" + i + ":filterableDataTable_comboBox_firstBody")
                    .assertElementExists(false);
            element("formID:filterableDataTable_comboBox:" + i + ":filterableDataTable_comboBox_secondBody")
                    .assertElementExists(false);
        }

        if (loadingMode instanceof ServerLoadingMode) {
            // reset tab index for possible further tests
            loadingModes.tabs().get(0).clickAndWait();
        }

    }
View Full Code Here

    }

    private void filteringDropDown(LoadingMode loadingMode) {
        testAppFunctionalPage("/components/datatable/datatableFilteringDropDownField.jsf");

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

        filterableDataTable.column(0).filter(DropDownFieldFilterInspector.class, "formID:filterableDataTable_dropDownField:filter1").makeFiltering("col3_row1");

        element("formID:filterableDataTable_dropDownField:filterableDataTable_dropDownField_firstHeader")
                .assertText("first column header");
        element("formID:filterableDataTable_dropDownField:filterableDataTable_dropDownField_secondHeader")
                .assertText("second column header");
        element("formID:filterableDataTable_dropDownField:filterableDataTable_dropDownField_firstFooter")
                .assertText("first column footer");
        element("formID:filterableDataTable_dropDownField:filterableDataTable_dropDownField_secondFooter")
                .assertText("second column footer");

        DataTableUtils.TestDataTableItem referenceFilteredRow = DataTableUtils.TWO_STRING_COLUMN_LIST.get(0);

        //check is right row appeared after filtering and other rows is non-visible
        for (int i = 0; i < 9; i++) {
            if (i == 0) {
                ElementInspector firstBody = element("formID:filterableDataTable_dropDownField:0:filterableDataTable_dropDownField_firstBody");
                firstBody.assertVisible(true);
                ElementInspector secondBody = element("formID:filterableDataTable_dropDownField:0:filterableDataTable_dropDownField_secondBody");
                secondBody.assertVisible(true);

                //compare filtered row with the reference values
                firstBody.assertText(referenceFilteredRow.getFirstColumn());
                secondBody.assertText(referenceFilteredRow.getSecondColumn());
            } else {
                element("formID:filterableDataTable_dropDownField:" + i + ":filterableDataTable_dropDownField_firstBody")
                        .assertElementExists(false);
                element("formID:filterableDataTable_dropDownField:" + i + ":filterableDataTable_dropDownField_secondBody")
                        .assertElementExists(false);
            }
        }
        if (loadingMode instanceof ServerLoadingMode) {
            // reset tab index for possible further tests
            loadingModes.tabs().get(0).clickAndWait();
        }

    }
View Full Code Here

    }

    private void featuresCombination(LoadingMode loadingMode) {
        testAppFunctionalPage("/components/datatable/datatableFeaturesCombination.jsf");
        TabSetInspector loadingModes = tabSet("formID:loadingModes");
        if (loadingMode instanceof ServerLoadingMode) {
            loadingModes.tabs().get(1).clickAndWait();
        }

        DataTableInspector combinationDataTable = dataTable("formID:featuresCombinationDataTableID");
        if (loadingMode instanceof ServerLoadingMode) {
            combinationDataTable.setLoadingMode(ServerLoadingMode.getInstance());
        }

        //perform filtering using comboBox filter kind
        combinationDataTable.column(2).filter(ComboBoxFilterInspector.class, "formID:featuresCombinationDataTableID:filter2").makeFiltering("criterion_1,2,3");

        //get reference data for checking filtered data
        List referenceDataAfterComboboxFilter = DataTableUtils.getFilteredValuesFeaturesCombinationTable("criterion_1,2,3");
        //get actual data

        int rowsQuantity = combinationDataTable.rowCount();
        List<DataTableUtils.FeaturesCombinationTestDataTableItem> actualDataAfterComboboxFiltering = new ArrayList<DataTableUtils.FeaturesCombinationTestDataTableItem>();
        for (int i = 0; i < rowsQuantity; i++) {
            ElementInspector firstBody = element("formID:featuresCombinationDataTableID:" + i + ":featuresCombinationDataTableID_firstBody");
            ElementInspector secondBody = element("formID:featuresCombinationDataTableID:" + i + ":featuresCombinationDataTableID_secondBody");
            ElementInspector thirdBody = element("formID:featuresCombinationDataTableID:" + i + ":featuresCombinationDataTableID_thirdBody");
            ElementInspector fourthBody = element("formID:featuresCombinationDataTableID:" + i + ":featuresCombinationDataTableID_fourthBody");

            actualDataAfterComboboxFiltering.add(new DataTableUtils.FeaturesCombinationTestDataTableItem(firstBody.text(),
                    secondBody.text(), thirdBody.text(), fourthBody.text()));

            DataTableUtils.FeaturesCombinationTestDataTableItem featuresCombinationTestDataTableItem =
                    (DataTableUtils.FeaturesCombinationTestDataTableItem) referenceDataAfterComboboxFilter.get(i);
            firstBody.assertText(featuresCombinationTestDataTableItem.getFirstColumn());
            secondBody.assertText(featuresCombinationTestDataTableItem.getSecondColumn());
            thirdBody.assertText(featuresCombinationTestDataTableItem.getThirdColumn());
            fourthBody.assertText(featuresCombinationTestDataTableItem.getFourthColumn());
        }

        //select first row
        element("formID:featuresCombinationDataTableID:0:featuresCombinationDataTableID_firstBody").click();
        combinationDataTable.checkSelectedIndex(0);

        //sort by first column
        combinationDataTable.column(1).makeSorting();
        //check data after sorting by first column
        checkDataAfterSorting(rowsQuantity, actualDataAfterComboboxFiltering);
        //check selection after sorting by first column
        combinationDataTable.checkSelectedIndex(0);

        //sort by second column
        combinationDataTable.column(2).makeSorting();
        //check data after sorting by second column
        checkDataAfterSorting(rowsQuantity, actualDataAfterComboboxFiltering);
        //check selection after sorting by second column
        combinationDataTable.checkSelectedIndex(0);

        //sort by third column
        combinationDataTable.column(3).makeSorting();
        combinationDataTable.column(3).makeSorting();
        //check data after sorting by third column
        Collections.reverse(actualDataAfterComboboxFiltering);
        checkDataAfterSorting(rowsQuantity, actualDataAfterComboboxFiltering);
        //check selection after sorting by third column
        combinationDataTable.checkSelectedIndex(2);

        //sort by fourth column
        combinationDataTable.column(4).makeSorting();
        //check data after sorting by fourth column
        Collections.reverse(actualDataAfterComboboxFiltering);
        checkDataAfterSorting(rowsQuantity, actualDataAfterComboboxFiltering);
        //check selection after sorting by fourth column
        combinationDataTable.checkSelectedIndex(0);

        /* perform filtering using dropDown filter */
        combinationDataTable.column(2).filter(ComboBoxFilterInspector.class, "formID:featuresCombinationDataTableID:filter2").makeFiltering("<All>");

        combinationDataTable.checkSelectedIndex(0);
        combinationDataTable.column(3).filter(DropDownFieldFilterInspector.class, "formID:featuresCombinationDataTableID:filter3").makeFiltering("criterion_1,4,7");

        combinationDataTable.checkSelectedIndex(0);

        //get reference data for checking filtered data
        List referenceDataAfterDropDownFilter = DataTableUtils.getFilteredValuesFeaturesCombinationTable("criterion_1,4,7");
        int rowsQuantityDropDown = combinationDataTable.rowCount();
        for (int i = 0; i < rowsQuantityDropDown; i++) {
            DataTableUtils.FeaturesCombinationTestDataTableItem featuresCombinationTestDataTableItem = (DataTableUtils.FeaturesCombinationTestDataTableItem) referenceDataAfterDropDownFilter.get(i);
            element("formID:featuresCombinationDataTableID:" + i + ":featuresCombinationDataTableID_firstBody")
                    .assertText(featuresCombinationTestDataTableItem.getFirstColumn());
            element("formID:featuresCombinationDataTableID:" + i + ":featuresCombinationDataTableID_secondBody")
                    .assertText(featuresCombinationTestDataTableItem.getSecondColumn());
            element("formID:featuresCombinationDataTableID:" + i + ":featuresCombinationDataTableID_thirdBody")
                    .assertText(featuresCombinationTestDataTableItem.getThirdColumn());
            element("formID:featuresCombinationDataTableID:" + i + ":featuresCombinationDataTableID_fourthBody")
                    .assertText(featuresCombinationTestDataTableItem.getFourthColumn());
        }

        /* perform filtering using searchField filter */
        combinationDataTable.checkSelectedIndex(0);

        combinationDataTable.column(1).filter(InputTextFilterInspector.class, "formID:featuresCombinationDataTableID:filter1").makeFiltering("id_1");

        combinationDataTable.checkSelectedIndex(0);

        //get reference data for checking filtered data
        List<DataTableUtils.FeaturesCombinationTestDataTableItem> referenceDataAfterSearchFieldFilter = DataTableUtils.getFilteredValuesFeaturesCombinationTable("id_1");
        DataTableUtils.FeaturesCombinationTestDataTableItem featuresCombinationTestDataTableItem = referenceDataAfterSearchFieldFilter.get(0);
        element("formID:featuresCombinationDataTableID:0:featuresCombinationDataTableID_firstBody")
                .assertText(featuresCombinationTestDataTableItem.getFirstColumn());
        element("formID:featuresCombinationDataTableID:0:featuresCombinationDataTableID_secondBody")
                .assertText(featuresCombinationTestDataTableItem.getSecondColumn());
        element("formID:featuresCombinationDataTableID:0:featuresCombinationDataTableID_thirdBody")
                .assertText(featuresCombinationTestDataTableItem.getThirdColumn());
        element("formID:featuresCombinationDataTableID:0:featuresCombinationDataTableID_fourthBody")
                .assertText(featuresCombinationTestDataTableItem.getFourthColumn());

        if (loadingMode instanceof ServerLoadingMode) {
            // reset tab index for possible further tests
            loadingModes.tabs().get(0).clickAndWait(loadingMode);
        }
    }
View Full Code Here

    }

     @Test
    public void testChangeSelectedTabWithoutSubmit() {
        testAppFunctionalPage("/components/tabset/tabSetChangeSelectionStyling.jsf");
        TabSetInspector tabSet = tabSet("formID:tabSetWithoutSubmit");

        /* verify that first tab is selected */
        // using getSelectedIndex() function
        ElementInspector getSelectedTab1Button = element("getSelectedTab1");
        getSelectedTab1Button.click();
        ElementInspector empty = element("empty");
        empty.assertText("0");

        // styles verification
        verifyStyles(tabSet, 0);

        /* swicth selected tab and make verifications again */
        tabSet.tabs().get(1).click();
        tabSet.tabs().get(1).mouseOut();
        getSelectedTab1Button.click();
        empty.assertText("1");

        //styles verification
        verifyStyles(tabSet, 1);
View Full Code Here

     @Test
    public void testChangeSelectedTabWithSubmit() {
        closeBrowser();
        testAppFunctionalPage("/components/tabset/tabSetChangeSelectionStyling.jsf");
        TabSetInspector tabSet = tabSet("formID:tabSetWithSubmit");

        /* verify that first tab is selected */
        // using q_getTabSetSelectedIndex function
        ElementInspector getSelectedTab2Button = element("getSelectedTab2");
        getSelectedTab2Button.click();
        ElementInspector empty1 = element("empty1");
        ElementInspector selectedIndex = element("formID:selectedIndex");
        ElementInspector selectedValue = element("formID:selectedValue");

        empty1.assertText("0");
        selectedIndex.assertText("0");
        selectedValue.assertText("Blue");

        // styles verification
        verifyStyles(tabSet, 0);

        /* swicth selected tab and make verifications again */
        tabSet.tabs().get(1).mouseOut();
        tabSet.tabs().get(1).clickAndWait();

        getSelectedTab2Button.click();
        empty1.assertText("1");

        selectedIndex.assertText("1");
View Full Code Here

     @Test
    public void testClientSideAPI() {
        closeBrowser();
        testAppFunctionalPage("/components/tabset/tabSetChangeSelectionStyling.jsf");
        TabSetInspector tabSetWithoutSubmit = tabSet("formID:tabSetWithoutSubmit");
        TabSetInspector tabSetWithSubmit = tabSet("formID:tabSetWithSubmit");

        //check getSelectedIndex() for both TabSets
        ElementInspector getSelectedTab1Button = element("getSelectedTab1");
        getSelectedTab1Button.click();
View Full Code Here

     @Test
    public void testSelectionChangeListener() {
        testAppFunctionalPage("/components/tabset/tabSetChangeListeners.jsf");

        TabSetInspector attributeTabSet = tabSet("formID:selectionChangeListenerAttributeWithoutSubmit");
        attributeTabSet.tabs().get(1).click();
        TabSetInspector tagTabSet = tabSet("formID:selectionChangeListenerTagWithoutSubmit");
        tagTabSet.tabs().get(1).click();

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

        ElementInspector out3Element = element("formID:out3");
        out3Element.assertText("true");
        ElementInspector out4Element = element("formID:out4");
        out4Element.assertText("true");

        attributeTabSet.tabs().get(0).click();
        tagTabSet.tabs().get(0).click();

        submit.clickAndWait();

        out3Element.assertText("false");
        out4Element.assertText("false");
View Full Code Here

     @Test
    @Ignore
    // todo: works locally, but investigate why it fails on the server
    public void testDateChooserTabSetValidation() {
        liveDemoPage("/datechooser/DateChooser.jsf");
        TabSetInspector localeSelector = tabSet("dcForm:localeSelector");
        assertEquals(0, localeSelector.getTabIndex());
        localeSelector.tabs().get(1).click();
        waitForPageToLoad();
        assertEquals(1, localeSelector.getTabIndex());
        localeSelector.tabs().get(2).click();
        waitForPageToLoad();
        assertEquals(2, localeSelector.getTabIndex());
        localeSelector.tabs().get(0).click();
        waitForPageToLoad();
        assertEquals(0, localeSelector.getTabIndex());
        DateChooserInspector dateChooser = dateChooser("dcForm:dcMMdd");
        dateChooser.field().type("wrong");
        localeSelector.tabs().get(1).click();
        assertEquals(0, localeSelector.getTabIndex());
        dateChooser.field().assertValue("wrong");
    }
View Full Code Here

TOP

Related Classes of org.seleniuminspector.openfaces.TabSetInspector

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.