//create and fill list of the reference popupLayer values
List<DataTableUtils.TestDataTableItem> popupLayerDataTableValues = new ArrayList<DataTableUtils.TestDataTableItem>(DataTableUtils.TWO_STRING_COLUMN_LIST);
/* sorting, pagination, single selection */
ElementInspector nextPage = dataTablePaginator("fn:popupDataTable:popupDataTablePaginator").nextPage();
int rowCount = 3;
int pageCount = 3;
element("fn:popupDataTable:header_invoker").clickAndWait();
element("fn:popupDataTable:header_popup").assertVisible(true);
OpenFacesAjaxLoadingMode.getInstance().waitForLoad();
for (int pageNo = 1; pageNo <= pageCount; pageNo++) {
// execute pagination from first to third page and verify data on every page
List<DataTableUtils.TestDataTableItem> currentPageValues = DataTableUtils.getCurrentPageFromReferenceValues(popupLayerDataTableValues, pageNo);
for (int rowIndex = 0; rowIndex < rowCount; rowIndex++) {
DataTableUtils.TestDataTableItem currentReferenceRow = currentPageValues.get(rowIndex);
// invoke popupLayers in current row
element("fn:popupDataTable:" + rowIndex + ":body_invoker").click();
element("fn:popupDataTable:" + rowIndex + ":body_invoker1").click();
//check is single selection performed well
dataTable("fn:popupDataTable").checkSelectedIndex(rowIndex);
//check: is popupLayers are visible
ElementInspector bodyPopup = element("fn:popupDataTable:" + rowIndex + ":body_popup");
bodyPopup.assertVisible(true);
ElementInspector bodyPopup1 = element("fn:popupDataTable:" + rowIndex + ":body_popup1");
bodyPopup1.assertVisible(true);
//get text from the invoked popupLayers
String currentFirstCellValue = bodyPopup.text().substring(0, 9);
String currentSecondCellValue = bodyPopup1.text().substring(0, 9);
// compare received values with their reference values
assertEquals(currentReferenceRow.getFirstColumn(), currentFirstCellValue);
assertEquals(currentReferenceRow.getSecondColumn(), currentSecondCellValue);
}