-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Migrate num scale e2e * Fix team id * Fix bugs
- Loading branch information
1 parent
8f43cc8
commit b9ccd4f
Showing
5 changed files
with
416 additions
and
0 deletions.
There are no files selected for viewing
124 changes: 124 additions & 0 deletions
124
src/e2e/java/teammates/e2e/cases/sql/FeedbackNumScaleQuestionE2ETest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
package teammates.e2e.cases.sql; | ||
|
||
import org.testng.annotations.Test; | ||
|
||
import teammates.common.datatransfer.questions.FeedbackNumericalScaleQuestionDetails; | ||
import teammates.common.datatransfer.questions.FeedbackNumericalScaleResponseDetails; | ||
import teammates.e2e.pageobjects.FeedbackSubmitPage; | ||
import teammates.e2e.pageobjects.InstructorFeedbackEditPage; | ||
import teammates.storage.sqlentity.FeedbackQuestion; | ||
import teammates.storage.sqlentity.FeedbackResponse; | ||
import teammates.storage.sqlentity.Student; | ||
|
||
/** | ||
* SUT: {@link Const.WebPageURIs#INSTRUCTOR_SESSION_EDIT_PAGE}, {@link Const.WebPageURIs#SESSION_SUBMISSION_PAGE} | ||
* specifically for NumScale questions. | ||
*/ | ||
public class FeedbackNumScaleQuestionE2ETest extends BaseFeedbackQuestionE2ETest { | ||
|
||
@Override | ||
protected void prepareTestData() { | ||
testData = removeAndRestoreDataBundle(loadSqlDataBundle("/FeedbackNumScaleQuestionE2ESqlTest.json")); | ||
|
||
instructor = testData.instructors.get("instructor"); | ||
course = testData.courses.get("course"); | ||
feedbackSession = testData.feedbackSessions.get("openSession"); | ||
student = testData.students.get("[email protected]"); | ||
} | ||
|
||
@Test | ||
@Override | ||
public void testAll() { | ||
testEditPage(); | ||
logout(); | ||
testSubmitPage(); | ||
} | ||
|
||
@Override | ||
protected void testEditPage() { | ||
InstructorFeedbackEditPage feedbackEditPage = loginToFeedbackEditPage(); | ||
|
||
______TS("verify loaded question"); | ||
FeedbackQuestion loadedQuestion = testData.feedbackQuestions.get("qn1ForFirstSession"); | ||
FeedbackNumericalScaleQuestionDetails questionDetails = | ||
(FeedbackNumericalScaleQuestionDetails) loadedQuestion.getQuestionDetailsCopy(); | ||
feedbackEditPage.verifyNumScaleQuestionDetails(1, questionDetails); | ||
|
||
______TS("add new question"); | ||
// add new question exactly like loaded question | ||
loadedQuestion.setQuestionNumber(2); | ||
feedbackEditPage.addNumScaleQuestion(loadedQuestion); | ||
feedbackEditPage.waitUntilAnimationFinish(); | ||
|
||
feedbackEditPage.verifyNumScaleQuestionDetails(2, questionDetails); | ||
verifyPresentInDatabase(loadedQuestion); | ||
|
||
______TS("copy question"); | ||
FeedbackQuestion copiedQuestion = testData.feedbackQuestions.get("qn1ForSecondSession"); | ||
questionDetails = (FeedbackNumericalScaleQuestionDetails) copiedQuestion.getQuestionDetailsCopy(); | ||
feedbackEditPage.copyQuestion(copiedQuestion.getCourseId(), | ||
copiedQuestion.getQuestionDetailsCopy().getQuestionText()); | ||
copiedQuestion.setQuestionNumber(3); | ||
copiedQuestion.setFeedbackSession(feedbackSession); | ||
|
||
feedbackEditPage.verifyNumScaleQuestionDetails(3, questionDetails); | ||
verifyPresentInDatabase(copiedQuestion); | ||
|
||
______TS("edit question"); | ||
questionDetails = (FeedbackNumericalScaleQuestionDetails) loadedQuestion.getQuestionDetailsCopy(); | ||
FeedbackNumericalScaleQuestionDetails newQuestionDetails = | ||
(FeedbackNumericalScaleQuestionDetails) questionDetails.getDeepCopy(); | ||
newQuestionDetails.setMinScale(0); | ||
newQuestionDetails.setStep(1); | ||
newQuestionDetails.setMaxScale(100); | ||
loadedQuestion.setQuestionDetails(newQuestionDetails); | ||
feedbackEditPage.editNumScaleQuestion(2, newQuestionDetails); | ||
feedbackEditPage.waitForPageToLoad(); | ||
|
||
feedbackEditPage.verifyNumScaleQuestionDetails(2, newQuestionDetails); | ||
verifyPresentInDatabase(loadedQuestion); | ||
|
||
// reset question details to original | ||
loadedQuestion.setQuestionDetails(questionDetails); | ||
} | ||
|
||
@Override | ||
protected void testSubmitPage() { | ||
FeedbackSubmitPage feedbackSubmitPage = loginToFeedbackSubmitPage(); | ||
|
||
______TS("verify loaded question"); | ||
FeedbackQuestion question = testData.feedbackQuestions.get("qn1ForFirstSession"); | ||
Student receiver = testData.students.get("[email protected]"); | ||
feedbackSubmitPage.verifyNumScaleQuestion(1, receiver.getTeamName(), | ||
(FeedbackNumericalScaleQuestionDetails) question.getQuestionDetailsCopy()); | ||
|
||
______TS("submit response"); | ||
FeedbackResponse response = getResponse(question, receiver, 5.4); | ||
feedbackSubmitPage.fillNumScaleResponse(1, receiver.getTeamName(), response); | ||
feedbackSubmitPage.clickSubmitQuestionButton(1); | ||
|
||
// TODO: uncomment when SubmitFeedbackResponse is working | ||
// verifyPresentInDatabase(response); | ||
|
||
// ______TS("check previous response"); | ||
// feedbackSubmitPage = getFeedbackSubmitPage(); | ||
// feedbackSubmitPage.verifyNumScaleResponse(1, receiver.getTeamName(), response); | ||
|
||
// ______TS("edit response"); | ||
// response = getResponse(question, receiver, 10.0); | ||
// feedbackSubmitPage.fillNumScaleResponse(1, receiver.getTeamName(), response); | ||
// feedbackSubmitPage.clickSubmitQuestionButton(1); | ||
|
||
// feedbackSubmitPage = getFeedbackSubmitPage(); | ||
// feedbackSubmitPage.verifyNumScaleResponse(1, receiver.getTeamName(), response); | ||
// verifyPresentInDatabase(response); | ||
} | ||
|
||
private FeedbackResponse getResponse(FeedbackQuestion feedbackQuestion, Student receiver, Double answer) { | ||
FeedbackNumericalScaleResponseDetails details = new FeedbackNumericalScaleResponseDetails(); | ||
details.setAnswer(answer); | ||
return FeedbackResponse.makeResponse( | ||
feedbackQuestion, student.getEmail(), null, receiver.getTeamName(), null, details); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.