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);
}