@Test(dependsOnMethods = "isPostPresented") public void checkTags() { Assert.assertTrue(blogPage.checkTags(postName, tagName), "Expected tag for post with title '" + postName + "' isn't presented"); }
public boolean checkTags(String title, String tag) { boolean isDisplayed; WebElement element; String tagXpath; if (title == null || title.isEmpty()) { throw new IllegalArgumentException("Title is required"); } if (tag == null) { tagXpath = String.format(TAG_NONE, title); try { element = drone.findAndWait(By.xpath(tagXpath)); isDisplayed = element.getText().contains("None"); } catch (NoSuchElementException ex) { if (logger.isDebugEnabled()) { logger.debug("Unable to locate post page or 'Tags: (None)'", ex); } throw new PageOperationException("Unable to locate post page or 'Tags: (None)'"); } } else { tagXpath = String.format(TAG_NAME, title, tag); try { element = drone.findAndWait(By.xpath(tagXpath)); isDisplayed = element.isDisplayed(); } catch (NoSuchElementException te) { if (logger.isDebugEnabled()) { logger.debug("Unable to locate expected tag or post page", te); } throw new PageOperationException("Unable to locate expected tag or post page"); } } return isDisplayed; }
BlogPage extends SitePage { public boolean checkTags(String title, String tag) { boolean isDisplayed; WebElement element; String tagXpath; if (title == null || title.isEmpty()) { throw new IllegalArgumentException("Title is required"); } if (tag == null) { tagXpath = String.format(TAG_NONE, title); try { element = drone.findAndWait(By.xpath(tagXpath)); isDisplayed = element.getText().contains("None"); } catch (NoSuchElementException ex) { if (logger.isDebugEnabled()) { logger.debug("Unable to locate post page or 'Tags: (None)'", ex); } throw new PageOperationException("Unable to locate post page or 'Tags: (None)'"); } } else { tagXpath = String.format(TAG_NAME, title, tag); try { element = drone.findAndWait(By.xpath(tagXpath)); isDisplayed = element.isDisplayed(); } catch (NoSuchElementException te) { if (logger.isDebugEnabled()) { logger.debug("Unable to locate expected tag or post page", te); } throw new PageOperationException("Unable to locate expected tag or post page"); } } return isDisplayed; } }
BlogPage extends SitePage { public boolean checkTags(String title, String tag) { boolean isDisplayed; WebElement element; String tagXpath; if (title == null || title.isEmpty()) { throw new IllegalArgumentException("Title is required"); } if (tag == null) { tagXpath = String.format(TAG_NONE, title); try { element = drone.findAndWait(By.xpath(tagXpath)); isDisplayed = element.getText().contains("None"); } catch (NoSuchElementException ex) { if (logger.isDebugEnabled()) { logger.debug("Unable to locate post page or 'Tags: (None)'", ex); } throw new PageOperationException("Unable to locate post page or 'Tags: (None)'"); } } else { tagXpath = String.format(TAG_NAME, title, tag); try { element = drone.findAndWait(By.xpath(tagXpath)); isDisplayed = element.isDisplayed(); } catch (NoSuchElementException te) { if (logger.isDebugEnabled()) { logger.debug("Unable to locate expected tag or post page", te); } throw new PageOperationException("Unable to locate expected tag or post page"); } } return isDisplayed; } BlogPage(WebDrone drone); }
BlogPage extends SitePage { public boolean checkTags(String title, String tag) { boolean isDisplayed; WebElement element; String tagXpath; if (title == null || title.isEmpty()) { throw new IllegalArgumentException("Title is required"); } if (tag == null) { tagXpath = String.format(TAG_NONE, title); try { element = drone.findAndWait(By.xpath(tagXpath)); isDisplayed = element.getText().contains("None"); } catch (NoSuchElementException ex) { if (logger.isDebugEnabled()) { logger.debug("Unable to locate post page or 'Tags: (None)'", ex); } throw new PageOperationException("Unable to locate post page or 'Tags: (None)'"); } } else { tagXpath = String.format(TAG_NAME, title, tag); try { element = drone.findAndWait(By.xpath(tagXpath)); isDisplayed = element.isDisplayed(); } catch (NoSuchElementException te) { if (logger.isDebugEnabled()) { logger.debug("Unable to locate expected tag or post page", te); } throw new PageOperationException("Unable to locate expected tag or post page"); } } return isDisplayed; } BlogPage(WebDrone drone); @SuppressWarnings("unchecked") @Override BlogPage render(RenderTime timer); @SuppressWarnings("unchecked") BlogPage render(); @SuppressWarnings("unchecked") @Override BlogPage render(long time); PostViewPage createPostInternally(String titleField); PostViewPage createPostInternally(String titleField, String txtLines); PostViewPage createPostInternally(String titleField, String txtLines, String tagName); PostViewPage createPostInternally(String titleField, String txtLines, List<String> tags); PostViewPage saveAsDraft(String titleField, String txtLines); boolean isNewPostEnabled(); PostViewPage openBlogPost(String title); int getPostsCount(); boolean isPostPresented(String postName); PostViewPage saveAsDraft(String titleField, String txtLines, List<String> tagName); RssFeedPage clickRssFeedBtn(String username, String password); boolean checkTags(String title, String tag); PostViewPage editPost(String oldTitle, String newTitle, String txtLines, String tagName, boolean removeTag); PostDirectoryInfo getPostDirectoryInfo(final String title); BlogTreeMenuNavigation getLeftMenus(); }
BlogPage extends SitePage { public boolean checkTags(String title, String tag) { boolean isDisplayed; WebElement element; String tagXpath; if (title == null || title.isEmpty()) { throw new IllegalArgumentException("Title is required"); } if (tag == null) { tagXpath = String.format(TAG_NONE, title); try { element = drone.findAndWait(By.xpath(tagXpath)); isDisplayed = element.getText().contains("None"); } catch (NoSuchElementException ex) { if (logger.isDebugEnabled()) { logger.debug("Unable to locate post page or 'Tags: (None)'", ex); } throw new PageOperationException("Unable to locate post page or 'Tags: (None)'"); } } else { tagXpath = String.format(TAG_NAME, title, tag); try { element = drone.findAndWait(By.xpath(tagXpath)); isDisplayed = element.isDisplayed(); } catch (NoSuchElementException te) { if (logger.isDebugEnabled()) { logger.debug("Unable to locate expected tag or post page", te); } throw new PageOperationException("Unable to locate expected tag or post page"); } } return isDisplayed; } BlogPage(WebDrone drone); @SuppressWarnings("unchecked") @Override BlogPage render(RenderTime timer); @SuppressWarnings("unchecked") BlogPage render(); @SuppressWarnings("unchecked") @Override BlogPage render(long time); PostViewPage createPostInternally(String titleField); PostViewPage createPostInternally(String titleField, String txtLines); PostViewPage createPostInternally(String titleField, String txtLines, String tagName); PostViewPage createPostInternally(String titleField, String txtLines, List<String> tags); PostViewPage saveAsDraft(String titleField, String txtLines); boolean isNewPostEnabled(); PostViewPage openBlogPost(String title); int getPostsCount(); boolean isPostPresented(String postName); PostViewPage saveAsDraft(String titleField, String txtLines, List<String> tagName); RssFeedPage clickRssFeedBtn(String username, String password); boolean checkTags(String title, String tag); PostViewPage editPost(String oldTitle, String newTitle, String txtLines, String tagName, boolean removeTag); PostDirectoryInfo getPostDirectoryInfo(final String title); BlogTreeMenuNavigation getLeftMenus();  }