示例#1
0
class Initialize(TestCase):
    '''
    用例初始化
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.common = Common()
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()
        # self.common.deletefile(self.luadriver)
        self.common.closeactivity_switchserver(self.luadriver)

    def run_test(self):
        '''
        测试用例
        '''
        self.hall_page.wait_element("同步标志")
        self.hall_page.screenshot("hall.png")
        self.start_step("获取mid")
        mid = self.common.get_mid()
        self.common.set_config_value("casecfg", "mid", str(mid))
        print self.common.get_config_value("casecfg", "mid")
        env = self.common.get_config_value('casecfg', 'env')
        if env != "0":
            self.log_info("游戏机器人开关设置为关闭")
            self.start_step("设置第一页的游戏开关")
            gamelist = self.game_page.get_game_list()
            print gamelist
            for i in range(len(gamelist)):
                gamename = gamelist[i].get_attribute("name")
                gameid = filter(lambda ch: ch in '0123456789', gamename)
                print gameid
                self.game_page.set_robot(gameid=gameid)
            self.start_step("点击大厅第二页")
            if (self.game_page.element_is_exist("右三角标") == True):
                self.game_page.wait_element("右三角标").click()
            else:
                self.game_page.wait_element("左三角标").click()
            self.start_step("查看第二屏子游戏列表")
            gamelist = self.game_page.get_game_list()
            print gamelist
            for i in range(len(gamelist)):
                gamename = gamelist[i].get_attribute("name")
                gameid = filter(lambda ch: ch in '0123456789', gamename)
                print gameid
                self.game_page.set_robot(gameid=gameid)
            self.common.recover_user(str(mid))

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        self.common.closedriver()
示例#2
0
class D25736_ThreeRoom_Enter_ToomuchMoney(TestCase):
    '''
    三人场进场
    金币过多
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 15
    # pending = True

    def pre_test(self):
        self.common = Common()
        global mid,money
        money = 30000
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_money(mid, money)
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()
        self.level_page = Level_Page()
        self.start_step("初始化driver")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity()

    def run_test(self):
        self.hall_page.wait_element("同步标志")
        self.start_step("进去三人场")
        while self.hall_page.element_is_exist("游戏列表"):
            elments1 = self.hall_page.get_elements("游戏列表")
            print len(elments1)
            elments1[2].click()
        self.start_step("查看房间列表")
        self.hall_page.screenshot("查看房间列表.png")
        elments = self.level_page.get_elements("房间列表")
        self.start_step("获取初级场底分")
        image_element = self.game_page.wait_element("场次底分")
        chujichangdifen = self.common.image_text(image_element)
        if chujichangdifen == '':
            chujichangdifen = '50'
        self.log_info("初级场底分:"+chujichangdifen)
        self.start_step("点击初级场房间")
        self.level_page.wait_element("房间列表").click()
        string = self.level_page.wait_element("金币超出文本").get_attribute("text")
        self.assert_equal("检查是否出现金币超出弹框",string.find("您的金币已超过本房间上限")!= -1)
        self.level_page.screenshot("金币超出.png")
        self.level_page.wait_element("去高级场").click()
        self.level_page.screenshot("高级场房间.png")
        elments1 = self.game_page.wait_element("房间底分")
        room = self.common.image_text(elments1)
        if room.isdigit():
            self.start_step("初级场底:%s,房间底分:%s,核对是否是高级场" %(chujichangdifen,room))
            self.assert_equal("进入了高级场",actual= int(room)>int(chujichangdifen))
        self.game_page.is_in_gameroom(self.luadriver)

    def post_test(self):
        try:
            self.game_page.is_in_gameroom(self.luadriver)
            self.common.set_money(mid, 3000)
        finally:
            self.common.closedriver()
示例#3
0
class C31067_DFQP_Exchange_Gold_Exchange1(TestCase):
    '''
    携带银币充足兑换
    总银币大于20w,携带银币大于103000
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 8

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.start_step("设置银币大于20w")
        self.common.set_coin(mid=mid, value='200001')
        self.hall_page = Hall_Page()
        self.exchange_page = Exchange_Page()
        self.safebox_page = Safebox_Page()
        self.personinfo_page = Personinfo_Page()
        self.start_step("初始化Luadriver")
        self.luadriver = self.common.setupdriver()
        self.start_step("关闭活动")
        self.common.closeactivity(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step('进入保险箱页面')
        self.hall_page.wait_element('保险箱').click()
        self.start_step("将银币存入保险箱")
        self.safebox_page.wait_element("银币").click()
        self.safebox_page.wait_element("存入").click()
        self.start_step("将银币存入保险箱")
        element1 = self.safebox_page.wait_element("滚动条")
        element2 = self.safebox_page.wait_element("增加金条/银条数目")
        swipe_startx = element1.location['x']
        swipe_starty = element1.location['y']
        swipe_endx = element2.location['x']
        swipe_endy = element2.location['y']
        print swipe_startx, swipe_starty, swipe_endx, swipe_endy, swipe_endx
        self.luadriver.swipe(swipe_startx, swipe_starty,
                             swipe_startx + (swipe_endx - swipe_startx) / 2,
                             swipe_endy, 1000)
        self.safebox_page.wait_element('确定---保险箱').click()
        self.luadriver.keyevent(4)
        self.start_step("进入金条兑换界面")
        self.exchange_page.wait_element("换金条").click()
        self.exchange_page.screenshot("Gold_Exchange1.png")

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        try:
            self.common.recover_user()
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
示例#4
0
class C30978_DFCP_Task_Interface_GetReward(TestCase):
    '''
    领取牌局任务奖励
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        PHPInterface.set_mission_to_complete(mid, 103000, 369, 1)
        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(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.hall_page.wait_element("任务").click()
        time.sleep(2)
        self.task_page.wait_element("每日任务tag").click()
        time.sleep(2)
        # self.common.swipeelement(self.task_page.wait_element("玩游戏任务列表2"),self.task_page.wait_element("玩游戏任务列表1"))
        time.sleep(5)
        # self.task_page.wait_element("玩游戏任务1").click()
        # time.sleep(2)
        # try:
        #     self.game_page.wait_element("资源下载-确定").click()
        #     time.sleep(15)
        # except:
        #     print ("游戏已下载")
        # self.hall_page.screenshot('game1.png')
        elements = self.task_page.get_elements("领取奖励")
        count = 0
        print len(elements)
        while (count < len(elements)):
            element_text = elements[count].get_attribute('text')
            if element_text == '领奖励':
                print '找到并点击了领奖励'
                elements[count].click()
                time.sleep(4)
                self.task_page.screenshot("lingqujiangli %s.png" % count)
                break
            count = count + 1

    def post_test(self):

        self.common.recover_user(mid)
        # self.common.deletefile(self.luadriver)
        self.common.closedriver()
示例#5
0
class C31045_DFQP_Safebox_Bring3w(TestCase):
    '''
    	携带银币数大于20000
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_coin(mid=mid, value='30000')
        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(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step('进入保险箱页面')
        self.hall_page.wait_element('保险箱').click()
        time.sleep(3)
        self.start_step("将银币存入保险箱")
        self.safebox_page.wait_element("银币保险箱").click()
        time.sleep(3)
        self.safebox_page.wait_element("存入").click()
        time.sleep(3)
        try:
            self.safebox_page.wait_element("存入").click()
            time.sleep(3)
        except:
            print "无此按钮"
        self.start_step("拖动滑动条")
        self.common.swipeelement(self.safebox_page.wait_element("滚动条"),
                                 self.safebox_page.wait_element("增加金条/银条数目"))
        time.sleep(8)
        self.safebox_page.wait_element('确定---保险箱').click()
        time.sleep(5)
        self.safebox_page.screenshot('safebox1.png')

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        # self.common.release_user(user_info['mid'])
        # self.common.deletefile(self.luadriver)
        self.common.recover_user(mid=mid)
        self.common.closedriver()
示例#6
0
class D25687_LaiziRoom_Enter(TestCase):
    '''
    金币不足进入房间
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 15

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_money(mid, 900)
        self.hall_page = Hall_Page()
        self.level_page = Level_Page()
        self.game_page = Game_Page()
        self.start_step("初始化driver")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity()

    def run_test(self):
        self.hall_page.wait_element("同步标志")
        self.start_step("进去癞子场")
        while self.hall_page.element_is_exist("游戏列表"):
            elments1 = self.hall_page.get_elements("游戏列表")
            elments1[1].click()
            self.start_step("切换到癞子场")
            self.game_page.wait_element("切换按钮").click()
            elments = self.game_page.get_elements("切换玩法")
            elments[0].click()
            self.level_page.wait_element("快速开始").click()
        self.start_step("点击初级场房间")
        elments = self.level_page.get_elements("房间列表")
        print len(elments)
        for j in range(3):
            self.start_step("点击第%s个房间" % (j + 1))
            elments[j].click()

            try:
                self.level_page.wait_element("关闭2").click()
            except:
                self.log_info("未出现此按钮")
            self.game_page.element_is_exist("立即购买")
            self.assert_equal(
                "检查是否出现立即购买",
                self.level_page.wait_element("立即购买文本").get_attribute("text") ==
                "立即购买")
            self.game_page.screenshot("点击第%s个房间界面.png" % (j + 1))
            self.hall_page.wait_element("关闭1").click()
        self.game_page.is_in_gameroom(self.luadriver)

    def post_test(self):
        try:
            self.game_page.is_in_gameroom(self.luadriver)
            self.common.set_money(mid, 5000)
        finally:
            self.common.closedriver()
class D25763_FourRoom_Cards_Display(TestCase):
    '''
    房间内底牌及倍数显示是否正常
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 15
    pending = True

    def pre_test(self):
        self.common = Common()
        self.start_step("设置金币数为30001")
        global mid, money
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_money(mid, 30001)
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()
        self.level_page = Level_Page()
        self.start_step("初始化driver")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity()

    def run_test(self):
        self.hall_page.wait_element("同步标志")
        self.start_step("进入四人场")
        while self.hall_page.element_is_exist("游戏列表"):
            elments = self.hall_page.get_elements("游戏列表")
            elments[3].click()
        self.start_step("查看房间列表")
        elments = self.level_page.get_elements("房间列表")
        self.start_step("进入房间")
        difenlist = {'1': '10', '2': '50', '3': '100'}
        for j in range(len(elments) / 2):
            if j < 3:
                self.start_step("进入第%s个房间" % (j + 1))
                elments[j].click()
                time.sleep(5)
                self.game_page.wait_element("四人场房间底分")
                self.game_page.screenshot("第%s个房间底分为%s.png" %
                                          ((j + 1), difenlist[str(j + 1)]))
                image_element = self.game_page.wait_element("四人场房间底分")
                beishutext = self.common.image_text(image_element)
                # if beishutext.isdigit():
                #     self.assert_equal("底分展示",actual=beishutext,expect=difenlist[str(j+1)])
                while self.game_page.element_is_exist("退出"):
                    self.game_page.wait_element("退出").click()
        self.game_page.is_in_gameroom(self.luadriver)

    def post_test(self):
        try:
            self.game_page.is_in_gameroom(self.luadriver)
            self.common.set_money(mid, 5000)
        finally:
            self.common.closedriver()
示例#8
0
class C31069_DFQP_Exchange_Gold_Exchange3(TestCase):
    '''
    成功兑换金条
    总银币大于20w,携带银币等于103000
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 8

    def pre_test(self):
        self.common = Common()
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.start_step("设置银币大于20w")
        self.common.set_safeBoxMoney("200001")
        self.common.set_coin(mid=mid, value='103000')
        self.hall_page = Hall_Page()
        self.exchange_page = Exchange_Page()
        self.safebox_page = Safebox_Page()
        self.personinfo_page = Personinfo_Page()
        self.start_step("关闭活动")
        self.common.closeactivity(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step("进入金条兑换界面")
        self.exchange_page.wait_element("换金条").click()
        dict1 = PHPInterface.get_user_info(mid)  # 获取玩家信息
        crystal = eval(dict1).get('result', {
            'crystal': None
        }).get('crystal')  # 获取当前金币
        time.sleep(3)
        self.exchange_page.wait_element("确定兑换").click()
        time.sleep(2)
        self.exchange_page.screenshot("Gold_Exchange1.png")
        dict1 = PHPInterface.get_user_info(mid)  # 获取玩家信息
        crystal1 = eval(dict1).get('result', {
            'crystal': None
        }).get('crystal')  # 获取当前金币
        self.assert_equal(True, crystal + 200, crystal1)

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        try:
            self.common.recover_user()
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
示例#9
0
class C30973_DFQP_Share1(TestCase):
    '''
    领取微信任务奖励
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 8

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        PHPInterface.set_mission_to_complete(mid, 103000, 541)
        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(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        time.sleep(1)
        self.hall_page.wait_element("同步标志")
        self.start_step("进入任务页面")
        self.hall_page.wait_element("任务").click()
        time.sleep(2)
        self.task_page.wait_element("每日任务tag").click()
        time.sleep(5)
        self.start_step("微信邀请好友")
        try:
            self.task_page.wait_element("微信邀请好友").click()
            # self.luadriver.find_element_by_xpath("//element/element/taskRewardLayout/content/dayTaskListView/element/dayTaskItem/bg/btn/doTask").click()
            time.sleep(1)
            self.task_page.screenshot('hare1.png')
        except:
            print("暂未此任务")

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        # self.common.release_user(user_info['mid'])
        # self.common.deletefile(self.luadriver)
        self.common.closedriver()
示例#10
0
class C31048_DFQP_Safebox(TestCase):
    '''
    携带金币数小于200
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_crystal(mid=mid, value='100')
        # 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(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step('进入保险箱页面')
        self.hall_page.wait_element('保险箱').click()
        time.sleep(2)
        self.start_step("将金条存入保险箱")
        self.safebox_page.wait_element("金条保险箱").click()
        time.sleep(2)
        self.safebox_page.wait_element("存入").click()
        time.sleep(2)
        self.safebox_page.screenshot("safebox.png")

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        # self.common.release_user(UserID)
        # self.common.deletefile(self.luadriver)
        self.common.closedriver()
示例#11
0
class D25770_FourRoom_Money_Display(TestCase):
    '''
    金币和元宝信息显示正常
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 15

    def pre_test(self):
        self.common = Common()
        global mid, money
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_money("mid", value="5000")
        money = Interface.get_money(mid)
        self.log_info("金币数:%s" % money)
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()
        self.level_page = Level_Page()
        self.start_step("初始化driver")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity()

    def run_test(self):
        self.hall_page.wait_element("同步标志")
        self.start_step("进入四人场")
        while self.hall_page.element_is_exist("游戏列表"):
            elments = self.hall_page.get_elements("游戏列表")
            elments[3].click()
        self.start_step("进入房间")
        while self.level_page.element_is_exist("房间列表"):
            self.level_page.wait_element("房间列表").click()
        time.sleep(5)
        self.game_page.screenshot("金币元宝显示.png")
        image_element = self.game_page.wait_element("购买金币")
        text = self.common.image_text(image_element)
        self.log_info("text:" + text)
        self.start_step("接口获取的金币数目为:%s,界面获取的金币数目为:%s,核对是否一致" % (money, text))
        # if text.isdigit():
        #     self.assert_equal("金币数是否一致",actual=text,expect=money)
        self.game_page.is_in_gameroom(self.luadriver)

    def post_test(self):
        try:
            self.game_page.is_in_gameroom(self.luadriver)
            self.common.set_money(mid, 5000)
        finally:
            self.common.closedriver()
class D25708_DoubleLaizi_Quickstart(TestCase):
    '''
    金币不足,快速开始
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 20

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_money(mid, 999)
        self.hall_page = Hall_Page()
        self.level_page = Level_Page()
        self.game_page = Game_Page()
        self.start_step("初始化driver")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity()

    def run_test(self):
        self.hall_page.wait_element("同步标志")
        self.start_step("进去癞子场")
        while self.hall_page.element_is_exist("游戏列表"):
            elments1 = self.hall_page.get_elements("游戏列表")
            print len(elments1)
            elments1[1].click()
        self.level_page.wait_element("快速开始").click()
        try:
            self.level_page.wait_element("关闭2").click()
        except:
            self.log_info("未出现此按钮")
        self.game_page.element_is_exist("立即购买")
        self.assert_equal(
            "检查是否出现立即购买",
            self.level_page.wait_element("立即购买文本").get_attribute("text") ==
            "立即购买")
        self.game_page.screenshot("快速开始界面.png")
        self.hall_page.wait_element("关闭1").click()
        self.game_page.is_in_gameroom(self.luadriver)

    def post_test(self):
        try:
            self.game_page.is_in_gameroom(self.luadriver)
            self.common.set_money(mid, 5000)
        finally:
            self.common.closedriver()
示例#13
0
class D25726_DoubleLaizi_Money_Display(TestCase):
    '''
    房间金币元宝显示
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 15

    def pre_test(self):
        self.common = Common()
        global money
        money = 1000
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()
        self.level_page = Level_Page()
        self.start_step("初始化driver")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity()
        self.common.user_money(money=money)

    def run_test(self):
        self.start_step("进入双癞子场")
        while self.hall_page.element_is_exist("游戏列表"):
            elments1 = self.hall_page.get_elements("游戏列表")
            elments1[1].click()
        self.start_step("进入房间")
        while self.level_page.element_is_exist("房间列表"):
            self.level_page.wait_element("房间列表").click()
        time.sleep(5)
        self.game_page.screenshot("金币元宝显示.png")
        elment1 = self.game_page.wait_element("购买金币")
        text = self.common.image_text(elment1)
        self.log_info("text:" + text)
        self.start_step("界面获取的金币数目为:%s,核对是否一致" % text)
        env = self.common.get_config_value('casecfg', 'env')
        if env == "0":
            if text.isdigit():
                self.game_page.screenshot("界面金币数")
                self.log_info("当前为正式服,界面获取的金币数目为:%s" % text)
        elif env == "1":
            if text.isdigit():
                self.assert_equal("当前为测试服,判断金币数是否一致", actual=int(text) == 1000)
        self.game_page.is_in_gameroom(self.luadriver)

    def post_test(self):
        self.game_page.is_in_gameroom(self.luadriver)
        self.common.closedriver()
示例#14
0
class D25758_FourRoom_Displays(TestCase):
    '''
    金币不足
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 15

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_money(mid, 1000)
        self.hall_page = Hall_Page()
        self.level_page = Level_Page()
        self.game_page = Game_Page()
        self.start_step("初始化driver")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity()

    def run_test(self):
        self.hall_page.wait_element("同步标志")
        self.start_step("进去四人场")
        while self.hall_page.element_is_exist("游戏列表"):
            elments = self.hall_page.get_elements("游戏列表")
            elments[3].click()
        self.start_step("点击快速开始")
        self.level_page.wait_element("快速开始").click()
        self.level_page.screenshot("破产点击快速开始出现的界面.png")
        try:
            self.level_page.wait_element("关闭2").click()
        except:
            self.log_info("未出现此按钮")
        self.level_page.element_is_exist("立即购买")
        self.assert_equal(
            "检查是否出现立即购买",
            self.level_page.wait_element("立即购买文本").get_attribute("text") ==
            "立即购买")
        self.level_page.screenshot("立即购买")

    def post_test(self):
        try:
            self.game_page.is_in_gameroom(self.luadriver)
            self.common.set_money(mid, 5000)
        finally:
            self.common.closedriver()
示例#15
0
class D25749_ThreeRoom_Talkfor1000_Display(TestCase):
    '''
    1000、5000底注场
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 15
    # pending = True

    def pre_test(self):
        self.common = Common()
        self.start_step("设置金币数为100000")
        global mid,money
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_money(mid,100000)
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()
        self.level_page = Level_Page()
        self.start_step("初始化driver")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity()

    def run_test(self):
        self.hall_page.wait_element("同步标志")
        self.start_step("进去三人场")
        elments1 = self.hall_page.get_elements("游戏列表")
        print len(elments1)
        elments1[2].click()
        self.start_step("查看房间列表")
        self.hall_page.screenshot("查看房间列表.png")
        elments = self.level_page.get_elements("房间列表")
        self.common.swipeelement(elments[3], elments[1])
        elments = self.level_page.get_elements("房间列表")
        print len(elments)
        self.start_step("进入房间")
        elments[len(elments)*1/2-2].click()
        self.game_page.wait_element("聊天").click()
        self.hall_page.screenshot("聊天.png",sleeptime=0)
        self.game_page.is_in_gameroom(self.luadriver)

    def post_test(self):
        try:
            self.game_page.is_in_gameroom(self.luadriver)
            self.common.set_money(mid, 3000)
        finally:
            self.common.closedriver()
示例#16
0
class C30975_DFCP_Task_TaskandBroke(TestCase):
    '''
    破产状态做牌局任务
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_coin(mid, "2000")
        # 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()

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.hall_page.wait_element("任务").click()
        time.sleep(2)
        self.task_page.wait_element("每日任务tag").click()
        time.sleep(2)
        self.common.swipeelement(self.task_page.wait_element("玩游戏任务列表2"),
                                 self.task_page.wait_element("玩游戏任务列表1"))
        time.sleep(2)
        self.task_page.wait_element("玩游戏任务1").click()
        time.sleep(2)
        try:
            self.game_page.wait_element("资源下载-确定").click()
            time.sleep(15)
        except:
            print("游戏已下载")
        self.hall_page.screenshot('game1.png')

    def post_test(self):
        self.common.recover_user(mid)
        # self.common.deletefile(self.luadriver)
        self.common.closedriver()
示例#17
0
class C30976_DFCP_Task_Interface_TaskEnterGame1(TestCase):
    '''
    银币不足但未破产做牌局任务
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 5

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_coin(mid, "3000")
        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(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.hall_page.wait_element("任务").click()
        time.sleep(2)
        self.task_page.wait_element("每日任务tag").click()
        time.sleep(2)
        self.common.swipeelement(self.task_page.wait_element("玩游戏任务列表2"),
                                 self.task_page.wait_element("玩游戏任务列表1"))
        time.sleep(2)
        self.task_page.wait_element("玩游戏任务1").click()
        time.sleep(2)
        try:
            self.game_page.wait_element("资源下载-确定").click()
            time.sleep(15)
        except:
            print("游戏已下载")
        self.hall_page.screenshot('game1.png')

    def post_test(self):
        self.common.recover_user(mid)
        # self.common.release_user(user_info['mid'])
        # self.common.deletefile(self.luadriver)
        self.common.closedriver()
示例#18
0
class C31034_DFCP_Backpack_GetPro(TestCase):
    '''
    购买道具,商城购买道具,查看物品箱
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 5

    def pre_test(self):
        self.common = Common()
        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()
        global mid
        mid = self.common.get_config_value("casecfg","mid")
        self.common.set_coin(mid,value=50000)
        self.start_step("初始化driver")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step("进入物品箱页面")
        self.hall_page.wait_element("物品箱").click()
        self.hall_page.screenshot('Backpack_Enterpack1.png')
        self.luadriver.keyevent(4)
        self.start_step("进入商城页面")
        self.hall_page.wait_element("商城").click()
        self.mall_page.wait_element("道具页签").click()
        self.start_step("购买道具")
        self.mall_page.wait_element("提示卡").click()
        self.sign_page.wait_element("购买").click()
        self.mall_page.wait_element("返回").click()
        self.start_step("进入物品箱页面")
        self.hall_page.wait_element("物品箱").click()
        self.hall_page.screenshot('buy.png')

    def post_test(self):
        # self.common.release_user(user_info['mid'])
        # self.common.deletefile(self.luadriver)
        self.common.recover_user(mid=mid)
        self.common.closedriver()
示例#19
0
class D25774_FourRoom_Change_Table(TestCase):
    '''
    换桌
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 15

    def pre_test(self):
        self.common = Common()
        global mid, money
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_money(mid, 5000)
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()
        self.level_page = Level_Page()
        self.start_step("初始化driver")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity()

    def run_test(self):
        self.hall_page.wait_element("同步标志")
        self.start_step("进去四人场")
        while self.hall_page.element_is_exist("游戏列表"):
            elments1 = self.hall_page.get_elements("游戏列表")
            elments1[3].click()
        self.start_step("进入房间")
        while self.level_page.element_is_exist("房间列表"):
            self.level_page.wait_element("房间列表").click()
        time.sleep(6)
        self.game_page.wait_element("换桌").click()
        self.level_page.screenshot("换桌.png")
        self.level_page.screenshot("换桌1.png")
        self.start_step("退出玩牌房间")
        self.game_page.is_in_gameroom(self.luadriver)

    def post_test(self):
        try:
            self.game_page.is_in_gameroom(self.luadriver)
            self.common.set_money(mid, 5000)
        finally:
            self.common.closedriver()
示例#20
0
class C31060_DFCP_Mall_Interface_GetPro(TestCase):
    '''
    商城购买道具
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 5

    def pre_test(self):
        self.common = Common()
        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()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_coin(mid=mid, value='53000')
        # global user_info
        # user_info = self.common.get_user()
        # print user_info
        self.luadriver = self.common.setupdriver()
        # 每个用例都需要关闭活动,把这个放在初始化里面实现
        self.common.closeactivity(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.start_step("进入商城页面")
        self.hall_page.wait_element("商城").click()
        self.mall_page.wait_element("道具页签").click()
        self.start_step("购买道具")
        self.mall_page.wait_element("提示卡").click()
        time.sleep(5)
        self.sign_page.wait_element("购买").click()
        time.sleep(2)
        self.hall_page.screenshot('bug.png')

    def post_test(self):
        # self.common.release_user(user_info['mid'])
        # self.common.deletefile(self.luadriver)
        self.common.closedriver()
        self.common.recover_user(mid)
示例#21
0
class C61017_DFQP_Message_Display1(TestCase):
    '''
    消息界面展示
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.start_step("初始化环境")
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        PHPInterface.send_message(int(mid), "接口发送vip私信", "接口发送vip私信", 4, 1, 0)
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()
        self.message_page = Message_Page()
        self.hall_page = Hall_Page()
        self.personinfo_page = Personinfo_Page()
        self.backpack_page = Backpack_Page()

    def run_test(self):
        '''
        测试用例
        '''
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        time.sleep(4)
        self.start_step("进入消息页面")
        self.hall_page.wait_element("消息").click()
        time.sleep(3)
        self.start_step("查看消息")
        self.hall_page.screenshot('message_display.png')

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        try:
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
示例#22
0
class C31064_DFQP_Exchange_gold1(TestCase):
    '''
    金条兑换
    银币大于20w,金条兑换入口显示
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.common = Common()
        self.hall_page = Hall_Page()
        self.exchange_page = Exchange_Page()
        self.personinfo_page = Personinfo_Page()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.start_step("设置银币大于20w")
        self.common.set_coin(mid=mid, value='200001')
        self.start_step("初始化Luadriver")
        self.luadriver = self.common.setupdriver()
        self.start_step("关闭活动")
        self.common.closeactivity(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step("进入金条兑换界面")
        self.exchange_page.wait_element("换金条").click()
        self.exchange_page.wait_element("确定兑换")
        self.exchange_page.screenshot("Exchange_gold1.png")

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        try:
            self.common.recover_user()
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
示例#23
0
class C31265_DFQP_Match_MyInvolved(TestCase):
    '''
    大厅比赛场---查看我报名的邀请赛
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):

        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_coin(mid=mid, value='53000')
        # 初始化luadriver
        # print ("pre_test")
        self.luadriver = self.common.setupdriver()
        # PHPInterface.set_env(env=PHPInterface.PRE_REPUBLISH_ENV)
        self.common.closeactivity(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()

    def run_test(self):
        '''
        测试用例
        '''
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        time.sleep(5)
        self.start_step("点击比赛场按钮")
        self.hall_page.wait_element("比赛场").click()
        time.sleep(5)
        self.start_step("点击邀请赛")
        self.match_page.wait_element("比赛场-邀请赛").click()
        time.sleep(5)
        self.start_step("查看我报名的邀请赛")
        self.match_page.wait_element("我报名的邀请赛").click()
        time.sleep(3)
        self.match_page.screenshot("1.png")
        if (self.match_page.element_is_exist("已报名比赛1") == True):
            self.match_page.wait_element("已报名比赛1").click()
            time.sleep(3)
            self.match_page.screenshot("2.png")
            time.sleep(3)
            self.match_page.wait_element("退赛").click()
            time.sleep(3)
            self.match_page.screenshot("3.png")
            time.sleep(2)
            self.luadriver.keyevent(4)
            time.sleep(3)

        else:
            print("没有已报名的邀请赛")
            self.luadriver.keyevent(4)
            time.sleep(3)
            self.start_step("创建邀请赛")
            self.match_page.wait_element("创建邀请赛").click()
            time.sleep(3)
            self.match_page.wait_element("完成创建").click()
            time.sleep(3)
            self.match_page.wait_element("确定").click()
            time.sleep(3)
            self.match_page.screenshot("4.png")
            time.sleep(3)
            self.match_page.wait_element("马上报名").click()
            time.sleep(3)
            if (self.game_page.element_is_exist("资源下载-确定") == True):
                self.game_page.wait_element("资源下载-确定").click()
                time.sleep(10)
            else:
                self.match_page.screenshot("5.png")
                time.sleep(3)
                self.match_page.wait_element("知道了/现在进入").click()
                time.sleep(3)
                print("邀请赛报名成功")
                self.match_page.wait_element("箭头返回").click()
                time.sleep(3)
                self.start_step("查看我报名的邀请赛")
                self.match_page.wait_element("我报名的邀请赛").click()
                time.sleep(3)
                self.match_page.screenshot("6.png")
                self.match_page.wait_element("已报名比赛1").click()
                time.sleep(3)
                self.match_page.screenshot("7.png")
                time.sleep(3)
                self.match_page.wait_element("退赛").click()
                time.sleep(3)
                self.match_page.screenshot("8.png")
                time.sleep(2)
                self.luadriver.keyevent(4)
                time.sleep(3)

        self.match_page.wait_element("箭头返回").click()
        time.sleep(3)
        self.match_page.wait_element("返回").click()
        time.sleep(3)
        self.hall_page.wait_element("同步标志")

    def post_test(self):
        '''
        测试用例执行完后,清理测试环境
        '''
        try:
            self.common.recover_user(mid)
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
示例#24
0
class C31264_DFQP_Match_MyMatch(TestCase):
    '''
    大厅比赛场---查看我创建的邀请赛
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 15

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_coin(mid=mid, value='53000')
        self.luadriver = self.common.setupdriver()
        # PHPInterface.set_env(env=PHPInterface.PRE_REPUBLISH_ENV)
        self.common.closeactivity(self.luadriver)  # 关闭活动弹框
        self.hall_page = Hall_Page()
        self.match_page = Match_Page()
        self.personinfo_page = Personinfo_Page()
        self.start_step("获取用户ID信息")

    def run_test(self):
        '''
        测试用例
        '''
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        time.sleep(5)
        self.start_step("点击比赛场按钮")
        self.hall_page.wait_element("比赛场").click()
        time.sleep(3)
        self.start_step("点击邀请赛")
        self.match_page.wait_element("比赛场-邀请赛").click()
        time.sleep(5)
        self.start_step("创建邀请赛")
        self.match_page.wait_element("创建邀请赛").click()
        time.sleep(5)
        self.match_page.wait_element("完成创建").click()
        time.sleep(3)
        self.match_page.screenshot("1.png")
        time.sleep(3)
        self.match_page.wait_element("确定").click()
        time.sleep(3)
        self.match_page.screenshot("2.png")
        time.sleep(3)
        self.match_page.wait_element("关闭").click()
        time.sleep(3)
        print("邀请赛创建成功")
        self.match_page.wait_element("箭头返回").click()
        time.sleep(3)
        self.start_step("查看我创建的邀请赛")
        self.match_page.wait_element("我创建的邀请赛").click()
        time.sleep(3)
        self.match_page.screenshot("3.png")
        time.sleep(3)
        self.match_page.wait_element("邀请好友/领取退还奖品").click()
        time.sleep(3)
        if (self.match_page.element_is_exist("微信邀请") == True):
            self.start_step("微信邀请好友")
            try:
                self.start_step("微信邀请好友")
                self.match_page.wait_element("微信邀请").click()
                time.sleep(3)
                self.match_page.screenshot("4.png")
                # time.sleep(3)
                # self.luadriver.keyevent(4)
                time.sleep(2)
                self.luadriver.keyevent(4)
            except:
                print "微信邀请好友失败"
            self.start_step("QQ邀请好友")
            time.sleep(2)
            self.start_step("QQ邀请好友")
            self.match_page.wait_element("QQ邀请").click()
            time.sleep(3)
            self.match_page.screenshot("5.png")
            time.sleep(2)
            self.match_page.wait_element("立即邀请").click()
            time.sleep(2)
            self.match_page.screenshot("6.png")
            while (self.match_page.element_is_exist("面对面扫码") == False):
                time.sleep(2)
                self.luadriver.keyevent(4)
                self.match_page.screenshot("61.png")
            time.sleep(2)
            self.start_step("面对面扫码")
            self.match_page.wait_element("面对面扫码").click()
            time.sleep(3)
            self.match_page.screenshot("7.png")
            time.sleep(2)
            self.luadriver.keyevent(4)
            time.sleep(2)
            self.luadriver.keyevent(4)
            time.sleep(2)
        else:
            print("领取退还奖品")
            self.match_page.screenshot("8.png")
        self.match_page.wait_element("箭头返回").click()
        time.sleep(3)
        self.match_page.wait_element("箭头返回").click()
        time.sleep(3)
        self.match_page.wait_element("返回").click()
        time.sleep(3)
        self.hall_page.wait_element("同步标志")

    def post_test(self):
        '''
        测试用例执行完后,清理测试环境
        '''
        self.common.recover_user(mid)
        self.common.closedriver()
示例#25
0
class C31263_DFQP_Match_CreateInvitational(TestCase):
    '''
    大厅比赛场---创建邀请赛
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        global coin, totalmoney, safebox_crystal
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_coin(mid=mid, value='20000')
        self.common.set_crystal(mid=mid, value='450')
        self.hall_page = Hall_Page()
        self.match_page = Match_Page()
        self.personinfo_page = Personinfo_Page()
        self.luadriver = self.common.setupdriver()
        # PHPInterface.set_env(env=PHPInterface.PRE_REPUBLISH_ENV)
        self.common.closeactivity(self.luadriver)  #关闭活动弹框

    def run_test(self):
        '''
        测试用例
        '''
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        time.sleep(5)
        self.start_step("点击比赛场按钮")
        self.hall_page.wait_element("比赛场").click()
        time.sleep(10)
        self.start_step("点击邀请赛")
        self.match_page.wait_element("比赛场-邀请赛").click()
        time.sleep(10)
        self.start_step("创建邀请赛")
        self.match_page.wait_element("创建邀请赛").click()
        time.sleep(3)
        self.match_page.wait_element("完成创建").click()
        time.sleep(3)
        self.match_page.screenshot("3.png")
        time.sleep(3)
        # 现金不足
        if (coin < 53000):
            # 现金不足,存款足够
            if (totalmoney >= 53000):
                self.match_page.wait_element("notNow").click()
                time.sleep(3)
                self.match_page.screenshot("4.png")
                time.sleep(3)
                self.match_page.wait_element("确定").click()
                time.sleep(3)
                self.match_page.screenshot("5.png")
                time.sleep(3)
                self.match_page.wait_element("关闭").click()
                time.sleep(3)
                self.match_page.wait_element("箭头返回").click()
            #现金不足,存款不足
            elif (totalmoney < 53000):
                self.match_page.wait_element("现在充值").click()
                time.sleep(3)
                self.match_page.screenshot("5.png")
                time.sleep(3)
                self.match_page.wait_element("关闭").click()
                time.sleep(3)
                self.match_page.wait_element("箭头返回").click()
        #现金足够
        else:
            self.match_page.wait_element("确定").click()
            time.sleep(3)
            self.match_page.screenshot("5.png")
            time.sleep(3)
            self.match_page.wait_element("关闭").click()
            time.sleep(3)
            self.match_page.wait_element("箭头返回").click()

        self.match_page.wait_element("箭头返回").click()
        time.sleep(3)
        self.match_page.wait_element("返回").click()
        time.sleep(3)
        self.hall_page.wait_element("同步标志")

    def post_test(self):
        '''
        测试用例执行完后,清理测试环境
        '''
        try:
            self.common.recover_user(mid)
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
示例#26
0
class C30963_DFQP_Sign(TestCase):
    '''
    VIP用户打开每日签到界面领,签到领取银币
    '''
    owner = "YoungLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 5

    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)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        user_info1 = PHPInterface.get_user_info(mid)  #获取用户信息
        coin = json.loads(user_info1).get('result', {'coin': None}).get('coin')
        print '签到前银币:' + str(coin)
        # 关闭悬浮球
        self.common.closefloatBall()
        i = 0
        while i < 3:
            i += 1
            try:
                self.personinfo_page.wait_element("关闭").click()
            except:
                print "已关闭窗口"
        self.start_step('进入任务界面')
        self.hall_page.wait_element('任务').click()
        self.start_step('进入每日签到界面')
        self.sign_page.wait_element('每日签到页面').click()
        self.start_step('进入每日签到页面开始签到')
        try:
            self.sign_page.wait_element('签到').click()
        except:
            print '已签到过'
        self.personinfo_page.screenshot('.png')
        time.sleep(5)
        user_info = PHPInterface.get_user_info(mid)  # 获取用户信息
        coin1 = json.loads(user_info1).get('result', {
            'coin': None
        }).get('coin')
        print '签到后银币:' + str(coin1)
        if coin1 == coin + 1000:
            print 'vip用户签到获得1000银币'
        else:
            print 'vip用户签到没有获得1000银币'

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        # self.common.release_user(user_info['mid'])
        # self.common.deletefile(self.luadriver)
        self.common.recover_user(mid)
        self.common.closedriver()
示例#27
0
class C30965_DFQP_Sign(TestCase):
    '''
    无补签卡,点击补签按钮购买补签卡
    '''
    owner = "YoungLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        self.common.set_coin(mid=mid, value='60000')
        self.hall_page = Hall_Page()
        self.sign_page = Sign_Page()
        self.personinfo_page = Personinfo_Page()
        self.luadriver = self.common.setupdriver()
        self.start_step("关闭活动,并切换到预发布")
        self.common.closeactivity(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.common.closefloatBall()
        self.start_step('进入任务界面')
        self.hall_page.wait_element('任务').click()
        self.start_step('进入每日签到界面')
        self.sign_page.wait_element('每日签到页面').click()
        try:
            self.sign_page.wait_element('补签').click()
        except:
            print '已签到过'
        List = self.sign_page.wait_element('补签卡数量').get_attribute('text')
        print List
        buSignupNum = re.findall(r'\d+', List)
        AddNum = int(buSignupNum[0])
        if int(buSignupNum[0]) > 0:
            PHPInterface.set_sign_card(mid, -1, AddNum)  #如果事先有补签卡,则先删除所有补签卡
            self.common.closeactivity_switchserver(self.luadriver)
            self.start_step('进入任务界面')
            self.hall_page.wait_element('任务').click()
            time.sleep(4)
            self.start_step('进入每日签到界面')
            self.sign_page.wait_element('每日签到页面').click()
            try:
                self.sign_page.wait_element('补签').click()
            except:
                print '已签到过'
        self.start_step('点击获取按钮')
        self.sign_page.wait_element('获取').click()
        time.sleep(4)
        self.start_step('点击购买')
        self.sign_page.wait_element('购买').click()
        time.sleep(4)
        self.personinfo_page.screenshot('.png')
        List = self.sign_page.wait_element('补签卡数量').get_attribute('text')
        print List
        buSignupNum = re.findall(r'\d+', List)
        if buSignupNum == ['1']:
            print '补签卡成功购买到账'
        else:
            print '补签卡未能成功购买到账'
        user_info = PHPInterface.get_user_info(mid)  # 获取玩家信息
        coin = json.loads(user_info).get('result', {
            'coin': None
        }).get('coin')  # 获取当前银币值
        if coin == 10000:
            print '50000银币扣除'

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        # self.common.release_user(user_info['mid'])
        self.common.recover_user(mid)
        self.common.closedriver()
示例#28
0
class C30968_DFQP_Sign(TestCase):
    '''
    有2张补签卡,每日签到界面点击2次【补】按钮
    '''
    owner = "YoungLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 5

    def pre_test(self):
        self.common = Common()
        global mid
        mid = self.common.get_config_value("casecfg", "mid")
        PHPInterface.set_sign_card(mid, 1, 2)  # 后台添加一张补签卡
        # 初始化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)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        # 关闭悬浮球
        self.common.closefloatBall()
        self.common.closeActivityBtn()
        self.start_step('进入任务界面')
        self.hall_page.wait_element('任务').click()
        self.start_step('进入每日签到界面')
        self.sign_page.wait_element('每日签到tag').click()
        try:
            self.sign_page.wait_element('补签').click()
            self.start_step('进入补签页面')
        except:
            print '已签过到'
        self.start_step('第一次点击[补]开始补签')
        for i in range(1, 37):  # 轮询查找[补]按钮,找到便break循环
            element = self.luadriver.find_lua_element_by_xpath(
                '//element/element/taskRewardLayout/content/dayRewardView/buSignupView/calendarView/element/element/dayCalendarItem/bu[%d]'
                % i)
            element_name = element.get_attribute('name')
            if element_name == 'bu':
                element.click()
                print '找到并点击了[补]按钮'
                try:
                    self.sign_page.wait_element('确定补签').click()
                except:
                    print '已补签过'
                break
            else:
                print '继续查找[补]按钮'
        self.start_step('第二次点击[补]开始补签')
        for i in range(1, 37):  # 轮询查找[补]按钮,找到便break循环
            element = self.luadriver.find_lua_element_by_xpath(
                '//element/element/taskRewardLayout/content/dayRewardView/buSignupView/calendarView/element/element/dayCalendarItem/bu[%d]'
                % i)
            element_name = element.get_attribute('name')
            if element_name == 'bu':
                element.click()
                self.personinfo_page.screenshot('.png')
                print '找到并点击了[补]按钮'
                try:
                    self.sign_page.wait_element('确定补签').click()
                except:
                    print '已补签过'
                break
            else:
                print '继续查找[补]按钮'

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        # self.common.release_user(user_info['mid'])
        # self.common.deletefile(self.luadriver)
        self.common.closedriver()
示例#29
0
class C27385_quicklyStartGame_coinsEnough(TestCase):
    '''
    玩家自身携带条件不足够进入全部玩法场次时,快速开始入场
    '''
    owner = "GuixiangGui"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 30
    
    def pre_test(self):
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()
        self.yuepai_page = Yuepai_Page()
        self.common = Common()
        self.start_step("初始化driver")
        self.driver = self.common.setupdriver()
        self.start_step("关闭弹出框")
        self.common.closeactivity(self.driver)
        
    def run_test(self):
        
        def test_game(gameElement, needClickRight, isTiro = True):
            gameId = gameElement.get_attribute("name")
            self.start_step("进入子游戏%s " %gameId)
            levelConfig = PHPInterface.get_levelconfig(re.search('\d+', gameId).group(), 0, 0, 12)
            tiro_high_limit = int(levelConfig.get("values").get("HIGH_LIMIT"))
            screenName = gameId
            if tiro_high_limit < 0 and not isTiro:
                return
            if isTiro:
                if tiro_high_limit < 0:
                    tiro_high_limit = int(levelConfig.get("values").get("LOW_LIMIT"))+500
                self.common.set_coin(self.mid, tiro_high_limit-100)
                screenName = screenName+'Tiro.png'
            else:
                self.common.set_coin(self.mid, tiro_high_limit+100)
                screenName = screenName+'Midrange.png'
            
            self.common.switchserver()
            self.common.closeActivityBtn()
                
            if needClickRight and self.hall_page.element_is_exist("右三角"):
                self.hall_page.wait_element("右三角").click()
                
            self.start_step("开始快速开场测试")
            gameElement.click()
            
            self.game_page.wait_element("快速开始").click()
            if self.game_page.element_is_exist("菜单键", 10):
                self.game_page.screenshot(screenName)
            else:
                self.game_page.screenshot(gameId+"_intoRoom_fail.png")
                
            self.yuepai_page.is_exist_yuepairoom()
            # while True:
            #     if self.hall_page.element_is_exist("预发布"):
            #         break
            #     self.driver.back()
        
        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()
                if self.game_page.element_not_exist("广播"):
                    self.game_page.click_game_play()
                roomLevel = self.game_page.get_elements("房间场次")
                if len(roomLevel)>1:
                    try:
                        test_game(gameElement, needClickRight, True)
                        test_game(gameElement, needClickRight, False)
                    except:
                        self.game_page.screenshot(gameElement.get_attribute("name")+"_failed.png")
                 
                try:
                    self.start_step("退出房间")
                    self.yuepai_page.is_exist_yuepairoom()
                    self.game_page.wait_element("返回1").click()
                except:
                    self.log_info("退出房间失败")
        
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.mid = self.common.get_config_value("casecfg", "mid")
        self.start_step("遍历首页游戏列表")
        traverseGameList(self.game_page.get_game_list())
        try:
            self.hall_page.wait_element("右三角").click()
            traverseGameList(self.game_page.get_game_list(), True)
        except:
            print "没有右三角按钮"
            
    def post_test(self):
        self.common.closedriver()
        self.common.recover_user(self.mid)
示例#30
0
class base(TestCase):
    def pre_test(self, propsCount):
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()
        self.common = Common()
        mid = self.common.get_config_value("casecfg", "mid")
        #         PHPInterface
        self.start_step("初始化driver")
        self.driver = self.common.setupdriver()
        self.start_step("关闭弹出框")
        self.common.closeactivity(self.driver)

    def test(self, useCount=1):
        def test_game(gameId):

            headsEle = self.game_page.get_elements("头像frame")
            propsEle = self.game_page.get_elements("道具")
            headsEle[0].click()
            self.game_page.screenshot(gameId + "_propsDisplay" + ".png")
            propsEle[0].click()
            self.game_page.screenshot(gameId + "_self_interactive" + ".png")
            if len(headsEle) > 1:
                count = self.useCount
                while count > 0:
                    headsEle[1].click()
                    propsEle[0].click()
                    count = count - 1

                self.game_page.screenshot(gameId + "_playerB_interactive" +
                                          ".png")
                propsEle[0].click()
                self.game_page.screenshot(gameId + "_afterUse_display" +
                                          ".png")
            while True:
                if self.hall_page.element_is_exist("预发布"):
                    break
                self.driver.back()

        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()

        self.useCount = useCount
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.mid = self.common.get_config_value("casecfg", "mid")
        self.start_step("遍历首页游戏列表")
        traverseGameList(self.game_page.get_game_list())
        try:
            self.hall_page.wait_element("右三角").click()
            traverseGameList(self.game_page.get_game_list(), True)
        except:
            print "没有右三角按钮"

    def post_test(self):
        self.common.closedriver()