Esempio n. 1
0
    def setUp(self):
        """
        Common setup for component tests
        """
        super(StudioLmsComponentBaseTest, self).setUp()

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

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

        self.unit_container_page = UnitPageExtended(self.browser, None)

        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.studio_course_outline.visit()
        # Delete any existing sections
        self.studio_course_outline.delete_all_sections()
Esempio n. 2
0
class StudioLmsComponentBaseTest(WebAppTest):
    """
    Base class for component tests
    """
    def setUp(self):
        """
        Common setup for component tests
        """
        super(StudioLmsComponentBaseTest, self).setUp()

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

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

        self.unit_container_page = UnitPageExtended(
            self.browser, None
        )

        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.studio_course_outline.visit()
        # Delete any existing sections
        self.studio_course_outline.delete_all_sections()
Esempio n. 3
0
    def setUp(self):
        super(TestCourseImport, self).setUp()
        login_api = StudioLoginApi()
        login_api.authenticate(self.browser)

        self.course_info = get_course_info()

        self.import_page = ImportCoursePageExtended(*self.page_args())
        self.course_outline_page = CourseOutlinePageExtended(*self.page_args())
Esempio n. 4
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()
Esempio n. 5
0
    def setUp(self):
        super(TestCourseImport, self).setUp()
        login_api = StudioLoginApi()
        login_api.authenticate(self.browser)

        self.course_info = get_course_info()

        self.import_page = ImportCoursePageExtended(*self.page_args())
        self.course_outline_page = CourseOutlinePageExtended(*self.page_args())
class TestCourseImport(WebAppTest):
    """
    Tests the Course import page
    """
    tarball_name = 'course.tar.gz'
    import_page_class = ImportCoursePageExtended
    landing_page_class = CourseOutlinePageExtended

    def setUp(self):
        super(TestCourseImport, self).setUp()
        login_api = StudioLoginApi()
        login_api.authenticate(self.browser)

        self.course_info = get_course_info()

        self.import_page = ImportCoursePageExtended(*self.page_args())
        self.course_outline_page = CourseOutlinePageExtended(*self.page_args())

    def page_args(self):
        """
        Common arguments for pages to be used in tests.
        """
        return [
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        ]

    def test_course_updated(self):
        """
        Tests that we can update(import) course using tarball.
        """
        self.import_page.visit()
        self.import_page.upload_tarball(self.tarball_name)
        self.import_page.wait_for_upload()
        self.course_outline_page.visit()
        # There's a section named
        # 'Section :754c5e889ac3489e9947ba62b916bdab' in the tarball.
        self.assertIn(
            "Section :754c5e889ac3489e9947ba62b916bdab",
            self.course_outline_page.get_section_names()
        )
Esempio n. 7
0
    def test_course_outline(self):
        """
        Verifies that the Help link for 'Learn more about content
        visibility settings' is working.
        """
        studio_login_page = StudioLogin(self.browser)
        studio_home_page = DashboardPageExtended(self.browser)
        studio_login_page.visit()
        studio_login_page.login(DEMO_COURSE_USER, DEMO_COURSE_PASSWORD)

        course_info = get_course_info()

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

        # Verification only, should be on this page after login.
        studio_home_page.wait_for_page()

        # Navigate to the course's outline page
        studio_home_page.select_course(get_course_display_name())
        studio_course_outline.wait_for_page()

        # First verify the Help link
        expected_href = EDXAPP_CMS_DOC_LINK_BASE_URL + \
            '/en/latest/developing_course/controlling_content_visibility.html'
        # Assert that help link is correct.
        assert_side_bar_help_link(
            test=self,
            page=studio_course_outline,
            href=expected_href,
            help_text='Learn more about content visibility settings',
            as_list_item=False
        )

        # If the help page is still up (see LT-53), then close it.
        if self.browser.current_url.startswith('https://edx.readthedocs.io'):
            # TODO wrap this in a try/except block or otherwise harden,
            # make sure that you now have an active window (the other one)
            # and it's the right one (i.e. Studio or LMS)
            self.browser.close()  # close only the current window
            self.browser.switch_to_window(self.browser.window_handles[0])
Esempio n. 8
0
    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()
Esempio n. 9
0
    def test_course_outline(self):
        """
        Verifies that the Help link for 'Learn more about content
        visibility settings' is working.
        """
        studio_login_page = StudioLogin(self.browser)
        studio_home_page = DashboardPageExtended(self.browser)
        studio_login_page.visit()
        studio_login_page.login(DEMO_COURSE_USER, DEMO_COURSE_PASSWORD)

        course_info = get_course_info()

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

        # Verification only, should be on this page after login.
        studio_home_page.wait_for_page()

        # Navigate to the course's outline page
        studio_home_page.select_course(get_course_display_name())
        studio_course_outline.wait_for_page()

        # First verify the Help link
        expected_href = EDXAPP_CMS_DOC_LINK_BASE_URL + \
            '/en/latest/developing_course/controlling_content_visibility.html'
        # Assert that help link is correct.
        assert_side_bar_help_link(
            test=self,
            page=studio_course_outline,
            href=expected_href,
            help_text='Learn more about content visibility settings',
            as_list_item=False)

        # If the help page is still up (see LT-53), then close it.
        if self.browser.current_url.startswith('https://edx.readthedocs.io'):
            # TODO wrap this in a try/except block or otherwise harden,
            # make sure that you now have an active window (the other one)
            # and it's the right one (i.e. Studio or LMS)
            self.browser.close()  # close only the current window
            self.browser.switch_to_window(self.browser.window_handles[0])
Esempio n. 10
0
    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()
Esempio n. 11
0
    def clean_up_function(self):
        """
        Clean up function to clean the course
        """
        super(StudioBaseTestClass, self).tearDown()
        course_info = get_course_info()

        pages_page = PagesPageExtended(self.browser, course_info['org'],
                                       course_info['number'],
                                       course_info['run'])

        course_update_page = CourseUpdatesPageExtended(self.browser,
                                                       course_info['org'],
                                                       course_info['number'],
                                                       course_info['run'])

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

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

        textbook_page = TextbookPageExtended(self.browser,
                                             self.course_info['org'],
                                             self.course_info['number'],
                                             self.course_info['run'])

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

        pages_page.visit()
        if pages_page.get_custom_page_count() > 0:
            pages_page.wait_for_the_visibility_of_new_page()
            pages_page.delete_all_pages()

        if pages_page.toggle_wiki_page_show_value() is False:
            pages_page.toggle_wiki_page_display()
            self.assertTrue(pages_page.toggle_wiki_page_show_value())

        course_update_page.visit()
        course_update_page.delete_all_course_updates()

        grading_page.visit()
        grading_page.remove_all_grades()
        grading_page.delete_all_assignment_types()

        studio_course_outline.visit()
        studio_course_outline.make_sure_only_one_section_is_present()

        textbook_page.visit()
        textbook_page.delete_all_textbooks()
Esempio n. 12
0
    def setUp(self):
        super(DashboardTest, self).setUp()

        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 = CourseHomePageExtended(
            self.browser, get_course_info()
        )
        self.dashboard_page = DashboardPageExtended(self.browser)

        self.dashboard_page.visit()
Esempio n. 13
0
    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()
Esempio n. 14
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()
Esempio n. 15
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 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()