def test5(self): # 获取充值前代币的储值 a = MySql.db_Query_233(self, dict['mysql']['datebase233'], dict['mysql']['查询代币']) b = re.findall(r"['](.+?)[.]", str(a)) db_befor = b[0] # 获取充值前预存款的储值 mean.wechat_login(self) time.sleep(1) mean.swipe_to_down(self) time.sleep(1) yck_befor = mean.get_text(self, dict['element']['预存款储值']) time.sleep(1) # 登录盈客宝充值代币 mean.click(self, dict['element']['代币充值按钮']) time.sleep(1) # 选择充值套餐 mean.click(self, dict['element']['商品100代币']) time.sleep(1) # 选择微信支付 mean.click(self, dict['element']['微信支付']) time.sleep(1) mean.click(self, dict['element']['支付按钮']) time.sleep(1) mean.input(self, dict['element']['微信支付密码输入框'], dict['element']['微信支付密码']) time.sleep(1) # 获取充值后预存款储值 mean.click(self, dict['element']['订单返回按钮']) time.sleep(1) mean.swipe_to_down(self) time.sleep(1) yck_after = mean.get_text(self, dict['element']['预存款储值']) self.driver.close() # 获取充值后的的代币 c = MySql.db_Query_233(self, dict['mysql']['datebase233'], dict['mysql']['查询代币']) d = re.findall(r"['](.+?)[.]", str(c)) db_after = d[0] # 断言 try: assert db_befor + int(100) == db_after and yck_befor - float( 0.01) == yck_after print('微信充值代币成功!') except Exception as e: print('微信充值代币失败!', e)
def test7(self): # 获取当前金币储值 a = MySql.db_Query_233(self, dict['mysql']['datebase233'], dict['mysql']['查询金币']) b = re.findall(r"['](.+?)[.]", str(a)) jb_befor = b[0] # 获取当前预存款储值 mean.wechat_login(self) time.sleep(1) mean.swipe_to_down(self) time.sleep(1) mean.click(self, dict['element']['金币充值按钮']) time.sleep(1) mean.click(self, dict['element']['商品100金币']) time.sleep(1) mean.click(self, dict['element']['微信支付']) time.sleep(1) mean.click(self, dict['element']['支付按钮']) time.sleep(1) mean.input(self, dict['element']['微信支付密码输入框'], dict['element']['微信支付密码']) time.sleep(1) mean.click(self, dict['element']['订单完成返回首页按钮']) time.sleep(1) mean.swipe_to_down(self) time.sleep(1) # 获取充值后金币储值 c = MySql.db_Query_233(self, dict['mysql']['datebase233'], dict['mysql']['查询金币']) d = re.findall(r"['](.+?)[.]", str(c)) jb_after = d[0] self.driver.close() # 断言 try: assert jb_befor + int(100) == jb_after print('金币充值成功!') except Exception as err: print('金币充值失败!', err)
def test3(self): mean.wechat_login(self) time.sleep(1) mean.swipe_to_down(self) # 获取充值前预存款储值 yck_befor = mean.get_text(self, dict['element']['预存款储值']) time.sleep(1) mean.click(self, dict['element']['预存款充值按钮']) time.sleep(1) mean.click(self, dict['element']['商品100预存款']) time.sleep(1) mean.click(self, dict['element']['支付按钮']) time.sleep(1) # 微信输入密码弹出安全键盘,界面无输入控件,不知道用send_keys方法是否可行 mean.input(self, dict['element']['微信密码输入框'], dict['element']['微信支付密码']) time.sleep(1) mean.click(self, dict['element']['微信支付完成按钮']) time.sleep(1) mean.click(self, dict['element']['查看订单详情按钮']) time.sleep(1) orde_text = mean.get_text(self, dict['element']['获取订单状态']) # 订单状态:已完成 time.sleep(1) mean.back(self) time.sleep(1) mean.swipe_to_down(self) time.sleep(1) yck_after = mean.get_text(self, dict['element']['预存款储值']) self.driver.close() # 断言 try: #这里再加个业务平台数预存款储值据库的校验 assert yck_befor + int( 100) == yck_after and orde_text == '订单状态:已完成' print('预存款充值成功!订单状态已完成!') except Exception: print('预存款充值失败!')
def test4(self): # 获取充值前代币的储值 a = MySql.db_Query_233(self, dict['mysql']['datebase233'], dict['mysql']['查询代币']) b = re.findall(r"['](.+?)[.]", str(a)) db_befor = b[0] time.sleep(1) # 获取充值前预存款的储值 mean.wechat_login(self) time.sleep(1) mean.swipe_to_down(self) time.sleep(1) yck_befor = mean.get_text(self, dict['element']['预存款储值']) time.sleep(1) # 登录盈客宝充值代币 mean.wechat_login(self) mean.swipe_to_down(self) mean.click(self, dict['element']['代币充值按钮']) time.sleep(1) # 选择充值套餐 mean.click(self, dict['element']['商品100代币']) time.sleep(1) # 选取预存款支付 mean.click(self, dict['element']['预存款支付']) time.sleep(1) # 点击支付 mean.click(self, dict['element']['支付按钮']) time.sleep(1) # 输入会员密码 mean.input(self, dict['element']['会员密码输入框'], dict['element']['会员密码']) time.sleep(1) # 点击【确定】 mean.click(self, dict['element']['会员密码确定按钮']) time.sleep(1) # 充值后代币的储值 c = MySql.db_Query_233(self, 'YCHMALL', dict['mysql']['查询代币']) d = re.findall(r"['](.+?)[.]", str(c)) db_after = d[0] # 充值后预存款储值 time.sleep(2) mean.click(self, dict['element']['订单完成返回首页按钮']) time.sleep(1) mean.swipe_to_down(self) time.sleep(1) yck_after = mean.get_text(self, dict['element']['预存款储值']) self.driver.close() # 断言 try: assert db_befor + int(100) == db_after and yck_befor - float( 0.01) == yck_after print('代币充值成功,预存款扣款正确!') except Exception as error: print('代币充值失败!', error)