def test_enterprise_recovery_email(self):
     """
     Scenario: A user is able to set secondary email
     """
     self.lms_login.visit()
     # Enterprise portal flow
     self.login_to_ent_portal(
         ENT_PORTAL_USERNAME,
         ENT_PORTAL_PASSWORD)
     self.access_course()
     self.ent_edx_login.wait_for_page()
     # Register a new enterprise user
     self.register_ent_edx_user()
     self.ent_course_enrollment.wait_for_page()
     self.dashboard.visit()
     # There should be a message to add secondary email account.
     self.assertTrue(self.dashboard.is_secondary_account_message_visible(
         'Add a recovery email'
         ))
     new_password = get_random_password()
     # # Call the fixture to unlink existing account for the user
     # self.addCleanup(self.unlink_account)
     # Add secondary email address in account settings page.
     self.add_recovery_email(self.user_email)
     # Get the secondary email activation url from the email.
     recovery_email_url = self.temp_mail.get_url_from_email(
         'activate_secondary_email'
     )
     self.dashboard.visit()
     # There should be a message to activate secondary email account.
     self.assertTrue(self.dashboard.is_secondary_account_message_visible(
         'Recovery email is not activated yet'
         ))
     recovery_email_page = ConfirmRecoveryEmail(self.browser, recovery_email_url)
     recovery_email_page.visit()
     # Secondary Email Account has been activated.
     self.assertTrue(recovery_email_page.is_secondary_account_activation_complete)
     # Unlink existing account for the user and logout.
     self.unlink_account()
     # login and go to reset password page to reset the password.
     self.logout_from_lms_using_api()
     self.lms_login.visit()
     self.lms_login.send_forgot_password(self.user_email)
     self.assertTrue(
         self.lms_login.is_password_reset_email_message_visible
     )
     # Get reset password url for the email.
     reset_password_url = self.temp_mail.get_url_from_email(
         'password_reset_confirm'
     )
     # Reset password and log back in.
     reset_password = ResetPassword(self.browser, reset_password_url)
     reset_password.visit()
     reset_password.reset_password(new_password)
     self.lms_login.visit()
     self.lms_login.provide_info(self.user_email, new_password)
     self.lms_login.submit()
     self.dashboard.wait_for_page()
     self.user_account.visit()
     self.assertEqual(self.user_email, self.user_account.get_user_email())
示例#2
0
 def test_reset_password(self):  # TE-2044
     # pylint: disable=no-value-for-parameter
     # pylint: disable=no-member
     # pylint: disable=attribute-defined-outside-init
     """
     Scenario: A user is able to reset the password
     """
     temp_mail = GuerrillaMailApi()
     self.user_name = str(uuid.uuid4().node)
     self.user_email = temp_mail.get_email_account(self.user_name)
     new_password = get_random_password()
     # Got to login page and use the forgot password functionality
     self.login_page.visit()
     self.login_page.send_forgot_password(self.user_email)
     self.assertTrue(
         self.login_page.is_password_reset_email_message_visible()
     )
     reset_password_url = self.get_url_from_email(
         self.user_email,
         'password_reset_confirm'
     )
     reset_password = ResetPassword(self.browser, reset_password_url)
     reset_password.visit()
     reset_password.reset_password(new_password)
     self.reset_password_complete.go_to_login_page()
     self.login_page.authenticate_user(
         self.user_email,
         new_password,
     )
     self.dashboard.is_browser_on_page()
示例#3
0
 def test_activate_account_and_reset_password(self):
     """
     Scenario: A user is able to activate his account
     and afterwards reset the password
     """
     self.home_page.visit()
     self.home_page.click_registration_button()
     self.registration_page.wait_for_page()
     # Register a new user
     self.registration_page.register_white_label_user(
         get_white_label_registration_fields(
             email=self.temp_mail.user_email,
             username=self.temp_mail.user_name
         )
     )
     self.dashboard_page.wait_for_page()
     # There should be a message to activate the account.
     self.assertTrue(self.dashboard_page.is_activation_message_present)
     # Get the activation url from the email.
     activation_url = self.temp_mail.get_url_from_email('activate')
     activate_account_page = ActivateAccount(self.browser, activation_url)
     activate_account_page.visit()
     # Account has been activated.
     self.assertTrue(activate_account_page.is_account_activation_complete)
     # Go back to the dashboard page and assert
     #  that activation is successful.
     activate_account_page.click_dashboard_from_drop_down_menu()
     self.dashboard_page.wait_for_page()
     self.assertFalse(self.dashboard_page.is_activation_message_present)
     # logout and go to reset password page to reset the password.
     self.dashboard_page.logout_lms()
     self.home_page.wait_for_page()
     self.home_page.click_login_button()
     self.login_page.wait_for_page()
     self.login_page.send_forgot_password(self.temp_mail.user_email)
     self.assertTrue(
         self.login_page.is_password_reset_email_message_visible
     )
     # Get reset password url for the email.
     reset_password_url = self.temp_mail.get_url_from_email(
         'password_reset_confirm'
     )
     new_password = get_random_password()
     reset_password_page = ResetPassword(self.browser, reset_password_url)
     reset_password_page.visit()
     # Reset password and log back in.
     reset_password_page.reset_password(new_password)
     reset_password_complete = ResetPasswordComplete(self.browser)
     reset_password_complete.click_login_button()
     self.login_page.wait_for_page()
     self.login_page.provide_info(self.temp_mail.user_email, new_password)
     self.login_page.submit()
     self.dashboard_page.wait_for_page()
 def test_01_reset_password(self):  # TE-2044
     # pylint: disable=no-value-for-parameter
     # pylint: disable=no-member
     # pylint: disable=attribute-defined-outside-init
     """
     Scenario: A user is able to reset the password
     """
     temp_mail = GuerrillaMailApi()
     self.user_name = str(uuid.uuid4().node)
     self.user_email = temp_mail.get_email_account(self.user_name)
     new_password = str(uuid.uuid4().node)
     # Got to login page and use the forgot password functionality
     self.login_page.visit()
     self.login_page.send_forgot_password(self.user_email)
     self.assertTrue(
         self.login_page.is_password_reset_email_message_visible())
     reset_password_url = self.get_url_from_email(self.user_email,
                                                  'password_reset_confirm')
     reset_password = ResetPassword(self.browser, reset_password_url)
     reset_password.visit()
     reset_password.reset_password(new_password)
     self.reset_password_complete.go_to_login_page()
     self.login_page.authenticate_user(self.user_email, new_password,
                                       self.dashboard)
     self.dashboard.is_browser_on_page()
示例#5
0
 def test_enterprise_recovery_email(self):
     """
     Scenario: A user is able to set secondary email
     """
     self.lms_login.visit()
     # Enterprise portal flow
     self.login_to_ent_portal(ENT_PORTAL_USERNAME, ENT_PORTAL_PASSWORD)
     self.access_course()
     self.ent_edx_login.wait_for_page()
     # Register a new enterprise user
     self.register_ent_edx_user()
     self.ent_course_enrollment.wait_for_page()
     self.dashboard.visit()
     # There should be a message to add secondary email account.
     self.assertTrue(
         self.dashboard.is_secondary_account_message_visible(
             'Add a recovery email'))
     new_password = get_random_password()
     # # Call the fixture to unlink existing account for the user
     # self.addCleanup(self.unlink_account)
     # Add secondary email address in account settings page.
     self.add_recovery_email(self.user_email)
     # Get the secondary email activation url from the email.
     recovery_email_url = self.temp_mail.get_url_from_email(
         'activate_secondary_email')
     self.dashboard.visit()
     # There should be a message to activate secondary email account.
     self.assertTrue(
         self.dashboard.is_secondary_account_message_visible(
             'Recovery email is not activated yet'))
     recovery_email_page = ConfirmRecoveryEmail(self.browser,
                                                recovery_email_url)
     recovery_email_page.visit()
     # Secondary Email Account has been activated.
     self.assertTrue(
         recovery_email_page.is_secondary_account_activation_complete)
     # Unlink existing account for the user and logout.
     self.unlink_account()
     # login and go to reset password page to reset the password.
     self.logout_from_lms_using_api()
     self.lms_login.visit()
     self.lms_login.send_forgot_password(self.user_email)
     self.assertTrue(self.lms_login.is_password_reset_email_message_visible)
     # Get reset password url for the email.
     reset_password_url = self.temp_mail.get_url_from_email(
         'password_reset_confirm')
     # Reset password and log back in.
     reset_password = ResetPassword(self.browser, reset_password_url)
     reset_password.visit()
     reset_password.reset_password(new_password)
     self.lms_login.visit()
     self.lms_login.provide_info(self.user_email, new_password)
     self.lms_login.submit()
     self.dashboard.wait_for_page()
     self.user_account.visit()
     self.assertEqual(self.user_email, self.user_account.get_user_email())
 def test_activate_account_and_reset_password(self):
     """
     Scenario: A user is able to activate his account
     and afterwards reset the password
     """
     self.home_page.visit()
     self.home_page.click_registration_button()
     self.registration_page.wait_for_page()
     # Register a new user
     self.registration_page.register_white_label_user(
         get_white_label_registration_fields(
             email=self.temp_mail.user_email,
             password=PASSWORD,
             user_name=self.temp_mail.user_name))
     self.dashboard_page.wait_for_page()
     # There should be a message to activate the account.
     self.assertTrue(self.dashboard_page.is_activation_message_present)
     # Get the activation url from the email.
     activation_url = self.temp_mail.get_url_from_email('activate')
     activate_account_page = ActivateAccount(self.browser, activation_url)
     activate_account_page.visit()
     # Account has been activated.
     self.assertTrue(activate_account_page.is_account_activation_complete)
     # Go back to the dashboard page and assert
     #  that activation is successful.
     activate_account_page.click_dashboard_from_drop_down_menu()
     self.dashboard_page.wait_for_page()
     self.assertFalse(self.dashboard_page.is_activation_message_present)
     # logout and go to reset password page to reset the password.
     self.dashboard_page.logout_lms()
     self.home_page.wait_for_page()
     self.home_page.click_login_button()
     self.login_page.wait_for_page()
     self.login_page.send_forgot_password(self.temp_mail.user_email)
     self.assertTrue(
         self.login_page.is_password_reset_email_message_visible)
     # Get reset password url for the email.
     reset_password_url = self.temp_mail.get_url_from_email(
         'password_reset_confirm')
     new_password = str(uuid.uuid4().node)
     reset_password_page = ResetPassword(self.browser, reset_password_url)
     reset_password_page.visit()
     # Reset password and log back in.
     reset_password_page.reset_password(new_password)
     reset_password_complete = ResetPasswordComplete(self.browser)
     reset_password_complete.click_login_button()
     self.login_page.wait_for_page()
     self.login_page.provide_info(self.temp_mail.user_email, new_password)
     self.login_page.submit()
     self.dashboard_page.wait_for_page()