def visit_profile_page(self, username, privacy=None):
        """
        Visit a user's profile page and if a privacy is specified and
        is different from the displayed value, then set the privacy to that value.
        """
        profile_page = LearnerProfilePage(self.browser, username)

        # Change the privacy if requested by loading the page and
        # changing the drop down
        if privacy is not None:
            profile_page.visit()

            # Change the privacy setting if it is not the desired one already
            profile_page.privacy = privacy

            # Verify the current setting is as expected
            if privacy == self.PRIVACY_PUBLIC:
                assert profile_page.privacy == 'all_users'
            else:
                assert profile_page.privacy == 'private'

            if privacy == self.PRIVACY_PUBLIC:
                self.set_public_profile_fields_data(profile_page)

        # Reset event tracking so that the tests only see events from
        # loading the profile page.
        self.start_time = datetime.now()

        # Load the page
        profile_page.visit()

        return profile_page
Exemplo n.º 2
0
    def test_dashboard_learner_profile_link(self):
        """
        Scenario: Verify that my profile link is present on dashboard page and we can navigate to correct page.

        Given that I am a registered user.
        When I go to Dashboard page.
        And I click on username dropdown.
        Then I see Profile link in the dropdown menu.
        When I click on Profile link.
        Then I will be navigated to Profile page.
        """
        username, __ = self.log_in_as_unique_user()
        dashboard_page = DashboardPage(self.browser)
        dashboard_page.visit()
        self.assertIn('Profile', dashboard_page.tabs_link_text)
        dashboard_page.click_my_profile_link()
        my_profile_page = LearnerProfilePage(self.browser, username)
        my_profile_page.wait_for_page()
Exemplo n.º 3
0
    def test_dashboard_learner_profile_link(self):
        """
        Scenario: Verify that my profile link is present on dashboard page and we can navigate to correct page.

        Given that I am a registered user.
        When I go to Dashboard page.
        And I click on username dropdown.
        Then I see Profile link in the dropdown menu.
        When I click on Profile link.
        Then I will be navigated to Profile page.
        """
        username, __ = self.log_in_as_unique_user()
        dashboard_page = DashboardPage(self.browser)
        dashboard_page.visit()
        self.assertIn('Profile', dashboard_page.tabs_link_text)
        dashboard_page.click_my_profile_link()
        my_profile_page = LearnerProfilePage(self.browser, username)
        my_profile_page.wait_for_page()
    def visit_profile_page(self, username, privacy=None):
        """
        Visit a user's profile page and if a privacy is specified and
        is different from the displayed value, then set the privacy to that value.
        """
        profile_page = LearnerProfilePage(self.browser, username)

        # Change the privacy if requested by loading the page and
        # changing the drop down
        if privacy is not None:
            profile_page.visit()

            # Change the privacy setting if it is not the desired one already
            profile_page.privacy = privacy

            # Verify the current setting is as expected
            if privacy == self.PRIVACY_PUBLIC:
                self.assertEqual(profile_page.privacy, 'all_users')
            else:
                self.assertEqual(profile_page.privacy, 'private')

            if privacy == self.PRIVACY_PUBLIC:
                self.set_public_profile_fields_data(profile_page)

        # Reset event tracking so that the tests only see events from
        # loading the profile page.
        self.start_time = datetime.now()  # pylint: disable=attribute-defined-outside-init

        # Load the page
        profile_page.visit()

        return profile_page