def qbb_test():
    QBB_URL = "http://192.168.10.31:8080/logout.html"  # 测试地址
    driver = WebBaseDriver("Chrome")
    driver.implicitly_wai(5)
    driver.maximize_window()
    pa_qb = Qbb_Pafront(driver)
    qd = Qbb_Front(driver)
    # 登录
    user_name = '382359qbb'
    user_pwd = '654321'
    qd.login(QBB_URL, user_name, user_pwd)

    # 注册,注册不需要登录
    phone = qd.get_basics.random_phone()  # 手机号码  随机生成
    rg_pwd = 'a1234567'                   # 注册密码,注册成功之后会改成654321
    # user_id = qd.qbb_register_tzr(QBB_URL, phone, rg_pwd, rg_pwd)
    # print(user_id)
    #############################################################
    money = 5000                          # 金额(投资,充值提现)
    success = 'pass'                      # 成功还是失败,除了pass都是失败
    card = 6226602900000009               # 银行卡号
    pa_ts_pwd = 'a12345'                  # 存管交易密码,默认a12345
    #############################################################

    # 存管开户
    # pa_qb.pa_account(card, phone, pa_ts_pwd)

    # 充值/存管充值
    # qd.recharge(money, success, bank_card=card)
    pa_qb.pa_recharge(money, pa_ts_pwd, success)

    # 投资/存管投资
    investment_hj = 'pre'                # 投资环境,pre=准生产,test=测试
    bid = 20180706000001                  # 标的号
    qd.bid_investment(money, investment_hj, '654321', bid=bid)
    # pa_qb.pa_bid_investment(money, investment_hj, pa_ts_pwd, bid=bid)

    # 提现/存管提现
    # qd.withdraw(1, money, '654321', success)
    # pa_qb.pa_withdraw(money, pa_ts_pwd, success)

    driver.sleep(2)
    driver.quit_browser()
示例#2
0
        elif is_host == '0':
            self.bid_investment(money, hj, '654321', bid=bid)
        else:
            print("please enter is_host again")

    def judge_hj(self, hj):
        if hj == 'test':
            self.hj_url = 31
        elif hj == 'pre':
            self.hj_url = 135
        else:
            print("%s,Input error,Please enter the correct environment" % hj)
        return self.hj_url


if __name__ == '__main__':
    url = 'http://192.168.10.31:8080/userCenter/register.html'
    db = 'pre'
    driver = WebBaseDriver("Chrome")
    driver.implicitly_wai(5)
    driver.maximize_window()
    ac = Activity(driver)
    user_phone = ac.get_basics.random_phone()
    # ac.at_recharge('pre', 0, '322271', 200, 'passs')
    ac.invite_friends('test', user_phone, 'a1234567')
    driver.sleep(10)
    driver.quit_browser()



示例#3
0
class QbbSingleTest(unittest.TestCase):
    result = None
    QBB_HTURL = "http://192.168.10.31:8084/qian88_admin/tologin.action"
    QBB_URL = "http://192.168.10.32:8081"
    DL_URL = "http://192.168.10.32:8081/login.html"
    PRO_URL = "http://192.168.10.135:8080"
    PRO_DLURL = "http://192.168.10.135:8080/logout.html"
    QBB_JT = "picture\\ QBB_%s_%s.png"
    filename = 'zhuc_Result_06.07-09.52.23'
    sheet_name = 'result'
    head_list = ['url(注册网址)', 'userid/relevanceId', 'luckcd', '邀请好友是否给活动机会']
    ###############
    user_name = '311152qbb'
    user_pwd = '654321'
    pa_name = '322228qbb'
    pa_pwd = '654321'
    ###############
    user_phone = '17302646415'
    yzm = '123456'
    pwd = 'a1234567'
    repwd = 'a1234567'
    ts_pwd = '654321'
    pa_ts_pwd = 'a12345'
    ###############
    recharge_money = 200
    withdraw_money = 200
    bank_mun = 1
    band_card = 6217680304046050
    pa_phone = 17302646411
    ###############
    bid_title = 'ZADB20180411000059'
    bid = 20180411000059
    pa_bid = 20180529000007
    investment_money = 500

    def setUp(self):
        self.driver = WebBaseDriver("Chrome")
        self.driver.navigate(self.DL_URL)
        self.driver.implicitly_wai(5)
        self.driver.maximize_window()
        self.front = Qbb_Front(self.driver)
        self.pa_front = Qbb_Pafront(self.driver)
        self.data_Treat = Data_Treating()

    def tearDown(self):
        print('###############################################')
        self.driver.sleep(3)
        self.driver.quit_browser()

    def test_01(self):
        """登录"""
        data = self.data_Treat.read_content(self.filename, self.sheet_name)
        self.a = 0
        dl_list = []
        self.data_Treat.create_table('登录')
        for i in data:
            self.front.login(self.DL_URL, i.split('-')[0], i.split('-')[1])
            url = self.driver.get_url()
            print(url, self.DL_URL)
            if url == self.DL_URL:
                self.result = 'error'
            else:
                self.result = 'pass'
                # self.driver.click('logout')
                self.driver.navigate(self.DL_URL)
            self.a = self.a + 1
            print(self.a)
            dl_list.extend([
                i.split('-')[0],
                i.split('-')[0] + ' ,' + i.split('-')[1],
                i.split('-')[1]
            ])
            self.data_Treat.write_head(self.head_list)
            self.data_Treat.write_content(dl_list, self.result, self.a)
            dl_list.clear()
        self.data_Treat.close()

    def test_02(self):
        """注册用户"""
        self.front.qbb_register_tzr(self.user_phone, self.yzm, self.pwd,
                                    self.repwd)

    def test_03(self):
        """普通充值"""
        self.front.login(self.DL_URL, self.user_name, self.user_pwd)
        self.driver.navigate(self.QBB_URL)
        self.front.recharge(self.recharge_money, 'pass')

    def test_04(self):
        """普通提现"""
        self.front.login(self.DL_URL, self.user_name, self.user_pwd)
        self.driver.navigate(self.QBB_URL)
        self.front.withdraw(self.bank_mun, self.withdraw_money, self.ts_pwd)

    def test_05(self):
        """普通投资"""
        self.front.login(self.DL_URL, self.user_name, self.user_pwd)
        self.driver.navigate(self.QBB_URL)
        self.front.bid_investment(self.investment_money,
                                  'CS',
                                  self.ts_pwd,
                                  bid=self.bid)

    def test_06(self):
        """存管充值"""
        self.pa_front.login(self.PRO_DLURL, self.pa_name, self.pa_pwd)
        self.driver.navigate(self.PRO_URL)
        self.pa_front.pa_recharge(self.recharge_money, self.pa_ts_pwd, 'pass')

    def test_07(self):
        """存管提现"""
        self.pa_front.login(self.PRO_DLURL, self.pa_name, self.pa_pwd)
        self.driver.navigate(self.PRO_URL)
        self.pa_front.pa_withdraw(self.withdraw_money, self.pa_ts_pwd,
                                  self.pa_phone)

    def test_08(self):
        """存管投资"""
        self.pa_front.login(self.PRO_DLURL, self.pa_name, self.pa_pwd)
        self.driver.navigate(self.PRO_URL)
        self.pa_front.pa_bid_investment(self.investment_money,
                                        'PRO',
                                        self.pa_phone,
                                        self.pa_ts_pwd,
                                        bid=self.pa_bid)
示例#4
0
class QbbSceneTest(unittest.TestCase):
    QBB_HTURL = "http://192.168.10.31:8084/qian88_admin/tologin.action"
    DL_URL = "http://192.168.10.31:8080/tologin.html"
    PRO_DLURL = "http://192.168.10.135:8080/logout.html"
    QBB_JT = "picture\\ QBB_%s_%s.png"
    filename = 'zhuc_Result_06.07-09.52.23'
    sheet_name = 'result'
    ###############
    rg_pwd = 'a1234567'
    ###############
    pa_ts_pwd = 'a12345'
    ###############
    recharge_money = 200
    withdraw_money = 200
    order_status = 'x,//*[@id="context"]/div/table/tbody/tr[2]/td[7]'
    bank_mun = 1
    ###############
    bid_title = 'ZADB20180411000059'
    investment_money = 200
    result = 'pass'

    def setUp(self):
        self.rg_phone = self.front.get_basics.random_phone()
        self.driver = WebBaseDriver("Chrome")
        self.driver.implicitly_wai(5)
        self.driver.maximize_window()
        self.front = Qbb_Front(self.driver)
        self.pa_front = Qbb_Pafront(self.driver)
        self.data_Treat = Data_Treating()

    def tearDown(self):
        print('###############################################')
        self.driver.sleep(3)
        self.driver.quit_browser()

    def test_01(self):
        """普通注册充值投资提现流程"""
        self.front.qbb_register_tzr(self.DL_URL, self.rg_phone, self.rg_pwd,
                                    self.rg_pwd)
        self.front.login(self.DL_URL, self.rg_phone, self.rg_pwd)
        self.front.recharge(self.recharge_money, self.result)
        self.front.bid_investment(self.investment_money, 'PRO', self.rg_pwd)
        self.front.withdraw(self.bank_mun, self.withdraw_money, self.rg_pwd,
                            self.result)

    def test_02(self):
        """存管注册开户充值投资提现流程"""
        self.front.qbb_register_tzr(self.DL_URL, self.rg_phone, self.rg_pwd,
                                    self.rg_pwd)
        self.front.login(self.DL_URL, self.rg_phone, self.rg_pwd)
        self.pa_front.pa_recharge(self.recharge_money, self.pa_ts_pwd,
                                  self.result)
        self.pa_front.pa_bid_investment(self.investment_money, 'PRO',
                                        self.pa_ts_pwd)
        self.driver.driver.back()
        self.driver.driver.back()
        self.pa_front.pa_withdraw(self.withdraw_money, self.pa_ts_pwd,
                                  self.pa_phone, self.result)

    def test_03(self):
        """用户普通充值投资提现流程"""
        pass

    def test_04(self):
        """用户存管开户充值投资提现流程"""
        pass
class Activity_test(unittest.TestCase):
    result = None
    sheet_name = 'result'
    DL_URL = "http://192.168.10.32:8081/login.html"
    Cn_db = ConnectMysql()
    get_basics = Basics()
    #################################################
    act_num = 1042

    def setUp(self):
        self.driver = WebBaseDriver("Chrome")
        self.driver.implicitly_wai(5)
        self.driver.maximize_window()
        self.act = Activity(self.driver)
        self.data_Treat = Data_Treating()

    def tearDown(self):
        print('###############################################')
        self.driver.sleep(3)
        self.driver.quit_browser()

    def test_01(self):
        """invite_friends"""
        self.rg_pwd = 'a1234567'
        data = self.data_Treat.read_content('活动邀请好友', self.sheet_name)
        self.a = 0
        self.if_list = []
        self.data_Treat.create_table('邀请好友')
        for i in data:
            rg_phone = self.get_basics.random_phone()
            array = i.split('-')
            self.act.invite_friends(array[0], rg_phone, self.rg_pwd)
            if array[3] == 1:
                self.result = 'error'
            else:
                self.result = 'pass'
            id_sql = self.get_basics.hy_id_sql % rg_phone
            chance_sql = self.get_basics.hy_chance_sql % rg_phone
            id_result = self.Cn_db.connect_db(self.act.login_hj(), id_sql)
            chance_result = self.Cn_db.connect_db(self.act.login_hj(),
                                                  chance_sql)
            self.if_list.extend([
                array[0],
                id_result.__str__(),
                chance_result.__str__(),
            ])
            self.data_Treat.write_head(self.get_basics.if_head)
            self.data_Treat.write_content(self.if_list, self.result, self.a)
            self.if_list.clear()
        self.data_Treat.close()

    def test_02(self):
        """at_recharge"""
        ######################  读取
        data = self.data_Treat.read_content('活动充值', self.sheet_name)
        self.a = 0
        self.if_list = []
        self.data_Treat.create_table('活动充值')
        for i in data:
            print(i)
            self.a = self.a + 1
            array = i.split('-')
            self.act.at_recharge(array[0], array[1], array[2], array[3],
                                 array[4])
            if array[4] == 'pass':
                self.result = 'pass'
            else:
                self.result = 'error'
            cz_wb_sql = self.get_basics.cz_wb_sql % (array[2], self.act_num)
            cz_wb_result = self.Cn_db.connect_db(array[0], cz_wb_sql)
            ######################  写入
            self.if_list.extend([
                array[2],
                array[3] + '(%r)' % array[1],
                cz_wb_result.__str__(),
            ])
            self.data_Treat.write_head(self.get_basics.at_recharge_head)
            self.data_Treat.write_content(self.if_list, self.result, self.a)
            self.if_list.clear()
        self.data_Treat.close()

    def test_03(self):
        """at_withdraw"""
        ######################  读取
        data = self.data_Treat.read_content('活动提现', self.sheet_name)
        self.a = 0
        self.if_list = []
        self.data_Treat.create_table('活动提现')
        for i in data:
            self.a = self.a + 1
            array = i.split('-')
            self.act.at_withdraw(array[0], array[1], array[2], array[3],
                                 array[4])
            if array[4] == 'pass':
                self.result = 'pass'
            else:
                self.result = 'error'
            tx_wb_sql = self.get_basics.tx_wb_sql % (array[2], self.act_num)
            tx_wb_result = self.Cn_db.connect_db(array[0], tx_wb_sql)
            ######################  写入
            self.if_list.extend([
                array[2],
                array[3] + '(%r)' % array[1],
                tx_wb_result.__str__(),
            ])
            self.data_Treat.write_head(self.get_basics.at_withdraw_head)
            self.data_Treat.write_content(self.if_list, self.result, self.a)
            self.if_list.clear()
        self.data_Treat.close()

    def test_04(self):
        """investment"""
        ######################  读取
        data = self.data_Treat.read_content('活动投资', self.sheet_name)
        self.a = 0
        self.if_list = []
        self.data_Treat.create_table('活动投资')
        for i in data:
            self.a = self.a + 1
            array = i.split('-')
            self.act.at_investment(array[0], array[1], array[2], array[3],
                                   array[4])
            if array[4] == 'pass':
                self.result = 'pass'
            else:
                self.result = 'error'
            tx_wb_sql = self.get_basics.tx_wb_sql % (array[2], self.act_num)
            tx_wb_result = self.Cn_db.connect_db(array[0], tx_wb_sql)
            ######################  写入
            self.if_list.extend([
                array[2],
                array[3] + '(%r)' % array[1],
                tx_wb_result.__str__(),
            ])
            self.data_Treat.write_head(self.get_basics.at_investment_head)
            self.data_Treat.write_content(self.if_list, self.result, self.a)
            self.if_list.clear()
        self.data_Treat.close()