def pre_test(self): self.common = Common() # global user_info # user_info = self.common.get_user() # print user_info self.luadriver = self.common.setupdriver() self.common.closeactivity_switchserver(self.luadriver) self.hall_page = Hall_Page() self.task_page = Task_Page() self.game_page = Game_Page() self.personinfo_page = Personinfo_Page() self.start_step("获取用户mid") cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) # self.hall_page.wait_element("头像").click() # time.sleep(5) # if self.personinfo_page.wait_element("账号ID").get_attribute('text') != user_info['cid']: # self.common.loginuser(user_info['user'], user_info['password']) # try: # self.personinfo_page.wait_element("关闭").click() # except: # print "已关闭窗口" # self.start_step("获取当前用户的银币值") dict = PHPInterface.get_user_info(mid) # 获取玩家信息 coin = eval(dict).get('result', {'coin': None}).get('coin') # 获取当前银币值 print coin AddMoney = 2000 - coin PHPInterface.add_money(mid, AddMoney)
def pre_test(self): self.common = Common() # global user_info # user_info = self.common.get_user() # print user_info self.hall_page = Hall_Page() self.mall_page = Mall_Page() self.sign_page = Sign_Page() self.backpack_page = Backpack_Page() self.personinfo_page = Personinfo_Page() self.start_step("初始化driver") self.luadriver = self.common.setupdriver() self.start_step("关闭活动") self.common.closeactivity_switchserver(self.luadriver) self.start_step("获取用户mid") cid = self.common.get_cid() mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid user_info1 = PHPInterface.get_user_info(mid) # 获取玩家信息 coin = json.loads(user_info1).get('result', {'coin': None}).get('coin') # 获取当前银币值 AddMoney = 53000 - coin PHPInterface.add_money(mid, AddMoney) # 将银币值设为3000 PHPInterface.add_money(mid, 53000) self.hall_page.wait_element("头像").click() time.sleep(2)
def pre_test(self): self.common = Common() self.hall_page = Hall_Page() self.sign_page = Sign_Page() self.personinfo_page = Personinfo_Page() self.safebox_page = Safebox_Page() # global user_info,UserID # user_info = self.common.get_user() # print user_info self.start_step("初始化Luadriver") self.luadriver = self.common.setupdriver() self.start_step("关闭活动,并切换到预发布") self.common.closeactivity_switchserver(self.luadriver) self.start_step("获取用户mid") cid = self.common.get_cid() mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid # UserID = user_info.get('mid') # print 'UserID:%s' % UserID dict = PHPInterface.get_user_info(mid) # 获取玩家信息 coin = eval(dict).get('result', {'coin': None}).get('coin') # 获取当前银币值 # if coin <= 20000: # AddMoney = 30000 - coin # 如果当前银币不多于20000,则将银币值设置为30000 PHPInterface.add_money(mid, 30000) self.common.closeactivity_switchserver(self.luadriver)
def pre_test(self): self.common = Common() # 初始化Luadriver self.luadriver = self.common.setupdriver() self.hall_page = Hall_Page() self.sign_page = Sign_Page() self.personinfo_page = Personinfo_Page() self.safebox_page = Safebox_Page() self.start_step("关闭活动,并切换到预发布") self.common.closeactivity_switchserver(self.luadriver) # global user_info,UserID # user_info = self.common.get_user() # print user_info # UserID = user_info.get('mid') # print 'UserID:%s' % UserID cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid user_info1 = PHPInterface.get_user_info(mid) # 获取玩家信息 coin = json.loads(user_info1).get('result', {'coin': None}).get('coin') # 获取当前银币值 AddMoney = 40000 - coin PHPInterface.add_money(mid, AddMoney) # 将银币值设为40000 self.start_step("重新加载,让添加的银币生效") self.common.closeactivity_switchserver(self.luadriver)
def pre_test(self): global coin,totalmoney,safebox_crystal self.common = Common() self.hall_page = Hall_Page() self.match_page = Match_Page() self.personinfo_page = Personinfo_Page() global user_info user_info = self.common.get_user() print user_info #初始化luadriver print ("pre_test") self.luadriver = self.common.setupdriver() # PHPInterface.set_env(env=PHPInterface.PRE_REPUBLISH_ENV) self.common.closeactivityprepublish(self.luadriver) #关闭活动弹框 time.sleep(15) self.start_step("获取用户ID信息") self.match_page.wait_element("头像").click() time.sleep(3) cid = self.personinfo_page.wait_element("账号ID").get_attribute('text') print "获取的用户cid为:%s" % cid if(cid != user_info['cid']): self.common.loginuser(user_info['user'],user_info['password']) time.sleep(10) if(self.match_page.is_exist("关闭")==True): self.match_page.wait_element("关闭").click() time.sleep(3) else: self.match_page.wait_element("关闭").click() time.sleep(3) cid1 = user_info['cid'] mid = PHPInterface.get_mid(cid1, region=1) print "用户mid为:%s" % mid time.sleep(5) self.start_step("获取用户银币信息") dict = PHPInterface.get_user_info(mid) coin = eval(dict).get('result',{'coin':None}).get('coin') print "用户银币数为:%s" % coin crystal = eval(dict).get('result',{'crystal':None}).get('crystal') print "用户金条数为:%s" % crystal time.sleep(5) self.start_step("获取用户保险箱存款信息") safebox_info = PHPInterface.get_safebox(mid) safebox_money = safebox_info.get('safebox') print "保险箱银币存款为:%s" % safebox_money safebox_crystal = safebox_info.get('crystalsafebox') print "保险箱金条存款为:%s" % safebox_crystal totalmoney = safebox_info.get('totalmoney') print "用户银币总数量为:%s" % totalmoney time.sleep(10)
def pre_test(self): self.common = Common() self.hall_page = Hall_Page() self.task_page = Task_Page() self.game_page = Game_Page() self.personinfo_page = Personinfo_Page() # global user_info # user_info = self.common.get_user() # print user_info self.luadriver = self.common.setupdriver() self.common.closeactivity_switchserver(self.luadriver) self.start_step("获取用户mid") cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) PHPInterface.set_mission_to_complete(mid, 103000, 369, 1)
def pre_test(self): self.common = Common() self.hall_page = Hall_Page() self.task_page = Task_Page() self.game_page = Game_Page() self.personinfo_page = Personinfo_Page() # global user_info # user_info = self.common.get_user() # print user_info self.luadriver = self.common.setupdriver() # 每个用例都需要关闭活动,把这个放在初始化里面实现 self.common.closeactivity_switchserver(self.luadriver) cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid PHPInterface.add_money(mid, 5000)
def pre_test(self): self.common = Common() self.start_step("初始化Luadriver") self.luadriver = self.common.setupdriver() # 每个用例都需要关闭活动,把这个放在初始化里面实现 self.common.closeactivity_switchserver(self.luadriver,"预发布") # global user_info # user_info = self.common.get_user() # print user_info self.start_step("重置默认头像") self.start_step("获取用户mid") cid = self.common.get_cid() mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid PHPInterface.reset_img(mid) self.hall_page = Hall_Page() self.personinfo_page = Personinfo_Page()
def pre_test(self): self.common = Common() self.hall_page = Hall_Page() self.task_page = Task_Page() # global user_info # user_info = self.common.get_user() # print user_info # 初始化Luadriver self.luadriver = self.common.setupdriver() # 每个用例都需要关闭活动,把这个放在初始化里面实现 self.common.closeactivity_switchserver(self.luadriver) cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid PHPInterface.set_mission_to_complete(mid, 103000, 541)
def pre_test(self): self.common = Common() # global user_info # user_info = self.common.get_user() # print user_info # 初始化Luadriver self.luadriver = self.common.setupdriver() self.hall_page = Hall_Page() self.sign_page = Sign_Page() self.personinfo_page = Personinfo_Page() self.safebox_page = Safebox_Page() self.start_step("关闭活动,并切换到预发布") self.common.closeactivity_switchserver(self.luadriver) cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid self.start_step("重新加载,让添加的银币生效") self.common.closeactivity_switchserver(self.luadriver)
def pre_test(self): self.common = Common() # global user_info # user_info = self.common.get_user() # print user_info self.luadriver = self.common.setupdriver() # 每个用例都需要关闭活动,把这个放在初始化里面实现 self.common.closeactivity_switchserver(self.luadriver) self.hall_page = Hall_Page() self.mall_page = Mall_Page() self.sign_page = Sign_Page() self.backpack_page = Backpack_Page() self.personinfo_page = Personinfo_Page() time.sleep(1) cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid PHPInterface.add_money(mid, 53000)
def pre_test(self): self.common = Common() # 初始化Luadriver self.luadriver = self.common.setupdriver() self.hall_page = Hall_Page() self.sign_page = Sign_Page() self.personinfo_page = Personinfo_Page() self.common.closeactivity_switchserver(self.luadriver, '预发布') # global user_info,UserID # user_info = self.common.get_user() # print user_info # UserID = user_info.get('mid') # print 'UserID:%s' % UserID # PHPInterface.set_env(PHPInterface.PRE_REPUBLISH_ENV) cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid PHPInterface.set_sign_card(mid,1,2) # 后台添加两张补签卡
def pre_test(self): #删除自动登陆文件,置为游客状态 self.common = Common() self.hall_page = Hall_Page() self.personinfo_page = Personinfo_Page() # global user_info # user_info = self.common.get_user() # print user_info # 初始化Luadriver self.luadriver = self.common.setupdriver() # 每个用例都需要关闭活动,把这个放在初始化里面实现 self.common.closeactivity_switchserver(self.luadriver,"预发布") self.start_step("获取用户mid") cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid PHPInterface.set_vip(mid,4) time.sleep(3)
def pre_test(self): global coin, totalmoney, safebox_crystal self.common = Common() global user_info user_info = self.common.get_user() print user_info # 初始化luadriver # print ("pre_test") self.luadriver = self.common.setupdriver() # PHPInterface.set_env(env=PHPInterface.PRE_REPUBLISH_ENV) self.common.closeactivityprepublish(self.luadriver) # 关闭活动弹框 time.sleep(15) self.hall_page = Hall_Page() self.match_page = Match_Page() self.personinfo_page = Personinfo_Page() self.game_page = Game_Page() self.start_step("获取用户ID信息") self.match_page.wait_element("头像").click() time.sleep(3) cid = self.personinfo_page.wait_element("账号ID").get_attribute('text') print "获取的用户cid为:%s" % cid if (cid != user_info['cid']): self.common.loginuser(user_info['user'], user_info['password']) time.sleep(10) if (self.match_page.is_exist("关闭") == True): self.match_page.wait_element("关闭").click() time.sleep(3) else: self.match_page.wait_element("关闭").click() time.sleep(3) cid1 = user_info['cid'] mid = PHPInterface.get_mid(int(cid1), region=1) print "用户mid为:%s" % mid self.start_step("获取用户银币信息") dict = PHPInterface.get_user_info(mid) coin = eval(dict).get('result', {'coin': None}).get('coin') print "用户银币数为:%s" % coin if (coin < 53000): PHPInterface.add_money(mid, (53000 - coin)) self.common.closeactivityprepublish(self.luadriver) time.sleep(10)
def pre_test(self): self.common = Common() # global user_info # user_info = self.common.get_user() # print user_info # 初始化Luadriver self.luadriver = self.common.setupdriver() # global UserID # UserID = user_info.get('mid') # print 'UserID:%s' % UserID self.hall_page = Hall_Page() self.sign_page = Sign_Page() self.personinfo_page = Personinfo_Page() self.safebox_page = Safebox_Page() self.common.closeactivity_switchserver(self.luadriver) cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid PHPInterface.add_crystal(mid,100) self.start_step("重新加载,让添加的银币生效") self.common.closeactivity_switchserver(self.luadriver)
def pre_test(self): self.common = Common() self.luadriver = self.common.setupdriver() self.hall_page = Hall_Page() self.task_page = Task_Page() self.game_page = Game_Page() self.personinfo_page = Personinfo_Page() # 每个用例都需要关闭活动,把这个放在初始化里面实现 self.common.closeactivity_switchserver(self.luadriver) # global user_info # user_info = self.common.get_user() # print user_info self.start_step("获取当前用户的银币值") cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid dict = PHPInterface.get_user_info(mid) # 获取玩家信息 coin = eval(dict).get('result', {'coin': None}).get('coin') # 获取当前银币值 print coin AddMoney = 3000 - coin PHPInterface.add_money(mid, AddMoney)
def pre_test(self): self.common = Common() # global user_info # user_info = self.common.get_user() # print user_info self.luadriver = self.common.setupdriver() self.hall_page = Hall_Page() self.mall_page = Mall_Page() self.sign_page = Sign_Page() self.backpack_page = Backpack_Page() self.personinfo_page = Personinfo_Page() self.common.closeactivity_switchserver(self.luadriver) # time.sleep(1) self.start_step("获取账号mid") cid = self.common.get_cid() global mid mid = PHPInterface.get_mid(cid, region=1) print "用户mid为:%s" % mid # UserID = user_info.get('mid') # print 'UserID:%s' % UserID dict = PHPInterface.get_user_info(mid) # 获取玩家信息 crystal = eval(dict).get('result', { 'crystal': None }).get('crystal') # 获取当前金条值 #初始化银币 coin = eval(dict).get('result', {'coin': None}).get('coin') # 获取当前银币值 AddMoney = 20000 - int(coin) print AddMoney PHPInterface.add_money(mid, AddMoney) # 将设置银币值 AddCrystal = 450 - crystal PHPInterface.add_crystal(mid, AddCrystal) # 将金条数目置1400 # self.hall_page.wait_element("预发布").click() # time.sleep(15) # self.common.closeActivityBtn() self.common.closeactivity_switchserver(self.luadriver)