Beispiel #1
0
    def traversal_gameList(self, game_list, is_next=False):
        for game in game_list:
            gameid_name = game.get_attribute("name")
            gameid = int(gameid_name[4:len(gameid_name)])
            self.start_step("机器人开关打开")
            print PHPInterface.set_robot_flag(gameid, 0, 0, 12, 1)
            if BaseCase.enterGame(self, game, is_next):
                if not self.game_page.element_is_exist("换桌"):
                    self.assert_equal(gameid_name + " 游戏没有找到换桌按钮", True, False)

                if not BaseCase.gameIsAutoReady(self, game) :
                    if self.game_page.element_is_exist("准备"):
                        self.start_step("点击准备")
                        self.game_page.wait_element("准备").click()
                    else:
                        self.assert_equal(gameid_name + " 游戏没有找到准备按钮", True, False)
                        BaseCase.gameToHall(self)
                        continue

                # 下局取款
                if BaseCase.wait_for_gameover(self, gameid_name):
                    # self.start_step("一局后取款")
                    self.game_page.wait_element("房间内菜单").click()
                    self.game_page.wait_element("取款").click()
                    self.safebox_page.wait_element("减少金条/银条数目").click()
                    self.safebox_page.wait_element("确定---保险箱").click()
                    self.game_page.screenshot("%s一局后取款.png"% gameid_name)
                self.start_step("关闭机器人")
                print PHPInterface.set_robot_flag(gameid, 0, 0, 12, 0)
                self.start_step("退出子游戏房间%s到大厅" % gameid_name)
                BaseCase.gameToHall(self)
                # 恢复银币数
                self.common.set_coin(mid, "10000")
                self.common.switchserver()
                self.common.closeactivity(self.luadriver)
Beispiel #2
0
    def traversal_gameList(self,game_list, is_next=False):
        for game in game_list:
            gameid_name = game.get_attribute("name")
            gameid = int(gameid_name[4:len(gameid_name)])
            # 关机器人
            print PHPInterface.set_robot_flag(gameid, 0, 0, 12, 0)
            self.start_step("点击大厅游戏位:%s" % gameid_name)
            if BaseCase.enterGame(self, game, is_next):
                if not BaseCase.gameIsAutoReady(self, game):
                    try:
                        self.start_step("点击准备")
                        self.game_page.wait_element("准备").click()
                    except:
                        self.assert_equal(gameid_name + "未出现准备按钮", False, True)
                        BaseCase.gameToHall(self)
                        continue

                # 能获取到换桌,说明牌局未开始
                if self.game_page.element_is_exist("换桌"):
                    self.start_step("退出游戏房间")
                    BaseCase.gameToHall(self)
                else:
                    self.assert_equal(gameid_name + "未出现换桌按钮", False, True)
                    BaseCase.gameToHall(self)
                    continue
Beispiel #3
0
    def traversal_gameList(self, game_list, is_next=False):
        for game in game_list:
            gameid_name= game.get_attribute("name")
            gameid = int(gameid_name[4:len(gameid_name)])
            self.start_step("关闭机器人")
            PHPInterface.set_robot_flag(gameid, 0, 0, 12, 0)
            if BaseCase.enterGame(self, game, is_next):
                if not BaseCase.gameIsAutoReady(self, game):
                    if self.game_page.element_is_exist("准备"):
                        self.start_step("点击房间内菜单按钮")
                        self.game_page.wait_element("房间内菜单").click()
                        self.game_page.wait_element("取款").click()
                        # self.game_page.screenshot("%s保险箱.png" % gameid_name)

                        # self.start_step("拖动滑动杆")
                        ele = self.safebox_page.wait_element("滑动杆")
                        startX = ele.location['x'] + ele.size['width']
                        y = ele.location['y'] + ele.size['height'] / 2
                        # 滑动杆向左滑动1/5
                        endX = ele.location['x'] + ele.size['width'] * 4 / 5
                        # endX = ele.location['x']
                        self.luadriver.swipe(startX, y, endX, y)
                        self.safebox_page.wait_element("确定---保险箱").click()
                        # self.start_step("取款成功后点准备会升场")
                        self.game_page.wait_element("准备").click()
                        self.game_page.screenshot("%s升场.png" % gameid_name)
                    else:
                        self.assert_equal(gameid_name + "未出现准备按钮", False, True)

                self.start_step("退出子游戏房间%s到大厅" % gameid_name)
                BaseCase.gameToHall(self)
                # 恢复玩家携带银币数
                self.common.set_coin(mid, "10000")
                self.common.switchserver()
                self.common.closeactivity(self.luadriver)
Beispiel #4
0
    def traversal_gameList(self, game_list, is_next=False):
        for game in game_list:
            gameid_name = game.get_attribute("name")
            gameid = int(gameid_name[4:len(gameid_name)])
            self.start_step("关闭机器人")
            PHPInterface.set_robot_flag(gameid, 0, 0, 12, 0)
            if BaseCase.enterGame(self, game, is_next):
                if not BaseCase.gameIsAutoReady(self, game):
                    if self.game_page.element_is_exist("准备"):
                        self.start_step("点击房间内菜单按钮")
                        self.game_page.wait_element("房间内菜单").click()
                        self.game_page.screenshot("%s房间内菜单.png" % gameid_name)
                        self.game_page.wait_element("取款").click()
                        self.game_page.screenshot("%s保险箱.png" % gameid_name)
                        self.start_step("减少牌桌银币保险箱银币数:")
                        self.safebox_page.wait_element("减少金条/银条数目").click()
                        self.safebox_page.wait_element("确定---保险箱").click()
                    else:
                        self.assert_equal(gameid_name + "未出现准备按钮", False, True)

                self.start_step("退出子游戏房间%s到大厅" % gameid_name)
                BaseCase.gameToHall(self)
                #恢复玩家携带银币数
                self.common.set_coin(mid, "10000")
                self.common.switchserver()
                self.common.closeactivity(self.luadriver)
Beispiel #5
0
    def traversal_gameList(self, game_list, is_next=False):
        for game in game_list:
            gameid_name = game.get_attribute("name")
            gameid = int(gameid_name[4:len(gameid_name)])
            self.start_step("关机器人")
            print PHPInterface.set_robot_flag(gameid, 0, 0, 12, 0)
            self.start_step("进入大厅游戏: %s" % gameid_name)
            if BaseCase.enterGame(self, game, is_next):
                if not BaseCase.gameIsAutoReady(self, game):
                    if self.game_page.element_is_exist("准备"):
                        self.start_step("点击菜单查看取款按钮状态")
                        self.game_page.wait_element("房间内菜单").click()
                        self.game_page.screenshot("%s未准备看取款按钮状态.png" % gameid_name)
                        self.start_step("点击取款")
                        self.game_page.wait_element("取款").click()
                        if self.game_page.element_is_exist("关闭银币保险箱") == False:
                            self.assert_equal(gameid_name + "取款按钮点击失败", False, True)
                        else:
                            self.game_page.wait_element("关闭银币保险箱").click()
                    else:
                        self.assert_equal(gameid_name + "未出现准备按钮", False, True)

                self.start_step("从%s游戏房间返回到大厅" % gameid_name)
                # 牌局未开始
                if self.game_page.element_is_exist("换桌"):
                    BaseCase.gameToHall(self)
                # 牌局已开始
                elif BaseCase.wait_for_gameover(self, gameid_name):
                    BaseCase.gameToHall(self)
Beispiel #6
0
    def traversal_gameList(self, game_list, is_next=False):
        for game in game_list:
            gameid_name = game.get_attribute("name")
            gameid = int(gameid_name[4:len(gameid_name)])
            self.start_step("进入大厅游戏:%s" % gameid_name)
            self.start_step("机器人开关打开")
            PHPInterface.set_robot_flag(gameid, 0, 0, 12, 1)
            if BaseCase.enterGame(self, game, is_next):
                if not BaseCase.gameIsAutoReady(self, game):
                    try:
                        self.start_step("点击房间内准备按钮")
                        self.game_page.wait_element("准备").click()
                    except:
                        self.assert_equal(gameid_name + "未出现准备按钮", False, True)
                        BaseCase.gameToHall(self)
                        continue

                #等待几秒 确保牌局开始
                time.sleep(5)
                self.start_step("点击房间内菜单")
                self.clickRoomMenu(gameid_name)
                # BaseCase.clickRoomMenu(self, gameid_name)
                self.start_step("等待游戏结束,从游戏房间返回到大厅")
                # notoverFlag = True
                # while notoverFlag:
                #     if self.game_page.element_is_exist("换桌") or self.game_page.element_is_exist("牌局结束换桌"):
                #         notoverFlag = False
                #         self.luadriver.back()
                #     elif not self.game_page.element_is_exist("换桌") and not self.game_page.element_is_exist("牌局结束换桌"):
                #         time.sleep(1)
                if BaseCase.wait_for_gameover(self, gameid_name):
                    BaseCase.gameToHall(self)
                self.start_step("关闭机器人")
                PHPInterface.set_robot_flag(gameid, 0, 0, 12, 0)
Beispiel #7
0
 def run_test(self):
     self.start_step("等待页面加载完成")
     self.hall_page.wait_element("同步标志")
     self.start_step('获取mid')
     self.hall_page.wait_element('测试按钮').click()
     element = self.luadriver.find_lua_element_by_name('uid')
     text = element.get_attribute('text')
     global mid
     mid = int(re.search('\d+', text).group())
     print mid
     self.hall_page.wait_element('关闭测试页面').click()
     self.start_step('进入约牌')
     self.hall_page.wait_element('约牌').click()
     time.sleep(4)
     self.start_step('进入记分房')
     self.yuepai_page.wait_element('记分房').click()
     elements = self.yuepai_page.get_elements('子游戏')
     for element in elements:
         if element.get_attribute('text') == '斗地主':
             element.click()
     try:
         self.yuepai_page.wait_element('确定').click()
     except:
         print '已下载'
     PHPInterface.set_robot_flag(0, 0, 0, 12, 1)
     Flag = True
     while Flag:
         try:
             self.yuepai_page.wait_element('百分比')
         except:
             Flag = False
         time.sleep(2)
     self.start_step('点击开房')
     self.yuepai_page.wait_element('开房').click()
     time.sleep(5)
     try:
         self.yuepai_page.wait_element('准备').click()
     except:
         print '已准备'
     time.sleep(5)
     self.yuepai_page.wait_element('+邀请').click()
     time.sleep(2)
     self.hall_page.screenshot('1.png')
     Flag = True
     while Flag:
         try:
             self.game_page.wait_element('game20结算框标志')
             Flag = False
         except:
             print '玩牌中'
         time.sleep(2)
     self.hall_page.screenshot('2.png')
     PHPInterface.set_robot_flag(0, 0, 0, 12, 0)
Beispiel #8
0
 def run_test(self):
     self.start_step("等待页面加载完成")
     self.hall_page.wait_element("同步标志")
     self.start_step('获取mid')
     self.hall_page.wait_element('测试按钮').click()
     element = self.luadriver.find_lua_element_by_name('uid')
     text = element.get_attribute('text')
     global mid
     mid = int(re.search('\d+', text).group())
     print mid
     self.hall_page.wait_element('关闭测试页面').click()
     self.hall_page.wait_element('葫芦岛麻将').click()
     try:
         self.game_page.wait_element('资源下载-确定').click()
     except:
         print '游戏已下载'
     PHPInterface.set_robot_flag(2601, 0, 0, 12, 1)
     Flag = True
     while Flag:
         try:
             self.hall_page.wait_element('场次名称')
             Flag = False
         except:
             pass
         time.sleep(1)
     self.hall_page.wait_element('场次名称').click()
     time.sleep(5)
     self.hall_page.wait_element('准备').click()
     time.sleep(5)
     Eles = self.game_page.get_elements('游戏内头像')
     Ele_ymax = Eles[0]
     for Ele in Eles:
         if int(Ele.location['y']) > int(Ele_ymax.location['y']):
             Ele_ymax = Ele
     Ele_ymax.click()
     time.sleep(2)
     self.hall_page.screenshot('游戏内头像.png')
     Flag = True
     while Flag:
         try:
             self.game_page.wait_element('game2601换桌')
             Flag = False
         except:
             print '玩牌中'
         time.sleep(2)
     self.hall_page.screenshot('结算页面弹出.png')
     PHPInterface.set_robot_flag(2601, 0, 0, 12, 0)
Beispiel #9
0
 def run_test(self):
     self.start_step("等待页面加载完成")
     self.hall_page.wait_element("同步标志")
     self.start_step('获取mid')
     self.hall_page.wait_element('测试按钮').click()
     element = self.luadriver.find_lua_element_by_name('uid')
     text = element.get_attribute('text')
     global mid
     mid = int(re.search('\d+', text).group())
     print mid
     self.hall_page.wait_element('关闭测试页面').click()
     self.hall_page.wait_element('葫芦岛麻将').click()
     try:
         self.game_page.wait_element('资源下载-确定').click()
     except:
         print '游戏已下载'
     PHPInterface.set_robot_flag(2601, 0, 0, 12, 1)
     Flag = True
     while Flag:
         try:
             self.hall_page.wait_element('场次名称')
             Flag = False
         except:
             pass
         time.sleep(1)
     self.hall_page.wait_element('场次名称').click()
     time.sleep(5)
     self.hall_page.wait_element('准备').click()
     time.sleep(2)
     self.hall_page.screenshot('进入房间.png')
     Flag = True
     while Flag:
         try:
             self.game_page.wait_element('game2601换桌')
             Flag = False
         except:
             print '玩牌中'
         time.sleep(2)
     self.hall_page.screenshot('结算页面.png')
     self.game_page.wait_element('game2601关闭').click()
     time.sleep(2)
     self.hall_page.screenshot('关闭结算页面.png')
     self.game_page.wait_element('换桌').click()
     time.sleep(1)
     self.hall_page.screenshot('点击换桌.png')
     PHPInterface.set_robot_flag(2601, 0, 0, 12, 1)
Beispiel #10
0
 def set_robot(self,gameid,level=12,robotflag=0):
     '''
     设置机器人开关
     '''
     gamecfg = Interface.get_levelconfig(gameid, 0, 0, level)
     robotflag1 = gamecfg.get('values', {'ADDROBOTFLAG': None}).get('ADDROBOTFLAG')
     if (robotflag1 != robotflag):
         result = Interface.set_robot_flag(gameid, 0, 0, level, robotflag=robotflag)
         print result
     return True
Beispiel #11
0
 def set_Robot(self,
               gameid,
               basechiptype=0,
               playmode=1,
               roomlevel=1,
               robotflag=0):
     #七人焖鸡默认的七人玩法,对应的playmod是3  其余游戏均为0
     if gameid == '23':
         playmode = 3
     return PHPInterface.set_robot_flag(gameid, basechiptype, playmode,
                                        roomlevel, robotflag)
Beispiel #12
0
 def traverseGameList(gameList, needClickRight=False):
     for gameElement in gameList:
         if needClickRight and self.hall_page.element_is_exist("右三角"):
             self.hall_page.wait_element("右三角").click()
         gameElement.click()
         if self.hall_page.element_is_exist("重新获取", 3):
             self.game_page.screenshot(
                 gameElement.get_attribute("name") + "_open_failed.png")
             self.hall_page.wait_element("关闭对话框").click()
             continue
         self.game_page.game_is_download()
         gameId = gameElement.get_attribute("name")
         PHPInterface.set_robot_flag(re.search("\d+", gameId), 0, 0, 12,
                                     1)
         if self.game_page.element_not_exist("广播"):
             self.game_page.click_game_play()
         self.game_page.get_elements("房间场次")[0].click()
         test_game(gameId)
         PHPInterface.set_robot_flag(re.search("\d+", gameId), 0, 0, 12,
                                     0)
         while True:
             if self.hall_page.element_is_exist("客服", 3):
                 break
             self.driver.back()
Beispiel #13
0
    def traversal_gameList(self, game_list, is_next=False):
       for game in game_list:
           gameid_name = game.get_attribute("name")
           gameid = int(gameid_name[4:len(gameid_name)])
           self.start_step("机器人开关打开")
           print PHPInterface.set_robot_flag(gameid, 0, 0, 12, 1)
           self.start_step("进入大厅游戏%s" % gameid_name)
           if BaseCase.enterGame(self, game, is_next):
               if not BaseCase.gameIsAutoReady(self, game):
                   try:
                       self.start_step("点击房间内准备按钮")
                       self.game_page.wait_element("准备").click()
                   except:
                       self.assert_equal(gameid_name + "未出现准备按钮", False, True)
                       BaseCase.gameToHall(self)
                       continue

               self.start_step("等待游戏结束")
               if BaseCase.wait_for_gameover(self, gameid_name):
                  self.clickRoomMenu(gameid_name)
               self.start_step("从%s游戏房间返回到大厅" % gameid_name)
               BaseCase.gameToHall(self)
               self.start_step("关闭机器人")
               print PHPInterface.set_robot_flag(gameid, 0, 0, 12, 0)
Beispiel #14
0
 def open_autoPerson(self, gameElement):
     name = gameElement.get_attribute("name")
     gameid = int(name[4:len(name)])
     # 获取gameid
     PHPInterface.set_robot_flag(gameid, 0, 0, 12, 1)