Revert "ECOM-4334 Update learner dashboard"
This reverts commit caa5a0ac02.
This commit is contained in:
@@ -174,12 +174,6 @@ 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):
|
||||
"""
|
||||
|
||||
@@ -266,17 +266,21 @@ class OwnLearnerProfilePageTest(LearnerProfileTestMixin, WebAppTest):
|
||||
|
||||
def test_dashboard_learner_profile_link(self):
|
||||
"""
|
||||
Scenario: Verify that when user click on username it will leads to profile page.
|
||||
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.
|
||||
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, user_id = self.log_in_as_unique_user()
|
||||
dashboard_page = DashboardPage(self.browser)
|
||||
dashboard_page.visit()
|
||||
dashboard_page.click_username()
|
||||
dashboard_page.click_username_dropdown()
|
||||
self.assertIn('Profile', dashboard_page.username_dropdown_link_text)
|
||||
dashboard_page.click_my_profile_link()
|
||||
my_profile_page = LearnerProfilePage(self.browser, username)
|
||||
my_profile_page.wait_for_page()
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ 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
|
||||
@@ -443,7 +442,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
|
||||
})
|
||||
|
||||
|
||||
class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase, ProgramsApiConfigMixin):
|
||||
class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase):
|
||||
""" Tests for the account settings view. """
|
||||
|
||||
USERNAME = 'student'
|
||||
@@ -457,7 +456,6 @@ class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase, ProgramsApiConf
|
||||
'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):
|
||||
@@ -504,29 +502,12 @@ class AccountSettingsViewTest(ThirdPartyAuthTestMixin, TestCase, ProgramsApiConf
|
||||
|
||||
def test_view(self):
|
||||
|
||||
response = self.client.get(path=self.view_path)
|
||||
view_path = reverse('account_settings')
|
||||
response = self.client.get(path=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, '<li class="tab-nav-item">')
|
||||
|
||||
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, '<li class="item nav-global-01">')
|
||||
|
||||
|
||||
@override_settings(SITE_NAME=settings.MICROSITE_LOGISTRATION_HOSTNAME)
|
||||
class MicrositeLogistrationTests(TestCase):
|
||||
|
||||
@@ -36,7 +36,6 @@ from third_party_auth import pipeline
|
||||
from third_party_auth.decorators import xframe_allow_whitelisted
|
||||
from util.bad_request_rate_limiter import BadRequestRateLimiter
|
||||
|
||||
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
|
||||
from openedx.core.djangoapps.theming.helpers import is_request_in_themed_site, get_value as get_themed_value
|
||||
from openedx.core.djangoapps.user_api.accounts.api import request_password_change
|
||||
from openedx.core.djangoapps.user_api.errors import UserNotFound
|
||||
@@ -395,7 +394,6 @@ def account_settings_context(request):
|
||||
'user_accounts_api_url': reverse("accounts_api", kwargs={'username': user.username}),
|
||||
'user_preferences_api_url': reverse('preferences_api', kwargs={'username': user.username}),
|
||||
'disable_courseware_js': True,
|
||||
'show_program_listing': ProgramsApiConfig.current().show_program_listing,
|
||||
}
|
||||
|
||||
if third_party_auth.is_enabled():
|
||||
|
||||
@@ -6,13 +6,13 @@ from django.core.urlresolvers import reverse
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
|
||||
from openedx.core.djangoapps.programs.tests.mixins import ProgramsApiConfigMixin
|
||||
from student.tests.factories import UserFactory
|
||||
from student_profile.views import learner_profile_context
|
||||
from util.testing import UrlResetMixin
|
||||
from student.tests.factories import UserFactory
|
||||
|
||||
from student_profile.views import learner_profile_context
|
||||
|
||||
|
||||
class LearnerProfileViewTest(UrlResetMixin, TestCase, ProgramsApiConfigMixin):
|
||||
class LearnerProfileViewTest(UrlResetMixin, TestCase):
|
||||
""" Tests for the student profile view. """
|
||||
|
||||
USERNAME = "username"
|
||||
@@ -101,23 +101,3 @@ class LearnerProfileViewTest(UrlResetMixin, TestCase, ProgramsApiConfigMixin):
|
||||
profile_path = reverse('learner_profile', kwargs={'username': "no_such_user"})
|
||||
response = self.client.get(path=profile_path)
|
||||
self.assertEqual(404, response.status_code)
|
||||
|
||||
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)
|
||||
profile_path = reverse('learner_profile', kwargs={'username': self.USERNAME})
|
||||
response = self.client.get(path=profile_path)
|
||||
|
||||
self.assertContains(response, '<li class="tab-nav-item">')
|
||||
|
||||
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, '<li class="item nav-global-01">')
|
||||
|
||||
@@ -12,7 +12,6 @@ from django.contrib.staticfiles.storage import staticfiles_storage
|
||||
from badges.utils import badges_enabled
|
||||
from edxmako.shortcuts import render_to_response, marketing_link
|
||||
from microsite_configuration import microsite
|
||||
from openedx.core.djangoapps.programs.models import ProgramsApiConfig
|
||||
from openedx.core.djangoapps.user_api.accounts.api import get_account_settings
|
||||
from openedx.core.djangoapps.user_api.errors import UserNotFound, UserNotAuthorized
|
||||
from openedx.core.djangoapps.user_api.preferences.api import get_user_preferences
|
||||
@@ -96,7 +95,6 @@ def learner_profile_context(request, profile_username, user_is_staff):
|
||||
'platform_name': microsite.get_value('platform_name', settings.PLATFORM_NAME),
|
||||
},
|
||||
'disable_courseware_js': True,
|
||||
'show_program_listing': ProgramsApiConfig.current().show_program_listing,
|
||||
}
|
||||
|
||||
if badges_enabled():
|
||||
|
||||
@@ -49,21 +49,13 @@ site_status_msg = get_site_status_msg(course_id)
|
||||
</%block>
|
||||
<header id="global-navigation" class="header-global ${"slim" if course else ""}" >
|
||||
<nav class="wrapper-header" aria-label="${_('Global')}">
|
||||
<h1 class="logo">
|
||||
|
||||
<%block name="navigation_logo">
|
||||
% if user.is_authenticated():
|
||||
<a href="${reverse('dashboard')}">
|
||||
<img src="${static.url(branding_api.get_logo_url())}" alt=${_("Your Dashboard")}/>
|
||||
</a>
|
||||
% else:
|
||||
<a href="${marketing_link('ROOT')}">
|
||||
<img src="${static.url(branding_api.get_logo_url())}"
|
||||
alt="${_("{platform_name} Home Page").format(platform_name=static.get_platform_name())}"/>
|
||||
</a>
|
||||
% endif
|
||||
</%block>
|
||||
</h1>
|
||||
<h1 class="logo">
|
||||
<a href="${marketing_link('ROOT')}">
|
||||
<%block name="navigation_logo">
|
||||
<img src="${static.url(branding_api.get_logo_url())}" alt="${_("{platform_name} Home Page").format(platform_name=static.get_platform_name())}"/>
|
||||
</%block>
|
||||
</a>
|
||||
</h1>
|
||||
|
||||
% if course:
|
||||
<h2 class="course-header"><span class="provider">${course.display_org_with_default}:</span>
|
||||
|
||||
@@ -28,6 +28,8 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
|
||||
</button>
|
||||
<ul class="dropdown-menu list-divided is-hidden" id="${_("Usermenu")}" tabindex="-1">
|
||||
<%block name="navigation_dropdown_menu_links" >
|
||||
<li class="dropdown-item item has-block-link"><a href="${reverse('dashboard')}" class="action">${_("Dashboard")}</a></li>
|
||||
<li class="dropdown-item item has-block-link"><a href="${reverse('learner_profile', kwargs={'username': user.username})}" class="action">${_("Profile")}</a></li>
|
||||
<li class="dropdown-item item has-block-link"><a href="${reverse('account_settings')}" class="action">${_("Account")}</a></li>
|
||||
</%block>
|
||||
<li class="dropdown-item item has-block-link"><a href="${reverse('logout')}" role="menuitem" class="action">${_("Sign Out")}</a></li>
|
||||
@@ -36,19 +38,19 @@ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_
|
||||
% else:
|
||||
<ol class="user">
|
||||
<li class="primary">
|
||||
<a href="${reverse('learner_profile', kwargs={'username': user.username})}" class="user-link">
|
||||
<span class="sr">${_("Profile for:")}</span>
|
||||
<a href="${reverse('dashboard')}" class="user-link">
|
||||
<span class="sr">${_("Dashboard for:")}</span>
|
||||
<%
|
||||
username = user.username
|
||||
profile_image_url = get_profile_image_urls_for_user(user)['medium']
|
||||
%>
|
||||
<img class="user-image-frame" src="${profile_image_url}" alt="">
|
||||
<img class="user-image-frame" src="${profile_image_url}" alt="${_('Profile image for {username}').format(username=username)}">
|
||||
<div class="label-username">${username}</div>
|
||||
</a>
|
||||
</li>
|
||||
<li class="primary">
|
||||
<button class="dropdown" aria-haspopup="true" aria-expanded="false" title=${_("Account settings menu")}><span class="fa fa-sort-desc" aria-hidden="true"></span></button>
|
||||
<ul class="dropdown-menu" aria-label=${_("Account settings")} role="menu">
|
||||
<button class="dropdown" aria-haspopup="true" aria-expanded="false"><span class="sr">${_("More options dropdown")}</span><span class="fa fa-sort-desc" aria-hidden="true"></span></button>
|
||||
<ul class="dropdown-menu" aria-label="More Options" role="menu">
|
||||
${navigation_dropdown_menu_links()}
|
||||
<li class="item"><a href="${reverse('logout')}" role="menuitem">${_("Sign Out")}</a></li>
|
||||
</ul>
|
||||
|
||||
@@ -51,18 +51,11 @@ site_status_msg = get_site_status_msg(course_id)
|
||||
% endif
|
||||
<div class="${"rwd" if responsive else ""} wrapper-header nav-container">
|
||||
<h1 class="logo" itemscope="" itemtype="http://schema.org/Organization">
|
||||
<%block name="navigation_logo">
|
||||
% if user.is_authenticated():
|
||||
<a href="${reverse('dashboard')}">
|
||||
<img src="${static.url("images/logo.png")}" alt=${_("Your Dashboard")}/>
|
||||
</a>
|
||||
% else:
|
||||
<a href="${marketing_link('ROOT')}" itemprop="url">
|
||||
<img src="${static.url("images/logo.png")}" itemprop="logo"
|
||||
alt="${_("{platform_name} Home Page").format(platform_name=static.get_platform_name())}"/>
|
||||
</a>
|
||||
% endif
|
||||
</%block>
|
||||
<a href="${marketing_link('ROOT')}" itemprop="url">
|
||||
<%block name="navigation_logo">
|
||||
<img src="${static.url("images/logo.png")}" alt="${_("{platform_name} Home Page").format(platform_name=static.get_platform_name())}" itemprop="logo" />
|
||||
</%block>
|
||||
</a>
|
||||
</h1>
|
||||
|
||||
% if course and not disable_courseware_header:
|
||||
@@ -76,20 +69,10 @@ site_status_msg = get_site_status_msg(course_id)
|
||||
|
||||
% if user.is_authenticated():
|
||||
% if not course or disable_courseware_header:
|
||||
% if not nav_hidden or show_program_listing:
|
||||
<nav aria-label="Main" class="nav-main">
|
||||
<ul class="left list-inline nav-global authenticated">
|
||||
% if show_program_listing:
|
||||
<li class="tab-nav-item">
|
||||
<a class="${'active ' if reverse('dashboard') == request.path else ''}tab-nav-link" href="${reverse('dashboard')}">
|
||||
${_("Courses")}
|
||||
</a>
|
||||
</li>
|
||||
<li class="tab-nav-item">
|
||||
<a class="${'active ' if reverse('program_listing_view') in request.path else ''}tab-nav-link" href="${reverse('program_listing_view')}">
|
||||
${_("Programs")}
|
||||
</a>
|
||||
</li>
|
||||
% elif not nav_hidden:
|
||||
% if not nav_hidden:
|
||||
<%block name="navigation_global_links_authenticated">
|
||||
<li class="item nav-global-01">
|
||||
<a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a>
|
||||
@@ -102,8 +85,21 @@ site_status_msg = get_site_status_msg(course_id)
|
||||
</li>
|
||||
</%block>
|
||||
% endif
|
||||
% if show_program_listing:
|
||||
<li class="tab-nav-item">
|
||||
<a class="${'active ' if reverse('dashboard') == request.path else ''}tab-nav-link" href="${reverse('dashboard')}">
|
||||
${_("Courses")}
|
||||
</a>
|
||||
</li>
|
||||
<li class="tab-nav-item">
|
||||
<a class="${'active ' if reverse('program_listing_view') in request.path else ''}tab-nav-link" href="${reverse('program_listing_view')}">
|
||||
${_("Programs")}
|
||||
</a>
|
||||
</li>
|
||||
% endif
|
||||
</ul>
|
||||
</nav>
|
||||
% endif
|
||||
% endif
|
||||
|
||||
<%include file="user_dropdown.html"/>
|
||||
|
||||
Reference in New Issue
Block a user