From de7cf93364af7607ab732d1603d453b6ea613dab Mon Sep 17 00:00:00 2001 From: SergSam Date: Sun, 3 Mar 2019 20:57:12 +0100 Subject: [PATCH 1/4] New classes for Question and Answers functionality and basic tests have been added. --- .../jcommune/QuestionAndAnswersTest.java | 83 +++++ .../src/test/resources/testng.xml | 16 +- .../jcommune/webdriver/action/Topics.java | 110 ++++++- .../entity/topic/QuestionAndAnswers.java | 9 + .../jcommune/webdriver/page/BranchPage.java | 24 ++ .../jcommune/webdriver/page/MainPage.java | 22 ++ .../tests/jcommune/webdriver/page/Pages.java | 3 + .../page/QuestionAndAnswersPage.java | 283 ++++++++++++++++++ 8 files changed, 536 insertions(+), 14 deletions(-) create mode 100644 functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/QuestionAndAnswersTest.java create mode 100644 jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/entity/topic/QuestionAndAnswers.java create mode 100644 jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/QuestionAndAnswersPage.java diff --git a/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/QuestionAndAnswersTest.java b/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/QuestionAndAnswersTest.java new file mode 100644 index 00000000..750e5628 --- /dev/null +++ b/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/QuestionAndAnswersTest.java @@ -0,0 +1,83 @@ +package org.jtalks.tests.jcommune; + +import org.jtalks.tests.jcommune.webdriver.action.Topics; +import org.jtalks.tests.jcommune.webdriver.action.Users; +import org.jtalks.tests.jcommune.webdriver.entity.topic.QuestionAndAnswers; +import org.jtalks.tests.jcommune.webdriver.entity.user.User; +import org.jtalks.tests.jcommune.webdriver.exceptions.ValidationException; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; +import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric; +import static org.jtalks.tests.jcommune.webdriver.JCommuneSeleniumConfig.driver; +import static org.jtalks.tests.jcommune.webdriver.page.Pages.mainPage; + +public class QuestionAndAnswersTest { + + @BeforeClass(alwaysRun = true) + @Parameters({"appUrl"}) + public void enablingQuestionAndAnswersPlugin (String appUrl) throws Exception { + driver.get(appUrl); + mainPage.logOutIfLoggedIn(driver); + Users.signIn(User.admin()); + mainPage.openPluginsPage(); + mainPage.checkingEnabledPlugins(); + } + + + @BeforeMethod(alwaysRun = true) + @Parameters({"appUrl"}) + public void setupCase(String appUrl) throws ValidationException { + driver.get(appUrl); + mainPage.logOutIfLoggedIn(driver); + } + + + @Test(groups = "ui-tests") + public void createQuestionWithTitleAndBody_ShouldPass() throws Exception { + Users.signUpAndSignIn(); + QuestionAndAnswers question = new QuestionAndAnswers(); + QuestionAndAnswers createdTopic = Topics.createQuestionAndAnswers(question); + Assert.assertTrue(Topics.isCreated(createdTopic)); + } + + @Test(groups = "ui-tests") + public void postValidCommentToOwnQuestion_ShouldPass() throws Exception { + Users.signUpAndSignIn(); + QuestionAndAnswers question = new QuestionAndAnswers(); + String comment = (randomAlphanumeric(200)); + Topics.createQuestionAndAnswers(question); + Topics.fillCommentToOwnQuestion(question, comment); + } + + @Test(groups = "ui-tests") + public void editCommentToOwnQuestion_ShouldPass() throws Exception { + Users.signUpAndSignIn(); + QuestionAndAnswers question = new QuestionAndAnswers(); + String comment = (randomAlphanumeric(200)); + Topics.createQuestionAndAnswers(question); + Topics.fillCommentToOwnQuestion(question, comment); + Topics.EditOwnCommentToQuestion(question, comment); + } + + @Test(groups = "ui-tests") + public void deleteCommentToOwnQuestion_ShouldPass() throws Exception { + Users.signUpAndSignIn(); + QuestionAndAnswers question = new QuestionAndAnswers(); + String comment = (randomAlphanumeric(200)); + Topics.createQuestionAndAnswers(question); + Topics.fillCommentToOwnQuestion(question, comment); + Topics.deleteOwnQAComment(question, comment); + } + + @Test(groups = "ui-tests") + public void addAnswerToOwnQuestion_ShouldPass() throws Exception { + Users.signUpAndSignIn(); + QuestionAndAnswers question = new QuestionAndAnswers(); + Topics.createQuestionAndAnswers(question); + Topics.answerToOwnQuestion(question); + + } +} diff --git a/functional-tests-jcommune/src/test/resources/testng.xml b/functional-tests-jcommune/src/test/resources/testng.xml index e7aa2941..b3b8f422 100644 --- a/functional-tests-jcommune/src/test/resources/testng.xml +++ b/functional-tests-jcommune/src/test/resources/testng.xml @@ -1,7 +1,8 @@ - + + @@ -31,12 +32,13 @@ - - - + + + + diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java index f57ab1cd..4175d0c9 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java @@ -15,13 +15,12 @@ package org.jtalks.tests.jcommune.webdriver.action; +import com.google.common.base.Splitter; +import org.apache.commons.lang3.StringUtils; import org.jtalks.tests.jcommune.assertion.Existence; import org.jtalks.tests.jcommune.webdriver.JCommuneSeleniumConfig; import org.jtalks.tests.jcommune.webdriver.entity.branch.Branch; -import org.jtalks.tests.jcommune.webdriver.entity.topic.CodeReview; -import org.jtalks.tests.jcommune.webdriver.entity.topic.CodeReviewComment; -import org.jtalks.tests.jcommune.webdriver.entity.topic.Post; -import org.jtalks.tests.jcommune.webdriver.entity.topic.Topic; +import org.jtalks.tests.jcommune.webdriver.entity.topic.*; import org.jtalks.tests.jcommune.webdriver.entity.user.User; import org.jtalks.tests.jcommune.webdriver.exceptions.CouldNotOpenPageException; import org.jtalks.tests.jcommune.webdriver.exceptions.PermissionsDeniedException; @@ -29,11 +28,14 @@ import org.jtalks.tests.jcommune.webdriver.exceptions.ValidationException; import static org.jtalks.tests.jcommune.webdriver.JCommuneSeleniumConfig.driver; +import org.jtalks.tests.jcommune.webdriver.page.Pages; import org.jtalks.tests.jcommune.webdriver.page.PostPage; +import org.jtalks.tests.jcommune.webdriver.page.QuestionAndAnswersPage; import org.jtalks.tests.jcommune.webdriver.page.TopicPage; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert; @@ -128,7 +130,7 @@ public static void editPost(Topic topic, Post postToEdit) { String newPostContent = randomAlphanumeric(100); topicPage.fillBody(newPostContent); topicPage.clickAnswerToTopicButton(); - for(int i = 0; i < topic.getPosts().size(); i++) { + for (int i = 0; i < topic.getPosts().size(); i++) { if (topic.getPosts().get(i).getPostContent().equals(postToEdit.getPostContent())) { topic.getPosts().get(i).setPostContent(newPostContent); break; @@ -386,7 +388,7 @@ public static void editCodeReviewComment(CodeReview codeReview, CodeReviewCommen String newCommentContent = randomAlphanumeric(100); postPage.editCodeReviewCommentBody(newCommentContent); postPage.clickOkButtonInEditComment(); - for(int i = 0; i < codeReview.getComments().size(); i++) { + for (int i = 0; i < codeReview.getComments().size(); i++) { if (codeReview.getComments().get(i).getPostContent().equals(codeReviewComment.getPostContent())) { codeReview.getComments().get(i).setPostContent(newCommentContent); break; @@ -424,10 +426,104 @@ public static void editPost(CodeReview codeReview, Post postToEdit) { throw new UnsupportedOperationException("Edit post can't be done in code review type topics"); } - public static void deleteCodeReviewComment(CodeReview codeReview, CodeReviewComment codeReviewComment){ + public static void deleteCodeReviewComment(CodeReview codeReview, CodeReviewComment codeReviewComment) { openRequiredTopic(codeReview); postPage.clickDeleteInCodeReviewCommentContainingString(codeReviewComment.getPostContent()); postPage.closeDeleteCRCommentConfirmDialogOk(); } + + // QuestionAndAnswers methods + + public static QuestionAndAnswers createQuestionAndAnswers(QuestionAndAnswers questionAndAnswers) + throws PermissionsDeniedException, CouldNotOpenPageException, ValidationException { + if (questionAndAnswers.getBranch() == null) { + List branches = sectionPage.getBranches(); + if (isEmpty(branches)) { + throw new CouldNotOpenPageException("Could not open any branch, there were 0 on the page. " + + "Page URL: [" + JCommuneSeleniumConfig.driver.getCurrentUrl() + "]. " + + "Page Title: [" + JCommuneSeleniumConfig.driver.getTitle() + "]. " + + "Page source: " + JCommuneSeleniumConfig.driver.getPageSource()); + } + Branch branch = new Branch(sectionPage.getBranches().get(0).getText()); + questionAndAnswers.withBranch(branch); + } + Branches.openBranch(questionAndAnswers.getBranch()); + branchPage.clickQuestionAndAnswers(); + questionAndAnswersPage.fillQuesionAndAnswersFields(questionAndAnswers); + questionAndAnswersPage.clickAnswerToTopicButton(); + assertQuestionAndAnswersFormValid(); + return questionAndAnswers; + } + + private static void assertQuestionAndAnswersFormValid() throws ValidationException { + String failedFields = ""; + info("Check subject"); + if (Existence.existsImmediately(driver, questionAndAnswersPage.getSubjectErrorMessage())) { + WebElement subjectError = questionAndAnswersPage.getSubjectErrorMessage(); + failedFields += subjectError.getText() + "\n"; + } + info("Check body"); + if (Existence.existsImmediately(driver, questionAndAnswersPage.getBodyErrorMessage())) { + WebElement bodyError = questionAndAnswersPage.getBodyErrorMessage(); + failedFields += bodyError.getText(); + } + info("Check finished"); + if (!failedFields.equals("")) { + info("Found validation errors: " + failedFields); + throw new ValidationException(failedFields); + } + info("Check successful. No errors."); + } + + @Step + public static String fillCommentToOwnQuestion(QuestionAndAnswers question, String comment) + throws PermissionsDeniedException, ValidationException { + openRequiredTopic(question); + info("We are in the required topic"); + questionAndAnswersPage.addFirstComment(comment); + questionAndAnswersPage.clickSubmitCommentButton(); + return comment; + } + + @Step + public static String EditOwnCommentToQuestion(QuestionAndAnswers question, String comment) + throws PermissionsDeniedException, ValidationException { + openRequiredTopic(question); + info("We are in the required topic"); + questionAndAnswersPage.findProperComment(comment); + questionAndAnswersPage.clickEditCommentButton(); + String newCommentContent = randomAlphanumeric(100); + questionAndAnswersPage.addComment(newCommentContent); + questionAndAnswersPage.clickConfirmEditCommentButton(); + Assert.assertEquals(questionAndAnswersPage.getFirstCommentContent().getText(),newCommentContent); + return newCommentContent; + } + + @Step + public static void deleteOwnQAComment(QuestionAndAnswers question,String comment) throws PermissionsDeniedException { + openRequiredTopic(question); + info("We are in the required topic"); + questionAndAnswersPage.findProperComment(comment); + info("Clicking delete button for topic's first comment"); + try { + questionAndAnswersPage.clickDeleteCommentButton();; + } catch (NoSuchElementException e) { + info("Delete button was not found"); + throw new PermissionsDeniedException("Delete button was not found. Lack of permissions?"); + } + questionAndAnswersPage.getConfirmDeleteCommentButton().click(); + } + + @Step + public static void answerToOwnQuestion(QuestionAndAnswers question) throws PermissionsDeniedException { + openRequiredTopic(question); + info("We are in the required topic"); + questionAndAnswersPage.clickAnswerToOwnQuestionButton(); + questionAndAnswersPage.getConfirmAnswerButton().click(); + info("Adding a new answer"); + questionAndAnswersPage.fillBody(randomAlphanumeric(200)); + info("Click the post answer button"); + questionAndAnswersPage.getPostButton().click(); + } } diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/entity/topic/QuestionAndAnswers.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/entity/topic/QuestionAndAnswers.java new file mode 100644 index 00000000..fecb9e77 --- /dev/null +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/entity/topic/QuestionAndAnswers.java @@ -0,0 +1,9 @@ +package org.jtalks.tests.jcommune.webdriver.entity.topic; + +public class QuestionAndAnswers extends Topic { + + public QuestionAndAnswers() { + super(); + } + +} diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/BranchPage.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/BranchPage.java index a0426784..51583c37 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/BranchPage.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/BranchPage.java @@ -43,6 +43,9 @@ public class BranchPage { @FindBy(className = "new-code-review-btn") private WebElement newCodeReviewButton; + @FindBy(className = "new-question-btn") + private WebElement newQuestionAndAnswersButton; + @FindBy(xpath = "//table[@id='topics-table']/tbody/tr/td[@class='posts-td-small posts-td-small_2']/h2/a[contains(@href, '" + JCommuneSeleniumConfig.JCOMMUNE_CONTEXT_PATH + "/topics/')]") private List topicsList; @@ -80,6 +83,23 @@ public void clickCreateCodeReview() throws PermissionsDeniedException { } } + + @Step + public void clickQuestionAndAnswers() throws PermissionsDeniedException { + info("Clicking New Question and Answers Button"); + try { + if (getNewTopicToggle() != null) { + getNewTopicToggle().click(); + } + getNewQuestionAndAnswersButton().click(); + } catch (NoSuchElementException e) { + info("No such button found!"); + throw new PermissionsDeniedException("Couldn't find New Question and Answers button. Check if Q&A plugin is enabled. Here is the page source: \n" + + driver.getPageSource()); + } + } + + public boolean isUserAlreadySubscribed() { return subscribeButton.getAttribute("href").contains("/unsubscribe"); } @@ -169,6 +189,10 @@ public WebElement getNewCodeReviewButton() { return newCodeReviewButton; } + public WebElement getNewQuestionAndAnswersButton() { + return newQuestionAndAnswersButton; + } + public List getTopicsList() { return topicsList; } diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/MainPage.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/MainPage.java index e314ce4c..86dcdfde 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/MainPage.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/MainPage.java @@ -45,6 +45,10 @@ public class MainPage { private WebElement administrationDropdownMenu; @FindBy(id = "Administration") private WebElement toggleAdmineModeLink; + @FindBy (id = "PluginPage") + WebElement togglePluginPageLink; + @FindBy (className = "plugin-checkbox") + private WebElement QuestionAndAnswersCheckbox; @FindBy(xpath = openedDropdownMenuSel) private WebElement openedDropdownMenu; @FindBy(xpath = languageSwitcherSel) @@ -246,6 +250,24 @@ public boolean isInSmallScreenMode() { } } + @Step + public void openPluginsPage() { + administrationDropdownMenu.click(); + togglePluginPageLink.click(); + } + + @Step + public void checkingEnabledPlugins() { + info("Checking if Q&A plugin is enabled"); + if (! QuestionAndAnswersCheckbox.isSelected()) { + info("Q&A plugin is disabled. Switching it ON"); + QuestionAndAnswersCheckbox.click(); + } else { + info("Q&A plugin is enabled already, doing nothing"); + } + info("Q&A plugin is switched ON"); + } + public WebElement getLastPostAuthor() { return lastPostAuthor; } diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/Pages.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/Pages.java index 2de7ea02..8abae5aa 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/Pages.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/Pages.java @@ -1,5 +1,6 @@ package org.jtalks.tests.jcommune.webdriver.page; +import org.jtalks.tests.jcommune.webdriver.entity.topic.QuestionAndAnswers; import org.openqa.selenium.WebDriver; /** @author stanislav bashkirtsev */ @@ -16,6 +17,7 @@ public class Pages { public static ExternalLinksDialog externalLinksDialog; public static ForumSettingsDialog forumSettingsDialog; public static MoveTopicEditor moveTopicEditor; + public static QuestionAndAnswersPage questionAndAnswersPage; public static void createAllPages(WebDriver driver) { @@ -31,5 +33,6 @@ public static void createAllPages(WebDriver driver) { externalLinksDialog = new ExternalLinksDialog(driver); forumSettingsDialog = new ForumSettingsDialog(driver); moveTopicEditor = new MoveTopicEditor(driver); + questionAndAnswersPage = new QuestionAndAnswersPage(driver); } } diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/QuestionAndAnswersPage.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/QuestionAndAnswersPage.java new file mode 100644 index 00000000..8546a012 --- /dev/null +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/QuestionAndAnswersPage.java @@ -0,0 +1,283 @@ +package org.jtalks.tests.jcommune.webdriver.page; + +import org.apache.commons.lang3.StringUtils; +import org.jtalks.tests.jcommune.webdriver.entity.topic.QuestionAndAnswers; +import org.jtalks.tests.jcommune.webdriver.entity.topic.Topic; +import org.jtalks.tests.jcommune.webdriver.exceptions.PermissionsDeniedException; +import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.WebDriver; +import org.openqa.selenium.WebElement; +import org.openqa.selenium.interactions.Actions; +import org.openqa.selenium.support.FindBy; +import org.openqa.selenium.support.FindBys; +import java.util.List; +import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric; +import static org.jtalks.tests.jcommune.utils.ReportNgLogger.info; +import static org.jtalks.tests.jcommune.webdriver.JCommuneSeleniumConfig.driver; + + +public class QuestionAndAnswersPage extends TopicPage { + private String commentContent = randomAlphanumeric(100); + + public static final String deleteCommentWarning = "(Are you sure you want to delete this comment?)" + + "|(Удалить комментарий?)"; + public static final String answerToOwnQuestionWarning ="(Are you sure you want to answer your question?)" + + "|(Use comments if you want to respond to someone's answer. Or edit your question if you want to add more details.)" + + "|(Вы точно хотите ответить на свой же вопрос?)" + + "|(Используйте комментарии, если хотите прокомментировать чей-то ответ. Либо отредактируйте свой вопрос, если хотите добавить больше информации.)"; + + @FindBys({@FindBy (css= "[id^='prompt']")}) + private List commentFields; + + @FindBys({@FindBy (css= "[class^='comment-content']")}) + private List commentFieldsContent; + + @FindBy(css= "[class='comment-textarea edit-comment']") + private WebElement commentTextArea; + + @FindBy(css= "[id='antiMultiAnswersBtn']") + private WebElement answerButton; + + @FindBy(css= "[id='continue-answering']") + private WebElement confirmAnswerButton; + +// @FindBy(className = "vote-up vote-up-unpressed") +// private WebElement voteUpButton; +// +// @FindBy(className = "vote-down vote-down-unpressed") +// private WebElement voteDownButton; +// +// @FindBy(className = "vote-result") +// private WebElement voteResult; + + @FindBy (css= "[class='btn btn-primary comment-submit']") + private WebElement commentButton; + + @FindBy(css= "[class='btn comment-cancel']") + private WebElement commentCamcelButton; + + @FindBy(css= "[class='icon-pencil']") + private WebElement editCommentButton; + + @FindBy(css= "[class='icon-trash']") + private WebElement deleteCommentButton; + + @FindBy(css= "[class='btn btn-primary edit-submit']") + private WebElement editCommentConfirmButton; + + @FindBy (css= "[id='remove-review-ok']") + private WebElement confirmDeleteCommentButton; + + public QuestionAndAnswersPage(WebDriver driver) { + super(driver); + } + + public void fillQuesionAndAnswersFields(QuestionAndAnswers question) { + info("Filling code review title: [" + StringUtils.left(question.getTitle(), 100) + "...]"); + getSubjectField().sendKeys(question.getTitle()); + fillBody(question.getFirstPost().getPostContent()); + } + + public QuestionAndAnswers getAnswer (QuestionAndAnswers question) { + getSubjectField().click(); + return question; + } + + public void findProperComment (String comment) { + info("Trying to find comment with content: " + comment); + for (WebElement currentComment : getCommentFieldsContent()) { + if (currentComment.getText().contains(comment)) { + info("Comment was found."); + } + else { + info("Comment wasn't found."); + } + break; + } + } + + + public void clickSubmitCommentButton() throws PermissionsDeniedException { + info("Clicking the button to post new comment to the post"); + try { + getCommentButton().click(); + info("The button was clicked"); + } catch (NoSuchElementException e) { + info("Couldn't click the button, looks like the permissions are granted"); + throw new PermissionsDeniedException("User does not have permissions to leave comments in the branch"); + } + } + + public void clickEditCommentButton() throws PermissionsDeniedException { + info("Clicking the button to edit a comment"); + try { + getEditCommentButton().click(); + info("The button was clicked"); + } catch (NoSuchElementException e) { + info("Couldn't click the button, looks like the permissions are granted"); + throw new PermissionsDeniedException("User does not have permissions to edit comments in the branch"); + } + } + + + public void clickConfirmEditCommentButton() throws PermissionsDeniedException { + info("Clicking the button to save an updated comment"); + try { + getEditCommentConfirmButton().click(); + info("The button was clicked"); + } catch (NoSuchElementException e) { + info("Couldn't click the button, looks like the permissions are granted"); + throw new PermissionsDeniedException("User does not have permissions to edit comments in the branch"); + } + } + + + public void clickDeleteCommentButton() throws PermissionsDeniedException { + info("Clicking the button to remove a comment"); + try { + getDeleteCommentButton().click(); + info("The button was clicked"); + } catch (NoSuchElementException e) { + info("Couldn't click the button, looks like the permissions are granted"); + throw new PermissionsDeniedException("User does not have permissions to delete comments in the branch"); + } + } + + public void clickAnswerToOwnQuestionButton() throws PermissionsDeniedException { + info("Clicking the button to answer to own question"); + try { + getAnswerButton().click(); + info("The button was clicked"); + } catch (NoSuchElementException e) { + info("Couldn't click the button, looks like the permissions are granted"); + throw new PermissionsDeniedException("User does not have permissions to answer to question in the branch"); + } + } + + + @Override + public void fillTopicMainFields(Topic topic) throws PermissionsDeniedException { + super.fillTopicMainFields(topic); + } + + @Override + public void clickAnswerToTopicButton() throws PermissionsDeniedException { + super.clickAnswerToTopicButton(); + } + + @Override + public void fillBody(String newMessage) { + super.fillBody(newMessage); + } + + @Override + public WebElement getPostButton() { + return super.getPostButton(); + } + + @Override + public WebElement getBodyErrorMessage() { + return super.getBodyErrorMessage(); + } + + @Override + public WebElement getSubjectErrorMessage() { + return super.getSubjectErrorMessage(); + } + + @Override + public WebElement getSubjectField() { + return super.getSubjectField(); + } + + @Override + public WebElement getMainBodyArea() { + return super.getMainBodyArea(); + } + + public List getCommentFields() { + return commentFields; + } + + public WebElement getCommentButton() { + return commentButton; + } + + + public WebElement getFirstCommentContent() { + return getCommentFieldsContent().get(0); + } + + public void addFirstComment (String answer){ + Actions actions = new Actions(driver); + for (WebElement comment : getCommentFields()) { + actions.moveToElement(comment); + actions.click(); + info("Filling new comment: " + answer); + actions.sendKeys(answer); + actions.build().perform(); + } + } + + public void addComment (String newComment){ + getCommentTextArea().clear(); + info("Filling new comment: " + newComment); + getCommentTextArea().sendKeys(newComment); + } + + +// +// public WebElement getVoteUpButton() { +// return voteUpButton; +// } +// +// public WebElement getVoteDownButton() { +// return voteDownButton; +// } +// +// public WebElement getVoteResult() { +// return voteResult; +// } +// + + public WebElement getCommentCamcelButton() { + return commentCamcelButton; + } + + public String getCommentContent() { + return commentContent; + } +// + public WebElement getEditCommentButton() { + return editCommentButton; + } + + public WebElement getEditCommentConfirmButton() { + return editCommentConfirmButton; + } + + public List getCommentFieldsContent() { + return commentFieldsContent; + } + + public WebElement getDeleteCommentButton() { + return deleteCommentButton; + } + + public WebElement getConfirmDeleteCommentButton() { + return confirmDeleteCommentButton; + } + + public WebElement getCommentTextArea() { + return commentTextArea; + } + + public WebElement getAnswerButton() { + return answerButton; + } + + public WebElement getConfirmAnswerButton() { + return confirmAnswerButton; + } + +} \ No newline at end of file From 65d204d17ea9f92e39a4c6cedb2d6af2cf25379e Mon Sep 17 00:00:00 2001 From: SergSam Date: Sun, 3 Mar 2019 22:10:06 +0100 Subject: [PATCH 2/4] Updated proper url --- functional-tests-jcommune/src/test/resources/testng.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functional-tests-jcommune/src/test/resources/testng.xml b/functional-tests-jcommune/src/test/resources/testng.xml index b3b8f422..cbfcaabf 100644 --- a/functional-tests-jcommune/src/test/resources/testng.xml +++ b/functional-tests-jcommune/src/test/resources/testng.xml @@ -1,8 +1,8 @@ - - + + From 1c936c152f7b0dcfb23a361df9e3323d932b7383 Mon Sep 17 00:00:00 2001 From: SergSam Date: Sat, 13 Apr 2019 20:11:31 +0200 Subject: [PATCH 3/4] New class for question and answers methods has been added + some minor fixes --- .../action/QuestionAndAnswersTopic.java | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/QuestionAndAnswersTopic.java diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/QuestionAndAnswersTopic.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/QuestionAndAnswersTopic.java new file mode 100644 index 00000000..400700ef --- /dev/null +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/QuestionAndAnswersTopic.java @@ -0,0 +1,120 @@ +package org.jtalks.tests.jcommune.webdriver.action; + +import org.jtalks.tests.jcommune.assertion.Existence; +import org.jtalks.tests.jcommune.webdriver.JCommuneSeleniumConfig; +import org.jtalks.tests.jcommune.webdriver.entity.branch.Branch; +import org.jtalks.tests.jcommune.webdriver.entity.topic.QuestionAndAnswers; +import org.jtalks.tests.jcommune.webdriver.exceptions.CouldNotOpenPageException; +import org.jtalks.tests.jcommune.webdriver.exceptions.PermissionsDeniedException; +import org.jtalks.tests.jcommune.webdriver.exceptions.ValidationException; +import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.WebElement; +import org.testng.Assert; +import ru.yandex.qatools.allure.annotations.Step; +import java.util.List; + +import static org.apache.commons.collections.CollectionUtils.isEmpty; +import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric; +import static org.jtalks.tests.jcommune.utils.ReportNgLogger.info; +import static org.jtalks.tests.jcommune.webdriver.JCommuneSeleniumConfig.driver; +import static org.jtalks.tests.jcommune.webdriver.action.Topics.openRequiredTopic; +import static org.jtalks.tests.jcommune.webdriver.page.Pages.*; +import static org.jtalks.tests.jcommune.webdriver.page.Pages.questionAndAnswersPage; + +public class QuestionAndAnswersTopic { + + public static QuestionAndAnswers createQuestionAndAnswers(QuestionAndAnswers questionAndAnswers) + throws PermissionsDeniedException, CouldNotOpenPageException, ValidationException { + if (questionAndAnswers.getBranch() == null) { + List branches = sectionPage.getBranches(); + if (isEmpty(branches)) { + throw new CouldNotOpenPageException("Could not open any branch, there were 0 on the page. " + + "Page URL: [" + JCommuneSeleniumConfig.driver.getCurrentUrl() + "]. " + + "Page Title: [" + JCommuneSeleniumConfig.driver.getTitle() + "]. " + + "Page source: " + JCommuneSeleniumConfig.driver.getPageSource()); + } + Branch branch = new Branch(sectionPage.getBranches().get(0).getText()); + questionAndAnswers.withBranch(branch); + } + Branches.openBranch(questionAndAnswers.getBranch()); + branchPage.clickQuestionAndAnswers(); + questionAndAnswersPage.fillQuesionAndAnswersFields(questionAndAnswers); + questionAndAnswersPage.clickAnswerToTopicButton(); + assertQuestionAndAnswersFormValid(); + return questionAndAnswers; + } + + private static void assertQuestionAndAnswersFormValid() throws ValidationException { + String failedFields = ""; + info("Check subject"); + if (Existence.existsImmediately(driver, questionAndAnswersPage.getSubjectErrorMessage())) { + WebElement subjectError = questionAndAnswersPage.getSubjectErrorMessage(); + failedFields += subjectError.getText() + "\n"; + } + info("Check body"); + if (Existence.existsImmediately(driver, questionAndAnswersPage.getBodyErrorMessage())) { + WebElement bodyError = questionAndAnswersPage.getBodyErrorMessage(); + failedFields += bodyError.getText(); + } + info("Check finished"); + if (!failedFields.equals("")) { + info("Found validation errors: " + failedFields); + throw new ValidationException(failedFields); + } + info("Check successful. No errors."); + } + + @Step + public static String fillCommentToQuestion(QuestionAndAnswers question, String comment) + throws PermissionsDeniedException, ValidationException { + openRequiredTopic(question); + info("We are in the required topic"); + questionAndAnswersPage.addFirstComment(comment); + questionAndAnswersPage.clickSubmitCommentButton(); + Assert.assertEquals(questionAndAnswersPage.getFirstCommentContent().getText(),comment); + return comment; + } + + @Step + public static String editCommentToQuestion(QuestionAndAnswers question, String comment) + throws PermissionsDeniedException, ValidationException { + openRequiredTopic(question); + info("We are in the required topic"); + questionAndAnswersPage.findComment(comment); + questionAndAnswersPage.clickEditCommentButton(); + String newCommentContent = randomAlphanumeric(100); + questionAndAnswersPage.editComment(newCommentContent); + questionAndAnswersPage.clickConfirmEditCommentButton(); + Assert.assertEquals(questionAndAnswersPage.getFirstCommentContent().getText(),newCommentContent); + return newCommentContent; + } + + @Step + public static void deleteQAComment(QuestionAndAnswers question,String comment) throws PermissionsDeniedException { + openRequiredTopic(question); + info("We are in the required topic"); + questionAndAnswersPage.findComment(comment); + info("Clicking delete button for topic's first comment"); + try { + questionAndAnswersPage.clickDeleteCommentButton();; + } catch (NoSuchElementException e) { + info("Delete button was not found"); + throw new PermissionsDeniedException("Delete button was not found. Lack of permissions?"); + } + questionAndAnswersPage.getConfirmDeleteCommentButton().click(); + } + + @Step + public static void answerToQuestion(QuestionAndAnswers question) throws PermissionsDeniedException { + openRequiredTopic(question); + info("We are in the required topic"); + questionAndAnswersPage.clickAnswerToQuestionButton(); + questionAndAnswersPage.getConfirmAnswerButton().click(); + info("Adding a new answer"); + String answer = randomAlphanumeric(100); + questionAndAnswersPage.fillBody(answer); + info("Click the post answer button"); + questionAndAnswersPage.getPostButton().click(); + Assert.assertEquals(questionAndAnswersPage.findAnswer(answer),answer); + } +} From 2130a76945a1259b2309c0a2d41716d369d79f40 Mon Sep 17 00:00:00 2001 From: SergSam Date: Sat, 13 Apr 2019 20:19:18 +0200 Subject: [PATCH 4/4] Methods have been updated regarding to review remarks --- .../jcommune/QuestionAndAnswersTest.java | 30 +++--- .../jcommune/webdriver/action/Topics.java | 93 ------------------- .../jcommune/webdriver/page/MainPage.java | 4 +- .../page/QuestionAndAnswersPage.java | 35 +++++-- .../jcommune/webdriver/page/TopicPage.java | 2 + 5 files changed, 47 insertions(+), 117 deletions(-) diff --git a/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/QuestionAndAnswersTest.java b/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/QuestionAndAnswersTest.java index 750e5628..ac73f4b2 100644 --- a/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/QuestionAndAnswersTest.java +++ b/functional-tests-jcommune/src/test/java/org/jtalks/tests/jcommune/QuestionAndAnswersTest.java @@ -1,10 +1,12 @@ package org.jtalks.tests.jcommune; +import org.jtalks.tests.jcommune.webdriver.action.QuestionAndAnswersTopic; import org.jtalks.tests.jcommune.webdriver.action.Topics; import org.jtalks.tests.jcommune.webdriver.action.Users; import org.jtalks.tests.jcommune.webdriver.entity.topic.QuestionAndAnswers; import org.jtalks.tests.jcommune.webdriver.entity.user.User; import org.jtalks.tests.jcommune.webdriver.exceptions.ValidationException; +import org.jtalks.tests.jcommune.webdriver.page.QuestionAndAnswersPage; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; @@ -23,7 +25,7 @@ public void enablingQuestionAndAnswersPlugin (String appUrl) throws Exception { mainPage.logOutIfLoggedIn(driver); Users.signIn(User.admin()); mainPage.openPluginsPage(); - mainPage.checkingEnabledPlugins(); + mainPage.ensurePlugingEnabled(); } @@ -36,10 +38,10 @@ public void setupCase(String appUrl) throws ValidationException { @Test(groups = "ui-tests") - public void createQuestionWithTitleAndBody_ShouldPass() throws Exception { + public void userCanCreateQuestionWithValidTitleAndBody_ShouldPass() throws Exception { Users.signUpAndSignIn(); QuestionAndAnswers question = new QuestionAndAnswers(); - QuestionAndAnswers createdTopic = Topics.createQuestionAndAnswers(question); + QuestionAndAnswers createdTopic = QuestionAndAnswersTopic.createQuestionAndAnswers(question); Assert.assertTrue(Topics.isCreated(createdTopic)); } @@ -48,8 +50,8 @@ public void postValidCommentToOwnQuestion_ShouldPass() throws Exception { Users.signUpAndSignIn(); QuestionAndAnswers question = new QuestionAndAnswers(); String comment = (randomAlphanumeric(200)); - Topics.createQuestionAndAnswers(question); - Topics.fillCommentToOwnQuestion(question, comment); + QuestionAndAnswersTopic.createQuestionAndAnswers(question); + QuestionAndAnswersTopic.fillCommentToQuestion(question, comment); } @Test(groups = "ui-tests") @@ -57,9 +59,9 @@ public void editCommentToOwnQuestion_ShouldPass() throws Exception { Users.signUpAndSignIn(); QuestionAndAnswers question = new QuestionAndAnswers(); String comment = (randomAlphanumeric(200)); - Topics.createQuestionAndAnswers(question); - Topics.fillCommentToOwnQuestion(question, comment); - Topics.EditOwnCommentToQuestion(question, comment); + QuestionAndAnswersTopic.createQuestionAndAnswers(question); + QuestionAndAnswersTopic.fillCommentToQuestion(question, comment); + QuestionAndAnswersTopic.editCommentToQuestion(question, comment); } @Test(groups = "ui-tests") @@ -67,17 +69,19 @@ public void deleteCommentToOwnQuestion_ShouldPass() throws Exception { Users.signUpAndSignIn(); QuestionAndAnswers question = new QuestionAndAnswers(); String comment = (randomAlphanumeric(200)); - Topics.createQuestionAndAnswers(question); - Topics.fillCommentToOwnQuestion(question, comment); - Topics.deleteOwnQAComment(question, comment); + QuestionAndAnswersTopic.createQuestionAndAnswers(question); + QuestionAndAnswersTopic.fillCommentToQuestion(question, comment); + QuestionAndAnswersTopic.deleteQAComment(question, comment); + Thread.sleep(100); + Assert.assertFalse(driver.getPageSource().contains(comment), "The comment is still present on the page"); } @Test(groups = "ui-tests") public void addAnswerToOwnQuestion_ShouldPass() throws Exception { Users.signUpAndSignIn(); QuestionAndAnswers question = new QuestionAndAnswers(); - Topics.createQuestionAndAnswers(question); - Topics.answerToOwnQuestion(question); + QuestionAndAnswersTopic.createQuestionAndAnswers(question); + QuestionAndAnswersTopic.answerToQuestion(question); } } diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java index 4175d0c9..35c0ea88 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/action/Topics.java @@ -433,97 +433,4 @@ public static void deleteCodeReviewComment(CodeReview codeReview, CodeReviewComm postPage.closeDeleteCRCommentConfirmDialogOk(); } - // QuestionAndAnswers methods - - public static QuestionAndAnswers createQuestionAndAnswers(QuestionAndAnswers questionAndAnswers) - throws PermissionsDeniedException, CouldNotOpenPageException, ValidationException { - if (questionAndAnswers.getBranch() == null) { - List branches = sectionPage.getBranches(); - if (isEmpty(branches)) { - throw new CouldNotOpenPageException("Could not open any branch, there were 0 on the page. " + - "Page URL: [" + JCommuneSeleniumConfig.driver.getCurrentUrl() + "]. " + - "Page Title: [" + JCommuneSeleniumConfig.driver.getTitle() + "]. " + - "Page source: " + JCommuneSeleniumConfig.driver.getPageSource()); - } - Branch branch = new Branch(sectionPage.getBranches().get(0).getText()); - questionAndAnswers.withBranch(branch); - } - Branches.openBranch(questionAndAnswers.getBranch()); - branchPage.clickQuestionAndAnswers(); - questionAndAnswersPage.fillQuesionAndAnswersFields(questionAndAnswers); - questionAndAnswersPage.clickAnswerToTopicButton(); - assertQuestionAndAnswersFormValid(); - return questionAndAnswers; - } - - private static void assertQuestionAndAnswersFormValid() throws ValidationException { - String failedFields = ""; - info("Check subject"); - if (Existence.existsImmediately(driver, questionAndAnswersPage.getSubjectErrorMessage())) { - WebElement subjectError = questionAndAnswersPage.getSubjectErrorMessage(); - failedFields += subjectError.getText() + "\n"; - } - info("Check body"); - if (Existence.existsImmediately(driver, questionAndAnswersPage.getBodyErrorMessage())) { - WebElement bodyError = questionAndAnswersPage.getBodyErrorMessage(); - failedFields += bodyError.getText(); - } - info("Check finished"); - if (!failedFields.equals("")) { - info("Found validation errors: " + failedFields); - throw new ValidationException(failedFields); - } - info("Check successful. No errors."); - } - - @Step - public static String fillCommentToOwnQuestion(QuestionAndAnswers question, String comment) - throws PermissionsDeniedException, ValidationException { - openRequiredTopic(question); - info("We are in the required topic"); - questionAndAnswersPage.addFirstComment(comment); - questionAndAnswersPage.clickSubmitCommentButton(); - return comment; - } - - @Step - public static String EditOwnCommentToQuestion(QuestionAndAnswers question, String comment) - throws PermissionsDeniedException, ValidationException { - openRequiredTopic(question); - info("We are in the required topic"); - questionAndAnswersPage.findProperComment(comment); - questionAndAnswersPage.clickEditCommentButton(); - String newCommentContent = randomAlphanumeric(100); - questionAndAnswersPage.addComment(newCommentContent); - questionAndAnswersPage.clickConfirmEditCommentButton(); - Assert.assertEquals(questionAndAnswersPage.getFirstCommentContent().getText(),newCommentContent); - return newCommentContent; - } - - @Step - public static void deleteOwnQAComment(QuestionAndAnswers question,String comment) throws PermissionsDeniedException { - openRequiredTopic(question); - info("We are in the required topic"); - questionAndAnswersPage.findProperComment(comment); - info("Clicking delete button for topic's first comment"); - try { - questionAndAnswersPage.clickDeleteCommentButton();; - } catch (NoSuchElementException e) { - info("Delete button was not found"); - throw new PermissionsDeniedException("Delete button was not found. Lack of permissions?"); - } - questionAndAnswersPage.getConfirmDeleteCommentButton().click(); - } - - @Step - public static void answerToOwnQuestion(QuestionAndAnswers question) throws PermissionsDeniedException { - openRequiredTopic(question); - info("We are in the required topic"); - questionAndAnswersPage.clickAnswerToOwnQuestionButton(); - questionAndAnswersPage.getConfirmAnswerButton().click(); - info("Adding a new answer"); - questionAndAnswersPage.fillBody(randomAlphanumeric(200)); - info("Click the post answer button"); - questionAndAnswersPage.getPostButton().click(); - } } diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/MainPage.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/MainPage.java index 86dcdfde..24f370a9 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/MainPage.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/MainPage.java @@ -257,13 +257,13 @@ public void openPluginsPage() { } @Step - public void checkingEnabledPlugins() { + public void ensurePlugingEnabled() { info("Checking if Q&A plugin is enabled"); if (! QuestionAndAnswersCheckbox.isSelected()) { info("Q&A plugin is disabled. Switching it ON"); QuestionAndAnswersCheckbox.click(); } else { - info("Q&A plugin is enabled already, doing nothing"); + info("Q&A plugin is already enabled, doing nothing"); } info("Q&A plugin is switched ON"); } diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/QuestionAndAnswersPage.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/QuestionAndAnswersPage.java index 8546a012..338408b0 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/QuestionAndAnswersPage.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/QuestionAndAnswersPage.java @@ -32,6 +32,9 @@ public class QuestionAndAnswersPage extends TopicPage { @FindBys({@FindBy (css= "[class^='comment-content']")}) private List commentFieldsContent; + @FindBys({@FindBy (css= "[class^='content']")}) + private List answersContent; + @FindBy(css= "[class='comment-textarea edit-comment']") private WebElement commentTextArea; @@ -73,17 +76,12 @@ public QuestionAndAnswersPage(WebDriver driver) { } public void fillQuesionAndAnswersFields(QuestionAndAnswers question) { - info("Filling code review title: [" + StringUtils.left(question.getTitle(), 100) + "...]"); + info("Filling QA title: [" + StringUtils.left(question.getTitle(), 100) + "...]"); getSubjectField().sendKeys(question.getTitle()); fillBody(question.getFirstPost().getPostContent()); } - public QuestionAndAnswers getAnswer (QuestionAndAnswers question) { - getSubjectField().click(); - return question; - } - - public void findProperComment (String comment) { + public String findComment (String comment) { info("Trying to find comment with content: " + comment); for (WebElement currentComment : getCommentFieldsContent()) { if (currentComment.getText().contains(comment)) { @@ -94,6 +92,21 @@ public void findProperComment (String comment) { } break; } + return comment; + } + + public String findAnswer (String answer) { + info("Trying to find answer with content: " + answer); + for (WebElement currentAnswer : getAnswersContent()) { + if (currentAnswer.getText().contains(answer)) { + info("Answer was found."); + } + else { + info("Answer wasn't found."); + } + break; + } + return answer; } @@ -143,7 +156,7 @@ public void clickDeleteCommentButton() throws PermissionsDeniedException { } } - public void clickAnswerToOwnQuestionButton() throws PermissionsDeniedException { + public void clickAnswerToQuestionButton() throws PermissionsDeniedException { info("Clicking the button to answer to own question"); try { getAnswerButton().click(); @@ -219,7 +232,7 @@ public void addFirstComment (String answer){ } } - public void addComment (String newComment){ + public void editComment (String newComment){ getCommentTextArea().clear(); info("Filling new comment: " + newComment); getCommentTextArea().sendKeys(newComment); @@ -260,6 +273,10 @@ public List getCommentFieldsContent() { return commentFieldsContent; } + public List getAnswersContent() { + return answersContent; + } + public WebElement getDeleteCommentButton() { return deleteCommentButton; } diff --git a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/TopicPage.java b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/TopicPage.java index 12e46217..a3d0ad02 100644 --- a/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/TopicPage.java +++ b/jcommune-webdriver/src/main/java/org/jtalks/tests/jcommune/webdriver/page/TopicPage.java @@ -6,6 +6,7 @@ import org.jtalks.tests.jcommune.webdriver.JCommuneSeleniumConfig; import org.jtalks.tests.jcommune.webdriver.entity.topic.CodeReview; import org.jtalks.tests.jcommune.webdriver.entity.topic.Poll; +import org.jtalks.tests.jcommune.webdriver.entity.topic.QuestionAndAnswers; import org.jtalks.tests.jcommune.webdriver.entity.topic.Topic; import org.jtalks.tests.jcommune.webdriver.exceptions.PermissionsDeniedException; import org.openqa.selenium.NoSuchElementException; @@ -242,6 +243,7 @@ public void fillCodeReviewFields(CodeReview codeReview) { getSubjectField().sendKeys(codeReview.getTitle()); fillBody(codeReview.getContent()); } + //Getters