Added Question and Answers functionality and basic tests #87
Added Question and Answers functionality and basic tests #87SergSam wants to merge 4 commits intojtalks-org:masterfrom
Conversation
|
|
||
|
|
||
| @Test(groups = "ui-tests") | ||
| public void createQuestionWithTitleAndBody_ShouldPass() throws Exception { |
There was a problem hiding this comment.
ShouldPass sounds unnatural here. What should pass? I'd call it something like canCreateQuestionWithValidTitleAndBody or createdQuestion_showsUpInBranch or even ifCreateQuestionPermissionsGrantedInBranch_canCreateQuestion. Though I don't see granting permissions, so the latter may be not applicable.
What about validation failure tests like whenCreatingQuestion_emptyTitleAndBody_resultInValidationErrors (don't need many of these though for each field, maybe just this one for body & title).
There was a problem hiding this comment.
The method will be renamed. Regarding to validation failure tests - since the creation of Q&A based on topic's form and we already have such methods for Topic, I decided do not duplicate code.
| public class QuestionAndAnswersPage extends TopicPage { | ||
| private String commentContent = randomAlphanumeric(100); | ||
|
|
||
| public static final String deleteCommentWarning = "(Are you sure you want to delete this comment?)" + |
There was a problem hiding this comment.
We've been writing tests only for English i18n as far as I remember.
There was a problem hiding this comment.
The topic page was taken as an example - there are two languages used.
| } | ||
|
|
||
| @Override | ||
| public void clickAnswerToTopicButton() throws PermissionsDeniedException { |
There was a problem hiding this comment.
Why do you override these methods?
There was a problem hiding this comment.
This button belongs to Topic page, I decided to use already existed method to avoid duplicating .
| } | ||
|
|
||
| @Step | ||
| public static String fillCommentToOwnQuestion(QuestionAndAnswers question, String comment) |
There was a problem hiding this comment.
Why is it important that it's "your own" question?
There was a problem hiding this comment.
When a user answers to own question he/she gets a warning pop up, which skiped for other users. But I'll try to adjust the method for all cases by adding an additional condition.
| Actions actions = new Actions(driver); | ||
| for (WebElement comment : getCommentFields()) { | ||
| actions.moveToElement(comment); | ||
| actions.click(); |
There was a problem hiding this comment.
You can call addComment() from this place instead of duplicating the code.
| return question; | ||
| } | ||
|
|
||
| public void findProperComment (String comment) { |
There was a problem hiding this comment.
Just findComment(), "proper" doesn't sound right.
| } | ||
|
|
||
| @Step | ||
| public void checkingEnabledPlugins() { |
| } | ||
|
|
||
| @Step | ||
| public static String EditOwnCommentToQuestion(QuestionAndAnswers question, String comment) |
|
|
||
| // QuestionAndAnswers methods | ||
|
|
||
| public static QuestionAndAnswers createQuestionAndAnswers(QuestionAndAnswers questionAndAnswers) |
There was a problem hiding this comment.
You can move these methods into a separate class.
No description provided.