Search in sources :

Example 6 with FeedbackSubmitPage

use of teammates.test.pageobjects.FeedbackSubmitPage in project teammates by TEAMMATES.

the class FeedbackRankQuestionUiTest method testStudentSubmitAndResultsPages.

@Test
public void testStudentSubmitAndResultsPages() throws Exception {
    ______TS("Rank submission: input disabled for closed session");
    FeedbackSubmitPage submitPage = loginToStudentFeedbackSubmitPage("alice.tmms@FRankUiT.CS4221", "closed");
    submitPage.waitForAndDismissAlertModal();
    assertTrue(submitPage.isElementVisible(Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0-0"));
    assertFalse(submitPage.isElementEnabled(Const.ParamsNames.FEEDBACK_RESPONSE_TEXT + "-1-0-0"));
    ______TS("Rank submission");
    submitPage = loginToStudentFeedbackSubmitPage("alice.tmms@FRankUiT.CS4221", "student");
    // verifies that question submit form without existing responses loads correctly
    submitPage.verifyHtmlMainContent("/studentFeedbackSubmitPageRank.html");
    submitPage.selectResponseTextDropdown(1, 0, 0, "1");
    submitPage.selectResponseTextDropdown(1, 0, 1, "2");
    // to check if deleting responses work
    submitPage.selectResponseTextDropdown(1, 1, 1, "");
    assertEquals("Please rank the above options.", submitPage.getRankMessage(1, 1));
    submitPage.selectResponseTextDropdown(2, 0, 0, "1");
    submitPage.selectResponseTextDropdown(2, 1, 0, "2");
    // test rank messages
    assertEquals("Please rank the above recipients.", submitPage.getRankMessage(5, 3));
    submitPage.selectResponseTextDropdown(5, 0, 0, "2");
    assertTrue(submitPage.getRankMessage(5, 0).isEmpty());
    submitPage.selectResponseTextDropdown(5, 1, 0, "2");
    assertEquals("The same rank should not be given multiple times.", submitPage.getRankMessage(5, 3));
    // try to submit with error
    submitPage.clickSubmitButton();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals("Please fix the error(s) for rank question(s) 5. " + "To skip a rank question, leave all the boxes blank.");
    submitPage.selectResponseTextDropdown(5, 1, 0, "1");
    assertEquals("Please rank the above recipients.", submitPage.getRankMessage(5, 3));
    // Submit
    submitPage.clickSubmitButton();
    submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
    FeedbackQuestionAttributes fq1 = BackDoor.getFeedbackQuestion("FRankUiT.CS4221", "Student Session", 1);
    assertNotNull(BackDoor.getFeedbackResponse(fq1.getId(), "alice.b.tmms@gmail.tmt", "tmms.helper1@gmail.tmt"));
    assertNull(BackDoor.getFeedbackResponse(fq1.getId(), "alice.b.tmms@gmail.tmt", "tmms.test@gmail.tmt"));
    FeedbackQuestionAttributes fq2 = BackDoor.getFeedbackQuestion("FRankUiT.CS4221", "Student Session", 2);
    assertNotNull(BackDoor.getFeedbackResponse(fq2.getId(), "alice.b.tmms@gmail.tmt", "tmms.helper1@gmail.tmt"));
    assertNotNull(BackDoor.getFeedbackResponse(fq2.getId(), "alice.b.tmms@gmail.tmt", "tmms.test@gmail.tmt"));
    // Go back to submission page and verify html
    submitPage = loginToStudentFeedbackSubmitPage("alice.tmms@FRankUiT.CS4221", "student");
    // try to submit duplicate ranks for question that permits it
    submitPage.selectResponseTextDropdown(6, 0, 0, "1");
    submitPage.selectResponseTextDropdown(6, 1, 0, "1");
    assertTrue("No error message expected", submitPage.getRankMessage(6, 0).isEmpty());
    submitPage.selectResponseTextDropdown(1, 0, 0, "3");
    assertEquals("The display message indicating this is a rank question is displayed until all options are ranked", "Please rank the above options.", submitPage.getRankMessage(1, 0));
    submitPage.selectResponseTextDropdown(1, 0, 1, "3");
    submitPage.selectResponseTextDropdown(1, 0, 2, "1");
    submitPage.selectResponseTextDropdown(1, 0, 3, "4");
    assertTrue("No error message expected", submitPage.getRankMessage(1, 0).isEmpty());
    submitPage.selectResponseTextDropdown(7, 0, 0, "4");
    submitPage.selectResponseTextDropdown(7, 0, 1, "3");
    submitPage.selectResponseTextDropdown(7, 0, 2, "2");
    submitPage.selectResponseTextDropdown(7, 0, 3, "1");
    assertTrue("No error message expected", submitPage.getRankMessage(7, 0).isEmpty());
    submitPage.clickSubmitButton();
    // Go back to submission page
    submitPage = loginToStudentFeedbackSubmitPage("alice.tmms@FRankUiT.CS4221", "student");
    // to verify that the question submit form with existing response works correctly
    submitPage.verifyHtmlMainContent("/studentFeedbackSubmitPageSuccessRank.html");
    ______TS("Rank : min/max options to be ranked test");
    // Question with only min options to be ranked restriction
    int qnNumber = 9;
    submitPage.selectResponseTextDropdown(qnNumber, 0, 0, "1");
    assertEquals("You need to rank at least 2 options.", submitPage.getRankMessage(qnNumber, 0));
    submitPage.selectResponseTextDropdown(qnNumber, 0, 2, "2");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 0).isEmpty());
    submitPage.selectResponseTextDropdown(qnNumber, 0, 2, "");
    assertEquals("You need to rank at least 2 options.", submitPage.getRankMessage(qnNumber, 0));
    submitPage.selectResponseTextDropdown(qnNumber, 0, 3, "3");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 0).isEmpty());
    // Question with only max options to be ranked restriction
    qnNumber = 10;
    submitPage.selectResponseTextDropdown(qnNumber, 0, 0, "1");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 0).isEmpty());
    submitPage.selectResponseTextDropdown(qnNumber, 0, 2, "2");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 0).isEmpty());
    submitPage.selectResponseTextDropdown(qnNumber, 0, 3, "3");
    assertEquals("Rank no more than 2 options.", submitPage.getRankMessage(qnNumber, 0));
    submitPage.selectResponseTextDropdown(qnNumber, 0, 3, "");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 0).isEmpty());
    // Question with both min and max options to be ranked restriction
    qnNumber = 11;
    submitPage.selectResponseTextDropdown(qnNumber, 0, 0, "1");
    assertEquals("You need to rank at least 3 options.", submitPage.getRankMessage(qnNumber, 0));
    submitPage.selectResponseTextDropdown(qnNumber, 0, 2, "2");
    assertEquals("You need to rank at least 3 options.", submitPage.getRankMessage(qnNumber, 0));
    submitPage.selectResponseTextDropdown(qnNumber, 0, 4, "4");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 0).isEmpty());
    submitPage.selectResponseTextDropdown(qnNumber, 0, 1, "3");
    assertEquals("Rank no more than 3 options.", submitPage.getRankMessage(qnNumber, 0));
    submitPage.selectResponseTextDropdown(qnNumber, 0, 3, "5");
    assertEquals("Rank no more than 3 options.", submitPage.getRankMessage(qnNumber, 0));
    submitPage.selectResponseTextDropdown(qnNumber, 0, 3, "");
    assertEquals("Rank no more than 3 options.", submitPage.getRankMessage(qnNumber, 0));
    submitPage.selectResponseTextDropdown(qnNumber, 0, 1, "");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 0).isEmpty());
    ______TS("Rank : min/max recipients to be ranked test");
    // Question with only min recipients to be ranked restriction
    qnNumber = 12;
    submitPage.selectResponseTextDropdown(qnNumber, 0, 0, "1");
    assertEquals("You need to rank at least 2 recipients.", submitPage.getRankMessage(qnNumber, 3));
    submitPage.selectResponseTextDropdown(qnNumber, 2, 0, "2");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 3).isEmpty());
    submitPage.selectResponseTextDropdown(qnNumber, 2, 0, "");
    assertEquals("You need to rank at least 2 recipients.", submitPage.getRankMessage(qnNumber, 3));
    submitPage.selectResponseTextDropdown(qnNumber, 3, 0, "3");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 3).isEmpty());
    // Question with only max recipients to be ranked restriction
    qnNumber = 13;
    submitPage.selectResponseTextDropdown(qnNumber, 0, 0, "1");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 3).isEmpty());
    submitPage.selectResponseTextDropdown(qnNumber, 2, 0, "2");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 3).isEmpty());
    submitPage.selectResponseTextDropdown(qnNumber, 3, 0, "3");
    assertEquals("Rank no more than 2 recipients.", submitPage.getRankMessage(qnNumber, 3));
    submitPage.selectResponseTextDropdown(qnNumber, 3, 0, "");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 3).isEmpty());
    // Question with both min and max options to be ranked restriction
    qnNumber = 14;
    submitPage.selectResponseTextDropdown(qnNumber, 0, 0, "1");
    assertEquals("You need to rank at least 3 recipients.", submitPage.getRankMessage(qnNumber, 3));
    submitPage.selectResponseTextDropdown(qnNumber, 1, 0, "2");
    assertEquals("You need to rank at least 3 recipients.", submitPage.getRankMessage(qnNumber, 3));
    submitPage.selectResponseTextDropdown(qnNumber, 2, 0, "3");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 3).isEmpty());
    submitPage.selectResponseTextDropdown(qnNumber, 3, 0, "4");
    assertEquals("Rank no more than 3 recipients.", submitPage.getRankMessage(qnNumber, 3));
    submitPage.selectResponseTextDropdown(qnNumber, 0, 0, "");
    assertTrue("No error message expected", submitPage.getRankMessage(qnNumber, 3).isEmpty());
    ______TS("Rank : student results");
    StudentFeedbackResultsPage studentResultsPage = loginToStudentFeedbackResultsPage("alice.tmms@FRankUiT.CS4221", "student");
    studentResultsPage.verifyHtmlMainContent("/studentFeedbackResultsPageRank.html");
}
Also used : StudentFeedbackResultsPage(teammates.test.pageobjects.StudentFeedbackResultsPage) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) FeedbackSubmitPage(teammates.test.pageobjects.FeedbackSubmitPage) Test(org.testng.annotations.Test)

Example 7 with FeedbackSubmitPage

use of teammates.test.pageobjects.FeedbackSubmitPage in project teammates by TEAMMATES.

the class FeedbackRankQuestionUiTest method testInstructorSubmitAndResultsPage.

@Test
public void testInstructorSubmitAndResultsPage() throws Exception {
    ______TS("Rank submission: input disabled for closed session");
    FeedbackSubmitPage submitPage = loginToInstructorFeedbackSubmitPage("instructor1", "closed");
    int qnNumber = 1;
    int responseNumber = 0;
    int rowNumber = 0;
    assertFalse(submitPage.isNamedElementEnabled(Const.ParamsNames.FEEDBACK_QUESTION_RANKOPTION + "-" + qnNumber + "-" + responseNumber + "-" + rowNumber));
    ______TS("Rank submission: test submission page if some students are not visible to the instructor");
    submitPage = loginToInstructorFeedbackSubmitPage("instructorhelper", "instructor");
    submitPage.verifyHtmlMainContent("/instructorFeedbackSubmitPageRankHelper.html");
    ______TS("Rank standard submission");
    submitPage = loginToInstructorFeedbackSubmitPage("instructor1", "instructor");
    submitPage.verifyHtmlMainContent("/instructorFeedbackResultsPageRankSubmission.html");
    submitPage.selectResponseTextDropdown(1, 0, 2, "2");
    submitPage.selectResponseTextDropdown(1, 0, 1, "1");
    submitPage.selectResponseTextDropdown(1, 0, 0, "3");
    assertTrue(submitPage.getRankMessage(1, 0).isEmpty());
    submitPage.selectRecipient(2, 0, "Emily F.");
    submitPage.selectResponseTextDropdown(2, 0, 13, "1");
    submitPage.selectResponseTextDropdown(2, 0, 1, "2");
    submitPage.selectRecipient(2, 1, "Alice Betsy</option></td></div>'\"");
    submitPage.selectResponseTextDropdown(2, 1, 11, "1");
    submitPage.selectResponseTextDropdown(2, 1, 1, "1");
    assertEquals("Testing duplicate rank for rank options", "The same rank should not be given multiple times.", submitPage.getRankMessage(2, 1));
    submitPage.selectResponseTextDropdown(2, 1, 1, "2");
    submitPage.selectResponseTextDropdown(3, 0, 0, "1");
    submitPage.selectResponseTextDropdown(3, 3, 0, "2");
    submitPage.clickSubmitButton();
    ______TS("Rank instructor results : question");
    InstructorFeedbackResultsPage instructorResultsPage = loginToInstructorFeedbackResultsPageWithViewType("instructor1", "instructor", false, "question");
    instructorResultsPage.loadResultQuestionPanel(1);
    instructorResultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageRankQuestionView.html");
    ______TS("Rank instructor results : Giver > Recipient > Question");
    instructorResultsPage = loginToInstructorFeedbackResultsPageWithViewType("instructor1", "instructor", false, "giver-recipient-question");
    instructorResultsPage.loadResultSectionPanel(1, 2);
    instructorResultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageRankGRQView.html");
    ______TS("Rank instructor results : Giver > Question > Recipient");
    instructorResultsPage = loginToInstructorFeedbackResultsPageWithViewType("instructor1", "instructor", false, "giver-question-recipient");
    instructorResultsPage.loadResultSectionPanel(1, 2);
    instructorResultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageRankGQRView.html");
    ______TS("Rank instructor results : Recipient > Question > Giver ");
    instructorResultsPage = loginToInstructorFeedbackResultsPageWithViewType("instructor1", "instructor", false, "recipient-question-giver");
    instructorResultsPage.loadResultSectionPanel(1, 2);
    instructorResultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageRankRQGView.html");
    ______TS("Rank instructor results : Recipient > Giver > Question");
    instructorResultsPage = loginToInstructorFeedbackResultsPageWithViewType("instructor1", "instructor", false, "recipient-giver-question");
    instructorResultsPage.loadResultSectionPanel(1, 2);
    instructorResultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageRankRGQView.html");
}
Also used : FeedbackSubmitPage(teammates.test.pageobjects.FeedbackSubmitPage) InstructorFeedbackResultsPage(teammates.test.pageobjects.InstructorFeedbackResultsPage) Test(org.testng.annotations.Test)

Aggregations

FeedbackSubmitPage (teammates.test.pageobjects.FeedbackSubmitPage)7 Test (org.testng.annotations.Test)2 StudentFeedbackResultsPage (teammates.test.pageobjects.StudentFeedbackResultsPage)2 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)1 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)1 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)1 AppUrl (teammates.common.util.AppUrl)1 AdminHomePage (teammates.test.pageobjects.AdminHomePage)1 InstructorCourseDetailsPage (teammates.test.pageobjects.InstructorCourseDetailsPage)1 InstructorCourseEditPage (teammates.test.pageobjects.InstructorCourseEditPage)1 InstructorCourseEnrollPage (teammates.test.pageobjects.InstructorCourseEnrollPage)1 InstructorCourseJoinConfirmationPage (teammates.test.pageobjects.InstructorCourseJoinConfirmationPage)1 InstructorCoursesPage (teammates.test.pageobjects.InstructorCoursesPage)1 InstructorFeedbackResultsPage (teammates.test.pageobjects.InstructorFeedbackResultsPage)1 InstructorHomePage (teammates.test.pageobjects.InstructorHomePage)1 StudentCourseDetailsPage (teammates.test.pageobjects.StudentCourseDetailsPage)1 StudentHomePage (teammates.test.pageobjects.StudentHomePage)1 StudentProfilePage (teammates.test.pageobjects.StudentProfilePage)1