Example #1
0
    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)
Example #2
0
 def testLoginToExampleHookCourseInstance(self):
     LoginPage(self.driver).loginToCourse(CourseName.HOOK)
     homePage = HomePage(self.driver, CourseName.HOOK)
     self.assertEqual(homePage.getCourseBanner(),
                      'aplus-001 My test course')
     self.assertTrue(
         LoginPage.defaultFullname in homePage.getLoggedInText())
Example #3
0
 def testLoginToTestCourseInstance(self):
     LoginPage(self.driver).loginToCourse(CourseName.APLUS)
     homePage = HomePage(self.driver, CourseName.APLUS)
     self.assertEqual(homePage.getCourseBanner(),
                      'aplus-001 My test course')
     self.assertTrue(
         LoginPage.defaultUsername in homePage.getLoggedInText())
Example #4
0
 def setup_class(cls):
     cls.utils = Utils()
     cls.steps = TestSteps()
     cls.asserts = Assertions()
     cls.login_page = LoginPage.LoginPage()
     cls.home_page = HomePage.HomePage()
     cls.config_data = cls.utils.get_config_data()
     cls.login_data = cls.utils.get_test_data("login")
     cls.driver = cls.utils.set_webdriver("chromedriver")
Example #5
0
    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)
Example #6
0
 def setup_class(cls):
     cls.steps = TestSteps()
     cls.utils = Utils()
     cls.asserts = Assertions()
     cls.driver = cls.utils.set_webdriver("chromedriver")
     cls.config_data = cls.utils.get_config_data()
     cls.checkout_data = cls.utils.get_test_data("checkout")
     cls.home_page = HomePage.HomePage()
     cls.cart_page = CartPage.CartPage()
     cls.login_page = LoginPage.LoginPage()
     cls.product_page = ProductPage.ProductPage()
Example #7
0
 def testLoginToExampleHookCourseInstance(self):
     LoginPage(self.driver).loginToCourse(CourseName.HOOK)
     homePage = HomePage(self.driver, CourseName.HOOK)
     self.assertEqual(homePage.getCourseBanner(), 'aplus-001 My test course')
     self.assertTrue(LoginPage.defaultUsername in homePage.getLoggedInText())
Example #8
0
 def testInitialScoreShouldBeZero(self):
     self.assertEqual("0 / 300", HomePage(self.driver).getMainScore())
Example #9
0
def step_impl(ctx):
    home_page = HomePage(ctx.browser)
    ctx.login_page = home_page.click_login_button()
Example #10
0
 def testLoginToTestCourseInstance(self):
     LoginPage(self.driver).loginToCourse(CourseName.APLUS)
     homePage = HomePage(self.driver, CourseName.APLUS)
     self.assertEqual(homePage.getCourseBanner(), 'aplus-001 My test course')
     self.assertTrue(LoginPage.defaultFullname in homePage.getLoggedInText())