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")