Forgot password model not visible when user clicks 'Forgot Password' link on CMS.
TNL-1921
This commit is contained in:
@@ -63,6 +63,30 @@ class RegisterPage(PageObject):
|
||||
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):
|
||||
"""Interact with combined login and registration page.
|
||||
|
||||
|
||||
@@ -30,13 +30,33 @@ from ...pages.lms.problem import ProblemPage
|
||||
from ...pages.lms.video.video import VideoPage
|
||||
from ...pages.lms.courseware import CoursewarePage
|
||||
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.pay_and_verify import PaymentAndVerificationFlow, FakePaymentPage
|
||||
from ...pages.lms.course_wiki import CourseWikiPage, CourseWikiEditPage
|
||||
from ...fixtures.course import CourseFixture, XBlockFixtureDesc, CourseUpdateDesc
|
||||
|
||||
|
||||
@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):
|
||||
"""Test that we can log in using the combined login/registration page.
|
||||
|
||||
@@ -149,8 +149,11 @@ define([
|
||||
// Simulate a click on the reset password link
|
||||
view.resetPassword();
|
||||
|
||||
// Verify that the password reset wrapper is populated
|
||||
expect($('#password-reset-wrapper')).not.toBeEmpty();
|
||||
// Verify that the login-anchor is hidden
|
||||
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() {
|
||||
|
||||
@@ -82,8 +82,12 @@ var edx = edx || {};
|
||||
},
|
||||
|
||||
postRender: function() {
|
||||
// Load the default form
|
||||
this.loadForm( this.activeForm );
|
||||
//get & check current url hash part & load form accordingly
|
||||
if (Backbone.history.getHash() === "forgot-password-modal") {
|
||||
this.resetPassword();
|
||||
} else {
|
||||
this.loadForm(this.activeForm);
|
||||
}
|
||||
},
|
||||
|
||||
loadForm: function( type ) {
|
||||
|
||||
Reference in New Issue
Block a user