Commit 0b66dc4b by Awais Jibran

Merge pull request #7718 from edx/aj/tnl1921-forgot-password-model-not-showing

Forgot password model not visible when user clicks 'Forgot Password' link on CMS.
parents a900e1f7 8bd09d40
...@@ -63,6 +63,30 @@ class RegisterPage(PageObject): ...@@ -63,6 +63,30 @@ class RegisterPage(PageObject):
return dashboard return dashboard
class ResetPasswordPage(PageObject):
"""Initialize the page.
Arguments:
browser (Browser): The browser instance.
"""
url = BASE_URL + "/login#forgot-password-modal"
def __init__(self, browser):
super(ResetPasswordPage, self).__init__(browser)
def is_browser_on_page(self):
return (
self.q(css="#login-anchor").is_present() and
self.q(css="#password-reset-anchor").is_present()
)
def is_form_visible(self):
return (
not self.q(css="#login-anchor").visible and
self.q(css="#password-reset-form").visible
)
class CombinedLoginAndRegisterPage(PageObject): class CombinedLoginAndRegisterPage(PageObject):
"""Interact with combined login and registration page. """Interact with combined login and registration page.
......
...@@ -30,7 +30,7 @@ from ...pages.lms.problem import ProblemPage ...@@ -30,7 +30,7 @@ from ...pages.lms.problem import ProblemPage
from ...pages.lms.video.video import VideoPage from ...pages.lms.video.video import VideoPage
from ...pages.lms.courseware import CoursewarePage from ...pages.lms.courseware import CoursewarePage
from ...pages.studio.settings import SettingsPage from ...pages.studio.settings import SettingsPage
from ...pages.lms.login_and_register import CombinedLoginAndRegisterPage from ...pages.lms.login_and_register import CombinedLoginAndRegisterPage, ResetPasswordPage
from ...pages.lms.track_selection import TrackSelectionPage from ...pages.lms.track_selection import TrackSelectionPage
from ...pages.lms.pay_and_verify import PaymentAndVerificationFlow, FakePaymentPage from ...pages.lms.pay_and_verify import PaymentAndVerificationFlow, FakePaymentPage
from ...pages.lms.course_wiki import CourseWikiPage, CourseWikiEditPage from ...pages.lms.course_wiki import CourseWikiPage, CourseWikiEditPage
...@@ -38,6 +38,26 @@ from ...fixtures.course import CourseFixture, XBlockFixtureDesc, CourseUpdateDes ...@@ -38,6 +38,26 @@ from ...fixtures.course import CourseFixture, XBlockFixtureDesc, CourseUpdateDes
@attr('shard_1') @attr('shard_1')
class ForgotPasswordPageTest(UniqueCourseTest):
"""
Test that forgot password forms is rendered if url contains 'forgot-password-modal'
in hash.
"""
def setUp(self):
""" Initialize the page object """
super(ForgotPasswordPageTest, self).setUp()
self.reset_password_page = ResetPasswordPage(self.browser)
def test_reset_password_form_visibility(self):
# Navigate to the password reset page
self.reset_password_page.visit()
# Expect that reset password form is visible on the page
self.assertTrue(self.reset_password_page.is_form_visible())
@attr('shard_1')
class LoginFromCombinedPageTest(UniqueCourseTest): class LoginFromCombinedPageTest(UniqueCourseTest):
"""Test that we can log in using the combined login/registration page. """Test that we can log in using the combined login/registration page.
......
...@@ -149,8 +149,11 @@ define([ ...@@ -149,8 +149,11 @@ define([
// Simulate a click on the reset password link // Simulate a click on the reset password link
view.resetPassword(); view.resetPassword();
// Verify that the password reset wrapper is populated // Verify that the login-anchor is hidden
expect($('#password-reset-wrapper')).not.toBeEmpty(); expect($("#login-anchor")).toHaveClass('hidden');
// Verify that the password reset form is not hidden
expect($("#password-reset-form")).not.toHaveClass('hidden');
}); });
it('enrolls the user on auth complete', function() { it('enrolls the user on auth complete', function() {
......
...@@ -82,8 +82,12 @@ var edx = edx || {}; ...@@ -82,8 +82,12 @@ var edx = edx || {};
}, },
postRender: function() { postRender: function() {
// Load the default form //get & check current url hash part & load form accordingly
this.loadForm( this.activeForm ); if (Backbone.history.getHash() === "forgot-password-modal") {
this.resetPassword();
} else {
this.loadForm(this.activeForm);
}
}, },
loadForm: function( type ) { loadForm: function( type ) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment