Search in sources :

Example 1 with InstructorCoursesPage

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

the class InstructorCourseEditPageUiTest method testDeleteCourseAction.

private void testDeleteCourseAction() {
    // TODO: use navigateTo instead
    courseEditPage = getCourseEditPage();
    ______TS("delete course then cancel");
    courseEditPage.clickDeleteCourseLinkAndCancel();
    assertNotNull(BackDoor.getCourse(courseId));
    ______TS("delete course then proceed");
    InstructorCoursesPage coursePage = courseEditPage.clickDeleteCourseLinkAndConfirm();
    assertTrue(coursePage.getTextsForAllStatusMessagesToUser().contains(String.format(Const.StatusMessages.COURSE_DELETED, courseId)));
}
Also used : InstructorCoursesPage(teammates.test.pageobjects.InstructorCoursesPage)

Example 2 with InstructorCoursesPage

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

the class InstructorCourseEditPageUiTest method testDeleteInstructorAction.

private void testDeleteInstructorAction() {
    ______TS("delete instructor then cancel");
    courseEditPage.clickDeleteInstructorLinkAndCancel(1);
    assertNotNull(BackDoor.getInstructorByGoogleId(instructorId, courseId));
    ______TS("delete instructor successfully");
    courseEditPage.clickDeleteInstructorLinkAndConfirm(1);
    String expectedMsg = "The instructor has been deleted from the course.";
    courseEditPage.waitForTextsForAllStatusMessagesToUserEquals(expectedMsg);
    ______TS("delete all other instructors");
    courseEditPage.clickDeleteInstructorLinkAndConfirm(1);
    courseEditPage.clickDeleteInstructorLinkAndConfirm(1);
    courseEditPage.clickDeleteInstructorLinkAndConfirm(1);
    courseEditPage.clickDeleteInstructorLinkAndConfirm(1);
    courseEditPage.clickDeleteInstructorLinkAndConfirm(1);
    courseEditPage.clickDeleteInstructorLinkAndConfirm(2);
    ______TS("test the only registered instructor with the privilege to modify instructors cannot be deleted");
    // Create an registered instructor with all privileges except modifying instructors
    InstructorPrivileges privilege = new InstructorPrivileges(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER);
    privilege.updatePrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR, false);
    InstructorAttributes instructor = InstructorAttributes.builder("InsCrsEdit.reg", courseId, "Teammates Reg", "InsCrsEdit.reg@gmail.tmt").withDisplayedName("Teammates Reg").withRole(Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM).withPrivileges(privilege).build();
    BackDoor.createInstructor(instructor);
    // Create an unregistered instructor with co-owner privilege
    courseEditPage.addNewInstructor("Unreg Instructor", "InstructorCourseEditEmail@gmail.tmt");
    // Delete own instructor role
    courseEditPage.clickDeleteInstructorLinkAndConfirm(2);
    courseEditPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.COURSE_INSTRUCTOR_DELETE_NOT_ALLOWED);
    // Delete other instructors
    courseEditPage.clickDeleteInstructorLinkAndConfirm(3);
    courseEditPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.COURSE_INSTRUCTOR_DELETED);
    courseEditPage.clickDeleteInstructorLinkAndConfirm(1);
    courseEditPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.COURSE_INSTRUCTOR_DELETED);
    ______TS("delete own instructor role and redirect to courses page");
    // Create another registered instructor with co-owner privilege
    BackDoor.createInstructor(testData.instructors.get("InsCrsEdit.coord"));
    courseEditPage = getCourseEditPage();
    // Delete own instructor role
    courseEditPage.clickDeleteInstructorLinkAndConfirm(2);
    InstructorCoursesPage coursesPage = courseEditPage.changePageType(InstructorCoursesPage.class);
    coursesPage.waitForAjaxLoadCoursesSuccess();
    coursesPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.COURSE_INSTRUCTOR_DELETED, Const.StatusMessages.COURSE_EMPTY);
    // Restore own instructor role to ensure remaining test cases work properly
    BackDoor.createInstructor(testData.instructors.get("InsCrsEdit.test"));
}
Also used : InstructorCoursesPage(teammates.test.pageobjects.InstructorCoursesPage) InstructorPrivileges(teammates.common.datatransfer.InstructorPrivileges) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 3 with InstructorCoursesPage

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

the class InstructorCoursesPageUiTest method getCoursesPage.

private InstructorCoursesPage getCoursesPage() {
    AppUrl coursesUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSES_PAGE).withUserId(instructorId);
    InstructorCoursesPage page = loginAdminToPage(coursesUrl, InstructorCoursesPage.class);
    page.waitForAjaxLoadCoursesSuccess();
    return page;
}
Also used : AppUrl(teammates.common.util.AppUrl) InstructorCoursesPage(teammates.test.pageobjects.InstructorCoursesPage)

Aggregations

InstructorCoursesPage (teammates.test.pageobjects.InstructorCoursesPage)3 InstructorPrivileges (teammates.common.datatransfer.InstructorPrivileges)1 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)1 AppUrl (teammates.common.util.AppUrl)1