Search in sources :

Example 1 with FeedbackSessionAttributes

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

the class InstructorFeedbackEditPageUiTest method testSanitization.

private void testSanitization() throws IOException {
    ______TS("Test sanitization for edit page");
    instructorId = testData.accounts.get("instructor1OfTestingSanitizationCourse").googleId;
    FeedbackSessionAttributes session = testData.feedbackSessions.get("session1InTestingSanitizationCourse");
    courseId = session.getCourseId();
    feedbackSessionName = session.getFeedbackSessionName();
    feedbackEditPage = getFeedbackEditPage();
    feedbackEditPage.verifyHtmlMainContent("/instructorFeedbackEditPageTestingSanitization.html");
    ______TS("Test sanitization for copy question modal");
    feedbackEditPage.clickCopyButton();
    feedbackEditPage.waitForCopyTableToLoad();
    feedbackEditPage.verifyHtmlPart(By.id("copyModal"), "/instructorFeedbackCopyQuestionModalTestingSanitization.html");
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes)

Example 2 with FeedbackSessionAttributes

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

the class InstructorFeedbackSessionsPageUiTest method testEditLink.

private void testEditLink() {
    InstructorFeedbackEditPage feedbackResultsPage;
    FeedbackSessionAttributes fsa;
    ______TS("edit link clickable when creator");
    fsa = testData.feedbackSessions.get("privateSession");
    feedbackResultsPage = feedbackPage.loadEditLink(fsa.getCourseId(), fsa.getFeedbackSessionName());
    assertTrue(feedbackResultsPage.isCorrectPage(fsa.getCourseId(), fsa.getFeedbackSessionName()));
    feedbackPage = getFeedbackPageForInstructor(idOfInstructorWithSessions);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) InstructorFeedbackEditPage(teammates.test.pageobjects.InstructorFeedbackEditPage)

Example 3 with FeedbackSessionAttributes

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

the class InstructorSubmissionAdjustmentUiTest method testAdjustmentOfSubmission.

@Test
public void testAdjustmentOfSubmission() throws MaximumRetriesExceededException {
    // load the enrollPage
    loadEnrollmentPage();
    ______TS("typical case: enroll new student to existing course");
    StudentAttributes newStudent = StudentAttributes.builder("idOfTypicalCourse1", "someName", "random@g.tmt").withComments("comments").withTeam("Team 1.1</td></div>'\"").withSection("None").build();
    String enrollString = "Section | Team | Name | Email | Comment" + System.lineSeparator() + newStudent.toEnrollmentString();
    enrollPage.enroll(enrollString);
    // Wait briefly to allow task queue to successfully execute tasks
    ThreadHelper.waitFor(2000);
    ______TS("typical case : existing student changes team");
    loadEnrollmentPage();
    final FeedbackSessionAttributes session = testData.feedbackSessions.get("session2InCourse1");
    final StudentAttributes student = testData.students.get("student1InCourse1");
    // Verify pre-existing submissions and responses
    List<FeedbackResponseAttributes> oldResponsesForSession = getAllResponsesForStudentForSession(student, session.getFeedbackSessionName());
    assertFalse(oldResponsesForSession.isEmpty());
    String newTeam = "Team 1.2";
    student.team = newTeam;
    enrollString = "Section | Team | Name | Email | Comment" + System.lineSeparator() + student.toEnrollmentString();
    enrollPage.enroll(enrollString);
    // It might take a while for the submission adjustment to persist (especially on the live server),
    // during which the pre-existing submissions and responses would be counted.
    // Hence, this needs to be retried several times until the count becomes zero.
    persistenceRetryManager.runUntilSuccessful(new RetryableTaskReturns<Integer>("Assert outdated responses removed") {

        @Override
        public Integer run() {
            return getAllResponsesForStudentForSession(student, session.getFeedbackSessionName()).size();
        }

        @Override
        public boolean isSuccessful(Integer numberOfResponses) {
            return numberOfResponses == 0;
        }
    });
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) Test(org.testng.annotations.Test)

Example 4 with FeedbackSessionAttributes

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

the class StudentFeedbackSubmissionEditPageActionTest method testAccessControl.

@Override
@Test
protected void testAccessControl() throws Exception {
    FeedbackSessionAttributes session1InCourse1 = dataBundle.feedbackSessions.get("session1InCourse1");
    String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, session1InCourse1.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, session1InCourse1.getFeedbackSessionName() };
    verifyOnlyStudentsOfTheSameCourseCanAccess(submissionParams);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) Test(org.testng.annotations.Test)

Example 5 with FeedbackSessionAttributes

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

the class FeedbackSessionAttributesTest method testBuilderCopy.

@Test
public void testBuilderCopy() {
    FeedbackSessionAttributes original = FeedbackSessionAttributes.builder("newFeedbackSessionName", "course", "email").withInstructions(new Text("default instructions")).withCreatedTime(Instant.now()).withStartTime(TimeHelperExtension.getInstantHoursOffsetFromNow(2)).withEndTime(TimeHelperExtension.getInstantHoursOffsetFromNow(5)).withSessionVisibleFromTime(TimeHelperExtension.getInstantHoursOffsetFromNow(1)).withResultsVisibleFromTime(TimeHelperExtension.getInstantHoursOffsetFromNow(6)).withTimeZone(ZoneId.of("Asia/Singapore")).withGracePeriodMinutes(0).withFeedbackSessionType(FeedbackSessionType.PRIVATE).withOpeningEmailEnabled(false).withClosingEmailEnabled(false).withPublishedEmailEnabled(false).build();
    FeedbackSessionAttributes copy = original.getCopy();
    assertEquals(original.getFeedbackSessionName(), copy.getFeedbackSessionName());
    assertEquals(original.getCourseId(), copy.getCourseId());
    assertEquals(original.getCreatorEmail(), copy.getCreatorEmail());
    assertEquals(original.getInstructions(), copy.getInstructions());
    assertEquals(original.getCreatedTime(), copy.getCreatedTime());
    assertEquals(original.getStartTime(), copy.getStartTime());
    assertEquals(original.getEndTime(), copy.getEndTime());
    assertEquals(original.getSessionVisibleFromTime(), copy.getSessionVisibleFromTime());
    assertEquals(original.getResultsVisibleFromTime(), copy.getResultsVisibleFromTime());
    assertEquals(original.getTimeZone(), copy.getTimeZone());
    assertEquals(original.getGracePeriodMinutes(), copy.getGracePeriodMinutes());
    assertEquals(original.getFeedbackSessionType(), copy.getFeedbackSessionType());
    assertEquals(original.isOpeningEmailEnabled(), copy.isOpeningEmailEnabled());
    assertEquals(original.isClosingEmailEnabled(), copy.isClosingEmailEnabled());
    assertEquals(original.isPublishedEmailEnabled(), copy.isPublishedEmailEnabled());
    assertEquals(original.isSentClosedEmail(), copy.isSentClosedEmail());
    assertEquals(original.isSentClosingEmail(), copy.isSentClosingEmail());
    assertEquals(original.isSentOpenEmail(), copy.isSentOpenEmail());
    assertEquals(original.isSentPublishedEmail(), copy.isSentPublishedEmail());
    assertEquals(original.getRespondingInstructorList(), copy.getRespondingInstructorList());
    assertEquals(original.getRespondingStudentList(), copy.getRespondingStudentList());
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) Text(com.google.appengine.api.datastore.Text) Test(org.testng.annotations.Test)

Aggregations

FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)205 Test (org.testng.annotations.Test)85 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)78 ArrayList (java.util.ArrayList)47 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)35 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)32 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)30 RedirectResult (teammates.ui.controller.RedirectResult)27 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)21 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)19 StatusMessage (teammates.common.util.StatusMessage)19 HashMap (java.util.HashMap)17 InvalidParametersException (teammates.common.exception.InvalidParametersException)14 FeedbackResponsesDb (teammates.storage.api.FeedbackResponsesDb)13 EmailWrapper (teammates.common.util.EmailWrapper)12 Text (com.google.appengine.api.datastore.Text)11 DataBundle (teammates.common.datatransfer.DataBundle)11 EmailGenerator (teammates.logic.api.EmailGenerator)10 List (java.util.List)9 TaskWrapper (teammates.common.util.TaskWrapper)9