Beispiel #1
0
class DashboardTest(WebAppTest):
    """
    Regression tests on LMS Dashboard
    """
    def setUp(self):
        super(DashboardTest, self).setUp()

        studio_login = StudioLoginApi()
        studio_login.authenticate(self.browser)

        lms_login = LmsLoginApi()
        lms_login.authenticate(self.browser)

        self.studio_home_page = DashboardPageExtended(self.browser)
        self.course_info = get_course_info()
        self.studio_course_outline = CourseOutlinePageExtended(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])
        self.lms_courseware = CoursewarePageExtended(
            self.browser, get_course_key(self.course_info))
        self.course_page = CourseInfoPageExtended(self.browser,
                                                  get_course_info())
        self.dashboard_page = DashboardPageExtended(self.browser)
        self.drupal_course_page = DemoCourseSelectionPage(self.browser)
        self.payment_page = PaymentPage(self.browser)

        self.dashboard_page.visit()

    @skipIf(LMS_BASE_URL != LMS_STAGE_BASE_URL,
            'There is no resume button on sandbox')  # LT-60
    def test_resume_course(self):
        """
        Verifies that user can successfully resume the course
        """
        # Delete any existing sections
        self.studio_course_outline.visit()
        self.studio_course_outline.delete_all_sections()

        # Pre Reqs
        section_name = 'Section :{}'.format(uuid4().hex)
        self.studio_course_outline.add_section_with_name(section_name)
        self.assertIn(
            section_name,
            self.studio_course_outline.q(css='.incontext-editor-value').text)

        subsection_name = 'Subsection :{}'.format(uuid4().hex)
        self.studio_course_outline.add_subsection_with_name(subsection_name)
        self.assertIn(
            subsection_name,
            self.studio_course_outline.q(css='.incontext-editor-value').text)
        # Test
        self.dashboard_page.visit()
        self.dashboard_page.select_course(get_course_display_name())
        self.course_page.wait_for_page()
        self.course_page.click_resume_button()
        self.lms_courseware.wait_for_page()
Beispiel #2
0
class StudioGradingTest(WebAppTest):
    """
    Test studio grading
    """
    def setUp(self):
        """
        Initialize the page object
        """
        super(StudioGradingTest, self).setUp()

        login_api = StudioLoginApi()
        login_api.authenticate(self.browser)

        self.course_info = get_course_info()
        self.grading_page = GradingPageExtended(self.browser,
                                                self.course_info['org'],
                                                self.course_info['number'],
                                                self.course_info['run'])

        self.studio_course_outline = CourseOutlinePageExtended(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])

        self.grading_page.visit()

    def atest_grade_range(self):
        """
        Verifies default, addition and deletion of grade range
        """
        # Delete any existing grades
        self.grading_page.remove_all_grades()

        # Default
        self.assertEquals(self.grading_page.letter_grade('.letter-grade'),
                          'Pass')
        # Addition
        self.grading_page.add_new_grade()
        self.assertEquals(self.grading_page.letter_grade('.letter-grade'), 'A')
        # Verify that after revisiting, changes remain intact
        self.grading_page.visit()
        self.assertEquals(self.grading_page.letter_grade('.letter-grade'), 'A')
        # Deletion
        self.grading_page.remove_grade()
        self.assertEquals(self.grading_page.letter_grade('.letter-grade'),
                          'Pass')
        # Verify that after revisiting, changes remain intact
        self.grading_page.visit()
        self.assertEquals(self.grading_page.letter_grade('.letter-grade'),
                          'Pass')

    def atest_assignment_types(self):
        """
        Verifies that user can add/delete assignment types
        """
        # Delete any existing assignment types
        self.grading_page.delete_all_assignment_types()

        self.grading_page.add_new_assignment_type()
        self.grading_page.fill_assignment_type_fields(name='Final',
                                                      abbreviation='Finale',
                                                      total_grade='100',
                                                      total_number='2',
                                                      drop='1')
        self.assertEquals(self.grading_page.assignment_name_field_value(),
                          ['Final'])

        # Navigating to course outline page to see if the added assignment
        # is available to use on subsections
        self.studio_course_outline.visit()

        section_name = 'Section :{}'.format(uuid4().hex)
        self.studio_course_outline.add_section_with_name(section_name)
        self.assertIn(
            section_name,
            self.studio_course_outline.q(css='.incontext-editor-value').text)

        subsection_name = 'Subsection :{}'.format(uuid4().hex)
        self.studio_course_outline.add_subsection_with_name(subsection_name)
        self.assertIn(
            subsection_name,
            self.studio_course_outline.q(css='.incontext-editor-value').text)

        self.studio_course_outline.open_subsection_settings_dialog()
        self.assertIn('Final',
                      self.studio_course_outline.get_subsection_grade())

        # Delete added section
        self.studio_course_outline.cancel_subsection_settings()
        self.studio_course_outline.delete_section()
        # Delete added assignment type
        self.grading_page.visit()
        self.grading_page.delete_assignment_type()
class StudioGradingTest(WebAppTest):
    """
    Test studio grading
    """
    def setUp(self):
        """
        Initialize the page object
        """
        super(StudioGradingTest, self).setUp()

        login_api = StudioLoginApi()
        login_api.authenticate(self.browser)

        self.course_info = get_course_info()
        self.grading_page = GradingPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run'])

        self.studio_course_outline = CourseOutlinePageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run'])

        self.grading_page.visit()

    def test_grade_range(self):
        """
        Verifies default, addition and deletion of grade range
        """
        # Delete any existing grades
        self.grading_page.remove_all_grades()

        # Default
        self.assertEquals(
            self.grading_page.letter_grade('.letter-grade'), 'Pass')
        # Addition
        self.grading_page.add_new_grade()
        self.assertEquals(self.grading_page.letter_grade('.letter-grade'), 'A')
        # Verify that after revisiting, changes remain intact
        self.grading_page.visit()
        self.assertEquals(self.grading_page.letter_grade('.letter-grade'), 'A')
        # Deletion
        self.grading_page.remove_grade()
        self.assertEquals(
            self.grading_page.letter_grade('.letter-grade'), 'Pass')
        # Verify that after revisiting, changes remain intact
        self.grading_page.visit()
        self.assertEquals(
            self.grading_page.letter_grade('.letter-grade'), 'Pass')

    def test_assignment_types(self):
        """
        Verifies that user can add/delete assignment types
        """
        # Delete any existing assignment types
        self.grading_page.delete_all_assignment_types()

        self.grading_page.add_new_assignment_type()
        self.grading_page.fill_assignment_type_fields(
            name='Final',
            abbreviation='Finale',
            total_grade='100',
            total_number='2',
            drop='1'
        )
        self.assertEquals(
            self.grading_page.assignment_name_field_value(), ['Final'])

        # Navigating to course outline page to see if the added assignment
        # is available to use on subsections
        self.studio_course_outline.visit()

        section_name = 'Section :{}'.format(uuid4().hex)
        self.studio_course_outline.add_section_with_name(section_name)
        self.assertIn(
            section_name,
            self.studio_course_outline.q(
                css='.incontext-editor-value').text
        )

        subsection_name = 'Subsection :{}'.format(uuid4().hex)
        self.studio_course_outline.add_subsection_with_name(
            subsection_name)
        self.assertIn(
            subsection_name,
            self.studio_course_outline.q(
                css='.incontext-editor-value').text
        )

        self.studio_course_outline.open_subsection_settings_dialog()
        self.assertIn(
            'Final',
            self.studio_course_outline.get_subsection_grade()
        )

        # Delete added section
        self.studio_course_outline.cancel_subsection_settings()
        self.studio_course_outline.delete_section()
        # Delete added assignment type
        self.grading_page.visit()
        self.grading_page.delete_assignment_type()