-
Notifications
You must be signed in to change notification settings - Fork 21
Added Question and Answers functionality and basic tests #87
base: master
Are you sure you want to change the base?
Conversation
|
||
|
||
@Test(groups = "ui-tests") | ||
public void createQuestionWithTitleAndBody_ShouldPass() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've been writing tests only for English i18n as far as I remember.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you override these methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it important that it's "your own" question?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just findComment()
, "proper" doesn't sound right.
} | ||
|
||
@Step | ||
public void checkingEnabledPlugins() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensurePlugingEnabled()
} | ||
|
||
@Step | ||
public static String EditOwnCommentToQuestion(QuestionAndAnswers question, String comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
editOwnCommentToQuestion
|
||
// QuestionAndAnswers methods | ||
|
||
public static QuestionAndAnswers createQuestionAndAnswers(QuestionAndAnswers questionAndAnswers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move these methods into a separate class.
No description provided.