def test_discount_once_per_customer_percentage_redeem_url(self):
        """
        Scenario: Inactive Users - Discount Once Per Customer Percentage
        Redeem URL: URL cannot be used twice by he same user
        """
        self.coupon = Coupon(COURSE_CATALOG_TYPE['single'],
                             COUPON_TYPE['disc'],
                             VOUCHER_TYPE['once_per_cust'],
                             course_id=self.course_id,
                             seat_type=SEAT_TYPE['prof'],
                             stock_record_ids=self.stock_record_id,
                             benefit_type=BENEFIT_TYPE['per'],
                             benefit_value=BENEFIT_VALUE['per'])
        self.coupon.setup_coupons_using_api(self.course_price)
        coupon_code = self.coupon.coupon_codes[0]
        # Delete coupon after test
        self.addCleanup(self.coupon.delete_coupon)
        self.home.visit()
        self.redeem_single_course_discount_coupon(coupon_code)
        self.login_page.wait_for_page()
        self.login_page.toggle_to_registration_page()
        self.registration_page.wait_for_page()
        user_name = str(uuid.uuid4().node)
        temp_mail = user_name + "@example.com"

        self.registration_page.register_white_label_user(
            get_white_label_registration_fields(email=temp_mail,
                                                username=user_name))
        self.single_seat_basket.wait_for_page()
        self.make_payment_after_discount()
        self.assert_course_added_to_dashboard()
        redeem_coupon = RedeemCouponPage(self.browser, coupon_code).visit()
        self.assertEqual(redeem_coupon.error_message,
                         ONCE_PER_CUSTOMER_REDEEM_URL_SAME_USER_REUSE)
Ejemplo n.º 2
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_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()
Ejemplo n.º 4
0
    def test_discount_once_per_customer_percentage_redeem_url(self):
        """
        Scenario: Inactive Users - Discount Once Per Customer Percentage
        Redeem URL: URL cannot be used twice by he same user
        """
        self.coupon = Coupon(
            COURSE_CATALOG_TYPE['single'],
            COUPON_TYPE['disc'],
            VOUCHER_TYPE['once_per_cust'],
            course_id=self.course_id,
            seat_type=SEAT_TYPE['prof'],
            stock_record_ids=self.stock_record_id,
            benefit_type=BENEFIT_TYPE['per'],
            benefit_value=BENEFIT_VALUE['per']
        )
        self.coupon.setup_coupons_using_api(self.course_price)
        coupon_code = self.coupon.coupon_codes[0]
        # Delete coupon after test
        self.addCleanup(self.coupon.delete_coupon)
        self.home.visit()
        self.redeem_single_course_discount_coupon(coupon_code)
        self.login_page.wait_for_page()
        self.login_page.toggle_to_registration_page()
        self.registration_page.wait_for_page()
        user_name = str(uuid.uuid4().node)
        temp_mail = user_name + "@example.com"

        self.registration_page.register_white_label_user(
            get_white_label_registration_fields(
                email=temp_mail,
                username=user_name
            )
        )
        self.single_seat_basket.wait_for_page()
        self.make_payment_after_discount()
        self.assert_course_added_to_dashboard()
        redeem_coupon = RedeemCouponPage(self.browser, coupon_code).visit()
        self.assertEqual(
            redeem_coupon.error_message,
            ONCE_PER_CUSTOMER_REDEEM_URL_SAME_USER_REUSE
        )