@Test(dependsOnMethods = "isTopicPresented") public void checkTags() { assertTrue(discussionsPage.checkTags(text, tag)); }
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 topic or 'Tags: (None)'", ex); } throw new PageOperationException("Unable to locate topic 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 topic", te); } throw new PageOperationException("Unable to locate expected tag or topic"); } } return isDisplayed; }
DiscussionsPage extends TopicsListPage { 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 topic or 'Tags: (None)'", ex); } throw new PageOperationException("Unable to locate topic 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 topic", te); } throw new PageOperationException("Unable to locate expected tag or topic"); } } return isDisplayed; } }
DiscussionsPage extends TopicsListPage { 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 topic or 'Tags: (None)'", ex); } throw new PageOperationException("Unable to locate topic 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 topic", te); } throw new PageOperationException("Unable to locate expected tag or topic"); } } return isDisplayed; } DiscussionsPage(WebDrone drone); }
DiscussionsPage extends TopicsListPage { 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 topic or 'Tags: (None)'", ex); } throw new PageOperationException("Unable to locate topic 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 topic", te); } throw new PageOperationException("Unable to locate expected tag or topic"); } } return isDisplayed; } DiscussionsPage(WebDrone drone); @SuppressWarnings("unchecked") @Override DiscussionsPage render(RenderTime timer); @SuppressWarnings("unchecked") @Override DiscussionsPage render(); @SuppressWarnings("unchecked") @Override DiscussionsPage render(long time); TopicViewPage createTopic(String titleField, String textLines); TopicViewPage createTopic(String titleField); TopicViewPage createTopic(String titleField, String textLines, String tag); TopicDirectoryInfo getTopicDirectoryInfo(final String title); boolean isNewTopicEnabled(); TopicViewPage viewTopic(String title); TopicViewPage editTopic(String oldTitle, String newTitle, String txtLines); TopicViewPage editTopic(String oldTitle, String newTitle, String txtLines, String tagName); TopicViewPage editTopic(String oldTitle, String newTitle, String txtLines, String tagName,  boolean removeTag); DiscussionsPage deleteTopicWithConfirm(String title); int getTopicsCount(); boolean isEditTopicDisplayed(String title); boolean isDeleteTopicDisplayed(String title); TopicsListFilter getTopicsListFilter(); List<String> getTopicTitles(); boolean isTopicPresented(String title); boolean checkTags(String title, String tag); boolean isNoTopicsDisplayed(); }
DiscussionsPage extends TopicsListPage { 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 topic or 'Tags: (None)'", ex); } throw new PageOperationException("Unable to locate topic 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 topic", te); } throw new PageOperationException("Unable to locate expected tag or topic"); } } return isDisplayed; } DiscussionsPage(WebDrone drone); @SuppressWarnings("unchecked") @Override DiscussionsPage render(RenderTime timer); @SuppressWarnings("unchecked") @Override DiscussionsPage render(); @SuppressWarnings("unchecked") @Override DiscussionsPage render(long time); TopicViewPage createTopic(String titleField, String textLines); TopicViewPage createTopic(String titleField); TopicViewPage createTopic(String titleField, String textLines, String tag); TopicDirectoryInfo getTopicDirectoryInfo(final String title); boolean isNewTopicEnabled(); TopicViewPage viewTopic(String title); TopicViewPage editTopic(String oldTitle, String newTitle, String txtLines); TopicViewPage editTopic(String oldTitle, String newTitle, String txtLines, String tagName); TopicViewPage editTopic(String oldTitle, String newTitle, String txtLines, String tagName,  boolean removeTag); DiscussionsPage deleteTopicWithConfirm(String title); int getTopicsCount(); boolean isEditTopicDisplayed(String title); boolean isDeleteTopicDisplayed(String title); TopicsListFilter getTopicsListFilter(); List<String> getTopicTitles(); boolean isTopicPresented(String title); boolean checkTags(String title, String tag); boolean isNoTopicsDisplayed();  }