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();
}
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");
}
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);
}
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());
}
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");
}
Aggregations