*/
//todo: add checking multiple selection functionality with the 'Ctrl' key
@Test
public void testMultipleSelectionAndKeyboardNavigation() {
testAppFunctionalPage("/components/treetable/treeTableMultipleSelection.jsf");
ElementInspector categoryOutput = element("formID:multipleSelectionTreeTableID:0:categoryID");
Actions click= new Actions(getDriver()).moveToElement(
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();
nodePathsOutput.assertText("Document DeletionSemen SemenychIvan IvanychNetwork Access");
nodeDataOutput.assertText("Document CreationAdministratorIvan IvanychDocument Modification");
selectionNodePathsDiv.assertText(" 4 5 6 7");
selectionNodeDataDiv.assertText(" 2 3 4 5");
//todo: checking with collapsed child node should be added after fix of 'JSFC-2603'
}