private void testInviteInstructorAction() { ______TS("success: invite an uregistered instructor"); int unregisteredInsturctorIndex = 4; courseEditPage.clickInviteInstructorLink(unregisteredInsturctorIndex); courseEditPage.verifyStatus( Const.StatusMessages.COURSE_REMINDER_SENT_TO + "*****@*****.**"); }
private void testNewInstructorLink() { ______TS("add new instructor link"); assertTrue(courseEditPage.clickShowNewInstructorFormButton()); assertTrue(courseEditPage.clickOnNewInstructorAccessLevelViewDetails("Co-owner")); assertTrue(courseEditPage.clickOnNewInstructorAccessLevelViewDetails("Manager")); assertTrue(courseEditPage.clickOnNewInstructorAccessLevelViewDetails("Observer")); assertTrue(courseEditPage.clickOnNewInstructorAccessLevelViewDetails("Tutor")); }
private void testDeleteCourseAction() { courseEditPage = getCourseEditPage(); ______TS("delete course then cancel"); courseEditPage.clickDeleteCourseLinkAndCancel(); assertNotNull(BackDoor.getCourseAsJson(courseId)); ______TS("delete course then proceed"); InstructorCoursesPage coursePage = courseEditPage.clickDeleteCourseLinkAndConfirm(); coursePage.verifyContains("Add New Course"); }
private void testDeleteInstructorAction() { courseEditPage = getCourseEditPage(); ______TS("delete instructor then cancel"); courseEditPage.clickDeleteInstructorLinkAndCancel(); assertNotNull(BackDoor.getInstructorAsJsonByGoogleId(instructorId, courseId)); ______TS("delete instructor successfully"); courseEditPage.clickDeleteInstructorLinkAndConfirm(); courseEditPage.verifyHtml("/instructorCourseEditDeleteInstructorSuccessful.html"); ______TS("failed to delete the last instructor"); courseEditPage.clickDeleteInstructorLinkAndConfirm(); courseEditPage.clickDeleteInstructorLinkAndConfirm(); courseEditPage.clickDeleteInstructorLinkAndConfirm(); courseEditPage.verifyStatus(Const.StatusMessages.COURSE_INSTRUCTOR_DELETE_NOT_ALLOWED); ______TS("deleted own instructor role and redirect to courses page"); // Change login id to another instructor BackDoor.createInstructor(testData.instructors.get("InsCrsEdit.coord")); instructorId = testData.instructors.get("InsCrsEdit.coord").googleId; courseEditPage = getCourseEditPage(); courseEditPage.clickDeleteInstructorLinkAndConfirm(); InstructorCoursesPage coursesPage = courseEditPage.changePageType(InstructorCoursesPage.class); coursesPage.verifyStatus( Const.StatusMessages.COURSE_INSTRUCTOR_DELETED + "\n" + Const.StatusMessages.COURSE_EMPTY); // Change back login id to original instructor to ensure remaining test cases work properly instructorId = testData.instructors.get("InsCrsEdit.test").googleId; }
private void testEditInstructorAction() { ______TS("success: edit an instructor"); courseEditPage = getCourseEditPage(); courseEditPage.editInstructor(instructorId, "New name", "*****@*****.**"); courseEditPage.verifyStatus(Const.StatusMessages.COURSE_INSTRUCTOR_EDITED); ______TS("failure: edit failed due to invalid parameters"); String invalidEmail = "InsCrsEdit.email.com"; courseEditPage = getCourseEditPage(); courseEditPage.editInstructor(instructorId, "New name", invalidEmail); courseEditPage.verifyStatus( (new FieldValidator()).getInvalidityInfo(FieldType.EMAIL, invalidEmail)); }
public void testContent() throws Exception { ______TS("page load"); courseEditPage = getCourseEditPage(); courseEditPage.verifyHtml("/instructorCourseEdit.html"); }
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 .getStatus() .contains(String.format(Const.StatusMessages.COURSE_DELETED, courseId))); }
private void testAddInstructorAction() { ______TS("success: add an instructor"); courseEditPage = getCourseEditPage(); courseEditPage.addNewInstructor("Teammates Instructor", "*****@*****.**"); courseEditPage.verifyStatus( String.format( Const.StatusMessages.COURSE_INSTRUCTOR_ADDED, "Teammates Instructor", "*****@*****.**")); Url courseDetailsLink = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_DETAILS_PAGE) .withCourseId(courseId) .withUserId(testData.instructors.get("InsCrsEdit.test").googleId); InstructorCourseDetailsPage courseDetailsPage = courseEditPage.navigateTo(courseDetailsLink, InstructorCourseDetailsPage.class); courseDetailsPage.verifyHtml("/instructorCourseDetailsAddInstructor.html"); ______TS("failure: add an existing instructor"); courseEditPage = getCourseEditPage(); courseEditPage.addNewInstructor("Teammates Instructor", "*****@*****.**"); courseEditPage.verifyStatus(Const.StatusMessages.COURSE_INSTRUCTOR_EXISTS); ______TS("failure: add an instructor with an invalid parameter"); String invalidEmail = "InsCrsEdit.email.com"; courseEditPage = getCourseEditPage(); courseEditPage.addNewInstructor("Teammates Instructor", invalidEmail); courseEditPage.verifyStatus( (new FieldValidator()).getInvalidityInfo(FieldType.EMAIL, invalidEmail)); }
public void testContent() throws Exception { ______TS("page load: Helper privileges (custom)"); instructorId = testData.instructors.get("InsCrsEdit.Helper").googleId; courseEditPage = getCourseEditPage(); // This is the full HTML verification for Instructor Course Edit Page, the rest can all be // verifyMainHtml courseEditPage.verifyHtml("/instructorCourseEditHelper.html"); ______TS("page load: Co-owner privileges"); instructorId = testData.instructors.get("InsCrsEdit.test").googleId; courseEditPage = getCourseEditPage(); courseEditPage.verifyHtmlMainContent("/instructorCourseEditCoowner.html"); ______TS("page load: Manager privileges"); instructorId = testData.instructors.get("InsCrsEdit.manager").googleId; courseEditPage = getCourseEditPage(); courseEditPage.verifyHtmlMainContent("/instructorCourseEditManager.html"); ______TS("page load: Observer privileges"); instructorId = testData.instructors.get("InsCrsEdit.observer").googleId; courseEditPage = getCourseEditPage(); courseEditPage.verifyHtmlMainContent("/instructorCourseEditObserver.html"); ______TS("page load: Tutor privileges"); instructorId = testData.instructors.get("InsCrsEdit.tutor").googleId; courseEditPage = getCourseEditPage(); courseEditPage.verifyHtmlMainContent("/instructorCourseEditTutor.html"); ______TS("go back to co-owner privileges"); instructorId = testData.instructors.get("InsCrsEdit.test").googleId; courseEditPage = getCourseEditPage(); }
private void testInputValidation() { ______TS("Checking max-length enforcement by the text boxes"); String maxLengthInstructorName = StringHelper.generateStringOfLength(FieldValidator.PERSON_NAME_MAX_LENGTH); String longInstructorName = StringHelper.generateStringOfLength(FieldValidator.PERSON_NAME_MAX_LENGTH + 1); courseEditPage.clickEditInstructorLink(1); courseEditPage.clickShowNewInstructorFormButton(); // Add instructor assertEquals( maxLengthInstructorName, courseEditPage.fillNewInstructorName(maxLengthInstructorName)); assertEquals( longInstructorName.substring(0, FieldValidator.PERSON_NAME_MAX_LENGTH), courseEditPage.fillNewInstructorName(longInstructorName)); // Edit instructor assertEquals( maxLengthInstructorName, courseEditPage.editInstructorName(1, maxLengthInstructorName)); assertEquals( longInstructorName.substring(0, FieldValidator.PERSON_NAME_MAX_LENGTH), courseEditPage.editInstructorName(1, longInstructorName)); String maxLengthEmail = StringHelper.generateStringOfLength(FieldValidator.EMAIL_MAX_LENGTH); String longEmail = StringHelper.generateStringOfLength(FieldValidator.EMAIL_MAX_LENGTH + 1); // Add instructor assertEquals(maxLengthEmail, courseEditPage.fillNewInstructorEmail(maxLengthEmail)); assertEquals( longEmail.substring(0, FieldValidator.EMAIL_MAX_LENGTH), courseEditPage.fillNewInstructorEmail(longEmail)); // Edit instructor assertEquals(maxLengthEmail, courseEditPage.editInstructorEmail(1, maxLengthEmail)); assertEquals( longEmail.substring(0, FieldValidator.EMAIL_MAX_LENGTH), courseEditPage.editInstructorEmail(1, longEmail)); }
private void testUnregisteredInstructorEmailNotEditable() { courseEditPage = getCourseEditPage(); ______TS("make a new unregistered instructor and test that its email can't be edited"); courseEditPage.addNewInstructor("Unreg Instructor", "*****@*****.**"); int unregInstrNum = 3; assertEquals( "Unreg Instructor", courseEditPage.getNameField(unregInstrNum).getAttribute("value")); assertFalse(courseEditPage.getNameField(unregInstrNum).isEnabled()); courseEditPage.clickEditInstructorLink(unregInstrNum); assertTrue(courseEditPage.isInstructorEditable(unregInstrNum)); assertEquals("true", courseEditPage.getEmailField(unregInstrNum).getAttribute("readonly")); assertTrue(courseEditPage.getNameField(unregInstrNum).isEnabled()); }
/** Tests the UI of edit course. */ private void testEditCourseAction() throws Exception { courseEditPage = getCourseEditPage(); ______TS("edit course valid name"); assertFalse(courseEditPage.isCourseEditFormEnabled()); courseEditPage.clickEditCourseLink(); assertTrue(courseEditPage.isCourseEditFormEnabled()); courseEditPage.clickSaveCourseButton(); courseEditPage.changePageType(InstructorCourseEditPage.class); courseEditPage.verifyStatus(Const.StatusMessages.COURSE_EDITED); ______TS("edit course invalid name"); assertFalse(courseEditPage.isCourseEditFormEnabled()); courseEditPage.clickEditCourseLink(); assertTrue(courseEditPage.isCourseEditFormEnabled()); courseEditPage.editCourseName(""); courseEditPage.clickSaveCourseButton(); courseEditPage.changePageType(InstructorCourseEditPage.class); courseEditPage.verifyStatus( getPopulatedErrorMessage( FieldValidator.SIZE_CAPPED_NON_EMPTY_STRING_ERROR_MESSAGE, "", FieldValidator.COURSE_NAME_FIELD_NAME, FieldValidator.REASON_EMPTY, FieldValidator.COURSE_NAME_MAX_LENGTH)); }
private void testNewInstructorLink() { courseEditPage = getCourseEditPage(); ______TS("add new instructor link"); assertEquals(true, courseEditPage.clickShowNewInstructorFormButton()); }
private void testEditInstructorLink() { courseEditPage = getCourseEditPage(); ______TS("edit instructor link"); assertEquals(true, courseEditPage.clickEditInstructorLink()); }
private void testEditInstructorLink() { ______TS("edit instructor link"); courseEditPage.clickEditInstructorLink(1); assertTrue(courseEditPage.isInstructorEditable(1)); }
private void testCancelEditInstructorLink() { ______TS("cancel edit instructor link"); courseEditPage.clickCancelEditInstructorLink(1); courseEditPage.verifyInstructorEditFormDisabled(1); }
@SuppressWarnings("deprecation") private void testCreateInstructorAction() throws Exception { InstructorAttributes instructor = new InstructorAttributes(); String shortName = "Instrúctör"; instructor.name = "AHPUiT Instrúctör"; instructor.email = "*****@*****.**"; String institute = "TEAMMATES Test Institute 1"; String demoCourseId = "AHPUiT.instr1.gma-demo"; ______TS( "action success : create instructor account and the account is created successfully after user's verification"); BackDoor.deleteAccount(TestProperties.inst().TEST_INSTRUCTOR_ACCOUNT); BackDoor.deleteCourse(demoCourseId); BackDoor.deleteInstructor(demoCourseId, instructor.email); homePage.createInstructor(shortName, instructor, institute); String expectedjoinUrl = Config.APP_URL + Const.ActionURIs.INSTRUCTOR_COURSE_JOIN; expectedjoinUrl = Url.addParamToUrl( expectedjoinUrl, Const.ParamsNames.REGKEY, StringHelper.encrypt(BackDoor.getKeyForInstructor(demoCourseId, instructor.email))); expectedjoinUrl = Url.addParamToUrl(expectedjoinUrl, Const.ParamsNames.INSTRUCTOR_INSTITUTION, institute); homePage .getStatus() .contains( "Instructor AHPUiT Instrúctör has been successfully created with join link:\n" + expectedjoinUrl); homePage.logout(); // verify the instructor and the demo course have been created assertNotNull(BackDoor.getCourse(demoCourseId)); assertNotNull(BackDoor.getInstructorByEmail(instructor.email, demoCourseId)); // get the joinURL which sent to the requester's email String joinActionUrl = TestProperties.inst().TEAMMATES_URL + Const.ActionURIs.INSTRUCTOR_COURSE_JOIN; String joinLink = Url.addParamToUrl( joinActionUrl, Const.ParamsNames.REGKEY, StringHelper.encrypt(BackDoor.getKeyForInstructor(demoCourseId, instructor.email))); joinLink = Url.addParamToUrl(joinLink, Const.ParamsNames.INSTRUCTOR_INSTITUTION, institute); // simulate the user's verification here because it is added by admin browser.driver.get(joinLink); confirmationPage = createCorrectLoginPageType(browser.driver.getPageSource()) .loginAsJoiningInstructor( TestProperties.inst().TEST_INSTRUCTOR_ACCOUNT, TestProperties.inst().TEST_INSTRUCTOR_PASSWORD); confirmationPage.clickCancelButton(); browser.driver.get(joinLink); confirmationPage = createCorrectLoginPageType(browser.driver.getPageSource()) .loginAsJoiningInstructor( TestProperties.inst().TEST_INSTRUCTOR_ACCOUNT, TestProperties.inst().TEST_INSTRUCTOR_PASSWORD); confirmationPage.clickConfirmButton(); // check a account has been created for the requester successfully assertNotNull(BackDoor.getAccount(TestProperties.inst().TEST_INSTRUCTOR_ACCOUNT)); // verify sample course is accessible for newly joined instructor as an instructor ______TS("new instructor can see sample course in homepage"); InstructorHomePage instructorHomePage = AppPage.getNewPageInstance(browser, InstructorHomePage.class); instructorHomePage.verifyHtmlMainContent("/newlyJoinedInstructorHomePage.html"); ______TS("new instructor can access sample coure enroll page"); InstructorCourseEnrollPage enrollPage = instructorHomePage.clickCourseErollLink(demoCourseId); enrollPage.verifyHtmlMainContent("/newlyJoinedInstructorCourseEnrollPage.html"); ______TS("new instructor can access sample coure details page"); instructorHomePage = enrollPage.goToPreviousPage(InstructorHomePage.class); InstructorCourseDetailsPage detailsPage = instructorHomePage.clickCourseViewLink(demoCourseId); detailsPage.verifyHtmlMainContent("/newlyJoinedInstructorCourseDetailsPage.html"); ______TS("new instructor can access sample coure edit page"); instructorHomePage = detailsPage.goToPreviousPage(InstructorHomePage.class); InstructorCourseEditPage editPage = instructorHomePage.clickCourseEditLink(demoCourseId); editPage.verifyHtmlMainContent("/newlyJoinedInstructorCourseEditPage.html"); ______TS("new instructor can access sample coure feedback session adding page"); instructorHomePage = editPage.goToPreviousPage(InstructorHomePage.class); InstructorFeedbacksPage feedbacksPage = instructorHomePage.clickCourseAddEvaluationLink(demoCourseId); feedbacksPage.verifyHtmlMainContent("/newlyJoinedInstructorFeedbacksPage.html"); ______TS("new instructor can archive sample course"); instructorHomePage = feedbacksPage.goToPreviousPage(InstructorHomePage.class); instructorHomePage.clickArchiveCourseLinkAndConfirm(demoCourseId); instructorHomePage.verifyHtmlMainContent( "/newlyJoinedInstructorHomePageSampleCourseArchived.html"); ______TS("new instructor can unarchive sample course"); String url = Url.addParamToUrl( TestProperties.inst().TEAMMATES_URL + Const.ActionURIs.INSTRUCTOR_COURSES_PAGE, Const.ParamsNames.USER_ID, TestProperties.inst().TEST_INSTRUCTOR_ACCOUNT); browser.driver.get(url); InstructorCoursesPage coursesPage = AppPage.getNewPageInstance(browser, InstructorCoursesPage.class); coursesPage.unarchiveCourse(demoCourseId); coursesPage.verifyHtmlMainContent( "/newlyJoinedInstructorCoursesPageSampleCourseUnarhived.html"); ______TS("new instructor can access sample course students page"); coursesPage .loadStudentsTab() .verifyHtmlMainContent("/newlyJoinedInstructorStudentListPage.html"); ______TS("new instructor can access sample course comments page"); coursesPage .loadInstructorCommentsTab() .verifyHtmlMainContent("/newlyJoinedInstructorCommentsPage.html"); ______TS("new instructor can view feedbackSession result of sample course"); coursesPage.loadInstructorHomeTab(); instructorHomePage = AppPage.getNewPageInstance(browser, InstructorHomePage.class); instructorHomePage .clickFeedbackSessionViewResultsLink( "AHPUiT.instr1.gma-demo", "Second team feedback session") .verifyHtmlMainContent("/newlyJoinedInstructorFeedbackResultsPage.html"); ______TS("new instructor can edit feedbackSession of sample course"); instructorHomePage.loadInstructorHomeTab(); InstructorFeedbackEditPage feedbackEditPage = instructorHomePage.clickFeedbackSessionEditLink( "AHPUiT.instr1.gma-demo", "Second team feedback session"); feedbackEditPage.clickEditSessionButton(); FeedbackSessionAttributes feedbackSession = BackDoor.getFeedbackSession("AHPUiT.instr1.gma-demo", "Second team feedback session"); feedbackEditPage.editFeedbackSession( feedbackSession.startTime, feedbackSession.endTime, new Text("updated instructions"), feedbackSession.gracePeriod); instructorHomePage.verifyHtmlMainContent( "/newlyJoinedInstructorFeedbackSessionSuccessEdited.html"); ______TS("new instructor can click submit button of sample feedbackSession"); instructorHomePage.loadInstructorHomeTab(); FeedbackSubmitPage fbsp = instructorHomePage.clickFeedbackSessionSubmitLink( "AHPUiT.instr1.gma-demo", "Second team feedback session"); fbsp.verifyHtmlMainContent("/newlyJoinedInstructorFeedbackSubmissionEditPage.html"); ______TS("new instructor can send reminder of sample course"); instructorHomePage.loadInstructorHomeTab(); feedbacksPage = instructorHomePage.clickFeedbackSessionRemindLink( "AHPUiT.instr1.gma-demo", "Second team feedback session"); feedbacksPage.verifyHtmlMainContent("/newlyJoinedInstructorFeedbackSessionRemind.html"); ______TS("new instructor can unpublish feedbackSession of sample course"); instructorHomePage.loadInstructorHomeTab(); feedbacksPage = instructorHomePage.clickFeedbackSessionUnpublishLink( "AHPUiT.instr1.gma-demo", "Second team feedback session"); feedbacksPage.verifyHtmlMainContent("/newlyJoinedInstructorFeedbackSessionUnpublished.html"); ______TS("new instructor can publish feedbackSession of sample course"); instructorHomePage.loadInstructorHomeTab(); feedbacksPage = instructorHomePage.clickFeedbackSessionPublishLink( "AHPUiT.instr1.gma-demo", "Second team feedback session"); feedbacksPage.verifyHtmlMainContent("/newlyJoinedInstructorFeedbackSessionPublished.html"); feedbacksPage.logout(); ______TS("action failure : invalid parameter"); Url homeUrl = createUrl(Const.ActionURIs.ADMIN_HOME_PAGE); homePage = loginAdminToPage(browser, homeUrl, AdminHomePage.class); instructor.email = "AHPUiT.email.tmt"; homePage .createInstructor(shortName, instructor, institute) .verifyStatus( String.format( FieldValidator.EMAIL_ERROR_MESSAGE, instructor.email, FieldValidator.REASON_INCORRECT_FORMAT)); ______TS("action success: course is accessible for newly joined instructor as student"); // in staging server, the student account uses the hardcoded email above, so this can only be // test on dev server if (!TestProperties.inst().TEAMMATES_URL.contains("local")) { BackDoor.deleteCourse(demoCourseId); BackDoor.deleteAccount(TestProperties.inst().TEST_INSTRUCTOR_ACCOUNT); BackDoor.deleteInstructor(demoCourseId, instructor.email); return; } // verify sample course is accessible for newly joined instructor as an student StudentHomePage studentHomePage = HomePage.getNewInstance(browser) .clickStudentLogin() .loginAsStudent( TestProperties.inst().TEST_INSTRUCTOR_ACCOUNT, TestProperties.inst().TEST_INSTRUCTOR_PASSWORD); studentHomePage.verifyContains(demoCourseId); studentHomePage.clickViewTeam(); StudentCourseDetailsPage courseDetailsPage = AppPage.getNewPageInstance(browser, StudentCourseDetailsPage.class); courseDetailsPage.verifyHtmlMainContent("/newlyJoinedInstructorStudentCourseDetailsPage.html"); studentHomePage = courseDetailsPage.goToPreviousPage(StudentHomePage.class); studentHomePage.getViewFeedbackButton("First team feedback session").click(); StudentFeedbackResultsPage sfrp = AppPage.getNewPageInstance(browser, StudentFeedbackResultsPage.class); sfrp.verifyHtmlMainContent("/newlyJoinedInstructorStudentFeedbackResultsPage.html"); studentHomePage = sfrp.goToPreviousPage(StudentHomePage.class); studentHomePage.getEditFeedbackButton("First team feedback session").click(); FeedbackSubmitPage fsp = AppPage.getNewPageInstance(browser, FeedbackSubmitPage.class); fsp.verifyHtmlMainContent("/newlyJoinedInstructorStudentFeedbackSubmissionEdit.html"); studentHomePage = fsp.loadStudentHomeTab(); StudentCommentsPage scp = studentHomePage.loadStudentCommentsTab(); scp.verifyHtmlMainContent("/newlyJoinedInstructorStudentCommentsPage.html"); studentHomePage = scp.loadStudentHomeTab(); StudentProfilePage spp = studentHomePage.loadProfileTab(); spp.verifyContains("Student Profile"); spp.verifyContains("AHPUiT Instrúctör"); studentHomePage.logout(); // login in as instructor again to test sample course deletion instructorHomePage = HomePage.getNewInstance(browser) .clickInstructorLogin() .loginAsInstructor( TestProperties.inst().TEST_INSTRUCTOR_ACCOUNT, TestProperties.inst().TEST_INSTRUCTOR_PASSWORD); instructorHomePage.clickAndConfirm(instructorHomePage.getDeleteCourseLink(demoCourseId)); assertTrue( instructorHomePage .getStatus() .contains("The course " + demoCourseId + " has been deleted.")); instructorHomePage.logout(); BackDoor.deleteAccount(TestProperties.inst().TEST_INSTRUCTOR_ACCOUNT); BackDoor.deleteCourse(demoCourseId); BackDoor.deleteInstructor(demoCourseId, instructor.email); }
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.verifyStatus(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 = new InstructorAttributes( "InsCrsEdit.reg", courseId, "Teammates Reg", "*****@*****.**", Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_CUSTOM, "Teammates Reg", privilege); BackDoor.createInstructor(instructor); // Create an unregistered instructor with co-owner privilege courseEditPage.addNewInstructor("Unreg Instructor", "*****@*****.**"); // Delete own instructor role courseEditPage.clickDeleteInstructorLinkAndConfirm(2); courseEditPage.verifyStatus(Const.StatusMessages.COURSE_INSTRUCTOR_DELETE_NOT_ALLOWED); // Delete other instructors courseEditPage.clickDeleteInstructorLinkAndConfirm(3); courseEditPage.verifyStatus(Const.StatusMessages.COURSE_INSTRUCTOR_DELETED); courseEditPage.clickDeleteInstructorLinkAndConfirm(1); courseEditPage.verifyStatus(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.verifyStatus( Const.StatusMessages.COURSE_INSTRUCTOR_DELETED + "\n" + Const.StatusMessages.COURSE_EMPTY); // Restore own instructor role to ensure remaining test cases work properly BackDoor.createInstructor(testData.instructors.get("InsCrsEdit.test")); }
private void testCancelEditInstructorAction() throws Exception { ______TS("success: cancel editing an instructor role from Co-owner to Manager"); int editInstructorIndex = 7; courseEditPage.clickEditInstructorLink(editInstructorIndex); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Manager"); courseEditPage.clickCancelEditInstructorLink(editInstructorIndex); assertFalse(courseEditPage.isRoleSelectedForInstructor(editInstructorIndex, "Manager")); assertTrue(courseEditPage.isRoleSelectedForInstructor(editInstructorIndex, "Co-owner")); ______TS("success: cancel editing an instructor role from Co-owner to Custom"); courseEditPage.clickEditInstructorLink(editInstructorIndex); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Custom"); courseEditPage.clickCourseLevelPrivilegesLink( editInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_INSTRUCTORS); courseEditPage.clickAddSectionLevelPrivilegesLink(editInstructorIndex); courseEditPage.clickSectionSelectionCheckBox(editInstructorIndex, 0, 0); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, 0, InstructorCourseEditPage.SECTION_VIEW_STUDENTS); courseEditPage.clickSessionLevelInSectionLevel(editInstructorIndex, 0); courseEditPage.clickAddSectionLevelPrivilegesLink(editInstructorIndex); courseEditPage.clickSectionSelectionCheckBox(editInstructorIndex, 1, 1); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, 1, InstructorCourseEditPage.SECTION_VIEW_STUDENTS); courseEditPage.clickAddSectionLevelPrivilegesLink(editInstructorIndex); courseEditPage.clickSectionSelectionCheckBox(editInstructorIndex, 2, 2); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, 2, InstructorCourseEditPage.SECTION_VIEW_STUDENTS); courseEditPage.clickCancelEditInstructorLink(editInstructorIndex); courseEditPage.verifyHtmlPart( By.id("formEditInstructor" + editInstructorIndex), "/instructorCourseEditCancelEditCoownerForm.html"); courseEditPage.clickEditInstructorLink(editInstructorIndex); assertFalse(courseEditPage.isTunePermissionsDivVisible(editInstructorIndex)); ______TS("success: cancel editing an instructor role from Custom to Co-owner"); editInstructorIndex = 1; courseEditPage.clickEditInstructorLink(editInstructorIndex); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Co-owner"); courseEditPage.clickCancelEditInstructorLink(editInstructorIndex); courseEditPage.verifyHtmlPart( By.id("formEditInstructor" + editInstructorIndex), "/instructorCourseEditCancelEditCustomInstructorForm.html"); ______TS("success: cancel editing a Custom instructor's permissions"); courseEditPage.clickEditInstructorLink(editInstructorIndex); courseEditPage.clickCourseLevelPrivilegesLink( editInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_INSTRUCTORS); courseEditPage.clickSectionSelectionCheckBox(editInstructorIndex, 0, 0); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, 0, InstructorCourseEditPage.SECTION_VIEW_STUDENTS); courseEditPage.clickSectionSelectionCheckBox(editInstructorIndex, 1, 1); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, 1, InstructorCourseEditPage.SECTION_VIEW_STUDENTS); courseEditPage.clickHideSectionLevelPrivileges(editInstructorIndex, 2); courseEditPage.clickCancelEditInstructorLink(editInstructorIndex); courseEditPage.verifyHtmlPart( By.id("formEditInstructor" + editInstructorIndex), "/instructorCourseEditCancelEditCustomInstructorPermissionsForm.html"); courseEditPage.clickEditInstructorLink(editInstructorIndex); assertTrue(courseEditPage.isTunePermissionsDivVisible(editInstructorIndex)); }
private void testAddInstructorAction() throws Exception { ______TS("success: add an instructor with privileges"); courseEditPage.clickShowNewInstructorFormButton(); courseEditPage.fillNewInstructorName("Teammates Instructor"); courseEditPage.fillNewInstructorEmail("*****@*****.**"); int newInstructorIndex = 8; courseEditPage.selectRoleForInstructor(newInstructorIndex, "Custom"); courseEditPage.clickCourseLevelPrivilegesLink( newInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_COURSE); courseEditPage.clickCourseLevelPrivilegesLink( newInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_STUDENTS); courseEditPage.clickCourseLevelPrivilegesLink( newInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_OTHERS_COMMENTS); 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.verifyStatus( String.format( Const.StatusMessages.COURSE_INSTRUCTOR_ADDED, "Teammates Instructor", "*****@*****.**")); 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", "*****@*****.**"); courseEditPage.verifyStatus(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.verifyStatus(new FieldValidator().getInvalidityInfoForEmail(invalidEmail)); String invalidName = ""; courseEditPage.addNewInstructor(invalidName, "*****@*****.**"); courseEditPage.verifyStatus(new FieldValidator().getInvalidityInfoForPersonName(invalidName)); }
private void testEditInstructorAction() throws Exception { ______TS("failure: ajax error on clicking edit button"); int editInstructorIndex = 1; courseEditPage.changeCourseIdInForm(editInstructorIndex, "InvalidCourse"); courseEditPage.clickEditInstructorLinkUnsuccessfully(editInstructorIndex); courseEditPage.waitForAjaxLoaderGifToDisappear(); assertTrue( courseEditPage .getEditInstructorLink(editInstructorIndex) .getText() .contains("Edit failed.")); courseEditPage.reloadPage(); ______TS("success: edit an instructor"); courseEditPage.editInstructor( editInstructorIndex, "New name", "*****@*****.**", Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER); courseEditPage.verifyStatus( String.format(Const.StatusMessages.COURSE_INSTRUCTOR_EDITED, "New name")); ______TS( "success: edit an instructor (InsCrsEdit.coord)--viewing instructor permission details"); courseEditPage.clickEditInstructorLink(editInstructorIndex); assertTrue(courseEditPage.isInstructorEditable(editInstructorIndex)); ______TS("view details: manager"); courseEditPage.clickViewDetailsLinkForInstructor( editInstructorIndex, InstructorCourseEditPage.INSTRUCTOR_TYPE_MANAGER); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS)); courseEditPage.closeModal(); ______TS("view details: observer"); courseEditPage.clickViewDetailsLinkForInstructor( editInstructorIndex, InstructorCourseEditPage.INSTRUCTOR_TYPE_OBSERVER); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS)); courseEditPage.closeModal(); ______TS("view details: tutor"); courseEditPage.clickViewDetailsLinkForInstructor( editInstructorIndex, InstructorCourseEditPage.INSTRUCTOR_TYPE_TUTOR); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInModalChecked( Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS)); courseEditPage.closeModal(); ______TS("view details: co-owner"); courseEditPage.clickViewDetailsLinkForInstructor( editInstructorIndex, InstructorCourseEditPage.INSTRUCTOR_TYPE_COOWNER); courseEditPage.verifyHtmlMainContent("/instructorCourseEditEditInstructorPrivilegesModal.html"); courseEditPage.closeModal(); ______TS("verify that custom has no privileges by default"); int customInstrNum = 5; courseEditPage.clickEditInstructorLink(customInstrNum); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( customInstrNum, "canmodifycourse")); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( customInstrNum, "canmodifyinstructor")); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( customInstrNum, "canmodifysession")); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( customInstrNum, "canmodifystudent")); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( customInstrNum, "canviewstudentinsection")); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( customInstrNum, "cangivecommentinsection")); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( customInstrNum, "canviewcommentinsection")); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( customInstrNum, "canmodifycommentinsection")); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( customInstrNum, "cansubmitsessioninsection")); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( customInstrNum, "canviewsessioninsection")); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( customInstrNum, "canmodifysessioncommentinsection")); courseEditPage.clickSaveInstructorButton(customInstrNum); ______TS("success: edit an instructor with privileges"); courseEditPage.clickEditInstructorLink(editInstructorIndex); assertTrue(courseEditPage.getDisplayedToStudentCheckBox(editInstructorIndex).isSelected()); // not displayed to students courseEditPage.clickDisplayedToStudentCheckBox(editInstructorIndex); // select the role as Custom for instr1 courseEditPage.selectRoleForInstructor(editInstructorIndex, "Custom"); // deselect some privileges from Co-owner default values courseEditPage.clickCourseLevelPrivilegesLink( editInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_COURSE); courseEditPage.clickCourseLevelPrivilegesLink( editInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_INSTRUCTORS); courseEditPage.clickCourseLevelPrivilegesLink( editInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_OTHERS_COMMENTS); courseEditPage.clickAddSectionLevelPrivilegesLink(editInstructorIndex); courseEditPage.clickSectionSelectionCheckBox(editInstructorIndex, 0, 0); courseEditPage.clickSectionSelectionCheckBox(editInstructorIndex, 0, 1); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, 0, InstructorCourseEditPage.SECTION_VIEW_STUDENTS); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, 0, InstructorCourseEditPage.SECTION_VIEW_OTHERS_COMMENTS); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, 0, InstructorCourseEditPage.SECTION_VIEW_RESPONSES_IN_SESSION); courseEditPage.clickSessionLevelInSectionLevel(editInstructorIndex, 0); courseEditPage.clickAddSectionLevelPrivilegesLink(editInstructorIndex); courseEditPage.clickSectionSelectionCheckBox(editInstructorIndex, 1, 1); courseEditPage.clickAddSectionLevelPrivilegesLink(editInstructorIndex); courseEditPage.clickSectionSelectionCheckBox(editInstructorIndex, 2, 1); courseEditPage.clickSectionSelectionCheckBox(editInstructorIndex, 2, 2); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, 2, InstructorCourseEditPage.SECTION_MODIFY_RESPONSES_IN_SESSION); // after 3 sections added, no more things to add assertFalse(courseEditPage.getAddSectionLevelPrivilegesLink(editInstructorIndex).isDisplayed()); courseEditPage.verifyHtmlMainContent( "/instructorCourseEditEditInstructorPrivilegesBeforeSubmit.html"); courseEditPage.clickSaveInstructorButton(editInstructorIndex); courseEditPage.verifyHtmlMainContent( "/instructorCourseEditEditInstructorPrivilegesSuccessful.html"); courseEditPage.clickEditInstructorLink(editInstructorIndex); assertTrue(courseEditPage.isInstructorEditable(editInstructorIndex)); courseEditPage.verifyHtmlMainContent( "/instructorCourseEditEditInstructorPrivilegesSuccessfulAndCheckEditAgain.html"); courseEditPage.clickSaveInstructorButton(editInstructorIndex); ______TS("failure: edit failed due to invalid parameters"); String invalidEmail = "InsCrsEdit.email.tmt"; courseEditPage.editInstructor( editInstructorIndex, "New name", invalidEmail, Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER); courseEditPage.verifyStatus(new FieldValidator().getInvalidityInfoForEmail(invalidEmail)); String invalidName = ""; courseEditPage.editInstructor( editInstructorIndex, invalidName, "*****@*****.**", Const.InstructorPermissionRoleNames.INSTRUCTOR_PERMISSION_ROLE_COOWNER); courseEditPage.verifyStatus(new FieldValidator().getInvalidityInfoForPersonName(invalidName)); ______TS( "success: test Custom radio button getting other privileges' default values when selected"); editInstructorIndex = 2; courseEditPage.clickEditInstructorLink(editInstructorIndex); ______TS("tutor->custom"); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Tutor"); courseEditPage.clickSaveInstructorButton(editInstructorIndex); courseEditPage.clickEditInstructorLink(editInstructorIndex); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Custom"); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS)); ______TS("observer->custom"); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Observer"); courseEditPage.clickSaveInstructorButton(editInstructorIndex); courseEditPage.clickEditInstructorLink(editInstructorIndex); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Custom"); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS)); ______TS("manager->custom"); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Manager"); courseEditPage.clickSaveInstructorButton(editInstructorIndex); courseEditPage.clickEditInstructorLink(editInstructorIndex); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Custom"); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS)); ______TS("co-owner->custom"); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Co-owner"); courseEditPage.clickSaveInstructorButton(editInstructorIndex); courseEditPage.clickEditInstructorLink(editInstructorIndex); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Custom"); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COURSE)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_INSTRUCTOR)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS)); ______TS("verify that session level checkboxes are accessible"); int sectionToCheck = 0; courseEditPage.clickAddSectionLevelPrivilegesLink(editInstructorIndex); courseEditPage.clickSessionLevelInSectionLevel(editInstructorIndex, sectionToCheck); assertTrue( courseEditPage.isTuneSessionPermissionsDivVisible(editInstructorIndex, sectionToCheck)); ______TS("verify checkbox toggling to false"); int sessionToCheck = 0; // course level courseEditPage.clickCourseLevelPrivilegesLink( editInstructorIndex, InstructorCourseEditPage.COURSE_VIEW_STUDENTS); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTIONS)); courseEditPage.clickCourseLevelPrivilegesLink( editInstructorIndex, InstructorCourseEditPage.COURSE_VIEW_OTHERS_COMMENTS); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS)); courseEditPage.clickCourseLevelPrivilegesLink( editInstructorIndex, InstructorCourseEditPage.COURSE_VIEW_RESPONSES_IN_SESSION); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)); assertFalse( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS)); // section level courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_VIEW_STUDENTS); assertFalse( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_VIEW_STUDENTS)); assertFalse( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_GIVE_STUDENT_COMMENTS)); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_VIEW_OTHERS_COMMENTS); assertFalse( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_VIEW_OTHERS_COMMENTS)); assertFalse( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_MODIFY_OTHERS_COMMENTS)); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_VIEW_RESPONSES_IN_SESSION); assertFalse( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_VIEW_RESPONSES_IN_SESSION)); assertFalse( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_MODIFY_RESPONSES_IN_SESSION)); // session level courseEditPage.clickSessionLevelPrivilegeLink( editInstructorIndex, sectionToCheck, sessionToCheck, InstructorCourseEditPage.SESSION_VIEW_RESPONSES); assertFalse( courseEditPage.isSessionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, sessionToCheck, InstructorCourseEditPage.SESSION_VIEW_RESPONSES)); assertFalse( courseEditPage.isSessionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, sessionToCheck, InstructorCourseEditPage.SESSION_MODIFY_RESPONSES)); ______TS("verify checkbox toggling to true"); // course level courseEditPage.clickCourseLevelPrivilegesLink( editInstructorIndex, InstructorCourseEditPage.COURSE_GIVE_STUDENT_COMMENTS); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_GIVE_COMMENT_IN_SECTIONS)); courseEditPage.clickCourseLevelPrivilegesLink( editInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_OTHERS_COMMENTS); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_COMMENT_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_COMMENT_IN_SECTIONS)); courseEditPage.clickCourseLevelPrivilegesLink( editInstructorIndex, InstructorCourseEditPage.COURSE_MODIFY_RESPONSES_IN_SESSION); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS)); assertTrue( courseEditPage.isPrivilegeCheckboxInPermissionDivChecked( editInstructorIndex, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS)); // section level courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_GIVE_STUDENT_COMMENTS); assertTrue( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_VIEW_STUDENTS)); assertTrue( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_GIVE_STUDENT_COMMENTS)); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_MODIFY_OTHERS_COMMENTS); assertTrue( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_VIEW_OTHERS_COMMENTS)); assertTrue( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_MODIFY_OTHERS_COMMENTS)); courseEditPage.clickSectionLevelPrivilegeLink( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_MODIFY_RESPONSES_IN_SESSION); assertTrue( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_VIEW_RESPONSES_IN_SESSION)); assertTrue( courseEditPage.isSectionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, InstructorCourseEditPage.SECTION_MODIFY_RESPONSES_IN_SESSION)); // session level courseEditPage.clickSessionLevelPrivilegeLink( editInstructorIndex, sectionToCheck, sessionToCheck, InstructorCourseEditPage.SESSION_MODIFY_RESPONSES); assertTrue( courseEditPage.isSessionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, sessionToCheck, InstructorCourseEditPage.SESSION_VIEW_RESPONSES)); assertTrue( courseEditPage.isSessionLevelPrivilegeLinkClicked( editInstructorIndex, sectionToCheck, sessionToCheck, InstructorCourseEditPage.SESSION_MODIFY_RESPONSES)); courseEditPage.selectRoleForInstructor(editInstructorIndex, "Co-owner"); }