Skip to content

Commit

Permalink
[#11640] Apply lazy-loading of question contents in session submissio…
Browse files Browse the repository at this point in the history
…n page (#11642)

* Load recipients and responses only when in view

* Add button to submit responses for individual questions

* Add E2E test for submitting response to one question only

* Rephrase saving complete modal when there is only one question to reduce ambiguity
  • Loading branch information
wkurniawan07 authored Mar 14, 2022
1 parent 96fa122 commit 720ea6d
Show file tree
Hide file tree
Showing 26 changed files with 533 additions and 537 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ protected void testSubmitPage() {
______TS("submit response");
String questionId = getFeedbackQuestion(question).getId();
FeedbackResponseAttributes response = getResponse(questionId, Arrays.asList(50, 20, 30));
feedbackSubmitPage.submitConstSumOptionResponse(1, "", response);
feedbackSubmitPage.fillConstSumOptionResponse(1, "", response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

verifyPresentInDatabase(response);

Expand All @@ -105,7 +106,8 @@ protected void testSubmitPage() {

______TS("edit response");
response = getResponse(questionId, Arrays.asList(23, 47, 30));
feedbackSubmitPage.submitConstSumOptionResponse(1, "", response);
feedbackSubmitPage.fillConstSumOptionResponse(1, "", response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyConstSumOptionResponse(1, "", response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ protected void testSubmitPage() {
FeedbackResponseAttributes response = getResponse(questionId, receiver, 49);
FeedbackResponseAttributes response2 = getResponse(questionId, receiver2, 51);
List<FeedbackResponseAttributes> responses = Arrays.asList(response, response2);
feedbackSubmitPage.submitConstSumRecipientResponse(1, responses);
feedbackSubmitPage.fillConstSumRecipientResponse(1, responses);
feedbackSubmitPage.clickSubmitQuestionButton(1);

verifyPresentInDatabase(response);
verifyPresentInDatabase(response2);
Expand All @@ -110,7 +111,8 @@ protected void testSubmitPage() {
response = getResponse(questionId, receiver, 21);
response2 = getResponse(questionId, receiver2, 79);
responses = Arrays.asList(response, response2);
feedbackSubmitPage.submitConstSumRecipientResponse(1, responses);
feedbackSubmitPage.fillConstSumRecipientResponse(1, responses);
feedbackSubmitPage.clickSubmitQuestionButton(1);

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyConstSumRecipientResponse(1, responses);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ protected void testSubmitPage() {
FeedbackResponseAttributes response2 = getResponse(questionId, receiver, 180);
FeedbackResponseAttributes response3 = getResponse(questionId, receiver2, 60);
List<FeedbackResponseAttributes> responses = Arrays.asList(response, response2, response3);
feedbackSubmitPage.submitContributionResponse(1, responses);
feedbackSubmitPage.fillContributionResponse(1, responses);
feedbackSubmitPage.clickSubmitQuestionButton(1);

verifyPresentInDatabase(response);
verifyPresentInDatabase(response2);
Expand All @@ -112,7 +113,8 @@ protected void testSubmitPage() {
response2 = getResponse(questionId, receiver, Const.POINTS_EQUAL_SHARE);
response3 = getResponse(questionId, receiver2, Const.POINTS_NOT_SURE);
responses = Arrays.asList(response, response2, response3);
feedbackSubmitPage.submitContributionResponse(1, responses);
feedbackSubmitPage.fillContributionResponse(1, responses);
feedbackSubmitPage.clickSubmitQuestionButton(1);

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyContributionResponse(1, responses);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ protected void testSubmitPage() {
______TS("submit response");
String questionId = getFeedbackQuestion(question).getId();
FeedbackResponseAttributes response = getResponse(questionId, false, "UI");
feedbackSubmitPage.submitMcqResponse(1, "", response);
feedbackSubmitPage.fillMcqResponse(1, "", response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

verifyPresentInDatabase(response);

Expand All @@ -109,7 +110,8 @@ protected void testSubmitPage() {

______TS("edit response");
response = getResponse(questionId, true, "This is the edited response.");
feedbackSubmitPage.submitMcqResponse(1, "", response);
feedbackSubmitPage.fillMcqResponse(1, "", response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyMcqResponse(1, "", response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ protected void testSubmitPage() {
String questionId = getFeedbackQuestion(question).getId();
List<String> answers = Arrays.asList("Leadership", "This is the other response.");
FeedbackResponseAttributes response = getResponse(questionId, receiver, answers.get(answers.size() - 1), answers);
feedbackSubmitPage.submitMsqResponse(1, receiver.getName(), response);
feedbackSubmitPage.fillMsqResponse(1, receiver.getName(), response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

verifyPresentInDatabase(response);

Expand All @@ -118,7 +119,8 @@ protected void testSubmitPage() {
______TS("edit response");
answers = Arrays.asList("");
response = getResponse(questionId, receiver, "", answers);
feedbackSubmitPage.submitMsqResponse(1, receiver.getName(), response);
feedbackSubmitPage.fillMsqResponse(1, receiver.getName(), response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyMsqResponse(1, receiver.getName(), response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ protected void testSubmitPage() {
______TS("submit response");
String questionId = getFeedbackQuestion(question).getId();
FeedbackResponseAttributes response = getResponse(questionId, receiver, 5.4);
feedbackSubmitPage.submitNumScaleResponse(1, receiver.getTeam(), response);
feedbackSubmitPage.fillNumScaleResponse(1, receiver.getTeam(), response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

verifyPresentInDatabase(response);

Expand All @@ -102,7 +103,8 @@ protected void testSubmitPage() {

______TS("edit response");
response = getResponse(questionId, receiver, 10.0);
feedbackSubmitPage.submitNumScaleResponse(1, receiver.getTeam(), response);
feedbackSubmitPage.fillNumScaleResponse(1, receiver.getTeam(), response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyNumScaleResponse(1, receiver.getTeam(), response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ protected void testSubmitPage() {
String questionId = getFeedbackQuestion(question).getId();
FeedbackResponseAttributes response = getResponse(questionId, receiver, Arrays.asList(2, 1, 3,
Const.POINTS_NOT_SUBMITTED));
feedbackSubmitPage.submitRankOptionResponse(1, receiver.getName(), response);
feedbackSubmitPage.fillRankOptionResponse(1, receiver.getName(), response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

verifyPresentInDatabase(response);

Expand All @@ -111,7 +112,8 @@ protected void testSubmitPage() {

______TS("edit response");
response = getResponse(questionId, receiver, Arrays.asList(Const.POINTS_NOT_SUBMITTED, 1, 3, 2));
feedbackSubmitPage.submitRankOptionResponse(1, receiver.getName(), response);
feedbackSubmitPage.fillRankOptionResponse(1, receiver.getName(), response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyRankOptionResponse(1, receiver.getName(), response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ protected void testSubmitPage() {
FeedbackResponseAttributes response = getResponse(questionId, receiver, 1);
FeedbackResponseAttributes response2 = getResponse(questionId, receiver2, 2);
List<FeedbackResponseAttributes> responses = Arrays.asList(response, response2);
feedbackSubmitPage.submitRankRecipientResponse(1, responses);
feedbackSubmitPage.fillRankRecipientResponse(1, responses);
feedbackSubmitPage.clickSubmitQuestionButton(1);

verifyPresentInDatabase(response);
verifyPresentInDatabase(response2);
Expand All @@ -112,7 +113,8 @@ protected void testSubmitPage() {
response = getResponse(questionId, receiver, Const.POINTS_NOT_SUBMITTED);
response2 = getResponse(questionId, receiver2, 1);
responses = Arrays.asList(response, response2);
feedbackSubmitPage.submitRankRecipientResponse(1, responses);
feedbackSubmitPage.fillRankRecipientResponse(1, responses);
feedbackSubmitPage.clickSubmitQuestionButton(1);

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyRankRecipientResponse(1, responses);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ protected void testSubmitPage() {
______TS("submit response");
String questionId = getFeedbackQuestion(question).getId();
FeedbackResponseAttributes response = getResponse(questionId, receiver, Arrays.asList(1, 1));
feedbackSubmitPage.submitRubricResponse(1, receiver.getName(), response);
feedbackSubmitPage.fillRubricResponse(1, receiver.getName(), response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

verifyPresentInDatabase(response);

Expand All @@ -120,7 +121,8 @@ protected void testSubmitPage() {

______TS("edit response");
response = getResponse(questionId, receiver, Arrays.asList(0, 0));
feedbackSubmitPage.submitRubricResponse(1, receiver.getName(), response);
feedbackSubmitPage.fillRubricResponse(1, receiver.getName(), response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyRubricResponse(1, receiver.getName(), response);
Expand Down
27 changes: 24 additions & 3 deletions src/e2e/java/teammates/e2e/cases/FeedbackSubmitPageE2ETest.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,42 @@ public void testAll() {
String questionId = getFeedbackQuestion(question).getId();
String recipient = "Team 2";
FeedbackResponseAttributes response = getMcqResponse(questionId, recipient, false, "UI");
submitPage.submitMcqResponse(1, recipient, response);
submitPage.fillMcqResponse(1, recipient, response);
submitPage.clickSubmitAllQuestionsButton();

verifyPresentInDatabase(response);

______TS("can submit only one question");

response = getMcqResponse(questionId, recipient, false, "Algo");
submitPage.fillMcqResponse(1, recipient, response);

FeedbackQuestionAttributes question2 = testData.feedbackQuestions.get("qn2InGracePeriodSession");
String question2Id = getFeedbackQuestion(question2).getId();
FeedbackResponseAttributes response2 = getMcqResponse(question2Id, recipient, false, "Teammates Test");
submitPage.fillMcqResponse(2, recipient, response2);

submitPage.clickSubmitQuestionButton(1);
// Question 2 response should not be persisted as only question 1 is submitted
verifyAbsentInDatabase(response2);
verifyPresentInDatabase(response);

______TS("add comment");
String responseId = getFeedbackResponse(response).getId();
int qnToComment = 1;
String comment = "<p>new comment</p>";
submitPage.addComment(qnToComment, recipient, comment);
submitPage.clickSubmitAllQuestionsButton();

verifyPresentInDatabase(response2);

submitPage.verifyComment(qnToComment, recipient, comment);
verifyPresentInDatabase(getFeedbackResponseComment(responseId, comment));

______TS("edit comment");
comment = "<p>edited comment</p>";
submitPage.editComment(qnToComment, recipient, comment);
submitPage.clickSubmitAllQuestionsButton();

submitPage.verifyComment(qnToComment, recipient, comment);
verifyPresentInDatabase(getFeedbackResponseComment(responseId, comment));
Expand Down Expand Up @@ -167,8 +187,9 @@ public void testAll() {
submitPage.verifyQuestionDetails(1, question);

______TS("submit moderated response");
response = getMcqResponse(questionId, recipient, false, "Algo");
submitPage.submitMcqResponse(1, recipient, response);
response = getMcqResponse(questionId, recipient, false, "UI");
submitPage.fillMcqResponse(1, recipient, response);
submitPage.clickSubmitQuestionButton(1);

verifyPresentInDatabase(response);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ protected void testSubmitPage() {
______TS("submit response");
String questionId = getFeedbackQuestion(question).getId();
FeedbackResponseAttributes response = getResponse(questionId, receiver, "<p>This is the response for qn 1</p>");
feedbackSubmitPage.submitTextResponse(1, receiver.getName(), response);
feedbackSubmitPage.fillTextResponse(1, receiver.getName(), response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

verifyPresentInDatabase(response);

Expand All @@ -98,7 +99,8 @@ protected void testSubmitPage() {
String editedResponse = "<p><strong>Edited response</strong></p>";
FeedbackTextResponseDetails editedDetails = new FeedbackTextResponseDetails(editedResponse);
response.setResponseDetails(editedDetails);
feedbackSubmitPage.submitTextResponse(1, receiver.getName(), response);
feedbackSubmitPage.fillTextResponse(1, receiver.getName(), response);
feedbackSubmitPage.clickSubmitQuestionButton(1);

feedbackSubmitPage = getFeedbackSubmitPage();
feedbackSubmitPage.verifyTextResponse(1, receiver.getName(), response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public void testAll() {
.withResponseDetails(details)
.build();

studentSubmissionPage.submitTextResponse(1, receiver.getName(), response);
studentSubmissionPage.fillTextResponse(1, receiver.getName(), response);
studentSubmissionPage.clickSubmitQuestionButton(1);

logout();
auditLogsPage = loginToPage(url, InstructorAuditLogsPage.class, instructor.getGoogleId());
Expand Down
Loading

0 comments on commit 720ea6d

Please sign in to comment.