Beispiel #1
0
class VipAgentDepositTest(TestCase):
    # susu公司充值汇总
    def set_up(self):
        # 启动浏览器
        self.base_driver = BoxDriver(Browser.Chrome)
        # 全屏浏览器
        self.base_driver.maximize_window()
        # 输入网址
        self.base_driver.navigate('https://fusion.spmobileapi.net/#/home')
        print("打开网址")

        # 休眠
        self.base_driver.forced_wait(3)

    def tear_down(self):
        self.base_driver.quit()

        # 测试用例
    def test_fail_registered_01(self):
        ''' 新用户层级20-100元 '''
        self.commonrecharge = CommonRecharge(self.base_driver)
        self.commonrecharge.login03()
        # 点击公司入款
        self.base_driver.click('x,//*[@id="main"]/div/section/ul/li[4]/p[1]')
        self.commonrecharge.cwbutton()
        # 打开csv文件
        csv_file = open('/fusion/csv/rechagre_vipagentdeposit.csv',
                        'r',
                        encoding='utf8')
        # 读取csv文件
        csv_date = csv.DictReader(csv_file)
        print('打开csv')
        for row in csv_date:
            if row['msg'] == 'fail01':
                print('进入数据循环')
                # 登陆模块,调用CommonRecharge中的login()
                # self.commonrecharge.hyzx_cwzx_idem_rk(row)
                self.base_driver.forced_wait(1)
                self.base_driver.vad = VipAgentDeposit(self.base_driver)
                self.base_driver.vad.vipagent(row)
                self.base_driver.vad.susu00(row)
                self.base_driver.vad.next_buttion()
                get_tips01 = self.base_driver.vad.get_tips01()
                # 断言,断言方法在TestCase类中
                # 获取在登录成功之后的用户名
                print('获取的文字是:' + get_tips01)
                self.assertEqual(get_tips01, row['tips01'], '充值金额不符合!')
                self.base_driver.refresh()
                print('刷新网页')
                self.base_driver.forced_wait(1)

                # 关闭浏览器
        self.base_driver.quit()
        # 使用完csv文件后,关闭
        csv_file.close()
        print('test_fail_registered_01 运行完毕')
        # 日志
        self.logger.info('关闭CSV文件')
class RechargeAlipay(TestCase):
    # susu公司充值汇总
    def set_up(self):
        # 启动浏览器
        self.base_driver = BoxDriver(Browser.Chrome)
        # 全屏浏览器
        self.base_driver.maximize_window()
        # 输入网址
        self.base_driver.navigate('https://fusion.spmobileapi.net/#/home')
        print("打开网址")

        # 休眠
        self.base_driver.forced_wait(3)

    def tear_down(self):
        self.base_driver.quit()

        # 测试用例
    # def test_fail_registered_01(self):
    #     ''' 新用户层级20-100元 '''
    #     self.commonrecharge = CommonRecharge(self.base_driver)
    #     self.commonrecharge.login03()
    #     # 点击支付宝
    #     self.base_driver.click('x,//*[@id="main"]/div/section/ul/li[2]/p[1]')
    #     self.commonrecharge.cwbutton()
    #     # 打开csv文件
    #     csv_file = open('/fusion/csv/recharge_alipaytransfer.csv', 'r', encoding='utf8')
    #     # 读取csv文件
    #     csv_date = csv.DictReader(csv_file)
    #     print('打开csv')
    #     for row in csv_date:
    #         if row['msg'] == 'fail01':
    #             print('进入数据循环')
    #             # 登陆模块,调用CommonRecharge中的login()
    #             # self.commonrecharge.hyzx_cwzx_idem_rk(row)
    #             self.base_driver.forced_wait(1)
    #             self.base_driver.ali = AlipayTransfer(self.base_driver)
    #             self.base_driver.ali.alipaytransfer(row)
    #             # self.base_driver.ali.buildbank(row)
    #             self.base_driver.ali.next_buttion()
    #             self.base_driver.forced_wait(1)
    #             # 断言,断言方法在TestCase类中
    #             # 获取不成功的提示信息
    #             # get_tips00 = self.base_driver.ali.get_tips00()
    #             # print('获取的文字是:' + get_tips00)
    #             # self.assertEqual(get_tips00, row['tips00'], '充值金额不符合!')
    #             # self.base_driver.refresh()
    #             # print('刷新网页')
    #             # self.base_driver.forced_wait(1)
    #             get_ornum = self.base_driver.ali.get_ordertips()
    #             print('获取的提示信息:' + get_ornum)
    #             self.assertEqual(get_ornum, row['tips02'], '充值成功')
    #             self.logger.info('用例运行成功,充值失败:' + row['examples'])
    #             # 关闭浏览器
    #     self.base_driver.quit()
    #     # 使用完csv文件后,关闭
    #     csv_file.close()
    #     print('test_fail_registered_01 运行完毕')
    #     # 日志
    #     self.logger.info('关闭CSV文件')
    # 测试用例
    # def test_fail_registered_01(self):
    #     ''' 支付宝转账失败-100元 '''
    #     self.commonrecharge = CommonRecharge(self.base_driver)
    #     self.commonrecharge.login03()
    #     # 点击支付宝
    #     self.base_driver.click('x,//*[@id="main"]/div/section/ul/li[2]/p[1]')
    #     self.commonrecharge.cwbutton()
    #     # 打开csv文件
    #     csv_file = open('/fusion/csv/recharge_alipaytransfer.csv', 'r', encoding='utf8')
    #     # 读取csv文件
    #     csv_date = csv.DictReader(csv_file)
    #     print('打开csv')
    #     for row in csv_date:
    #         if row['msg'] == 'fail01':
    #             print('进入数据循环111')
    #             try:
    #                 # 登陆模块,调用CommonRecharge中的login()
    #                 self.base_driver.forced_wait(3)
    #                 self.base_driver.ali = AlipayTransfer(self.base_driver)
    #                 self.base_driver.ali.alipaytransfer(row)
    #                 self.base_driver.forced_wait(1)
    #                 self.base_driver.ali.buildbank(row)
    #                 self.base_driver.ali.next_buttion()
    #                 self.base_driver.forced_wait(1)
    #                 get_tips100 = self.base_driver.ali.get_tips()
    #                 # 获取不成功的提示信息
    #                 print('获取的文字是:' + get_tips100)
    #                 self.assertEqual(get_tips100, row['tips00'], '充值金额不符合!')
    #                 self.base_driver.refresh()
    #                 self.base_driver.forced_wait(1)
    #                 self.logger.info('用例运行成功,充值失败' + row['examples'] + '本次转账' + row['examples'])
    #             except Exception as e:
    #                 print(e)
    #                 # 日志
    #                 self.logger.info('用例运行失败,充值成功' + row['examples'] + '本次转账' + row['examples'])
    #             finally:
    #                 # 点击充值
    #                 self.base_driver.forced_wait(3)
    #                 self.base_driver.click('x,//*[@id="main"]/div/ul/li[2]/ul/li[1]')
    #                 self.base_driver.forced_wait(4)
    #                 # 点击支付宝转账
    #                 self.base_driver.click('x,//*[@id="main"]/div/section/ul/li[2]/p[1]')
    #                 self.commonrecharge.cwbutton()
    #             self.base_driver.refresh()
    #             self.base_driver.forced_wait(3)
    #
    #             # 关闭浏览器
    #     self.base_driver.quit()
    #     # 使用完csv文件后,关闭
    #     csv_file.close()
    #     print('test_fail_registered_01 运行完毕')
    #     # 日志
    #     self.logger.info('关闭CSV文件')

    def test_fail_success_01(self):
        ''' 支付宝转账失败-100元 '''
        self.commonrecharge = CommonRecharge(self.base_driver)
        self.commonrecharge.login03()
        # 点击支付宝
        self.base_driver.click('x,//*[@id="main"]/div/section/ul/li[2]/p[1]')
        self.commonrecharge.cwbutton()
        # 打开csv文件
        csv_file = open('/fusion/csv/recharge_alipaytransfer.csv', 'r', encoding='utf8')
        # 读取csv文件
        csv_date = csv.DictReader(csv_file)
        print('打开csv')
        for row in csv_date:
            if row['msg'] == 'succ01':
                print('进入数据循环111')
                try:
                    # 登陆模块,调用CommonRecharge中的login()
                    self.base_driver.forced_wait(3)
                    self.base_driver.ali = AlipayTransfer(self.base_driver)
                    self.base_driver.ali.alipaytransfer(row)
                    self.base_driver.forced_wait(1)
                    self.base_driver.ali.buildbank(row)
                    self.base_driver.ali.next_buttion()
                    self.base_driver.forced_wait(1)
                    get_tips100 = self.base_driver.ali.get_ordertips()
                    # 获取不成功的提示信息
                    print('获取的文字是:' + get_tips100)
                    self.assertEqual(get_tips100, row['tips02'], '充值金额不符合!')
                    self.base_driver.refresh()
                    self.base_driver.forced_wait(1)
                    self.logger.info('用例运行成功,充值成功' + row['examples'] + '本次转账' + row['examples'])
                except Exception as e:
                    print(e)
                    # 日志
                    self.logger.info('用例运行失败,充值失败' + row['examples'] + '本次转账' + row['examples'])
                finally:
                    # 点击充值
                    self.base_driver.forced_wait(3)
                    self.base_driver.click('x,//*[@id="main"]/div/ul/li[2]/ul/li[1]')
                    self.base_driver.forced_wait(4)
                    # 点击支付宝转账
                    self.base_driver.click('x,//*[@id="main"]/div/section/ul/li[2]/p[1]')
                    self.commonrecharge.cwbutton()
                self.base_driver.refresh()
                self.base_driver.forced_wait(3)

                # 关闭浏览器
        self.base_driver.quit()
        # 使用完csv文件后,关闭
        csv_file.close()
        print('test_fail_registered_01 运行完毕')
        # 日志
        self.logger.info('关闭CSV文件')
Beispiel #3
0
class RechargeSuSuTest1(TestCase):
    # susu公司充值
    def set_up(self):
        # 启动浏览器
        self.base_driver = BoxDriver(Browser.Chrome)
        # 全屏浏览器
        self.base_driver.maximize_window()
        # 输入网址
        self.base_driver.navigate('https://fusion.spmobileapi.net/#/home')
        print("打开网址")
        # 休眠
        self.base_driver.forced_wait(3)

    def tear_down(self):
        self.base_driver.quit()

        # 测试用例
    def test_fail__01(self):
        ''' 用户充值susu公司入款失败 '''
        self.commonrecharge = CommonRecharge(self.base_driver)
        self.commonrecharge.login03()
        # 点击第一个 susu公司入款
        self.base_driver.click('x,//*[@id="main"]/div/section/ul/li[1]/p[1]')
        self.commonrecharge.cwbutton()
        # 打开csv文件
        csv_file = open('/fusion/csv/recharge_susudeposit1.csv',
                        'r',
                        encoding='utf8')
        # 读取csv文件
        csv_date = csv.DictReader(csv_file)
        print('打开csv')
        for row in csv_date:
            if row['msg'] == 'fail01':
                print('进入数据循环')
                try:
                    self.base_driver.forced_wait(1)
                    self.base_driver.susude = SuSuDeposit(self.base_driver)
                    self.base_driver.susude.susudeposit(row)
                    # 默认选择第一个
                    # self.base_driver.susude.rechargemethod(row)
                    self.base_driver.susude.next_buttion()
                    self.base_driver.forced_wait(3)
                    get_ckmoney = self.base_driver.susude.get_ckmoney()
                    # 获取在登录成功之后的用户名
                    print(get_ckmoney)
                    print('获取的文字是:' + str(get_ckmoney))
                    self.assertEqual(get_ckmoney, row['tips02'], '充值金额不符合!')
                    # 日志
                    self.logger.info('执行成功,执行用例是:' + row['examples'])
                except Exception as e:
                    print(e)
                    # 日志
                    self.logger.info('执行失败,执行用例是:' + row['examples'])
                finally:
                    # 点击充值
                    self.base_driver.click(
                        'x,//*[@id="main"]/div/ul/li[2]/ul/li[1]')
                    self.base_driver.forced_wait(2)
                    # 点击susu公司入款
                    self.base_driver.click(
                        'x,//*[@id="main"]/div/section/ul/li[1]/p[1]')
                    self.commonrecharge.cwbutton()
                self.base_driver.refresh()
                print('刷新网页')
                self.base_driver.forced_wait(1)
                # 关闭浏览器
        self.base_driver.quit()
        # 使用完csv文件后,关闭
        csv_file.close()
        # 日志
        self.logger.info('关闭CSV文件')
        print('test_fail_registered_01 运行完毕')

    def test_success_01(self):
        ''' 用户充值susu公司入款 成功'''
        self.commonrecharge = CommonRecharge(self.base_driver)
        self.commonrecharge.login03()
        # 点击第一个 susu公司入款
        self.base_driver.click_last_one(
            'x,//*[@id="main"]/div/section/ul/li[1]/p[1]')
        self.commonrecharge.cwbutton()
        # 打开csv文件
        csv_file = open('/fusion/csv/recharge_susudeposit1.csv',
                        'r',
                        encoding='utf8')
        # 读取csv文件
        csv_date = csv.DictReader(csv_file)
        print('打开csv')
        for row in csv_date:
            if row['msg'] == 'succ01':
                print('进入数据循环')
                try:
                    self.base_driver.forced_wait(1)
                    self.base_driver.susude = SuSuDeposit(self.base_driver)
                    self.base_driver.susude.susudeposit(row)
                    # 默认选择第一个
                    # self.base_driver.susude.rechargemethod(row)
                    self.base_driver.susude.next_buttion()
                    self.base_driver.forced_wait(3)
                    self.base_driver.susude.depoistname(row)
                    # self.base_driver.forced_wait(1)
                    self.base_driver.susude.rechgebutton()
                    self.base_driver.forced_wait(1)
                    # sum_tips = self.base_driver.susude.sum_tips()
                    # # 获取在登录成功之后的用户名
                    # print(sum_tips)
                    # print('获取的文字是:' + sum_tips)
                    # self.assertEqual(sum_tips, row['tips03'], '提交成功!')
                    self.logger.info('执行成功,执行用例是:' + row['examples'])
                except Exception as e:
                    print(e)
                    self.logger.info('执行失败,执行用例是:' + row['examples'])
                finally:
                    # 点击充值
                    self.base_driver.click(
                        'x,//*[@id="main"]/div/ul/li[2]/ul/li[1]')
                    self.base_driver.forced_wait(2)
                    # 点击susu公司入款
                    self.base_driver.click(
                        'x,//*[@id="main"]/div/section/ul/li[1]/p[1]')
                    self.commonrecharge.cwbutton()
                # self.base_driver.refresh()
                print('刷新网页')
                self.base_driver.forced_wait(1)
                # 关闭浏览器
        self.base_driver.quit()
        # 使用完csv文件后,关闭
        csv_file.close()
        print('test_fail_registered_01 运行完毕')
        # 日志
        self.logger.info('关闭CSV文件')
Beispiel #4
0
class WithdrawRecordTest(TestCase):

    # 充值记录
    def set_up(self):
        # 启动浏览器
        self.base_driver = BoxDriver(Browser.Chrome)
        # 全屏浏览器
        self.base_driver.maximize_window()
        # 输入网址
        # self.base_driver.navigate('https://fusion.spmobileapi.net/#/home')
        # self.base_driver.navigate('https://fusion.spmobileapi.net/memberCenter#/home/rechargeRecord')
        print("打开网址")

        # 休眠
        #  self.base_driver.forced_wait(3)

    def tear_down(self):
        self.base_driver.quit()

        # 测试用例
    def test_fail_registered_01(self):
        self.base_driver.navigate('https://fusion.spmobileapi.net/#/home')
        self.base_driver.forced_wait(3)
        ''' 新用户层级20-100元 '''
        self.commonrecharge = CommonRecharge(self.base_driver)
        self.commonrecharge.login031()
        # 点击提现记录
        self.base_driver.click('x,//*[@id="main"]/div/ul/li[2]/ul/li[4]')
        print('进入提现记录页面')
        # 打开csv文件
        csv_file = open('/fusion/csv/withdrawrecord.csv', 'r', encoding='utf8')
        # 读取csv文件
        csv_date = csv.DictReader(csv_file)
        print('打开csv')
        for row in csv_date:
            if row['msg'] == 'fail01':
                print('进入数据循环')
                # 登陆模块,调用CommonRecharge中的login()
                self.base_driver.forced_wait(3)
                self.base_driver.rech = WithdrawRecord(self.base_driver)
                # 输入查询的单号
                self.base_driver.forced_wait(1)
                self.base_driver.rech.ordernumber(row)
                # 点击查询按钮
                self.base_driver.rech.withdraw_button()
                get_rech_tips03 = self.base_driver.rech.get_rech_tips03()
                # 断言,断言方法在TestCase类中
                # 获取在登录成功之后的用户名
                print('获取的文字是:' + get_rech_tips03)
                self.assertEqual(get_rech_tips03, row['ordernum'], '查询不到该订单!')
                self.base_driver.refresh()
                print('刷新网页')
                print('      ')
                print('      ')
                print('      ')
                print('      ')
                self.base_driver.forced_wait(1)
                # 关闭浏览器
        self.base_driver.quit()
        # 使用完csv文件后,关闭
        csv_file.close()
        print('test_fail_registered_01 运行完毕')
        # 日志
        self.logger.info('关闭CSV文件')
Beispiel #5
0
class LoginPassTest(TestCase):
    # 会员中心--个人中心--登录密码
    def set_up(self):
        # 启动浏览器
        self.base_driver = BoxDriver(Browser.Chrome)
        # 全屏浏览器
        self.base_driver.maximize_window()
        # 输入网址
        self.base_driver.navigate('https://fusion.spmobileapi.net/#/home')

        # 休眠
        self.base_driver.forced_wait(4)

    def tear_down(self):
        self.base_driver.quit()

    # 测试用例s
    # def test_fail_01(self):
    #     ''' 用户名空---修改失败 '''
    #     self.commonrecharge = CommonRecharge(self.base_driver)
    #     self.commonrecharge.login032()
    #     # 点击个人中心
    #     self.base_driver.click('x,//*[@id="main"]/div/ul/li[1]')
    #     print('点击个人中心')
    #     # 点击登陆密码
    #     self.base_driver.click('x,//*[@id="main"]/div/section/div[1]/div[1]/div[1]')
    #     # 打开csv文件
    #     csv_file = open('/fusion/csv/percenter/login_password.csv', 'r', encoding='utf8')
    #     # 读取csv文件
    #     csv_date = csv.DictReader(csv_file)
    #     for row in csv_date:
    #         #  判断 tpshop_login.csv中row['msg']状态为'fail01'执行的数据
    #         if row['msg'] == 'fail01':
    #             # 实例化FusionMain
    #             print('开始数据循环')
    #             self.base_driver.forced_wait(1)
    #             self.fusion_login_main = LoginPassword(self.base_driver)
    #             # 调用登陆前方法login_before
    #             self.fusion_login_main.percenter_login(row)
    #             # 确定按钮
    #             self.fusion_login_main.sub_button()
    #             self.base_driver.forced_wait(1)
    #             # 断言s
    #             get_login_tips02 = self.fusion_login_main.get_tips()
    #             print('获取到提示:' + get_login_tips02)
    #             self.assertEqual(get_login_tips02, row['tips'], '修改失败')
    #             self.base_driver.refresh()
    #             self.base_driver.forced_wait(3)
    #             print('修改登陆密码失败')
    #             self.fusion_login_main.click_login()
    #             print('------')
    #             print('------')
    #             print('------')
    #
    #             # 关闭浏览器
    #     print('fail01运行完毕')
    #     self.base_driver.quit()
    #     # 使用完csv文件后,关闭
    #     csv_file.close()
    #     # 日志
    #     self.logger.info('关闭CSV文件')

    # 测试用例s
    def test_success_01(self):
        ''' 用户登陆密码---修改成功 '''
        self.commonrecharge = CommonRecharge(self.base_driver)
        self.commonrecharge.login032()
        # 点击个人中心
        self.base_driver.click('x,//*[@id="main"]/div/ul/li[1]')
        print('点击个人中心')
        # 点击登陆密码
        self.base_driver.click(
            'x,//*[@id="main"]/div/section/div[1]/div[1]/div[1]')
        # 打开csv文件
        csv_file = open('/fusion/csv/percenter/login_password.csv',
                        'r',
                        encoding='utf8')
        # 读取csv文件
        csv_date = csv.DictReader(csv_file)
        for row in csv_date:
            #  判断 tpshop_login.csv中row['msg']状态为'fail01'执行的数据
            if row['msg'] == 'succ01':
                # 实例化FusionMain
                try:
                    print('开始数据循环')
                    self.base_driver.forced_wait(1)
                    self.fusion_login_main = LoginPassword(self.base_driver)
                    # 调用登陆前方法login_before
                    self.fusion_login_main.percenter_login(row)
                    # 确定按钮
                    self.fusion_login_main.sub_button()
                    self.base_driver.forced_wait(2)
                    # 断言
                    get_login_tips02 = self.fusion_login_main.get_tips()
                    print('获取到提示:' + get_login_tips02)
                    self.assertEqual(get_login_tips02, row['tips'], '修改失败')
                    self.base_driver.refresh()
                    self.base_driver.forced_wait(3)
                    print('修改登陆密码成功')
                    self.fusion_login_main.click_login()
                    print('------')
                    print('------')
                    print('------')
                    # 日志
                    self.logger.info('本次修改成功,用例是' + row['examples'])
                except Exception as e:
                    print(e)
                    self.logger.info('本次修改失败,用例是' + row['examples'])

        # 关闭浏览器
        print('fsucc01运行完毕')
        self.base_driver.quit()
        # 使用完csv文件后,关闭
        csv_file.close()