Search in sources :

Example 1 with InstructorAttributes

use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.

the class InstructorHomePageUiTest method testArchiveCourseAction.

private void testArchiveCourseAction() throws Exception {
    String courseIdForCS1101 = testData.courses.get("CHomeUiT.CS1101").getId();
    ______TS("archive course action: click and cancel");
    homePage.clickArchiveCourseLinkAndCancel(courseIdForCS1101);
    InstructorAttributes instructor = BackDoor.getInstructorByGoogleId("CHomeUiT.instructor.tmms", courseIdForCS1101);
    InstructorAttributes helper = BackDoor.getInstructorByGoogleId("CHomeUiT.instructor.tmms.helper", courseIdForCS1101);
    // Both will be false before it is archived for testing
    assertFalse(instructor.isArchived);
    assertFalse(helper.isArchived);
    ______TS("archive course action: click and confirm");
    homePage.clickArchiveCourseLinkAndConfirm(courseIdForCS1101);
    instructor = BackDoor.getInstructorByGoogleId("CHomeUiT.instructor.tmms", courseIdForCS1101);
    helper = BackDoor.getInstructorByGoogleId("CHomeUiT.instructor.tmms.helper", courseIdForCS1101);
    assertTrue(instructor.isArchived);
    assertFalse(helper.isArchived);
    homePage.verifyHtmlMainContent("/instructorHomeCourseArchiveSuccessful.html");
    ______TS("archive action failed");
    String courseIdForCS2104 = testData.courses.get("CHomeUiT.CS2104").getId();
    // delete the course, then submit archive request to it
    BackDoor.deleteCourse(courseIdForCS2104);
    homePage.clickArchiveCourseLinkAndConfirm(courseIdForCS2104);
    assertTrue(browser.driver.getCurrentUrl().contains(Url.addParamToUrl(Const.ViewURIs.UNAUTHORIZED, Const.ParamsNames.ERROR_FEEDBACK_URL_REQUESTED, Const.ActionURIs.INSTRUCTOR_COURSE_ARCHIVE)));
    // recover the deleted course and its related entities
    testData = loadDataBundle("/InstructorHomePageUiTest2.json");
    removeAndRestoreDataBundle(testData);
    loginAsCommonInstructor();
    homePage.clickArchiveCourseLinkAndConfirm(courseIdForCS1101);
    homePage.loadInstructorHomeTab();
}
Also used : InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 2 with InstructorAttributes

use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.

the class InstructorStudentListPageUiTest method testContent.

private void testContent() throws Exception {
    String instructorId;
    ______TS("content: 2 course with students");
    InstructorAttributes instructorWith2Courses = testData.instructors.get("instructorOfCourse2");
    instructorId = instructorWith2Courses.googleId;
    AppUrl viewPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_STUDENT_LIST_PAGE).withUserId(instructorId);
    viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
    viewPage.checkCourse(0);
    viewPage.checkCourse(1);
    // This is the full HTML verification for Instructor Student List Page, the rest can all be verifyMainHtml
    viewPage.verifyHtml("/instructorStudentListWithHelperView.html");
    // verify copy email functionality
    viewPage.toggleShowEmailCheckbox();
    assertFalse(viewPage.isCopyEmailButtonVisible());
    viewPage.toggleShowEmailCheckbox();
    viewPage.clickCopyEmailButton();
    viewPage.waitForCopyEmailPopoverVisible();
    assertEquals(viewPage.getShownEmailsText(), viewPage.getSelectedText().trim());
    // update current instructor privileges
    BackDoor.deleteInstructor(instructorWith2Courses.courseId, instructorWith2Courses.email);
    instructorWith2Courses.privileges.setDefaultPrivilegesForCoowner();
    BackDoor.createInstructor(instructorWith2Courses);
    viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
    viewPage.checkCourse(0);
    viewPage.checkCourse(1);
    viewPage.verifyHtmlMainContent("/instructorStudentList.html");
    ______TS("content: 1 course with no students");
    instructorId = testData.instructors.get("instructorOfCourse1").googleId;
    viewPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_STUDENT_LIST_PAGE).withUserId(instructorId);
    viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
    viewPage.checkCourse(0);
    viewPage.verifyHtmlMainContent("/instructorStudentListPageNoStudent.html");
    ______TS("content: no course");
    instructorId = testData.accounts.get("instructorWithoutCourses").googleId;
    viewPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_STUDENT_LIST_PAGE).withUserId(instructorId);
    viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
    viewPage.verifyHtmlMainContent("/instructorStudentListPageNoCourse.html");
    ______TS("content: data required sanitization");
    instructorId = testData.accounts.get("instructor1OfTestingSanitizationCourse").googleId;
    viewPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_STUDENT_LIST_PAGE).withUserId(instructorId);
    viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
    viewPage.verifyHtmlMainContent("/instructorStudentListPageTestingSanitization.html");
}
Also used : AppUrl(teammates.common.util.AppUrl) InstructorStudentListPage(teammates.test.pageobjects.InstructorStudentListPage) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 3 with InstructorAttributes

use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.

the class InstructorStudentListPageUiTest method testDeleteAction.

private void testDeleteAction() {
    InstructorAttributes instructorWith2Courses = testData.instructors.get("instructorOfCourse2");
    String instructorId = instructorWith2Courses.googleId;
    AppUrl viewPageUrl = createUrl(Const.ActionURIs.INSTRUCTOR_STUDENT_LIST_PAGE).withUserId(instructorId);
    ______TS("action: delete");
    viewPage = loginAdminToPage(viewPageUrl, InstructorStudentListPage.class);
    viewPage.checkCourse(0);
    viewPage.checkCourse(1);
    ThreadHelper.waitFor(500);
    String studentName = testData.students.get("Student2Course2").name;
    String studentEmail = testData.students.get("Student2Course2").email;
    String courseId = testData.courses.get("course2").getId();
    viewPage.clickDeleteAndCancel(courseId, studentName);
    assertNotNull(BackDoor.getStudent(courseId, studentEmail));
    String expectedStatus = "The student has been removed from the course";
    viewPage.clickDeleteAndConfirm(courseId, studentName);
    InstructorCourseDetailsPage courseDetailsPage = viewPage.changePageType(InstructorCourseDetailsPage.class);
    courseDetailsPage.waitForTextsForAllStatusMessagesToUserEquals(expectedStatus);
}
Also used : AppUrl(teammates.common.util.AppUrl) InstructorCourseDetailsPage(teammates.test.pageobjects.InstructorCourseDetailsPage) InstructorStudentListPage(teammates.test.pageobjects.InstructorStudentListPage) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 4 with InstructorAttributes

use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.

the class InstructorStudentRecordsPageUiTest method testPanelsCollapseExpand.

private void testPanelsCollapseExpand() {
    DataBundle testDataQuestionType = loadDataBundle("/FeedbackSessionQuestionTypeTest.json");
    InstructorAttributes instructor = testDataQuestionType.instructors.get("instructor1OfCourse1");
    StudentAttributes student = testDataQuestionType.students.get("student1InCourse1");
    instructorId = instructor.googleId;
    courseId = instructor.courseId;
    studentEmail = student.email;
    viewPage = getStudentRecordsPage();
    ______TS("Typical case: panels expand/collapse");
    viewPage.clickAllRecordPanelHeadings();
    viewPage.waitForPanelsToCollapse();
    assertTrue(viewPage.areRecordsHidden());
    viewPage.clickAllRecordPanelHeadings();
    viewPage.waitForPanelsToExpand();
    assertTrue(viewPage.areRecordsVisible());
}
Also used : DataBundle(teammates.common.datatransfer.DataBundle) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 5 with InstructorAttributes

use of teammates.common.datatransfer.attributes.InstructorAttributes in project teammates by TEAMMATES.

the class InstructorStudentRecordsPageUiTest method testContent.

private void testContent() throws Exception {
    InstructorAttributes instructor;
    StudentAttributes student;
    ______TS("content: typical case, normal student records with comments");
    instructor = testData.instructors.get("teammates.test.CS2104");
    student = testData.students.get("benny.c.tmms@ISR.CS2104");
    instructorId = instructor.googleId;
    courseId = instructor.courseId;
    studentEmail = student.email;
    viewPage = getStudentRecordsPage();
    // This is the full HTML verification for Instructor Student Records Page, the rest can all be verifyMainHtml
    viewPage.verifyHtml("/instructorStudentRecords.html");
    ______TS("content: typical case, normal student records with comments, helper view");
    instructor = testData.instructors.get("teammates.test.CS2104.Helper");
    instructorId = instructor.googleId;
    courseId = instructor.courseId;
    studentEmail = student.email;
    viewPage = getStudentRecordsPage();
    viewPage.verifyHtmlMainContent("/instructorStudentRecordsWithHelperView.html");
    ______TS("content: normal student records with other instructor's comments, private feedback session");
    instructor = testData.instructors.get("teammates.test.CS1101");
    student = testData.students.get("teammates.test@ISR.CS1101");
    instructorId = instructor.googleId;
    courseId = instructor.courseId;
    studentEmail = student.email;
    viewPage = getStudentRecordsPage();
    viewPage.verifyHtmlMainContent("/instructorStudentRecordsPageWithPrivateFeedback.html");
    ______TS("content: no student records, no profiles");
    instructor = testData.instructors.get("teammates.noeval");
    student = testData.students.get("alice.b.tmms@ISR.NoEval");
    instructorId = instructor.googleId;
    courseId = instructor.courseId;
    studentEmail = student.email;
    viewPage = getStudentRecordsPage();
    viewPage.verifyHtmlMainContent("/instructorStudentRecordsPageNoRecords.html");
    ______TS("content: multiple feedback session type student record");
    DataBundle testDataQuestionType = loadDataBundle("/FeedbackSessionQuestionTypeTest.json");
    removeAndRestoreDataBundle(testDataQuestionType);
    instructor = testDataQuestionType.instructors.get("instructor1OfCourse1");
    student = testDataQuestionType.students.get("student1InCourse1");
    instructorId = instructor.googleId;
    courseId = instructor.courseId;
    studentEmail = student.email;
    viewPage = getStudentRecordsPage();
    viewPage.verifyHtmlMainContent("/instructorStudentRecordsPageMixedQuestionType.html");
    ______TS("content: profile with attemoted script and html injection with comment");
    instructor = testData.instructors.get("instructor1OfTestingSanitizationCourse");
    student = testData.students.get("student1InTestingSanitizationCourse");
    instructorId = instructor.googleId;
    courseId = instructor.courseId;
    studentEmail = student.email;
    viewPage = getStudentRecordsPage();
    viewPage.verifyHtmlMainContent("/instructorStudentRecordsPageWithScriptInjectionProfile.html");
}
Also used : DataBundle(teammates.common.datatransfer.DataBundle) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Aggregations

InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)325 Test (org.testng.annotations.Test)127 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)84 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)77 ArrayList (java.util.ArrayList)58 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)47 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)46 RedirectResult (teammates.ui.controller.RedirectResult)46 StatusMessage (teammates.common.util.StatusMessage)34 ShowPageResult (teammates.ui.controller.ShowPageResult)31 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)30 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)29 HashMap (java.util.HashMap)25 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)24 InvalidParametersException (teammates.common.exception.InvalidParametersException)24 FeedbackResponsesDb (teammates.storage.api.FeedbackResponsesDb)20 UnauthorizedAccessException (teammates.common.exception.UnauthorizedAccessException)18 EmailWrapper (teammates.common.util.EmailWrapper)15 InstructorPrivileges (teammates.common.datatransfer.InstructorPrivileges)14 DataBundle (teammates.common.datatransfer.DataBundle)13