Search in sources :

Example 16 with StudentAttributes

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

the class AdminSearchPageUiTest method testSanitization.

private void testSanitization() {
    ______TS("search for student with data requiring sanitization");
    searchPage.clearSearchBox();
    String searchContent = "searchUI.normal@sanitization.tmt";
    searchPage.inputSearchContent(searchContent);
    searchPage.clickSearchButton();
    StudentAttributes student = testData.students.get("student1InTestingSanitizationCourse");
    InstructorAttributes instructor = testData.instructors.get("instructor1OfTestingSanitizationCourse");
    CourseAttributes course = testData.courses.get("testingSanitizationCourse");
    assertStudentRowDisplayed(student, instructor, course);
    ______TS("search for instructor with data requiring sanitization");
    searchPage.clearSearchBox();
    searchContent = "searchUI.instructor1@sanitization.tmt";
    searchPage.inputSearchContent(searchContent);
    searchPage.clickSearchButton();
    assertInstructorRowDisplayed(instructor, course);
}
Also used : StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes)

Example 17 with StudentAttributes

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

the class InstructorCourseDetailsPageUiTest method testDeleteAction.

private void testDeleteAction() throws Exception {
    String courseId = testData.courses.get("CCDetailsUiT.CS2104").getId();
    StudentAttributes benny = testData.students.get("benny.tmms@CCDetailsUiT.CS2104");
    StudentAttributes danny = testData.students.get("danny.tmms@CCDetailsUiT.CS2104");
    ______TS("action: delete");
    detailsPage.clickDeleteAndCancel(benny.name);
    assertNotNull(BackDoor.getStudent(courseId, benny.email));
    // Use ${test.student1} etc.
    detailsPage.clickDeleteAndConfirm(benny.name).verifyHtmlMainContent("/instructorCourseDetailsStudentDeleteSuccessful.html");
    detailsPage.clickDeleteAndCancel(danny.name);
    assertNotNull(BackDoor.getStudent(courseId, danny.email));
}
Also used : StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes)

Example 18 with StudentAttributes

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

the class InstructorCourseDetailsPageUiTest method testLinks.

private void testLinks() {
    StudentAttributes student1 = testData.students.get("CCDetailsUiT.alice.tmms@CCDetailsUiT.CS2104");
    StudentAttributes student2 = testData.students.get("charlie.tmms@CCDetailsUiT.CS2104");
    ______TS("link: view");
    InstructorCourseStudentDetailsViewPage studentDetailsPage = detailsPage.clickViewStudent(student1.name);
    studentDetailsPage.verifyIsCorrectPage(student1.email);
    studentDetailsPage.closeCurrentWindowAndSwitchToParentWindow();
    ______TS("link: edit");
    InstructorCourseStudentDetailsEditPage studentEditPage = detailsPage.clickEditStudent(student2.name);
    studentEditPage.verifyIsCorrectPage(student2.email);
    studentEditPage.closeCurrentWindowAndSwitchToParentWindow();
    ______TS("link: all records");
    InstructorStudentRecordsPage studentAllRecordsPage = detailsPage.clickAllRecordsLink(student2.name);
    studentAllRecordsPage.verifyIsCorrectPage(student2.name);
    studentAllRecordsPage.closeCurrentWindowAndSwitchToParentWindow();
    studentAllRecordsPage = detailsPage.clickAllRecordsLink(student1.name);
    studentAllRecordsPage.verifyIsCorrectPage(student1.name.replaceAll("<", "&lt;").replaceAll(">", "&gt;"));
    studentAllRecordsPage.closeCurrentWindowAndSwitchToParentWindow();
    ______TS("link: download student list");
    AppUrl studentListDownloadUrl = createUrl(Const.ActionURIs.INSTRUCTOR_COURSE_STUDENT_LIST_DOWNLOAD).withUserId("CCDetailsUiT.instr").withCourseId("CCDetailsUiT.CS2104");
    detailsPage.verifyDownloadLink(studentListDownloadUrl);
}
Also used : InstructorCourseStudentDetailsViewPage(teammates.test.pageobjects.InstructorCourseStudentDetailsViewPage) InstructorCourseStudentDetailsEditPage(teammates.test.pageobjects.InstructorCourseStudentDetailsEditPage) AppUrl(teammates.common.util.AppUrl) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorStudentRecordsPage(teammates.test.pageobjects.InstructorStudentRecordsPage)

Example 19 with StudentAttributes

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

the class FeedbackSessionRemindEmailWorkerActionTest method allTests.

@Test
public void allTests() throws Exception {
    ______TS("Send feedback session reminder email");
    FeedbackSessionAttributes session1 = dataBundle.feedbackSessions.get("session1InCourse1");
    InstructorAttributes instructor1 = dataBundle.instructors.get("instructor1OfCourse1");
    // re-read from Datastore to update the respondents list
    session1 = fsLogic.getFeedbackSession(session1.getFeedbackSessionName(), session1.getCourseId());
    String[] submissionParams = new String[] { ParamsNames.SUBMISSION_FEEDBACK, session1.getFeedbackSessionName(), ParamsNames.SUBMISSION_COURSE, session1.getCourseId(), ParamsNames.USER_ID, instructor1.getGoogleId() };
    FeedbackSessionRemindEmailWorkerAction action = getAction(submissionParams);
    action.execute();
    // 2 students and 4 instructors sent reminder, 1 instructor notified
    verifySpecifiedTasksAdded(action, Const.TaskQueue.SEND_EMAIL_QUEUE_NAME, 7);
    List<String> studentRecipientList = new ArrayList<>();
    for (StudentAttributes student : studentsLogic.getStudentsForCourse(session1.getCourseId())) {
        if (!fsLogic.isFeedbackSessionCompletedByStudent(session1, student.email)) {
            studentRecipientList.add(student.email);
        }
    }
    List<String> instructorRecipientList = new ArrayList<>();
    List<String> instructorNotifiedList = new ArrayList<>();
    for (InstructorAttributes instructor : instructorsLogic.getInstructorsForCourse(session1.getCourseId())) {
        if (!fsLogic.isFeedbackSessionCompletedByInstructor(session1, instructor.email)) {
            instructorRecipientList.add(instructor.email);
        }
    }
    instructorNotifiedList.add(instructorsLogic.getInstructorForGoogleId(session1.getCourseId(), instructor1.getGoogleId()).email);
    String courseName = coursesLogic.getCourse(session1.getCourseId()).getName();
    List<TaskWrapper> tasksAdded = action.getTaskQueuer().getTasksAdded();
    for (TaskWrapper task : tasksAdded) {
        Map<String, String[]> paramMap = task.getParamMap();
        assertEquals(String.format(EmailType.FEEDBACK_SESSION_REMINDER.getSubject(), courseName, session1.getSessionName()), paramMap.get(ParamsNames.EMAIL_SUBJECT)[0]);
        String header = "The email below has been sent to students of course: [" + session1.getCourseId() + "]";
        String content = paramMap.get(ParamsNames.EMAIL_CONTENT)[0];
        String recipient = paramMap.get(ParamsNames.EMAIL_RECEIVER)[0];
        if (content.contains(header)) {
            // notification to only requesting instructors
            assertTrue(instructorNotifiedList.contains(recipient));
            instructorNotifiedList.remove(recipient);
            continue;
        }
        if (studentRecipientList.contains(recipient)) {
            studentRecipientList.remove(recipient);
            continue;
        }
        if (instructorRecipientList.contains(recipient)) {
            instructorRecipientList.remove(recipient);
            continue;
        }
        fail("Email recipient " + recipient + " is not in the list!");
    }
    // Ensure that every email recipient is accounted for
    assertTrue(String.valueOf(studentRecipientList.size()), studentRecipientList.isEmpty());
    assertTrue(String.valueOf(instructorRecipientList.size()), instructorRecipientList.isEmpty());
    assertTrue(instructorNotifiedList.isEmpty());
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) TaskWrapper(teammates.common.util.TaskWrapper) FeedbackSessionRemindEmailWorkerAction(teammates.ui.automated.FeedbackSessionRemindEmailWorkerAction) ArrayList(java.util.ArrayList) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Test(org.testng.annotations.Test)

Example 20 with StudentAttributes

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

the class FeedbackSessionUpdateRespondentWorkerActionTest method allTests.

@Test
public void allTests() throws EntityDoesNotExistException {
    FeedbackSessionAttributes session = dataBundle.feedbackSessions.get("session1InCourse1");
    ______TS("typical case: new student respondent");
    StudentAttributes student = dataBundle.students.get("student4InCourse1");
    verifyRespondentNotInSessionRespondentsList(session, student.email, false);
    String[] submissionParams = new String[] { ParamsNames.COURSE_ID, session.getCourseId(), ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), ParamsNames.RESPONDENT_EMAIL, student.email, ParamsNames.RESPONDENT_IS_INSTRUCTOR, "false", ParamsNames.RESPONDENT_IS_TO_BE_REMOVED, "false" };
    FeedbackSessionUpdateRespondentWorkerAction action = getAction(submissionParams);
    action.execute();
    verifyRespondentInSessionRespondentsList(session, student.email, false);
    ______TS("typical case: new instructor respondent");
    InstructorAttributes instructor = dataBundle.instructors.get("instructor2OfCourse1");
    verifyRespondentNotInSessionRespondentsList(session, instructor.email, true);
    submissionParams = new String[] { ParamsNames.COURSE_ID, session.getCourseId(), ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), ParamsNames.RESPONDENT_EMAIL, instructor.email, ParamsNames.RESPONDENT_IS_INSTRUCTOR, "true", ParamsNames.RESPONDENT_IS_TO_BE_REMOVED, "false" };
    action = getAction(submissionParams);
    action.execute();
    verifyRespondentInSessionRespondentsList(session, instructor.email, true);
    ______TS("typical case: deleted student respondent");
    verifyRespondentInSessionRespondentsList(session, student.email, false);
    submissionParams = new String[] { ParamsNames.COURSE_ID, session.getCourseId(), ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), ParamsNames.RESPONDENT_EMAIL, student.email, ParamsNames.RESPONDENT_IS_INSTRUCTOR, "false", ParamsNames.RESPONDENT_IS_TO_BE_REMOVED, "true" };
    action = getAction(submissionParams);
    action.execute();
    verifyRespondentNotInSessionRespondentsList(session, student.email, false);
    ______TS("typical case: deleted instructor respondent");
    verifyRespondentInSessionRespondentsList(session, instructor.email, true);
    submissionParams = new String[] { ParamsNames.COURSE_ID, session.getCourseId(), ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), ParamsNames.RESPONDENT_EMAIL, instructor.email, ParamsNames.RESPONDENT_IS_INSTRUCTOR, "true", ParamsNames.RESPONDENT_IS_TO_BE_REMOVED, "true" };
    action = getAction(submissionParams);
    action.execute();
    verifyRespondentNotInSessionRespondentsList(session, instructor.email, true);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) FeedbackSessionUpdateRespondentWorkerAction(teammates.ui.automated.FeedbackSessionUpdateRespondentWorkerAction) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Test(org.testng.annotations.Test)

Aggregations

StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)241 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)85 Test (org.testng.annotations.Test)80 ArrayList (java.util.ArrayList)55 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)33 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)33 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)30 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)27 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)22 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)17 ShowPageResult (teammates.ui.controller.ShowPageResult)15 HashMap (java.util.HashMap)14 TeamDetailsBundle (teammates.common.datatransfer.TeamDetailsBundle)14 InvalidParametersException (teammates.common.exception.InvalidParametersException)14 EmailWrapper (teammates.common.util.EmailWrapper)13 RedirectResult (teammates.ui.controller.RedirectResult)12 List (java.util.List)11 StatusMessage (teammates.common.util.StatusMessage)10 HashSet (java.util.HashSet)9 StudentEnrollDetails (teammates.common.datatransfer.StudentEnrollDetails)9