def pre_test(self): self.common = Common() self.luadriver = self.common.setupdriver() self.hall_page = Hall_Page() self.setting_page = Setting_Page() self.personinfo_page = Personinfo_Page() self.common.closeactivitytest(self.luadriver) self.hall_page.wait_element("头像").click() time.sleep(6) if self.personinfo_page.wait_element("账号ID").get_attribute( 'text') != self.casedata['cid']: self.common.loginuser(self.casedata['user'], self.casedata['password']) try: self.personinfo_page.wait_element("关闭").click() except: print "已关闭窗口" print "mid为: %s" % self.casedata['mid'] self.start_step("调用接口封停账号") resultBanUser = PHPInterface.shutdown_user(int(self.casedata['mid']), 1) if resultBanUser: print "封停账号成功" else: raise "封停账号失败" # 每个用例都需要关闭活动,把这个放在初始化里面实现 # self.common.closeactivitytest(self.luadriver) # self.start_step("获取Mid信息") # self.hall_page.wait_element("头像").click() # self.common.loginuser(self.casedata['user'], self.casedata['password']) # self.common.closeactivitytest(self.luadriver) # 关闭APP重新打开 self.common.closedriver() self.luadriver = self.common.setupdriver() self.common.closeactivitytest(self.luadriver)
def post_test(self): self.start_step("调用接口解封账号") resultBanUser = PHPInterface.shutdown_user(self.mid, 0) if resultBanUser: print "解封账号成功" else: raise "解封账号失败" self.common.closedriver()
def pre_test(self): self.common = Common() self.luadriver = self.common.setupdriver() # 删除缓存文件 self.common.deletefile(self.luadriver) self.hall_page = Hall_Page() #关闭APP重新打开 self.common.closedriver() self.luadriver = self.common.setupdriver() # 每个用例都需要关闭活动,把这个放在初始化里面实现 self.common.closeactivitytest(self.luadriver) #获取Mid信息 self.hall_page.wait_element("头像").click() self.mid = self.hall_page.wait_element("idNumber").get_attribute( "text") print "获取的mid为: %s" % self.mid self.start_step("调用接口封停账号") resultBanUser = PHPInterface.shutdown_user(int(self.mid), 1) if resultBanUser: print "封停账号成功" else: raise "封停账号失败"