@Test(dependsOnMethods = "checkTags", priority = 2) public void editPost() { if(!(drone.getCurrentPage() instanceof BlogPage)) { blogPage = postViewPage.clickBackLink().render(); } blogPage.editPost(postName, newPostName, newPostText, tagName, false).render(); assertTrue(postViewPage.verifyPostExists(newPostName)); assertFalse(postViewPage.verifyPostExists(postName)); postViewPage.clickBackLink().render(); }
public PostViewPage editPost(String oldTitle, String newTitle, String txtLines, String tagName, boolean removeTag) { try { EditPostForm editPostForm = getPostDirectoryInfo(oldTitle).editPost(); editPostForm.setTitleField(newTitle); editPostForm.insertText(txtLines); if (!removeTag) { editPostForm.addTag(tagName); } else { editPostForm.removeTag(tagName); } editPostForm.clickSaveAsDraft(); waitUntilAlert(); logger.info("Edited post " + oldTitle); return new PostViewPage(drone).render(); } catch (TimeoutException te) { throw new ShareException("Timed out finding buttons"); } }
BlogPage extends SitePage { public PostViewPage editPost(String oldTitle, String newTitle, String txtLines, String tagName, boolean removeTag) { try { EditPostForm editPostForm = getPostDirectoryInfo(oldTitle).editPost(); editPostForm.setTitleField(newTitle); editPostForm.insertText(txtLines); if (!removeTag) { editPostForm.addTag(tagName); } else { editPostForm.removeTag(tagName); } editPostForm.clickSaveAsDraft(); waitUntilAlert(); logger.info("Edited post " + oldTitle); return new PostViewPage(drone).render(); } catch (TimeoutException te) { throw new ShareException("Timed out finding buttons"); } } }
BlogPage extends SitePage { public PostViewPage editPost(String oldTitle, String newTitle, String txtLines, String tagName, boolean removeTag) { try { EditPostForm editPostForm = getPostDirectoryInfo(oldTitle).editPost(); editPostForm.setTitleField(newTitle); editPostForm.insertText(txtLines); if (!removeTag) { editPostForm.addTag(tagName); } else { editPostForm.removeTag(tagName); } editPostForm.clickSaveAsDraft(); waitUntilAlert(); logger.info("Edited post " + oldTitle); return new PostViewPage(drone).render(); } catch (TimeoutException te) { throw new ShareException("Timed out finding buttons"); } } BlogPage(WebDrone drone); }
BlogPage extends SitePage { public PostViewPage editPost(String oldTitle, String newTitle, String txtLines, String tagName, boolean removeTag) { try { EditPostForm editPostForm = getPostDirectoryInfo(oldTitle).editPost(); editPostForm.setTitleField(newTitle); editPostForm.insertText(txtLines); if (!removeTag) { editPostForm.addTag(tagName); } else { editPostForm.removeTag(tagName); } editPostForm.clickSaveAsDraft(); waitUntilAlert(); logger.info("Edited post " + oldTitle); return new PostViewPage(drone).render(); } catch (TimeoutException te) { throw new ShareException("Timed out finding buttons"); } } 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 PostViewPage editPost(String oldTitle, String newTitle, String txtLines, String tagName, boolean removeTag) { try { EditPostForm editPostForm = getPostDirectoryInfo(oldTitle).editPost(); editPostForm.setTitleField(newTitle); editPostForm.insertText(txtLines); if (!removeTag) { editPostForm.addTag(tagName); } else { editPostForm.removeTag(tagName); } editPostForm.clickSaveAsDraft(); waitUntilAlert(); logger.info("Edited post " + oldTitle); return new PostViewPage(drone).render(); } catch (TimeoutException te) { throw new ShareException("Timed out finding buttons"); } } 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();  }