Ejemplo n.º 1
0
 def setUp(self):
     self.test_case_info = TestCaseInfo(id=1,
                                        name="Test New User Certificate",
                                        author='Automation',
                                        result='Failed',
                                        start_time=cc.get_current_time())
     self.test_report = TestReport(self.test_case_info)
     self.logger = LogUtility()
     self.logger.create_logger_file('Test_New_User_Certificate')
Ejemplo n.º 2
0
 def setUp(self):
     self.test_case_info = TestCaseInfo(id=7,
                                        name="Test Bind",
                                        author='Automation',
                                        result='Failed',
                                        start_time=cc.get_current_time())
     self.test_report = TestReport(self.test_case_info)
     self.logger = LogUtility()
     self.logger.create_logger_file('Test_Bind')
Ejemplo n.º 3
0
    def test_bind_card(self):
        try:
            # Step1: 登录
            chargeAndWithdrawBankCardPage = ChargeAndWithdrawBankCardPage()
            chargeAndWithdrawBankCardPage.open(Constant.LoginURL)
            chargeAndWithdrawBankCardPage.login(Constant.NewUser,
                                                Constant.Password)

            # Step2:在银行卡管理页面绑卡
            chargeAndWithdrawBankCardPage.click_my_account()
            chargeAndWithdrawBankCardPage.click_bank_card_manage_on_left_panel(
            )
            # chargeAndWithdrawBankCardPage.click_add_bank_card()
            print('开始绑定银行卡......')
            # 填写储蓄卡卡号
            bankCardNum = Constant.CardNumber + str(
                random.randint(10000000000000, 99999999999999))
            chargeAndWithdrawBankCardPage.enter_bank_card(bankCardNum)
            chargeAndWithdrawBankCardPage.click_outside()
            self.assertTrue(
                chargeAndWithdrawBankCardPage.get_bank_type() == "中国邮储银行")
            chargeAndWithdrawBankCardPage.select_province(Constant.Province)
            chargeAndWithdrawBankCardPage.select_city(Constant.City)
            chargeAndWithdrawBankCardPage.enter_phone_bank(
                Constant.MobileInBank)
            # 获取验证码并填写
            clear_logcat()
            chargeAndWithdrawBankCardPage.click_get_valid_code_in_bind_card()
            smsCode = getsmscode()
            chargeAndWithdrawBankCardPage.enter_valid_code_in_bind_card(
                smsCode)
            chargeAndWithdrawBankCardPage.click_bank_card_submit_button()
            self.assertTrue(
                chargeAndWithdrawBankCardPage.get_current_url().__contains__(
                    "bind-success"))
            print('绑定银行卡完成......')

            # All case is passed
            self.test_case_info.result = "Pass"

        except Exception as err:
            self.test_case_info.error_info = str(err)
            self.logger.log(("Got error: " + str(err)))
        finally:
            self.test_case_info.end_time = cc.get_current_time()
            self.test_case_info.seconds_duration = cc.time_diff(
                self.test_case_info.start_time, self.test_case_info.end_time)
            chargeAndWithdrawBankCardPage.close_driver()
Ejemplo n.º 4
0
    def test_withdraw(self):
        try:
            # Step1: 登录
            chargeWithdrawBankCardPage = ChargeAndWithdrawBankCardPage()
            chargeWithdrawBankCardPage.open(Constant.LoginURL)
            chargeWithdrawBankCardPage.login(Constant.UserName,
                                             Constant.Password)

            # Step2: 提现前去我的账户页面查看可用余额
            chargeWithdrawBankCardPage.click_my_account_on_left_panel()
            balanceInAccount = chargeWithdrawBankCardPage.get_balance_in_account(
            )

            # Step3: 提现
            chargeWithdrawBankCardPage.click_withdraw_in_account()
            chargeWithdrawBankCardPage.send_charge_withdraw_amount(100)
            chargeWithdrawBankCardPage.click_submit_withdraw()
            #测试点:温馨提示弹框出现
            self.assertTrue(chargeWithdrawBankCardPage.is_auto_pop_show())
            chargeWithdrawBankCardPage.click_submit_withdraw()
            chargeWithdrawBankCardPage.enter_pay_password_in_withdraw(
                Constant.Password)
            chargeWithdrawBankCardPage.click_success_withdraw_button()

            # Step4: 提现后去我的账户页面查看可用余额
            chargeWithdrawBankCardPage.click_my_account_on_left_panel()
            currentBalanceInAccount = chargeWithdrawBankCardPage.get_balance_in_account(
            )

            #校验提现前后的可用余额
            self.assertEqual(balanceInAccount.__add__(-100.00),
                             currentBalanceInAccount)

            # All case is passed
            self.test_case_info.result = "Pass"

        except Exception as err:
            self.test_case_info.error_info = str(err)
            self.logger.log(("Got error: " + str(err)))
        finally:
            self.test_case_info.end_time = cc.get_current_time()
            self.test_case_info.seconds_duration = cc.time_diff(
                self.test_case_info.start_time, self.test_case_info.end_time)
            chargeWithdrawBankCardPage.close_driver()
Ejemplo n.º 5
0
    def test_charge(self):
        try:
            # Step1: 登录
            chargeAndWithdrawBankCardPage = ChargeAndWithdrawBankCardPage()
            chargeAndWithdrawBankCardPage.open(Constant.LoginURL)
            chargeAndWithdrawBankCardPage.login(Constant.UserName,
                                                Constant.Password)

            # Step2: 充值前去我的账户页面查看可用余额
            chargeAndWithdrawBankCardPage.click_my_account_on_left_panel()
            balanceInAccount = chargeAndWithdrawBankCardPage.get_balance_in_account(
            )

            # Step3: 充值 - 网银
            chargeAndWithdrawBankCardPage.click_charge_in_account()
            chargeAndWithdrawBankCardPage.send_charge_withdraw_amount(1800)
            chargeAndWithdrawBankCardPage.click_submit_charge()
            chargeAndWithdrawBankCardPage.click_online_pay_button()
            chargeAndWithdrawBankCardPage.click_go_pay_online()
            chargeAndWithdrawBankCardPage.close_driver()
            chargeAndWithdrawBankCardPage.switch_to_window('Insert')
            chargeAndWithdrawBankCardPage.click_attestation_success()
            chargeAndWithdrawBankCardPage.accept_alert()

            # Step4: 充值后去我的账户页面查看可用余额
            chargeAndWithdrawBankCardPage.click_my_account_on_left_panel()
            currentBalanceInAccount = chargeAndWithdrawBankCardPage.get_balance_in_account(
            )

            #校验充值前后的可用余额
            self.assertEqual(balanceInAccount.__add__(1800.00),
                             currentBalanceInAccount)

            # All case is passed
            self.test_case_info.result = "Pass"

        except Exception as err:
            self.test_case_info.error_info = str(err)
            self.logger.log(("Got error: " + str(err)))
        finally:
            self.test_case_info.end_time = cc.get_current_time()
            self.test_case_info.seconds_duration = cc.time_diff(
                self.test_case_info.start_time, self.test_case_info.end_time)
            chargeAndWithdrawBankCardPage.close_driver()
Ejemplo n.º 6
0
    def test_unbind_card(self):
        try:
            # Step1: 登录
            chargeAndWithdrawBankCardPage = ChargeAndWithdrawBankCardPage()
            chargeAndWithdrawBankCardPage.open(Constant.LoginURL)
            chargeAndWithdrawBankCardPage.login(Constant.UserName,
                                                Constant.Password)

            # Step2:到我的账户查看可用余额
            chargeAndWithdrawBankCardPage.click_my_account()
            balance = chargeAndWithdrawBankCardPage.get_balance_in_account()

            # Step3: 在银行卡管理页面解绑卡
            chargeAndWithdrawBankCardPage.click_bank_card_manage_on_left_panel(
            )
            chargeAndWithdrawBankCardPage.click_unbind_button()

            #如果账户的余额不为0,需要先全部提现再解绑卡
            if balance.__ge__(0.0):
                chargeAndWithdrawBankCardPage.click_withdraw_button_in_pop()
                self.assertTrue(chargeAndWithdrawBankCardPage.get_current_url(
                ).__contains__("withdraw"))
                chargeAndWithdrawBankCardPage.click_submit_withdraw_unbind()
                chargeAndWithdrawBankCardPage.enter_pay_password_in_withdraw(
                    Constant.Password)
                chargeAndWithdrawBankCardPage.click_success_withdraw_button()
                chargeAndWithdrawBankCardPage.click_unbind_button()
            else:
                #如果账户的余额为0,直接解绑成功
                self.assertFalse(
                    chargeAndWithdrawBankCardPage.is_bind_bank_card())

            # All case is passed
            self.test_case_info.result = "Pass"

        except Exception as err:
            self.test_case_info.error_info = str(err)
            self.logger.log(("Got error: " + str(err)))
        finally:
            self.test_case_info.end_time = cc.get_current_time()
            self.test_case_info.seconds_duration = cc.time_diff(
                self.test_case_info.start_time, self.test_case_info.end_time)
            chargeAndWithdrawBankCardPage.close_driver()
Ejemplo n.º 7
0
    def test_login(self):
        try:
            #Step1: open base site
            basePage = BasePage()
            basePage.open(Constant.LoginURL)

            # Step2: Enter username & password
            basePage.login(Constant.UserName, Constant.Password)

            # Checkpoint1: Check login frame title
            text = basePage.get_login_status()
            self.assertTrue(text, "我的账户")

            # All case is passed
            self.test_case_info.result = "Pass"

        except Exception as err:
            self.test_case_info.error_info = str(err)
            self.logger.log(("Got error: "+str(err)))
        finally:
            self.test_case_info.end_time = cc.get_current_time()
            self.test_case_info.seconds_duration = cc.time_diff(self.test_case_info.start_time, self.test_case_info.end_time)
            basePage.close_driver()
Ejemplo n.º 8
0
    def test_registerRealNameBindCardSetPassword(self):
        '''
            注册前操作步骤:
                1.查询测试用户[mobile]是否存在[wb_users表]
                2.查询测试用户[user_id]信息是否存在[wb_users_info表]
                3.删除测试用户信息[wb_users_info表]
                4.删除测试用户[wb_users表]
         '''
        # Step1: 注册
        queryUsers = session.query(Users)
        users = queryUsers.filter(Users.mobile == Constant.NewUser).scalar()
        if users is not None:
            queryUsersInfo = session.query(UsersInfo)
            usersInfo = queryUsersInfo.filter(
                UsersInfo.user_id == users.id).scalar()
            if usersInfo is not None:
                session.delete(usersInfo)
                session.flush()
            session.delete(users)
            session.flush()
            session.commit()
        else:
            print('开始注册......')
        newUserCertificationPage = NewUserCertificationPage()
        newUserCertificationPage.open(Constant.RegisterURL)
        newUserCertificationPage.new_user_register(Constant.NewUser,
                                                   Constant.Password)
        print('注册中......')
        #check point: 注册成功后的链接正确
        self.assertTrue(
            newUserCertificationPage.get_current_url().__contains__(
                "realname-auth/1"))
        print('注册完成......')
        #进到我的账户页面去实名认证
        newUserCertificationPage.click_my_account()

        # Step2: 实名认证
        print('开始实名认证......')
        newUserCertificationPage.click_realname_button()
        newUserCertificationPage.enter_realname(Constant.Realname)
        idCard = get_id_card()
        newUserCertificationPage.enter_id_card(idCard)
        newUserCertificationPage.click_realname_cert_button()
        print('实名认证完成......')

        #Step3: 绑卡
        print('开始绑定银行卡......')
        # 填写储蓄卡卡号
        bankCardNum = Constant.CardNumber + str(
            random.randint(10000000000000, 99999999999999))
        newUserCertificationPage.enter_bank_card(bankCardNum)
        newUserCertificationPage.click_outside()
        self.assertTrue(newUserCertificationPage.get_bank_type() == "中国邮储银行")
        newUserCertificationPage.select_province(Constant.Province)
        newUserCertificationPage.select_city(Constant.City)
        newUserCertificationPage.enter_phone_bank(Constant.MobileInBank)
        #获取验证码并填写
        clear_logcat()
        newUserCertificationPage.click_get_valid_code_in_bind_card()
        smsCode = getsmscode()
        newUserCertificationPage.enter_valid_code_in_bind_card(smsCode)
        newUserCertificationPage.click_bank_card_submit_button()
        print('绑定银行卡完成......')

        # Step4: 设置支付密码
        print('开始设置支付密码......')
        newUserCertificationPage.click_set_pay_password_button()
        newUserCertificationPage.enter_phone_in_bank(Constant.MobileInBank)
        newUserCertificationPage.click_get_valid_code_in_set_psw()
        smsCode = getsmscode()
        newUserCertificationPage.enter_valid_code_in_set_psw(smsCode)
        newUserCertificationPage.enter_pay_psw_in_set_psw(Constant.Password)
        newUserCertificationPage.enter_pay_psw_again_in_set_psw(
            Constant.Password)
        newUserCertificationPage.click_submit_button()
        print('设置支付交易密码成功......')

        try:

            # All case is passed
            self.test_case_info.result = "Pass"

        except Exception as err:
            self.test_case_info.error_info = str(err)
            self.logger.log(("Got error: " + str(err)))
        finally:
            self.test_case_info.end_time = cc.get_current_time()
            self.test_case_info.seconds_duration = cc.time_diff(
                self.test_case_info.start_time, self.test_case_info.end_time)
            certificationPage.close_driver()
        pass