Search in sources :

Example 31 with AppUrl

use of teammates.common.util.AppUrl in project teammates by TEAMMATES.

the class InstructorStudentListPageUiTest method testSearch.

private void testSearch() throws Exception {
    InstructorAttributes instructorWith2Courses = testData.instructors.get("instructorOfCourse2");
    String instructorId = instructorWith2Courses.googleId;
    AppUrl viewPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_STUDENT_LIST_PAGE).withUserId(instructorId);
    ______TS("content: search no match");
    viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
    viewPage.setSearchKey("noMatch");
    viewPage.verifyHtmlMainContent("/instructorStudentListPageSearchNoMatch.html");
    ______TS("content: search student with 1 result");
    viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
    viewPage.setSearchKey("charlie");
    viewPage.verifyHtmlMainContent("/instructorStudentListPageSearchStudent.html");
    ______TS("content: search student with multiple results");
    viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
    viewPage.setSearchKey("alice");
    viewPage.verifyHtmlMainContent("/instructorStudentListPageSearchStudentMultiple.html");
}
Also used : AppUrl(teammates.common.util.AppUrl) InstructorStudentListPage(teammates.test.pageobjects.InstructorStudentListPage) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 32 with AppUrl

use of teammates.common.util.AppUrl in project teammates by TEAMMATES.

the class InstructorSubmissionAdjustmentUiTest method loadEnrollmentPage.

private void loadEnrollmentPage() {
    AppUrl enrollUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_ENROLL_PAGE).withUserId(testData.instructors.get("instructor1OfCourse1").googleId).withCourseId(testData.courses.get("typicalCourse1").getId());
    enrollPage = loginAdminToPage(enrollUrl, InstructorCourseEnrollPage.class);
}
Also used : InstructorCourseEnrollPage(teammates.test.pageobjects.InstructorCourseEnrollPage) AppUrl(teammates.common.util.AppUrl)

Example 33 with AppUrl

use of teammates.common.util.AppUrl in project teammates by TEAMMATES.

the class InstructorCourseEditPageUiTest method testAddInstructorAction.

private void testAddInstructorAction() throws Exception {
    ______TS("success: add an instructor with privileges");
    courseEditPage.clickShowNewInstructorFormButton();
    courseEditPage.fillNewInstructorName("Teammates Instructor");
    courseEditPage.fillNewInstructorEmail("InsCrsEdit.instructor@gmail.tmt");
    int newInstructorIndex = 8;
    courseEditPage.selectRoleForInstructor(newInstructorIndex, "Custom");
    courseEditPage.clickCourseLevelPrivilegesLink(newInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_COURSE);
    courseEditPage.clickCourseLevelPrivilegesLink(newInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_STUDENTS);
    courseEditPage.clickAddSectionLevelPrivilegesLink(newInstructorIndex);
    courseEditPage.clickSectionSelectionCheckBox(newInstructorIndex, 0, 1);
    courseEditPage.clickSectionLevelPrivilegeLink(newInstructorIndex, 0, InstructorCourseEditPage.SECTION_VIEW_STUDENTS);
    courseEditPage.clickSectionLevelPrivilegeLink(newInstructorIndex, 0, InstructorCourseEditPage.SECTION_VIEW_RESPONSES_IN_SESSION);
    courseEditPage.clickAddInstructorButton();
    courseEditPage.waitForTextsForAllStatusMessagesToUserEquals(String.format(Const.StatusMessages.COURSE_INSTRUCTOR_ADDED, "Teammates Instructor", "InsCrsEdit.instructor@gmail.tmt"));
    AppUrl courseDetailsLink = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_DETAILS_PAGE).withCourseId(courseId).withUserId(testData.instructors.get("InsCrsEdit.test").googleId);
    InstructorCourseDetailsPage courseDetailsPage = AppPage.getNewPageInstance(browser, courseDetailsLink, InstructorCourseDetailsPage.class);
    courseDetailsPage.verifyHtmlPart(By.id("instructors"), "/instructorCourseDetailsAddInstructor.html");
    courseEditPage = getCourseEditPage();
    courseEditPage.clickEditInstructorLink(3);
    courseEditPage.verifyHtmlMainContent("/instructorCourseEditAddInstructor.html");
    ______TS("failure: add an existing instructor");
    courseEditPage.addNewInstructor("Teammates Instructor", "InsCrsEdit.instructor@gmail.tmt");
    courseEditPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.COURSE_INSTRUCTOR_EXISTS);
    ______TS("failure: add an instructor with an invalid parameter");
    String invalidEmail = "InsCrsEdit.email.tmt";
    courseEditPage.addNewInstructor("Teammates Instructor", invalidEmail);
    courseEditPage.waitForTextsForAllStatusMessagesToUserEquals(new FieldValidator().getInvalidityInfoForEmail(invalidEmail));
    String invalidName = "";
    courseEditPage.addNewInstructor(invalidName, "teammates@email.tmt");
    courseEditPage.waitForTextsForAllStatusMessagesToUserEquals(new FieldValidator().getInvalidityInfoForPersonName(invalidName));
}
Also used : AppUrl(teammates.common.util.AppUrl) InstructorCourseDetailsPage(teammates.test.pageobjects.InstructorCourseDetailsPage) FieldValidator(teammates.common.util.FieldValidator)

Example 34 with AppUrl

use of teammates.common.util.AppUrl in project teammates by TEAMMATES.

the class InstructorCourseEnrollPageUiTest method testEnrollAction.

private void testEnrollAction() throws Exception {
    /* We test both empty and non-empty courses because the generated
         * enroll result page is slightly different for the two cases.
         */
    String courseId = testData.courses.get("CCEnrollUiT.CS2104").getId();
    ______TS("enroll action: existent course, enroll lines with section field");
    AppUrl enrollUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_ENROLL_PAGE).withUserId(testData.instructors.get("CCEnrollUiT.teammates.test").googleId).withCourseId(testData.courses.get("CCEnrollUiT.CS2104").getId());
    enrollPage = loginAdminToPage(enrollUrl, InstructorCourseEnrollPage.class);
    String enrollString = "Section | Team | Name | Email | Comments\n" + // Modify team for student within section
    "Section 1| Team 4 | Alice Betsy</textarea><textarea>'\" | alice.b.tmms@gmail.tmt" + " | This comment has been changed\n" + // Modify section and team
    "Section 2| Team 2 | Benny Charles| benny.c.tmms@gmail.tmt |\n" + // A student with no comment
    "Section 3 | Team 3 |Frank Galoe | frank.g.tmms@gmail.tmt |\n" + // A new student with name containing accented characters
    "Section 1 | Team 1|José Gómez | jose.gomez.tmns@gmail.tmt" + " | This student name contains accented characters\n";
    InstructorCourseEnrollResultPage resultsPage = enrollPage.enroll(enrollString);
    // This is the full HTML verification for Instructor Course Enroll Results Page, the rest can all be verifyMainHtml
    resultsPage.verifyHtml("/instructorCourseEnrollPageResult.html");
    // Check 'Edit' link
    enrollPage = resultsPage.clickEditLink();
    enrollPage.verifyContains("Enroll Students for CCEnrollUiT.CS2104");
    assertEquals(enrollString, enrollPage.getEnrollText());
    // Ensure students were actually enrolled
    AppUrl coursesPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_DETAILS_PAGE).withUserId(testData.instructors.get("CCEnrollUiT.teammates.test").googleId).withCourseId(courseId);
    InstructorCoursesDetailsPage detailsPage = loginAdminToPage(coursesPageUrl, InstructorCoursesDetailsPage.class);
    assertEquals(6, detailsPage.getStudentCountForCourse());
    ______TS("enroll action: empty course, enroll lines with header containing empty columns, no sections");
    // Make the course empty
    BackDoor.deleteCourse(courseId);
    BackDoor.createCourse(testData.courses.get("CCEnrollUiT.CS2104"));
    BackDoor.createInstructor(testData.instructors.get("CCEnrollUiT.teammates.test"));
    enrollUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_ENROLL_PAGE).withUserId(testData.instructors.get("CCEnrollUiT.teammates.test").googleId).withCourseId(testData.courses.get("CCEnrollUiT.CS2104").getId());
    enrollPage = loginAdminToPage(enrollUrl, InstructorCourseEnrollPage.class);
    enrollString = "| Name | Email | | Team | Comments\n" + "|Alice Betsy</option></td></div>'\" | alice.b.tmms@gmail.tmt ||" + " Team 1</option></td></div>'\" | This comment has been changed\n" + // A student with no comment
    "|Frank Galoe | frank.g.tmms@gmail.tmt || Team 1</option></td></div>'\" |\n" + // A new student with name containing accented characters
    "|José Gómez | jose.gomez.tmns@gmail.tmt || Team 3 | This student name contains accented characters\n";
    resultsPage = enrollPage.enroll(enrollString);
    resultsPage.verifyHtmlMainContent("/instructorCourseEnrollPageResultForEmptyCourse.html");
    // Check 'Edit' link
    enrollPage = resultsPage.clickEditLink();
    enrollPage.verifyContains("Enroll Students for CCEnrollUiT.CS2104");
    assertEquals(enrollString, enrollPage.getEnrollText());
    // Ensure students were actually enrolled
    coursesPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_DETAILS_PAGE).withUserId(testData.instructors.get("CCEnrollUiT.teammates.test").googleId).withCourseId(courseId);
    detailsPage = loginAdminToPage(coursesPageUrl, InstructorCoursesDetailsPage.class);
    assertEquals(3, detailsPage.getStudentCountForCourse());
    ______TS("enroll action: fail to enroll as a team cannot be in 2 different sections");
    enrollUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_ENROLL_PAGE).withUserId(testData.instructors.get("CCEnrollUiT.teammates.test").googleId).withCourseId(testData.courses.get("CCEnrollUiT.CS2104").getId());
    enrollPage = loginAdminToPage(enrollUrl, InstructorCourseEnrollPage.class);
    enrollString = "Section | Team | Name | Email | Comments\n" + "Different Section | Team 1</option></td></div>'\" | Alice Betsy | alice.b.tmms@gmail.tmt |\n";
    enrollPage.enrollUnsuccessfully(enrollString);
    enrollPage.waitForTextsForAllStatusMessagesToUserEquals("The team \"Team 1</option></td></div>'\"\" is in multiple sections. " + "The team ID should be unique across the entire course " + "and a team cannot be spread across multiple sections." + "\nPlease use the enroll page to edit multiple students");
    ______TS("enroll action: fail to enroll due to invalid header");
    enrollString = "Section | Team | Name | Email | Comments | Section\n";
    enrollPage.enrollUnsuccessfully(enrollString);
    enrollPage.waitForTextsForAllStatusMessagesToUserEquals("The header row contains repeated fields");
    enrollString = "Section | Name | Email\n";
    enrollPage.enrollUnsuccessfully(enrollString);
    enrollPage.waitForTextsForAllStatusMessagesToUserEquals("The following required column names are missing in the header row: Team");
    ______TS("enroll action: fail to enroll as there is no input");
    enrollUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_ENROLL_PAGE).withUserId(testData.instructors.get("CCEnrollUiT.teammates.test").googleId).withCourseId(testData.courses.get("CCEnrollUiT.CS2104").getId());
    enrollPage = loginAdminToPage(enrollUrl, InstructorCourseEnrollPage.class);
    enrollString = "";
    enrollPage.enrollUnsuccessfully(enrollString);
    enrollPage.waitForTextsForAllStatusMessagesToUserEquals("Please input at least one student detail.");
    ______TS("enroll action: fail to enroll as there is an invalid line");
    enrollString = "Team | Name | Email | Comment" + System.lineSeparator() + // A new student with no email input
    "Team 3 | Frank Hughe" + System.lineSeparator() + // A new student with invalid email input
    "Team 1</option></td></div>'\" | Black Jack | bjack.gmail.tmt | This student email is invalid" + System.lineSeparator() + // A new student with invalid team name
    StringHelperExtension.generateStringOfLength(FieldValidator.TEAM_NAME_MAX_LENGTH + 1) + " | Robert Downey | rob@email.tmt | This student team name is too long" + System.lineSeparator() + // A new student with invalid name
    "Team 2 | " + StringHelperExtension.generateStringOfLength(FieldValidator.PERSON_NAME_MAX_LENGTH + 1) + " | longname@email.tmt | This student name is too long" + System.lineSeparator();
    enrollPage.enrollUnsuccessfully(enrollString);
    enrollPage.verifyHtmlMainContent("/instructorCourseEnrollError.html");
    ______TS("enroll action: scripts are successfully sanitized");
    // Enroll a student with a script in the name
    String xssScript = "<script>alert(\"was here\");</script>";
    enrollString = "Team | Name | Email | Comments\n" + "Team GreyHats | Mallory " + xssScript + " | mallory.tmms@gmail.tmt |\n";
    // Check that the script does not appear on the InstructorCourseEnrollResult page
    resultsPage = enrollPage.enroll(enrollString);
    resultsPage.verifyNotContain(xssScript);
    // Check that the script does not appear on the InstructorCourseEnroll page either
    enrollPage = resultsPage.clickEditLink();
    enrollPage.verifyNotContain(xssScript);
}
Also used : InstructorCourseEnrollResultPage(teammates.test.pageobjects.InstructorCourseEnrollResultPage) InstructorCourseEnrollPage(teammates.test.pageobjects.InstructorCourseEnrollPage) AppUrl(teammates.common.util.AppUrl) InstructorCoursesDetailsPage(teammates.test.pageobjects.InstructorCoursesDetailsPage)

Example 35 with AppUrl

use of teammates.common.util.AppUrl in project teammates by TEAMMATES.

the class InstructorCourseStudentDetailsEditPageUiTest method testContent.

private void testContent() throws Exception {
    String instructorId = testData.instructors.get("CCSDEditUiT.instr").googleId;
    String courseId = testData.courses.get("CCSDEditUiT.CS2104").getId();
    ______TS("content: unregistered student");
    AppUrl editPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_STUDENT_DETAILS_EDIT).withUserId(instructorId).withCourseId(courseId).withStudentEmail(testData.students.get("unregisteredStudent").email);
    editPage = loginAdminToPage(editPageUrl, InstructorCourseStudentDetailsEditPage.class);
    editPage.verifyHtmlMainContent("/instructorCourseStudentEditUnregisteredPage.html");
    ______TS("content: registered student");
    editPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_STUDENT_DETAILS_EDIT).withUserId(instructorId).withCourseId(courseId).withStudentEmail(testData.students.get("registeredStudent").email);
    editPage = loginAdminToPage(editPageUrl, InstructorCourseStudentDetailsEditPage.class);
    // This is the full HTML verification for Instructor Course Student Edit Page, the rest can all be verifyMainHtml
    editPage.verifyHtml("/instructorCourseStudentEditPage.html");
}
Also used : InstructorCourseStudentDetailsEditPage(teammates.test.pageobjects.InstructorCourseStudentDetailsEditPage) AppUrl(teammates.common.util.AppUrl)

Aggregations

AppUrl (teammates.common.util.AppUrl)52 Test (org.testng.annotations.Test)7 InstructorCourseEnrollPage (teammates.test.pageobjects.InstructorCourseEnrollPage)6 InstructorStudentListPage (teammates.test.pageobjects.InstructorStudentListPage)6 StudentHomePage (teammates.test.pageobjects.StudentHomePage)6 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)4 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)3 InstructorCourseDetailsPage (teammates.test.pageobjects.InstructorCourseDetailsPage)3 InstructorCourseStudentDetailsEditPage (teammates.test.pageobjects.InstructorCourseStudentDetailsEditPage)3 InstructorHomePage (teammates.test.pageobjects.InstructorHomePage)3 Stopwatch (teammates.client.scripts.util.Stopwatch)2 AdminHomePage (teammates.test.pageobjects.AdminHomePage)2 InstructorCourseStudentDetailsViewPage (teammates.test.pageobjects.InstructorCourseStudentDetailsViewPage)2 InstructorCoursesPage (teammates.test.pageobjects.InstructorCoursesPage)2 InstructorFeedbackResultsPage (teammates.test.pageobjects.InstructorFeedbackResultsPage)2 InstructorFeedbackSessionsPage (teammates.test.pageobjects.InstructorFeedbackSessionsPage)2 InstructorStudentRecordsPage (teammates.test.pageobjects.InstructorStudentRecordsPage)2 StudentCourseDetailsPage (teammates.test.pageobjects.StudentCourseDetailsPage)2 BlobInfo (com.google.appengine.api.blobstore.BlobInfo)1 BlobKey (com.google.appengine.api.blobstore.BlobKey)1