diff --git a/common/test/acceptance/pages/lms/dashboard.py b/common/test/acceptance/pages/lms/dashboard.py index 29d5ab928a..ccad73d953 100644 --- a/common/test/acceptance/pages/lms/dashboard.py +++ b/common/test/acceptance/pages/lms/dashboard.py @@ -174,6 +174,12 @@ class DashboardPage(PageObject): """ self.q(css='.dropdown').first.click() + def click_username(self): + """ + Click username. + """ + self.q(css='.label-username').first.click() + @property def username_dropdown_link_text(self): """ diff --git a/common/test/acceptance/tests/lms/test_learner_profile.py b/common/test/acceptance/tests/lms/test_learner_profile.py index 72ec3c6431..3881c06478 100644 --- a/common/test/acceptance/tests/lms/test_learner_profile.py +++ b/common/test/acceptance/tests/lms/test_learner_profile.py @@ -266,21 +266,17 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest): 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. + Scenario: Verify that when user click on username it will leads to profile 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. + And I click on username. Then I will be navigated to Profile page. """ username, user_id = self.log_in_as_unique_user() dashboard_page = DashboardPage(self.browser) dashboard_page.visit() - dashboard_page.click_username_dropdown() - self.assertIn('Profile', dashboard_page.username_dropdown_link_text) - dashboard_page.click_my_profile_link() + dashboard_page.click_username() my_profile_page = LearnerProfilePage(self.browser, username) my_profile_page.wait_for_page() diff --git a/lms/djangoapps/student_account/test/test_views.py b/lms/djangoapps/student_account/test/test_views.py index 4482d54341..3b810796bc 100644 --- a/lms/djangoapps/student_account/test/test_views.py +++ b/lms/djangoapps/student_account/test/test_views.py @@ -19,6 +19,7 @@ from django.test.utils import override_settings from django.http import HttpRequest from course_modes.models import CourseMode +from openedx.core.djangoapps.programs.tests.mixins import ProgramsApiConfigMixin from openedx.core.djangoapps.user_api.accounts.api import activate_account, create_account from openedx.core.djangoapps.user_api.accounts import EMAIL_MAX_LENGTH from openedx.core.djangolib.js_utils import dump_js_escaped_json @@ -442,7 +443,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi }) -class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase): +class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase, ProgramsApiConfigMixin): """ Tests for the account settings view. """ USERNAME = 'student' @@ -456,6 +457,7 @@ class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase): 'year_of_birth', 'preferred_language', ] + view_path = reverse('account_settings') @mock.patch("django.conf.settings.MESSAGE_STORAGE", 'django.contrib.messages.storage.cookie.CookieStorage') def setUp(self): @@ -502,12 +504,29 @@ class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase): def test_view(self): - view_path = reverse('account_settings') - response = self.client.get(path=view_path) + response = self.client.get(path=self.view_path) for attribute in self.FIELDS: self.assertIn(attribute, response.content) + def test_header_with_programs_listing_enabled(self): + """ + Verify that tabs header will be shown while program listing is enabled. + """ + self.create_programs_config(program_listing_enabled=True) + response = self.client.get(path=self.view_path) + + self.assertContains(response, '
  • ') + + def test_header_with_programs_listing_disabled(self): + """ + Verify that nav header will be shown while program listing is disabled. + """ + self.create_programs_config(program_listing_enabled=False) + response = self.client.get(path=self.view_path) + + self.assertContains(response, '
  • ') + + def test_header_with_programs_listing_disabled(self): + """ + Verify that nav header will be shown while program listing is disabled. + """ + self.create_programs_config(program_listing_enabled=False) + profile_path = reverse('learner_profile', kwargs={'username': self.USERNAME}) + response = self.client.get(path=profile_path) + + self.assertContains(response, '