class ScheduleAndDetailsLinks(WebAppTest):
    """
    Tests for Studio's Setting page links.
    """
    def setUp(self):
        super(ScheduleAndDetailsLinks, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )

        self.grading_page = GradingPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.group_configuration = GroupConfigurationsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.advanced_settings = AdvancedSettingsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.course_team_page = UsersPageMixin(self.browser)

    def test_other_links_crud(self):
        """
        Verifies that user can click and navigate to other links
        Grading: Grading page
        Course team: Course team page
        Group configuration: Group configuration page
        Advanced settings: Advanced settings page
        """
        name_page_dict = {
            'Grading': self.grading_page,
            'Course Team': self.course_team_page,
            'Group Configurations': self.group_configuration,
            'Advanced Settings': self.advanced_settings
        }

        for name, landing_page in name_page_dict.iteritems():
            self.settings_page.visit()
            self.settings_page.click_other_settings_links(name)
            landing_page.wait_for_page()
    def test_course_outline(self):
        """
        Verifies that user can click Edit Start Date button and is navigated
        to Schedule and Details page, and 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'])

        schedule_page = SettingsPageExtended(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 = 'https://edx.readthedocs.io/projects/' \
                        'edx-partner-course-staff/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])

        # Now do the verification for the edit start date button.
        studio_course_outline.click_edit_start_date_button()

        # This wait_for_page will also assert that we are on the correct page.
        schedule_page.wait_for_page()
    def setUp(self):
        super(ScheduleAndDetailsTest, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(self.browser,
                                                  self.course_info['org'],
                                                  self.course_info['number'],
                                                  self.course_info['run'])
        self.settings_page.visit()
class ScheduleAndDetailsLinks(WebAppTest):
    """
    Tests for Studio's Setting page links.
    """
    def setUp(self):
        super(ScheduleAndDetailsLinks, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(self.browser,
                                                  self.course_info['org'],
                                                  self.course_info['number'],
                                                  self.course_info['run'])

        self.grading_page = GradingPageExtended(self.browser,
                                                self.course_info['org'],
                                                self.course_info['number'],
                                                self.course_info['run'])
        self.group_configuration = GroupConfigurationsPage(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])
        self.advanced_settings = AdvancedSettingsPage(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])
        self.course_team_page = UsersPageMixin(self.browser)

    def test_other_links_crud(self):
        """
        Verifies that user can click and navigate to other links
        Grading: Grading page
        Course team: Course team page
        Group configuration: Group configuration page
        Advanced settings: Advanced settings page
        """
        name_page_dict = {
            'Grading': self.grading_page,
            'Course Team': self.course_team_page,
            'Group Configurations': self.group_configuration,
            'Advanced Settings': self.advanced_settings
        }

        for name, landing_page in name_page_dict.iteritems():
            self.settings_page.visit()
            self.settings_page.click_other_settings_links(name)
            landing_page.wait_for_page()
    def setUp(self):
        super(ScheduleAndDetailsLinks, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )

        self.grading_page = GradingPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.group_configuration = GroupConfigurationsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.advanced_settings = AdvancedSettingsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.course_team_page = UsersPageMixin(self.browser)
Esempio n. 6
0
class ScheduleAndDetailsTest(WebAppTest):
    """
    Tests for Studio's Setting page.
    """
    def setUp(self):
        super(ScheduleAndDetailsTest, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(self.browser,
                                                  self.course_info['org'],
                                                  self.course_info['number'],
                                                  self.course_info['run'])
        self.settings_page.visit()
    def setUp(self):
        super(ScheduleAndDetailsLinks, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(self.browser,
                                                  self.course_info['org'],
                                                  self.course_info['number'],
                                                  self.course_info['run'])

        self.grading_page = GradingPageExtended(self.browser,
                                                self.course_info['org'],
                                                self.course_info['number'],
                                                self.course_info['run'])
        self.group_configuration = GroupConfigurationsPage(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])
        self.advanced_settings = AdvancedSettingsPage(
            self.browser, self.course_info['org'], self.course_info['number'],
            self.course_info['run'])
        self.course_team_page = UsersPageMixin(self.browser)
    def setUp(self):
        super(ScheduleAndDetailsTest, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.settings_page.visit()
class ScheduleAndDetailsTest(WebAppTest):
    """
    Tests for Studio's Setting page.
    """
    def setUp(self):
        super(ScheduleAndDetailsTest, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(self.browser,
                                                  self.course_info['org'],
                                                  self.course_info['number'],
                                                  self.course_info['run'])
        self.settings_page.visit()

    def test_file_format(self):
        """
        Scenario: Upload course image of a wrong format.

        Given that I am on the Settings page of the course.
        And I click on 'Upload course card image'
        And I upload the image with wrong format.
        Then I should see upload error
        And path in course image input box should not have
        changed.
        """
        # Get current course image.
        current_file = self.settings_page.get_element(
            '.wrapper-input input').get_attribute('value')
        # Upload the image with wrong format.
        self.settings_page.upload_course_image('README.rst')
        # Assert that error is shown
        self.settings_page.wait_for_element_visibility(
            '.message.message-status.error.is-shown', 'Error is shown')
        self.assertEqual(
            get_text(self.settings_page,
                     '.message.message-status.error.is-shown'),
            'Only JPEG or PNG files can be uploaded. '
            'Please select a file ending in .jpeg or .png to upload.')
        self.settings_page.cancel_upload()
        # Assert that file path is unchanged.
        self.assertEqual(
            current_file,
            self.settings_page.get_element(
                '.wrapper-input input').get_attribute('value'))

    def test_cancel_upload(self):
        """
        Scenario: Upload a new course card image but cancel afterwards.

        Given that I am on the Settings page of the course.
        And I click on 'Upload course card image'
        And I upload the image
        And I cancel the image upload.
        And path in course image input box should not have
        changed.
        """
        # Get current course image.
        current_file = self.settings_page.get_element(
            '.wrapper-input input').get_attribute('value')
        self.settings_page.visit()
        # Upload the image.
        self.settings_page.upload_course_image('1.png')
        # Cancel the upload
        self.settings_page.cancel_upload()
        # Course card image should be the same as before.
        self.assertEqual(
            current_file,
            self.settings_page.get_element(
                '.wrapper-input input').get_attribute('value'))
class ScheduleAndDetailsLinks(WebAppTest):
    """
    Tests for Studio's Setting page links.
    """
    def setUp(self):
        super(ScheduleAndDetailsLinks, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.settings_page.visit()

    def test_other_grading_link(self):
        """
        Verifies that user can click and navigate to Grading
        """
        name = 'Grading'
        grading_page = GradingPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run'])
        self.settings_page.click_other_settings_links(name)
        grading_page.wait_for_page()

    def test_other_course_team_link(self):
        """
        Verifies that user can click and navigate to Course Team
        """
        name = 'Course Team'
        course_team_page = UsersPageMixin(self.browser)
        self.settings_page.click_other_settings_links(name)
        course_team_page.wait_for_page()

    def test_other_group_configuration_link(self):
        """
        Verifies that user can click and navigate to Group Configuration
        """
        name = 'Group Configurations'
        group_configuration = GroupConfigurationsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run'])
        self.settings_page.click_other_settings_links(name)
        group_configuration.wait_for_page()

    def test_other_advanced_settings_link(self):
        """
        Verifies that user can click and navigate to Advanced Settings
        """
        name = 'Advanced Settings'
        advanced_settings = AdvancedSettingsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run'])
        self.settings_page.click_other_settings_links(name)
        advanced_settings.wait_for_page()
class ScheduleAndDetailsTest(WebAppTest):
    """
    Tests for Studio's Setting page.
    """
    def setUp(self):
        super(ScheduleAndDetailsTest, self).setUp()

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

        self.course_info = get_course_info()

        self.settings_page = SettingsPageExtended(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )
        self.settings_page.visit()

    def test_file_format(self):
        """
        Scenario: Upload course image of a wrong format.

        Given that I am on the Settings page of the course.
        And I click on 'Upload course card image'
        And I upload the image with wrong format.
        Then I should see upload error
        And path in course image input box should not have
        changed.
        """
        # Get current course image.
        current_file = self.settings_page.get_element(
            '.wrapper-input input'
        ).get_attribute('value')
        # Upload the image with wrong format.
        self.settings_page.upload_course_image('README.rst')
        # Assert that error is shown
        self.settings_page.wait_for_element_visibility(
            '.message.message-status.error.is-shown',
            'Error is shown'
        )
        self.assertEqual(
            get_text(
                self.settings_page,
                '.message.message-status.error.is-shown'
            ),
            'Only JPEG or PNG files can be uploaded. '
            'Please select a file ending in .jpeg or .png to upload.'
        )
        self.settings_page.cancel_upload()
        # Assert that file path is unchanged.
        self.assertEqual(
            current_file,
            self.settings_page.get_element(
                '.wrapper-input input'
            ).get_attribute('value')
        )

    def test_cancel_upload(self):
        """
        Scenario: Upload a new course card image but cancel afterwards.

        Given that I am on the Settings page of the course.
        And I click on 'Upload course card image'
        And I upload the image
        And I cancel the image upload.
        And path in course image input box should not have
        changed.
        """
        # Get current course image.
        current_file = self.settings_page.get_element(
            '.wrapper-input input'
        ).get_attribute('value')
        self.settings_page.visit()
        # Upload the image.
        self.settings_page.upload_course_image('1.png')
        # Cancel the upload
        self.settings_page.cancel_upload()
        # Course card image should be the same as before.
        self.assertEqual(
            current_file,
            self.settings_page.get_element(
                '.wrapper-input input'
            ).get_attribute('value'))