@Test(dependsOnMethods = "getCurrentPages", groups = "Enterprise-only") public void addPages() { List<SitePageType> addPageTypes = new ArrayList<SitePageType>(); addPageTypes.add(SitePageType.WIKI); customizeSitePage = FactorySharePage.resolvePage(drone).render(); siteDashBoard = customizeSitePage.addPages(addPageTypes).render(); customizeSitePage = siteDashBoard.getSiteNav().selectCustomizeSite().render(); List<SitePageType> currentPages = customizeSitePage.getCurrentPages(); assertTrue(currentPages.contains(SitePageType.WIKI), "Current pages are:" + currentPages); }
public SiteDashboardPage addPages (List<SitePageType> pageTypes) { WebElement target = drone.findAndWait(CURRENT_PAGES_CONTAINER); if (getAvailablePages().containsAll(pageTypes)) { for (SitePageType theTypes : pageTypes) { try { WebDriver webDriver = ((WebDroneImpl) drone).getDriver(); Actions builder = new Actions(webDriver); WebElement elem = drone.findAndWait(theTypes.getLocator()); drone.dragAndDrop(elem, target); } catch (TimeoutException e) { throw new PageException("Not able to Site Page in the Page : " + theTypes, e); } } } else { throw new PageException("Some of Site Page(s) are not available to add, may be already added. " + pageTypes.toString()); } if(!getAddedPages().containsAll(pageTypes)) { throw new PageException("Not all pages were added!"); } drone.findAndWait(SAVE_BUTTON).click(); waitUntilAlert(); return drone.getCurrentPage().render(); }
CustomizeSitePage extends SitePage { public SiteDashboardPage addPages (List<SitePageType> pageTypes) { WebElement target = drone.findAndWait(CURRENT_PAGES_CONTAINER); if (getAvailablePages().containsAll(pageTypes)) { for (SitePageType theTypes : pageTypes) { try { WebDriver webDriver = ((WebDroneImpl) drone).getDriver(); Actions builder = new Actions(webDriver); WebElement elem = drone.findAndWait(theTypes.getLocator()); drone.dragAndDrop(elem, target); } catch (TimeoutException e) { throw new PageException("Not able to Site Page in the Page : " + theTypes, e); } } } else { throw new PageException("Some of Site Page(s) are not available to add, may be already added. " + pageTypes.toString()); } if(!getAddedPages().containsAll(pageTypes)) { throw new PageException("Not all pages were added!"); } drone.findAndWait(SAVE_BUTTON).click(); waitUntilAlert(); return drone.getCurrentPage().render(); } }
CustomizeSitePage extends SitePage { public SiteDashboardPage addPages (List<SitePageType> pageTypes) { WebElement target = drone.findAndWait(CURRENT_PAGES_CONTAINER); if (getAvailablePages().containsAll(pageTypes)) { for (SitePageType theTypes : pageTypes) { try { WebDriver webDriver = ((WebDroneImpl) drone).getDriver(); Actions builder = new Actions(webDriver); WebElement elem = drone.findAndWait(theTypes.getLocator()); drone.dragAndDrop(elem, target); } catch (TimeoutException e) { throw new PageException("Not able to Site Page in the Page : " + theTypes, e); } } } else { throw new PageException("Some of Site Page(s) are not available to add, may be already added. " + pageTypes.toString()); } if(!getAddedPages().containsAll(pageTypes)) { throw new PageException("Not all pages were added!"); } drone.findAndWait(SAVE_BUTTON).click(); waitUntilAlert(); return drone.getCurrentPage().render(); } CustomizeSitePage(WebDrone drone); }
CustomizeSitePage extends SitePage { public SiteDashboardPage addPages (List<SitePageType> pageTypes) { WebElement target = drone.findAndWait(CURRENT_PAGES_CONTAINER); if (getAvailablePages().containsAll(pageTypes)) { for (SitePageType theTypes : pageTypes) { try { WebDriver webDriver = ((WebDroneImpl) drone).getDriver(); Actions builder = new Actions(webDriver); WebElement elem = drone.findAndWait(theTypes.getLocator()); drone.dragAndDrop(elem, target); } catch (TimeoutException e) { throw new PageException("Not able to Site Page in the Page : " + theTypes, e); } } } else { throw new PageException("Some of Site Page(s) are not available to add, may be already added. " + pageTypes.toString()); } if(!getAddedPages().containsAll(pageTypes)) { throw new PageException("Not all pages were added!"); } drone.findAndWait(SAVE_BUTTON).click(); waitUntilAlert(); return drone.getCurrentPage().render(); } CustomizeSitePage(WebDrone drone); @SuppressWarnings("unchecked") @Override CustomizeSitePage render(RenderTime timer); @SuppressWarnings("unchecked") @Override CustomizeSitePage render(long time); @SuppressWarnings("unchecked") @Override CustomizeSitePage render(); List<SitePageType> getCurrentPages(); List<SitePageType> getAvailablePages(); SiteDashboardPage addPages(List<SitePageType> pageTypes); SiteDashboardPage addAllPages(); }
CustomizeSitePage extends SitePage { public SiteDashboardPage addPages (List<SitePageType> pageTypes) { WebElement target = drone.findAndWait(CURRENT_PAGES_CONTAINER); if (getAvailablePages().containsAll(pageTypes)) { for (SitePageType theTypes : pageTypes) { try { WebDriver webDriver = ((WebDroneImpl) drone).getDriver(); Actions builder = new Actions(webDriver); WebElement elem = drone.findAndWait(theTypes.getLocator()); drone.dragAndDrop(elem, target); } catch (TimeoutException e) { throw new PageException("Not able to Site Page in the Page : " + theTypes, e); } } } else { throw new PageException("Some of Site Page(s) are not available to add, may be already added. " + pageTypes.toString()); } if(!getAddedPages().containsAll(pageTypes)) { throw new PageException("Not all pages were added!"); } drone.findAndWait(SAVE_BUTTON).click(); waitUntilAlert(); return drone.getCurrentPage().render(); } CustomizeSitePage(WebDrone drone); @SuppressWarnings("unchecked") @Override CustomizeSitePage render(RenderTime timer); @SuppressWarnings("unchecked") @Override CustomizeSitePage render(long time); @SuppressWarnings("unchecked") @Override CustomizeSitePage render(); List<SitePageType> getCurrentPages(); List<SitePageType> getAvailablePages(); SiteDashboardPage addPages(List<SitePageType> pageTypes); SiteDashboardPage addAllPages();  }