/** * @param contentName * @param trashCanItems * @return */ private static TrashCanItem getItemPresentInThePage( String contentName, List<TrashCanItem> trashCanItems) { for (TrashCanItem trashCanItem : trashCanItems) { if (contentName.equalsIgnoreCase(trashCanItem.getFileName())) { return trashCanItem; } } return null; }
/** * Perform a trashcan search on itemName. Return the list of all trashcan items with matching * name. * * @param drone * @param itemName String to search for * @return List<String> */ public static List<String> getTrashCanItems(WebDrone drone, String itemName) { List<String> namesOfFiles = new ArrayList<String>(); TrashCanPage trashcanPage = (TrashCanPage) getSharePage(drone); trashcanPage.render(); trashcanPage = trashcanPage.itemSearch(itemName).render(); for (TrashCanItem item : trashcanPage.getTrashCanItems()) { namesOfFiles.add(item.getFileName()); } return namesOfFiles; }
/** * Recovers the specified trashcan item if found * * @param WebDrone @ param String itemName to be recovered * @return TrashCanPage */ public static HtmlPage recoverTrashCanItem(WebDrone drone, String itemName) { TrashCanItem trashCanItem = getTrashCanItem(drone, itemName); return trashCanItem.selectTrashCanAction(TrashCanValues.RECOVER).render(); }
/** * Deletes the specified trashcan item if found * * @param driver * @param itemName @ param String itemName to be deleted * @return TrashCanPage */ public static TrashCanPage deleteTrashCanItem(WebDrone driver, String itemName) { TrashCanItem trashCanItem = getTrashCanItem(driver, itemName); TrashCanDeleteConfirmationPage trashDeletePage = trashCanItem.selectTrashCanAction(TrashCanValues.DELETE).render(); return trashDeletePage.clickOkButton().render(); }