@Test(dependsOnMethods = "selectNode", groups = "Enterprise4.2", priority = 1) public void getNodeChildren() throws Exception { TreeMenuNavigation treeMenuNav = documentLibPage.getLeftMenus(); List<String> children = treeMenuNav.getNodeChildren(TreeMenu.CATEGORIES, "Category Root", "Languages", "English"); assertTrue(children.size() == 5); assertTrue(children.contains("American English")); assertTrue(children.contains("Australian English")); assertTrue(children.contains("British English")); assertTrue(children.contains("Canadian English")); assertTrue(children.contains("Indian English")); }
public List<String> getNodeChildren(TreeMenu treeMenu, String... nodePath) { if (treeMenu == null) { throw new IllegalArgumentException("TreeMenu is required."); } if (nodePath == null) { throw new IllegalArgumentException("node path is required."); } if (!treeMenu.hirearchy) { throw new IllegalArgumentException(treeMenu + " does not support child nodes."); } List<String> nodes = new ArrayList<>(Arrays.asList(nodePath)); String node = nodes.get(nodes.size() - 1); expandNode(treeMenu, nodes); List<String> children = new ArrayList<>(); String xpath = treeMenu.getXpath() + String.format(TREE_NODE_ELEMENT, node) + TREE_NODE_CHILDREN; By nodeLocator = By.xpath(xpath); try { List<WebElement> results = drone.findAll(nodeLocator); for (WebElement element : results) { children.add(element.getText()); } } catch (NoSuchElementException e) { } return children; }
TreeMenuNavigation extends SharePage { public List<String> getNodeChildren(TreeMenu treeMenu, String... nodePath) { if (treeMenu == null) { throw new IllegalArgumentException("TreeMenu is required."); } if (nodePath == null) { throw new IllegalArgumentException("node path is required."); } if (!treeMenu.hirearchy) { throw new IllegalArgumentException(treeMenu + " does not support child nodes."); } List<String> nodes = new ArrayList<>(Arrays.asList(nodePath)); String node = nodes.get(nodes.size() - 1); expandNode(treeMenu, nodes); List<String> children = new ArrayList<>(); String xpath = treeMenu.getXpath() + String.format(TREE_NODE_ELEMENT, node) + TREE_NODE_CHILDREN; By nodeLocator = By.xpath(xpath); try { List<WebElement> results = drone.findAll(nodeLocator); for (WebElement element : results) { children.add(element.getText()); } } catch (NoSuchElementException e) { } return children; } }
TreeMenuNavigation extends SharePage { public List<String> getNodeChildren(TreeMenu treeMenu, String... nodePath) { if (treeMenu == null) { throw new IllegalArgumentException("TreeMenu is required."); } if (nodePath == null) { throw new IllegalArgumentException("node path is required."); } if (!treeMenu.hirearchy) { throw new IllegalArgumentException(treeMenu + " does not support child nodes."); } List<String> nodes = new ArrayList<>(Arrays.asList(nodePath)); String node = nodes.get(nodes.size() - 1); expandNode(treeMenu, nodes); List<String> children = new ArrayList<>(); String xpath = treeMenu.getXpath() + String.format(TREE_NODE_ELEMENT, node) + TREE_NODE_CHILDREN; By nodeLocator = By.xpath(xpath); try { List<WebElement> results = drone.findAll(nodeLocator); for (WebElement element : results) { children.add(element.getText()); } } catch (NoSuchElementException e) { } return children; } TreeMenuNavigation(WebDrone drone); }
TreeMenuNavigation extends SharePage { public List<String> getNodeChildren(TreeMenu treeMenu, String... nodePath) { if (treeMenu == null) { throw new IllegalArgumentException("TreeMenu is required."); } if (nodePath == null) { throw new IllegalArgumentException("node path is required."); } if (!treeMenu.hirearchy) { throw new IllegalArgumentException(treeMenu + " does not support child nodes."); } List<String> nodes = new ArrayList<>(Arrays.asList(nodePath)); String node = nodes.get(nodes.size() - 1); expandNode(treeMenu, nodes); List<String> children = new ArrayList<>(); String xpath = treeMenu.getXpath() + String.format(TREE_NODE_ELEMENT, node) + TREE_NODE_CHILDREN; By nodeLocator = By.xpath(xpath); try { List<WebElement> results = drone.findAll(nodeLocator); for (WebElement element : results) { children.add(element.getText()); } } catch (NoSuchElementException e) { } return children; } TreeMenuNavigation(WebDrone drone); @SuppressWarnings("unchecked") @Override TreeMenuNavigation render(RenderTime timer); @SuppressWarnings("unchecked") @Override TreeMenuNavigation render(); @SuppressWarnings("unchecked") @Override TreeMenuNavigation render(final long time); HtmlPage selectDocumentNode(DocumentsMenu docMenu); HtmlPage selectTagNode(String tagName); HtmlPage selectNode(TreeMenu treeMenu, String... nodePath); List<String> getNodeChildren(TreeMenu treeMenu, String... nodePath); boolean isMenuTreeVisible(TreeMenu treeMenu); boolean isDocumentNodeVisible(DocumentsMenu docMenu); int getTagCount(String tagName); }
TreeMenuNavigation extends SharePage { public List<String> getNodeChildren(TreeMenu treeMenu, String... nodePath) { if (treeMenu == null) { throw new IllegalArgumentException("TreeMenu is required."); } if (nodePath == null) { throw new IllegalArgumentException("node path is required."); } if (!treeMenu.hirearchy) { throw new IllegalArgumentException(treeMenu + " does not support child nodes."); } List<String> nodes = new ArrayList<>(Arrays.asList(nodePath)); String node = nodes.get(nodes.size() - 1); expandNode(treeMenu, nodes); List<String> children = new ArrayList<>(); String xpath = treeMenu.getXpath() + String.format(TREE_NODE_ELEMENT, node) + TREE_NODE_CHILDREN; By nodeLocator = By.xpath(xpath); try { List<WebElement> results = drone.findAll(nodeLocator); for (WebElement element : results) { children.add(element.getText()); } } catch (NoSuchElementException e) { } return children; } TreeMenuNavigation(WebDrone drone); @SuppressWarnings("unchecked") @Override TreeMenuNavigation render(RenderTime timer); @SuppressWarnings("unchecked") @Override TreeMenuNavigation render(); @SuppressWarnings("unchecked") @Override TreeMenuNavigation render(final long time); HtmlPage selectDocumentNode(DocumentsMenu docMenu); HtmlPage selectTagNode(String tagName); HtmlPage selectNode(TreeMenu treeMenu, String... nodePath); List<String> getNodeChildren(TreeMenu treeMenu, String... nodePath); boolean isMenuTreeVisible(TreeMenu treeMenu); boolean isDocumentNodeVisible(DocumentsMenu docMenu); int getTagCount(String tagName); static final String REPOSITORY_ROOT_PROPERTY; static final String DOCUMENT_LIBRARY_ROOT_PROPERTY; static final String CATEGORY_ROOT_PROPERTY; static final String SHARED_FILES_ROOT_PROPERTY; }