diff --git a/common/test/acceptance/pages/lms/learner_profile.py b/common/test/acceptance/pages/lms/learner_profile.py index 755655d09d..8fcfa43c76 100644 --- a/common/test/acceptance/pages/lms/learner_profile.py +++ b/common/test/acceptance/pages/lms/learner_profile.py @@ -43,7 +43,7 @@ class LearnerProfilePage(FieldsMixin, PageObject): """ Check if browser is showing correct page. """ - return 'Learner Profile' in self.browser.title + return self.q(css='body.view-profile').present @property def privacy(self): diff --git a/common/test/acceptance/tests/lms/test_learner_profile.py b/common/test/acceptance/tests/lms/test_learner_profile.py index 6c49909371..c81f910a01 100644 --- a/common/test/acceptance/tests/lms/test_learner_profile.py +++ b/common/test/acceptance/tests/lms/test_learner_profile.py @@ -51,7 +51,8 @@ class LearnerProfileTestMixin(EventsTestMixin): def visit_profile_page(self, username, privacy=None): """ - Visits a user's profile page. + 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) @@ -59,9 +60,16 @@ class LearnerProfileTestMixin(EventsTestMixin): # changing the drop down if privacy is not None: profile_page.visit() - profile_page.wait_for_page() + + # 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) @@ -71,7 +79,6 @@ class LearnerProfileTestMixin(EventsTestMixin): # Load the page profile_page.visit() - profile_page.wait_for_page() return profile_page