def testStudentShouldGetFeedbackWithNotification(self): ASSISTANT_FEEDBACK_TEXT = "ASSISTANT_FEEDBACK" FEEDBACK_TEXT = "FEEDBACK" EXERCISE_NUMBER = "2" SUBMISSION_NUMBER = 1 POINTS = "50" # Submit exercise LoginPage(self.driver).loginAsStudent() fileUploadGrader = FileUploadGrader(self.driver) fileUploadGrader.submit() fileUploadGrader.logout() # Check submissions LoginPage(self.driver).loginAsAssistant() submissionPage = SubmissionPage(self.driver, exerciseId=EXERCISE_NUMBER) self.assertEqual(submissionPage.getSubmissionCount(), 1) # Assess exercise assessmentPage = AssessmentPage(self.driver, exerciseId=EXERCISE_NUMBER, submissionNumber=SUBMISSION_NUMBER) assessmentPage.setAssistantFeedback(ASSISTANT_FEEDBACK_TEXT) assessmentPage.setFeedback(FEEDBACK_TEXT) assessmentPage.setPoints(POINTS) assessmentPage.submit() assessmentPage.logout() # Check that student receives the correct assessment and a notification of it LoginPage(self.driver).loginAsStudent() homePage = HomePage(self.driver) self.assertTrue(homePage.hasNewNotifications()) studentFeedbackPage = StudentFeedbackPage(self.driver, exerciseId=EXERCISE_NUMBER, submissionNumber=SUBMISSION_NUMBER) self.assertEqual(studentFeedbackPage.getAssistantFeedbackText(), ASSISTANT_FEEDBACK_TEXT) self.assertEqual(studentFeedbackPage.getFeedbackText(), FEEDBACK_TEXT) self.assertEqual(FileUploadGrader(self.driver).getPoints(), POINTS)
def testShouldGiveZeroPointsOnEmptySubmit(self): fileUploadPage = FileUploadGrader(self.driver) fileUploadPage.submit() # Submit without files will be in error state and not counted. self.assertEqual(fileUploadPage.getAllowedSubmissions(), '0 / 10') self.assertEqual(fileUploadPage.getExerciseScore(), '0 / 100') self.assertEqual(fileUploadPage.getNumberOfSubmitters(), '1')
def testStudentShouldGetFeedbackWithNotification(self) -> None: ASSISTANT_FEEDBACK_TEXT = "ASSISTANT_FEEDBACK" FEEDBACK_TEXT = "FEEDBACK" EXERCISE_NUMBER = "2" SUBMISSION_NUMBER = 1 POINTS = "50" # Submit exercise LoginPage(self.driver).loginAsStudent() fileUploadGrader = FileUploadGrader(self.driver) fileUploadGrader.submit() fileUploadGrader.logout() # Check submissions LoginPage(self.driver).loginAsAssistant() submissionPage = SubmissionPage(self.driver, exerciseId=EXERCISE_NUMBER) self.assertEqual(submissionPage.getSubmissionCount(), 1) # Assess exercise inspectionPage = InspectionPage(self.driver, exerciseId=EXERCISE_NUMBER, submissionNumber=SUBMISSION_NUMBER) inspectionPage.clickAssessmentButton() inspectionPage.setAssistantFeedback(ASSISTANT_FEEDBACK_TEXT) inspectionPage.clickGraderFeedbackToggle() inspectionPage.setFeedback(FEEDBACK_TEXT) inspectionPage.setPoints(POINTS) inspectionPage.submit() inspectionPage.logout() # Check that student receives the correct assessment and a notification of it LoginPage(self.driver).loginAsStudent() homePage = HomePage(self.driver) self.assertTrue(homePage.hasNewNotifications()) studentFeedbackPage = StudentFeedbackPage( self.driver, exerciseId=EXERCISE_NUMBER, submissionNumber=SUBMISSION_NUMBER) self.assertEqual(studentFeedbackPage.getAssistantFeedbackText(), ASSISTANT_FEEDBACK_TEXT) self.assertEqual(studentFeedbackPage.getFeedbackText(), FEEDBACK_TEXT) self.assertEqual(FileUploadGrader(self.driver).getPoints(), POINTS)