def run_test(self):
        self.start_step("等待页面加载完成")
        time.sleep(1)
        self.hall_page.wait_element("同步标志")
        UserID = 2198806
        Type = 4
        PHPInterface.set_vip(UserID, Type)
        time.sleep(3)
        Money = self.luadriver.find_element_by_name('Text_gold').get_attribute(
            'text')
        print Money
        print type(Money)
        UserMoney = int(Money.replace(',', ''))
        print UserMoney
        if UserMoney >= 3000:
            AddMoney = 3000 - UserMoney
            PHPInterface.add_money(UserID, AddMoney)
            self.start_step('请手动玩一局破产')

        else:
            AddMoney = 0
            PHPInterface.add_money(UserID, AddMoney)
            self.start_step('已破产,开始测试')
            self.start_step('关闭破产提示')
            self.luadriver.find_element_by_name('closeBtn').click()
            self.start_step('进入川味斗地主页面')
            self.game_page.wait_element('川味斗地主').click()
            self.luadriver.find_element_by_name('button').click()
            self.luadriver.get_screenshot_as_file(screenshotpath +
                                                  'C201_DFQP_Broke3.png')
 def post_test(self):
     '''
     测试用例执行完成后,清理测试环境
     '''
     PHPInterface.set_vip(self.casedata['mid'], -1)
     self.common.deletefile(self.luadriver)
     self.common.closedriver()
 def post_test(self):
     '''
     测试用例执行完成后,清理测试环境
     '''
     # self.common.release_user(user_info['mid'])
     # self.common.deletefile(self.luadriver)
     PHPInterface.set_vip(mid, -1)  # 设置VIP过期
     self.common.closedriver()
 def pre_test(self):
     #删除自动登陆文件,置为游客状态
     self.common = Common()
     # 初始化Luadriver
     self.luadriver = self.common.setupdriver()
     PHPInterface.set_vip(self.casedata['mid'], 4)
     # 每个用例都需要关闭活动,把这个放在初始化里面实现
     self.common.closeactivity_switchserver(self.luadriver, "预发布")
     self.hall_page = Hall_Page()
     self.personinfo_page = Personinfo_Page()
Beispiel #5
0
 def pre_test(self):
     self.common = Common()
     global mid
     mid = self.common.get_config_value("casecfg", "mid")
     PHPInterface.set_vip(mid, 4)  # 设置用户为vip
     # 初始化Luadriver
     self.luadriver = self.common.setupdriver()
     self.hall_page = Hall_Page()
     self.sign_page = Sign_Page()
     self.personinfo_page = Personinfo_Page()
     self.common.closeactivity(self.luadriver)
Beispiel #6
0
 def pre_test(self):
     self.common = Common()
     self.hall_page = Hall_Page()
     self.game_page = Game_Page()
     self.yuepai_page = Yuepai_Page()
     self.start_step("初始化driver")
     self.luadriver = self.common.setupdriver()
     global mid
     mid = self.common.get_config_value("casecfg","mid")
     # self.common.set_coin(mid,value=50000)
     Interface.set_vip(mid,5)
     self.common.closeactivity(self.luadriver)
Beispiel #7
0
 def pre_test(self):
     self.common = Common()
     self.hall_page = Hall_Page()
     self.personinfo_page = Personinfo_Page()
     self.game_page = Game_Page()
     self.yuepai_page = Yuepai_Page()
     # 初始化Luadriver
     self.start_step("初始化driver")
     self.luadriver = self.common.setupdriver()
     # 每个用例都需要关闭活动,把这个放在初始化里面实现
     self.common.closeactivity(self.luadriver)
     self.mid = self.common.get_config_value("casecfg", "mid")
     self.common.recover_user(self.mid)
     PHPInterface.set_vip(self.mid, 5)
Beispiel #8
0
 def pre_test(self):
     #删除自动登陆文件,置为游客状态
     self.common = Common()
     global mid
     mid = self.common.get_config_value("casecfg", "mid")
     PHPInterface.set_vip(mid, 4)
     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(self.luadriver)
Beispiel #9
0
    def set_PlayerData(self, VIPType, kickCnt):
        '''
        设置玩家VIP及踢人卡数量,由于有界面操作   只能放在进入大厅成功后调用
        :param VIPCnt: 是否有VIP
        :param kickCnt: 踢人卡张数  踢人卡id为36  None:则是不设置踢人卡数量
        :return:
        '''
        self.start_step("设置玩家数据")

        if PHPInterface.set_vip(mid, VIPType) == 0:
            self.common.platformLog("接口设置VIP信息失败")
            return False
        else:
            self.common.platformLog("设置VIP状态成功")

        #目前道具接口有问题,设置为0   会返回失败  当设置数量为0时,强制返回True
        status = False
        if PHPInterface.add_props(mid, 36, kickCnt) == 0 and kickCnt != 0:
            self.common.platformLog("设置踢人卡数量失败")
            status = False
        else:
            global kickCard_cnt
            kickCard_cnt = kickCnt
            status = True
        self.common.platformLog("测试开始前设置被测玩家初始数据", mid, VIPType, kickCnt,
                                "设置VIP和踢人卡结果:", status)
        return status
 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):
     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
     # user_info = self.common.get_user()
     # print user_info
     # global UserID
     # 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_vip(mid, 4)  # 设置用户为vip
 def pre_test(self):
     self.common = Common()
     self.luadriver = self.common.setupdriver()
     self.hall_page = Hall_Page()
     self.sign_page = Sign_Page()
     self.personinfo_page = Personinfo_Page()
     # 设置成VIP
     PHPInterface.set_vip(self.casedata['mid'], 4)
     time.sleep(1)
     # 每个用例都需要关闭活动,把这个放在初始化里面实现
     self.common.closeactivitytest(self.luadriver)
     self.hall_page.wait_element("头像").click()
     time.sleep(2)
     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 "已关闭窗口"
 def pre_test(self):
     global UserID
     UserID = self.casedata.get('mid')
     print 'UserID:%s' % UserID
     PHPInterface.set_vip(UserID, 4)  # 设置用户为vip
     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.closeactivitytest(self.luadriver)
     self.hall_page.wait_element("头像").click()
     time.sleep(5)
     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 "已关闭窗口"
 def pre_test(self):
     global UserID
     UserID = self.casedata.get('mid2')
     print 'UserID:%s' % UserID
     # PHPInterface.set_env(PHPInterface.PRE_REPUBLISH_ENV)
     PHPInterface.set_vip(UserID, 4)  # 设置用户为vip
     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, '预发布')
     self.hall_page.wait_element("头像").click()
     time.sleep(5)
     self.common.loginuser(self.casedata['user2'],
                           self.casedata['password2'])
     i = 0
     while i < 3:
         i += 1
         try:
             self.personinfo_page.wait_element("关闭").click()
         except:
             print "已关闭窗口"
Beispiel #15
0
    def run_test(self):
        self.common.switchserver()
        self.start_step("关闭弹出框")
        self.common.closeactivity(self.luadriver)
        time.sleep(15)
        self.kill_popup_windom()

        mid = self.common.get_mid()
        self.log_info("当前用户mid:%s" % str(mid))
        r_v = PHPInterface.set_coin(mid, 50000)
        self.log_info("设置用户 银币数 接口返回值:%s" % str(r_v))

        self.common.switchserver()
        time.sleep(15)
        self.kill_popup_windom()

        self.loop_current_page_game()
        r_v = PHPInterface.set_vip(mid, 5)
        self.log_info("设置用户 vip 接口返回值:%s" % str(r_v))

        self.log_info("第二页游戏")
        self.game_page.wait_element("右三角标", timesleep=1).click()
        self.loop_current_page_game()
 def post_test(self):
     PHPInterface.set_vip(self.casedata['mid'], -1)
     self.common.closedriver()
Beispiel #17
0
    def test_step(self, game_id):
        '''
        1.玩家是VIP,进入房间游戏开始后通过后把玩家的VIP设置为过期
        2.玩家在牌局中点击聊天按钮,切到VIP表情,发送一个VIP表情后查看玩家头像显示
        :return:
        '''
        self.common.platformLog("C27488_KickPlayer_VIPExpired开始具体测试步骤",
                                game_id)
        self.common.set_coin(mid, 15000)

        if self.game_page.element_is_exist("房间标志", 60):
            self.common.platformLog("60s进入房间成功")
            self.game_page.screenshot(game_id + "_进入房间成功.png")
        else:
            self.assert_equal("60s进入房间失败_", game_id)
            self.game_page.screenshot(game_id + "_进入房间失败.png")
            return 0

        #若有准备按钮,则点击准备按钮  只有斗地主是自动准备好的
        try:
            self.game_page.wait_element("准备", 2).click()
        except:
            pass
        if kick_base.wait_in_game(self):
            try:
                if PHPInterface.set_vip(mid, -1):
                    self.common.platformLog("设置VIP过期成功")
                    # 斗地主 叫抢按钮会自动关闭弹框   等提示操作按钮出现后再进行操作
                    if game_id == "game203":
                        if self.game_page.element_is_exist("操作面板", 180):
                            self.common.platformLog("操作面板出现")
                            pass
                        else:
                            self.game_page.screenshot("斗地主牌局开始失败.png")
                            self.assert_equal("斗地主  180s未出现操作面板,测试失败", True,
                                              False)
                            return 0

                    # 使用VIP表情
                    chatBtn_name = "聊天"
                    if chatBtn_ElNames_dict != None and game_id in chatBtn_ElNames_dict:
                        chatBtn_name = chatBtn_ElNames_dict[game_id]

                    self.yuepai_page.wait_element(chatBtn_name, 2).click()
                    time.sleep(2)
                    self.yuepai_page.wait_element("表情", 2).click()
                    self.yuepai_page.wait_element("vip表情", 2).click()
                    self.yuepai_page.wait_element("VIPFaceItem", 2).click()

                    # 查看个人头像VIP标识
                    headsEle = self.game_page.get_elements("头像frame")

                    headsEle[0].click()
                    if self.game_page.element_is_exist("自己信息框VIP标识"):
                        self.assert_equal("VIP设置过期后,消失失败", True, False)
                        self.game_page.screenshot(game_id + "_VIP标识消失失败" +
                                                  ".png")
                        return 0
                    else:
                        self.common.platformLog("自己VIP标志消失,结果正确")
                        self.game_page.screenshot(game_id + "_VIP消失" + ".png")

                    # 关闭个人信息框
                    if self.game_page.element_is_exist("信息框同步标志", 1):
                        self.luadriver.back()

                    # 再次打开聊天表情项,查看能否使用VIP表情
                    self.yuepai_page.get_element("聊天").click()
                    time.sleep(2)
                    self.yuepai_page.wait_element("表情", 2).click()
                    self.yuepai_page.wait_element("vip表情", 2).click()
                    if self.yuepai_page.element_is_exist("立即成为VIP"):
                        self.common.platformLog("C27488_KickPlayer_VIPExpired",
                                                game_id, "测试成功")
                        self.game_page.screenshot(game_id + "_显示成为VIP按钮" +
                                                  ".png")
                    else:
                        self.assert_equal("VIP设置过期后,VIP表情失效失败", True, False)
                        self.game_page.screenshot(game_id + "_VIP表情未失效" +
                                                  ".png")
                else:
                    self.assert_equal("设置VIP过期信息失败,结束测试", True, False)
            except:
                self.assert_equal("VIP过期状态检测,失败", True, False)
                self.game_page.screenshot(game_id + "_VIP过期状态失败" + ".png")
        else:
            self.assert_equal("牌局指定时间内未开始测试失败", True, False)
            self.game_page.screenshot(game_id + "牌局指定时间内未开始测试失败" + ".png")