@Test(dependsOnMethods = "testSelectSiteWithNull", expectedExceptions = { IllegalArgumentException.class }) public void testSelectFolderWithNull() throws Exception { CopyOrMoveContentPage testPage = new CopyOrMoveContentPage(drone); testPage.selectPath((String[])null); }
public CopyOrMoveContentPage selectPath(String... folderPath) { if (folderPath == null || folderPath.length < 1) { throw new IllegalArgumentException("Invalid Folder path!!"); } int length = folderPath.length; List<WebElement> folderNames; try { for (String folder : folderPath) { try { drone.waitForElement(By.id("AlfrescoWebdronez1"), SECONDS.convert(WAIT_TIME_3000, MILLISECONDS)); } catch (TimeoutException e) { } folderNames = drone.findAndWaitForElements(folderItemsListCss); boolean selected = false; for (WebElement folderName : folderNames) { if (folderName.getText().equalsIgnoreCase(folder)) { folderName.click(); try { drone.waitForElement(By.id("AlfrescoWebdronez1"), SECONDS.convert(WAIT_TIME_3000, MILLISECONDS)); } catch (TimeoutException e) { } try { if (!drone.findAndWait(By.xpath(String.format(" .getAttribute("class").contains("selected")) { folderName.click(); } } catch (StaleElementReferenceException sle) { } selected = true; logger.info("Folder \"" + folder + "\" selected"); if (length > 1) { drone.waitForElement(folderItemsListCss, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); drone.waitForElement(selectedFolderItemsListCss, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); } break; } } length--; if (!selected) { throw new PageException("Cannot select the folder metioned in the path"); } } return new CopyOrMoveContentPage(drone); } catch (NoSuchElementException ne) { logger.error("Unable find the folder name. ", ne); } catch (TimeoutException te) { logger.error("Unable find the folders css. ", te); } throw new PageOperationException("Unable to select the folder path."); }
CopyOrMoveContentPage extends ShareDialogue { public CopyOrMoveContentPage selectPath(String... folderPath) { if (folderPath == null || folderPath.length < 1) { throw new IllegalArgumentException("Invalid Folder path!!"); } int length = folderPath.length; List<WebElement> folderNames; try { for (String folder : folderPath) { try { drone.waitForElement(By.id("AlfrescoWebdronez1"), SECONDS.convert(WAIT_TIME_3000, MILLISECONDS)); } catch (TimeoutException e) { } folderNames = drone.findAndWaitForElements(folderItemsListCss); boolean selected = false; for (WebElement folderName : folderNames) { if (folderName.getText().equalsIgnoreCase(folder)) { folderName.click(); try { drone.waitForElement(By.id("AlfrescoWebdronez1"), SECONDS.convert(WAIT_TIME_3000, MILLISECONDS)); } catch (TimeoutException e) { } try { if (!drone.findAndWait(By.xpath(String.format(" .getAttribute("class").contains("selected")) { folderName.click(); } } catch (StaleElementReferenceException sle) { } selected = true; logger.info("Folder \"" + folder + "\" selected"); if (length > 1) { drone.waitForElement(folderItemsListCss, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); drone.waitForElement(selectedFolderItemsListCss, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); } break; } } length--; if (!selected) { throw new PageException("Cannot select the folder metioned in the path"); } } return new CopyOrMoveContentPage(drone); } catch (NoSuchElementException ne) { logger.error("Unable find the folder name. ", ne); } catch (TimeoutException te) { logger.error("Unable find the folders css. ", te); } throw new PageOperationException("Unable to select the folder path."); } }
CopyOrMoveContentPage extends ShareDialogue { public CopyOrMoveContentPage selectPath(String... folderPath) { if (folderPath == null || folderPath.length < 1) { throw new IllegalArgumentException("Invalid Folder path!!"); } int length = folderPath.length; List<WebElement> folderNames; try { for (String folder : folderPath) { try { drone.waitForElement(By.id("AlfrescoWebdronez1"), SECONDS.convert(WAIT_TIME_3000, MILLISECONDS)); } catch (TimeoutException e) { } folderNames = drone.findAndWaitForElements(folderItemsListCss); boolean selected = false; for (WebElement folderName : folderNames) { if (folderName.getText().equalsIgnoreCase(folder)) { folderName.click(); try { drone.waitForElement(By.id("AlfrescoWebdronez1"), SECONDS.convert(WAIT_TIME_3000, MILLISECONDS)); } catch (TimeoutException e) { } try { if (!drone.findAndWait(By.xpath(String.format(" .getAttribute("class").contains("selected")) { folderName.click(); } } catch (StaleElementReferenceException sle) { } selected = true; logger.info("Folder \"" + folder + "\" selected"); if (length > 1) { drone.waitForElement(folderItemsListCss, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); drone.waitForElement(selectedFolderItemsListCss, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); } break; } } length--; if (!selected) { throw new PageException("Cannot select the folder metioned in the path"); } } return new CopyOrMoveContentPage(drone); } catch (NoSuchElementException ne) { logger.error("Unable find the folder name. ", ne); } catch (TimeoutException te) { logger.error("Unable find the folders css. ", te); } throw new PageOperationException("Unable to select the folder path."); } CopyOrMoveContentPage(WebDrone drone); }
CopyOrMoveContentPage extends ShareDialogue { public CopyOrMoveContentPage selectPath(String... folderPath) { if (folderPath == null || folderPath.length < 1) { throw new IllegalArgumentException("Invalid Folder path!!"); } int length = folderPath.length; List<WebElement> folderNames; try { for (String folder : folderPath) { try { drone.waitForElement(By.id("AlfrescoWebdronez1"), SECONDS.convert(WAIT_TIME_3000, MILLISECONDS)); } catch (TimeoutException e) { } folderNames = drone.findAndWaitForElements(folderItemsListCss); boolean selected = false; for (WebElement folderName : folderNames) { if (folderName.getText().equalsIgnoreCase(folder)) { folderName.click(); try { drone.waitForElement(By.id("AlfrescoWebdronez1"), SECONDS.convert(WAIT_TIME_3000, MILLISECONDS)); } catch (TimeoutException e) { } try { if (!drone.findAndWait(By.xpath(String.format(" .getAttribute("class").contains("selected")) { folderName.click(); } } catch (StaleElementReferenceException sle) { } selected = true; logger.info("Folder \"" + folder + "\" selected"); if (length > 1) { drone.waitForElement(folderItemsListCss, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); drone.waitForElement(selectedFolderItemsListCss, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); } break; } } length--; if (!selected) { throw new PageException("Cannot select the folder metioned in the path"); } } return new CopyOrMoveContentPage(drone); } catch (NoSuchElementException ne) { logger.error("Unable find the folder name. ", ne); } catch (TimeoutException te) { logger.error("Unable find the folders css. ", te); } throw new PageOperationException("Unable to select the folder path."); } CopyOrMoveContentPage(WebDrone drone); @SuppressWarnings("unchecked") @Override CopyOrMoveContentPage render(RenderTime timer); @SuppressWarnings("unchecked") @Override CopyOrMoveContentPage render(long time); @SuppressWarnings("unchecked") @Override CopyOrMoveContentPage render(); String getDialogTitle(); List<String> getDestinations(); List<String> getSites(); List<String> getFolders(); boolean isOkButtonPresent(); boolean isCancelButtonPresent(); HtmlPage selectOkButton(); HtmlPage selectCancelButton(); void selectCloseButton(); CopyOrMoveContentPage selectDestination(String destinationName); CopyOrMoveContentPage selectSite(String siteName); CopyOrMoveContentPage selectPath(String... folderPath); }
CopyOrMoveContentPage extends ShareDialogue { public CopyOrMoveContentPage selectPath(String... folderPath) { if (folderPath == null || folderPath.length < 1) { throw new IllegalArgumentException("Invalid Folder path!!"); } int length = folderPath.length; List<WebElement> folderNames; try { for (String folder : folderPath) { try { drone.waitForElement(By.id("AlfrescoWebdronez1"), SECONDS.convert(WAIT_TIME_3000, MILLISECONDS)); } catch (TimeoutException e) { } folderNames = drone.findAndWaitForElements(folderItemsListCss); boolean selected = false; for (WebElement folderName : folderNames) { if (folderName.getText().equalsIgnoreCase(folder)) { folderName.click(); try { drone.waitForElement(By.id("AlfrescoWebdronez1"), SECONDS.convert(WAIT_TIME_3000, MILLISECONDS)); } catch (TimeoutException e) { } try { if (!drone.findAndWait(By.xpath(String.format(" .getAttribute("class").contains("selected")) { folderName.click(); } } catch (StaleElementReferenceException sle) { } selected = true; logger.info("Folder \"" + folder + "\" selected"); if (length > 1) { drone.waitForElement(folderItemsListCss, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); drone.waitForElement(selectedFolderItemsListCss, SECONDS.convert(maxPageLoadingTime, MILLISECONDS)); } break; } } length--; if (!selected) { throw new PageException("Cannot select the folder metioned in the path"); } } return new CopyOrMoveContentPage(drone); } catch (NoSuchElementException ne) { logger.error("Unable find the folder name. ", ne); } catch (TimeoutException te) { logger.error("Unable find the folders css. ", te); } throw new PageOperationException("Unable to select the folder path."); } CopyOrMoveContentPage(WebDrone drone); @SuppressWarnings("unchecked") @Override CopyOrMoveContentPage render(RenderTime timer); @SuppressWarnings("unchecked") @Override CopyOrMoveContentPage render(long time); @SuppressWarnings("unchecked") @Override CopyOrMoveContentPage render(); String getDialogTitle(); List<String> getDestinations(); List<String> getSites(); List<String> getFolders(); boolean isOkButtonPresent(); boolean isCancelButtonPresent(); HtmlPage selectOkButton(); HtmlPage selectCancelButton(); void selectCloseButton(); CopyOrMoveContentPage selectDestination(String destinationName); CopyOrMoveContentPage selectSite(String siteName); CopyOrMoveContentPage selectPath(String... folderPath);  }