Esempio n. 1
0
class C70458_Scroeroom_Invite(TestCase):
    '''
    记分房手机未安装微信/QQ邀请,邀请玩家
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 5

    def pre_test(self):
        self.common = Common()
        self.hall_page = Hall_Page()
        self.yuepai_page = Yuepai_Page()
        # 初始化Luadriver
        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.start_step("创建免费记分房")
        self.yuepai_page.create_room('记分房')
        self.start_step('点击邀请按钮')
        self.yuepai_page.wait_element('+邀请', 30).click()
        self.yuepai_page.screenshot("invite.png")
        # if (self.yuepai_page.element_is_exist("微信邀请") == True):
        self.start_step("微信邀请好友")
        try:
            self.start_step("微信邀请好友")
            self.yuepai_page.wait_element("微信邀请").click()
            time.sleep(3)
            self.yuepai_page.screenshot("weichat.png")
            time.sleep(2)
            self.luadriver.keyevent(4)
        except:
            print "微信邀请好友失败"
        if (self.yuepai_page.element_is_exist("QQ邀请") == True):
            pass
        else:
            self.yuepai_page.wait_element('+邀请', 30).click()
        self.start_step("QQ邀请")
        self.yuepai_page.wait_element("QQ邀请").click()
        self.yuepai_page.screenshot("5.png")
        self.yuepai_page.wait_element("立即邀请").click()
        self.yuepai_page.screenshot("6.png")
        self.luadriver.keyevent(4)
        self.start_step("退出约牌房")
        self.yuepai_page.exit_yuepai_page()
        self.hall_page.wait_element("同步标志")

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        self.common.closedriver()
Esempio n. 2
0
class GameRoom_Initialize(TestCase):
    '''
    游戏房间初始化,目前只初始化了斗地主
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 30

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

    def gameroom_init(self, is_next=False):
        # game_list = self.game_page.get_game_list()
        game_list = ['game203']
        print game_list
        for i in range(len(game_list)):
            # self.start_step("打开机器人开关")
            gamename = game_list[i]
            if (self.game_page.game_is_exist(self.luadriver,
                                             gamename) == True):
                gameid = filter(lambda ch: ch in '0123456789', gamename)
                print gameid
                # gameid = '203'
                # gamename = "game203"
                # self.game_page.set_robot(gameid=gameid,robotflag=1)
                self.start_step("进入子游戏:%s" % game_list[i])
                time.sleep(1)
                self.luadriver.find_lua_element_by_name(gamename).click()
                self.game_page.game_is_download()
                try:
                    self.game_page.wait_element("同步标志", 20)
                    self.log_info("进入游戏ID:%s 的房间" % gamename)
                    try:
                        self.log_info("进入游戏ID:%s 的第一个玩法" % gamename)
                        elements = self.game_page.game_play_way()
                        elements[0][1].click()
                    except:
                        self.log_info("当前子游戏初级场")
                    self.game_page.wait_element("房间场次").click()
                    # self.game_page.screenshot("%s.png" % game_list[i])
                    self.start_step("判断当前游戏是否自动准备,如果是,则继续玩游戏,否则,退出房间")
                    if (self.game_page.element_is_exist("抢地主", 30) == True):
                        self.game_page.wait_element("抢地主").click()
                        while (self.yuepai_page.element_is_exist("准备",
                                                                 3) == False):
                            try:
                                self.yuepai_page.wait_element("菜单键").click()
                                self.game_page.wait_element("托管").click()
                                self.game_page.screenshot("%s.png" % gameid)
                                break
                            except:
                                self.log_info("托管失败")
                        try:
                            self.yuepai_page.wait_element("准备", 100)
                        except:
                            self.log_info("等待准备按钮出现失败")
                except:
                    try:
                        self.hall_page.wait_element("关闭对话框").click()
                    except:
                        self.log_info("未找到元素")
                try:
                    self.start_step("退出房间")
                    self.yuepai_page.is_exist_yuepairoom()
                    self.game_page.wait_element("返回1").click()
                    if is_next == True:
                        self.log_info("is_next为True则表示遍历的是第二页的子游戏")
                        self.game_page.wait_element("右三角标").click()
                except:
                    self.log_info("未找到元素")
                self.start_step("关闭机器人开关")
                self.common.set_robot(gameid=gameid, robotflag=0)

    def run_test(self):
        '''
        测试用例
        '''
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step("查看首屏子游戏列表")
        self.gameroom_init()
        # 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("查看第二屏子游戏列表,是否有规则按钮")
        # self.gameroom_init(is_next=True)

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        # mid = self.common.get_config_value("casecfg", "mid")
        # self.common.recover_user(mid)
        self.common.closedriver()
Esempio n. 3
0
class C31030_DFQP_Message_Gold(TestCase):
    '''
    金条私信
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.start_step("初始化环境")
        self.common = Common()
        global user_info
        user_info = self.common.get_user()
        print user_info
        print user_info['mid']
        # 初始化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()
        self.start_step("金条私信")
        # 每个用例都需要关闭活动,并切换到预发布
        self.common.closeactivity_switchserver(self.luadriver)
        dict = PHPInterface.get_user_info(user_info['mid'])  # 获取玩家信息
        global crystal
        crystal = eval(dict).get('result', {
            'crystal': None
        }).get('crystal')  # 获取当前银币值
        print crystal
        return1 = PHPInterface.send_message(int(user_info['mid']), "金条私信",
                                            "金条私信", 1, 1, 0)
        print return1
        self.start_step("判断是否登陆")
        if not self.common.isloginuser(self.luadriver):
            self.common.loginuser(user_info['user'], user_info['password'])
            self.common.closeActivityBtn()
        else:
            if self.personinfo_page.wait_element("账号ID").get_attribute(
                    'text') != user_info['cid']:
                self.common.loginuser(user_info['user'], user_info['password'])
                self.common.closeActivityBtn()
        try:
            self.personinfo_page.wait_element("关闭").click()
        except:
            print "已关闭窗口"

    def run_test(self):
        '''
        测试用例
        '''
        self.start_step("等待页面加载完成")
        self.hall_page.element_is_exist("同步标志")
        self.hall_page.wait_element("同步标志")
        time.sleep(4)
        self.start_step("进入消息页面")
        self.hall_page.wait_element("消息").click()
        time.sleep(2)
        self.start_step("查看消息")
        try:
            try:
                element = self.message_page.get_elements("小琪妹")
                element[1].click()
            except:
                self.message_page.wait_element("小琪妹").click()
            time.sleep(3)

            self.message_page.screenshot('getcalls1.png')
            self.start_step("立即领取")
            self.message_page.wait_element("立即领取").click()
            time.sleep(3)
            self.message_page.screenshot('getcalls2.png')
            self.message_page.wait_element("知道了").click()
            time.sleep(2)
            self.message_page.wait_element('已领取').get_attribute(
                'text') == "已领取"
        except:
            print("没有消息")
        time.sleep(6)
        # self.message_page.wait_element("返回").click()
        # self.hall_page.wait_element("头像").click()
        # self.hall_page.wait_element("同步标志")
        dict1 = PHPInterface.get_user_info(user_info['mid'])  # 获取玩家信息
        crystal1 = eval(dict1).get('result', {
            'crystal': None
        }).get('crystal')  # 获取当前银币值
        print crystal1
        self.assert_equal(True, crystal + 1, crystal1)

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        try:
            self.common.deletefile(self.luadriver)
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
        finally:
            self.common.release_user(user_info['mid'])
Esempio n. 4
0
class C31193_DFQP_Yuepai_CreateRoom_EnoughCrystal(TestCase):
    '''
    破产有金条时,创建金条约牌房
    '''
    owner = "YoungLiu"
    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='0')
        self.common.set_crystal(mid=mid, value="1000")
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()
        self.yuepai_page = Yuepai_Page()
        self.hall_page = Hall_Page()
        self.personinfo_page = Personinfo_Page()
        self.common.closeactivity(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step('进入约牌房界面')
        self.yuepai_page.wait_element('约牌').click()
        time.sleep(4)
        self.start_step('进入银币/金条房界面')
        self.yuepai_page.wait_element('银币/金条房').click()
        time.sleep(4)
        self.start_step('点击金条单选按钮')
        self.yuepai_page.wait_element('金条单选按钮').click()
        time.sleep(4)
        self.start_step('点击开房按钮')
        self.yuepai_page.wait_element('开房').click()
        try:
            if (self.yuepai_page.element_is_exist("立即升级") == True):
                self.yuepai_page.wait_element("关闭").click()
        except:
            print "无立即升级按钮"
        time.sleep(4)
        self.start_step('点击确定')
        try:
            self.yuepai_page.wait_element('确定').click()
            time.sleep(20)
        except:
            print '未找到确定按钮'
        Flag = True
        while Flag:
            try:
                self.yuepai_page.wait_element('开房').click()
            except:
                Flag = False
        try:
            self.yuepai_page.wait_element('准备ok')
            self.yuepai_page.screenshot('.png')
            print '成功创建房间'
        except:
            print '创建房间失败'
        time.sleep(10)
        self.start_step("退出约牌房")
        self.yuepai_page.wait_element("菜单键").click()
        time.sleep(3)
        self.yuepai_page.wait_element("退出键").click()
        time.sleep(4)
        self.yuepai_page.screenshot('exit.png')
        self.yuepai_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")
Esempio n. 5
0
class C31197_DFQP_Yuepai_CreateScoreCoinCrystalRoom(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.common.set_crystal(mid=mid, value="1000")
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()
        self.yuepai_page = Yuepai_Page()
        self.hall_page = Hall_Page()
        self.personinfo_page = Personinfo_Page()
        self.common.closeactivity(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step('进入约牌房界面')
        self.yuepai_page.wait_element('约牌').click()
        time.sleep(3)
        self.start_step('进入积分房界面')
        self.yuepai_page.wait_element('积分房').click()
        time.sleep(4)
        self.start_step('点击开房按钮')
        self.yuepai_page.wait_element('开房').click()
        time.sleep(4)
        self.start_step('点击确定')
        try:
            self.yuepai_page.wait_element('确定').click()
        except:
            print '未找到确定按钮'
        Flag = True
        while Flag:
            try:
                self.yuepai_page.wait_element('开房').click()
            except:
                Flag = False
        try:
            self.yuepai_page.wait_element('准备')
            self.yuepai_page.screenshot('1.png')
            print '成功创建积分房'
        except:
            print '创建积分房失败'
        self.start_step('退出积分房')
        self.yuepai_page.wait_element('菜单键').click()
        time.sleep(2)
        self.yuepai_page.wait_element('退出键').click()
        self.start_step('进入银币房')
        time.sleep(2)
        self.yuepai_page.wait_element('银币/金条房').click()
        self.yuepai_page.wait_element('银币单选按钮').click()
        self.start_step('点击开房按钮')
        self.yuepai_page.wait_element('开房').click()
        time.sleep(3)
        try:
            self.yuepai_page.wait_element('准备ok')
            self.yuepai_page.screenshot('2.png')
            print '成功创建银币房'
        except:
            print '创建银币房失败'
        self.start_step('退出银币房')
        self.yuepai_page.wait_element('菜单键').click()
        self.yuepai_page.wait_element('退出键').click()
        self.start_step('进入金条房')
        time.sleep(2)
        self.yuepai_page.wait_element('银币/金条房').click()
        self.yuepai_page.wait_element('金条单选按钮').click()
        self.start_step('点击开房按钮')
        self.yuepai_page.wait_element('开房').click()
        time.sleep(3)
        try:
            self.yuepai_page.wait_element('准备ok')
            self.yuepai_page.screenshot('3.png')
            print '成功创建金条房'
        except:
            print '创建金条房失败'
        time.sleep(4)
        self.start_step("退出约牌房")
        self.yuepai_page.wait_element("菜单键").click()
        time.sleep(3)
        self.yuepai_page.wait_element("退出键").click()
        time.sleep(4)
        self.yuepai_page.screenshot('exit.png')
        self.yuepai_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")
Esempio n. 6
0
class C31265_DFQP_Match_MyInvolved(TestCase):
    '''
    大厅比赛场---查看我报名的邀请赛
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        global coin, totalmoney, safebox_crystal
        self.common = Common()
        global user_info
        user_info = self.common.get_user()
        print user_info
        # 初始化luadriver
        # print ("pre_test")
        self.luadriver = self.common.setupdriver()
        # PHPInterface.set_env(env=PHPInterface.PRE_REPUBLISH_ENV)
        self.common.closeactivityprepublish(self.luadriver)  # 关闭活动弹框
        time.sleep(15)
        self.hall_page = Hall_Page()
        self.match_page = Match_Page()
        self.personinfo_page = Personinfo_Page()
        self.game_page = Game_Page()
        self.start_step("获取用户ID信息")
        self.match_page.wait_element("头像").click()
        time.sleep(3)
        cid = self.personinfo_page.wait_element("账号ID").get_attribute('text')
        print "获取的用户cid为:%s" % cid
        if (cid != user_info['cid']):
            self.common.loginuser(user_info['user'], user_info['password'])
            time.sleep(10)
            if (self.match_page.element_is_exist("关闭") == True):
                self.match_page.wait_element("关闭").click()
                time.sleep(3)
        else:
            self.match_page.wait_element("关闭").click()
            time.sleep(3)
        cid1 = user_info['cid']
        mid = PHPInterface.get_mid(int(cid1), region=1)
        print "用户mid为:%s" % mid

        self.start_step("获取用户银币信息")
        dict = PHPInterface.get_user_info(mid)
        coin = eval(dict).get('result', {'coin': None}).get('coin')
        print "用户银币数为:%s" % coin
        if (coin < 53000):
            PHPInterface.add_money(mid, (53000 - coin))
            self.common.closeactivityprepublish(self.luadriver)
            time.sleep(10)

    def 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.deletefile(self.luadriver)
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
        finally:
            self.common.release_user(user_info['mid'])
Esempio n. 7
0
class C31001_DFQP_Bandding(TestCase):
    '''
    游客绑定该地区已经登录注册过的手机账号
    '''
    owner = "Lucyliu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        #删除自动登陆文件,置为游客状态
        self.common = Common()
        global user_info
        user_info = self.common.get_user()
        print user_info
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()
        self.common.deletefile(self.luadriver)
        # 声明方法
        self.login_page = Login_Page()
        self.setting_page = Setting_Page()
        self.hall_page = Hall_Page()
        # 每个用例都需要关闭活动,把这个放在初始化里面实现
        self.common.closeactivity_switchserver(self.luadriver)

    def run_test(self):
        # 测试用例
        self.hall_page.wait_element("同步标志")
        self.start_step("注册登录")
        self.hall_page.wait_element("头像").click()
        time.sleep(4)
        self.setting_page.wait_element("切换账号").click()
        time.sleep(4)
        try:
            self.setting_page.wait_element("继续登录").click()
        except:
            print "不需要继续切换"
        time.sleep(4)
        self.start_step("注册新账号")
        self.setting_page.wait_element("注册新账号").click()
        time.sleep(4)
        # print self.setting_page.wait_element("你的手机号码").get_attribute('text')
        self.setting_page.wait_element("你的手机号码").get_attribute(
            'text') == "您的手机号"
        self.setting_page.wait_element("你的手机号码").send_keys(user_info['user'])
        time.sleep(4)
        self.setting_page.wait_element("确认登陆").click()
        time.sleep(2)
        self.start_step("登陆")
        self.setting_page.wait_element("直接登陆").click()
        self.setting_page.screenshot('Bandding.png')
        time.sleep(3)
        self.setting_page.wait_element("密码").send_keys(user_info['password'])
        time.sleep(3)
        self.setting_page.wait_element("注册登录按钮").click()
        time.sleep(10)
        self.hall_page.wait_element("同步标志")

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        try:
            self.common.deletefile(self.luadriver)
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
        finally:
            self.common.release_user(user_info['mid'])
Esempio n. 8
0
class C31148_DFQP_GameList_DownLoad_MoreGames(TestCase):
    '''
    更多游戏
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.common = Common()
        # 初始化Luadriver
        capabilities = {}
        capabilities['noReset'] = False
        self.luadriver = self.common.setupdriver(capabilities)

        # 关闭弹框
        self.common.closeactivity(self.luadriver)
        self.common.closefloatBall()
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()

    def run_test(self):
        '''
        测试用例
        '''
        self.startStep = ("等待页面加载完成")
        time.sleep(10)

        self.hall_page.wait_element("同步标志")
        self.game_page.wait_element("右三角标").click()
        time.sleep(2)
        self.start_step("点击第二页的更多游戏")
        self.start_step("点击更多游戏")
        self.game_page.wait_element("更多游戏").click()
        time.sleep(3)
        self.game_page.screenshot("1.png")
        self.start_step("下载更多游戏列表的第一个游戏")
        self.game_page.wait_element("更多游戏[1]").click()
        try:
            self.game_page.wait_element("更多游戏关闭下载弹框").click()
            time.sleep(3)
            self.game_page.wait_element("更多游戏[1]").click()
            time.sleep(3)
            self.game_page.wait_element("更多游戏-立刻下载").click()
            time.sleep(10)
            print("游戏下载成功")
            self.game_page.wait_element("更多游戏[1]").click()
            time.sleep(3)
            self.game_page.wait_element("返回").click()
            time.sleep(3)

        except:
            print("游戏已下载")
            time.sleep(5)
            self.game_page.wait_element("返回").click()
        time.sleep(3)

        self.start_step("下载更多游戏列表第二个游戏")
        self.game_page.wait_element("更多游戏[2]").click()

        try:

            # self.game_page.wait_element("更多游戏[2]").click()
            time.sleep(3)
            self.game_page.wait_element("更多游戏-立刻下载").click()
            time.sleep(10)
            print("游戏下载成功")
            self.game_page.wait_element("更多游戏[2]").click()
            time.sleep(5)
            self.game_page.wait_element("返回").click()
            time.sleep(3)
            self.game_page.wait_element("更多游戏[2]").click()
            time.sleep(3)
            self.game_page.wait_element("返回").click()
            time.sleep(3)

        except:
            print("游戏已下载")
            self.game_page.wait_element("返回").click()
        time.sleep(3)

        self.start_step("下载更多游戏列表第三个游戏")
        self.game_page.wait_element("更多游戏[3]").click()
        try:
            # self.game_page.wait_element("更多游戏[3]").click()
            time.sleep(3)
            self.game_page.wait_element("更多游戏-立刻下载").click()
            time.sleep(10)
            print("游戏下载成功")
            self.game_page.wait_element("更多游戏[3]").click()
            time.sleep(3)
            self.game_page.wait_element("返回").click()
            time.sleep(3)
        except:

            print("游戏已下载")
            self.game_page.wait_element("返回").click()
        time.sleep(3)
        self.start_step("下载更多游戏列表第四个游戏")
        self.game_page.wait_element("更多游戏[4]").click()
        try:
            # self.game_page.wait_element("更多游戏[4]").click()
            time.sleep(3)
            self.game_page.wait_element("更多游戏-立刻下载").click()
            time.sleep(10)
            print("游戏下载成功")
            self.game_page.wait_element("更多游戏[4]").click()
            time.sleep(3)
            self.game_page.wait_element("返回").click()
            time.sleep(3)

        except:
            print("游戏已下载")
            self.game_page.wait_element("返回").click()
        time.sleep(3)
        self.game_page.screenshot("2.png")
        time.sleep(2)
        self.game_page.wait_element("绿色箭头返回").click()
        time.sleep(2)
        self.game_page.wait_element("左三角标").click()
        time.sleep(2)

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        self.common.deletefile(self.luadriver)
        self.common.closedriver()
Esempio n. 9
0
class C31153_DFQP_FriendRoom_Match(TestCase):
    '''
    子游戏列表跳转约牌房和比赛场
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 15

    def pre_test(self):
        # 初始化Luadriver
        self.common = Common()
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()

        # 关闭弹框
        self.common.closeactivityprepublish(self.luadriver)
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()

    def run_test(self):
        '''
        测试用例---跳转约牌房和比赛场
        '''
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        time.sleep(3)
        self.start_step("点击进入血战到底")
        if (self.common.game_is_exist("血战到底") == True):
            self.game_page.wait_element("血战到底").click()
            time.sleep(5)
            self.common.game_is_download()
            self.game_page.screenshot("xuezhandaodi.png")
            time.sleep(2)
            if (self.game_page.is_exist("约牌按钮") == True):
                self.game_page.get_element(
                    "约牌按钮").click()  # 不存在约牌和比赛按钮时,会点击不准确
                time.sleep(3)
                print("进入约牌房")
                self.game_page.wait_element("返回1").click()
                time.sleep(3)
            else:
                print("无约牌房")
            if (self.game_page.is_exist("子游戏比赛按钮") == True):
                self.game_page.get_element("子游戏比赛按钮").click()
                time.sleep(3)
                print("进入比赛")
                self.game_page.wait_element("比赛场返回").click()
                time.sleep(3)
            else:
                print("无比赛")
            self.game_page.wait_element("返回").click()

        self.start_step("点击进入血流成河")
        if (self.common.game_is_exist("血流成河") == True):
            self.game_page.wait_element("血流成河").click()
            time.sleep(5)
            self.common.game_is_download()
            if (self.game_page.is_exist("约牌按钮") == True):
                self.game_page.get_element("约牌按钮").click()
                time.sleep(3)
                print("进入约牌房")
                self.game_page.wait_element("返回1").click()
                time.sleep(3)
            else:
                print("无约牌房")
            if (self.game_page.is_exist("子游戏比赛按钮") == True):
                self.game_page.get_element("子游戏比赛按钮").click()
                time.sleep(3)
                print("进入比赛")
                self.game_page.wait_element("比赛场返回").click()
                time.sleep(3)
            else:
                print("无比赛")
            self.game_page.wait_element("返回").click()

        self.start_step("点击进入川味斗地主")
        self.start_step("点击川味斗地主:")
        if (self.common.game_is_exist("川味斗地主") == True):
            self.game_page.wait_element("川味斗地主").click()
            time.sleep(3)
            self.common.game_is_download()
            if (self.game_page.is_exist("约牌按钮") == True):
                self.game_page.get_element("约牌按钮").click()
                time.sleep(3)
                print("进入约牌房")
                self.game_page.wait_element("返回1").click()
                time.sleep(3)
            else:
                print("无约牌房")
            if (self.game_page.is_exist("子游戏比赛按钮") == True):
                self.game_page.get_element("子游戏比赛按钮").click()
                time.sleep(3)
                print("进入比赛")
                self.game_page.wait_element("比赛场返回").click()
                time.sleep(3)
            else:
                print("无比赛")
            self.game_page.wait_element("返回").click()

        self.start_step("点击进入斗牛")

        if (self.common.game_is_exist("斗牛") == True):
            self.game_page.wait_element("斗牛").click()
            time.sleep(3)
            self.common.game_is_download()
            if (self.game_page.is_exist("约牌按钮") == True):
                self.game_page.get_element("约牌按钮").click()
                time.sleep(3)
                print("进入约牌房")
                self.game_page.wait_element("返回1").click()
                time.sleep(3)
            else:
                print("无约牌房")
            if (self.game_page.is_exist("子游戏比赛按钮") == True):
                self.game_page.get_element("子游戏比赛按钮").click()
                time.sleep(3)
                print("进入比赛")
                self.game_page.wait_element("比赛场返回").click()
                time.sleep(3)
            else:
                print("无比赛")
            self.game_page.wait_element("返回").click()
            time.sleep(2)

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        self.common.deletefile(self.luadriver)
        self.common.closedriver()
Esempio n. 10
0
class C74637_DFQP_Start_Nonetwork(TestCase):
    '''
    无网络,点击启动游戏,首次无网络时启动游戏
    '''
    owner = "Lucyliu"
    status = EnumStatus.Design
    priority = EnumPriority.Normal
    timeout = 5

    def pre_test(self):
        #删除自动登陆文件,置为游客状态
        self.common = Common()
        # 初始化Luadriver
        capabilities = {}
        capabilities['noReset'] = False  #清除应用缓存
        self.luadriver = self.common.setupdriver(capabilities)
        config = ConfigHelper(constant.cfg_path)
        global deviceName
        deviceName = config.getValue('appium', 'deviceName')
        self.common.switchnetwork(self.luadriver, u"无网络")
        print self.luadriver.network_connection
        # if self.luadriver.network_connection == 2:
        #     cmd = "adb -s " + deviceName + " shell am broadcast -a io.appium.settings.wifi --es setstatus disable"
        #     print cmd
        #     subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        #     try:
        #         self.luadriver.find_element_by_android_uiautomator('new UiSelector().text("允许")').click()
        #     except:
        #         print "未出现按钮1"
        # 声明方法
        self.login_page = Login_Page()
        self.hall_page = Hall_Page()
        #关闭活动页面
        self.common.closeactivity(self.luadriver)
        # time.sleep(10)

    def run_test(self):
        #测试用例
        self.start_step("启动游戏")
        self.hall_page.wait_element("头像")
        self.login_page.screenshot('GuestLogin1.png')
        # self.hall_page.wait_element("头像").click()
        # self.hall_page.element_is_exist("头像")

    def post_test(self):
        #测试用例执行完成后,清理测试环境
        self.common.switchnetwork(self.luadriver, u"WIFI模式")
        print self.luadriver.network_connection
        if self.luadriver.network_connection != 2:
            t1 = threading.Thread(target=self.switchnetwork)
            t2 = threading.Thread(target=self.closebtn)
            t1.start()
            t2.start()
            t1.join()
            t2.join()
        self.start_step("close driver")
        self.common.closedriver()

    def switchnetwork(self):
        '''
        测试用例运行过程中切换网络
        '''

        cmd = "shell am start -n com.example.unlock/.Unlock"
        print "adb start:" + str(time.time())
        self.luadriver.adb(cmd)
        print "adb end:" + str(time.time())

    def closebtn(self):
        time.sleep(1)
        print "closebtn" + str(time.time())
        try:
            self.luadriver.find_element_by_android_uiautomator(
                'new UiSelector().textMatches("确定|允许")').click()
            print "close1" + str(time.time())
        except:
            print "1" + str(time.time())
        try:
            self.luadriver.find_element_by_android_uiautomator(
                'new UiSelector().textMatches("确定|允许")').click()
            print "close2" + str(time.time())
        except:
            print "2" + str(time.time())
        try:
            self.luadriver.find_element_by_android_uiautomator(
                'new UiSelector().textMatches("确定|允许")').click()
            print "close3" + str(time.time())
        except:
            print "3" + str(time.time())
Esempio n. 11
0
class C31155_DFQP_GamePlayList(TestCase):
    '''
    游戏玩法切换
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.common = Common()
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()

        # 关闭弹框
        self.common.closeactivityprepublish(self.luadriver)
        self.hall_page = Hall_Page()
        self.game_page = Game_Page()

    def run_test(self):
        '''
        测试用例
        '''
        self.start_step("等待页面加载完成")

        self.hall_page.wait_element("同步标志")
        time.sleep(5)
        self.start_step("点击血战到底:")
        if (self.common.game_is_exist("血战到底") == True):
            self.game_page.wait_element("血战到底").click()
            time.sleep(3)
            self.common.game_is_download()
            time.sleep(2)
            if (self.game_page.is_exist("玩法切换1") == True):
                self.game_page.wait_element("玩法切换2").click()
                time.sleep(2)
                self.game_page.wait_element("玩法切换1").click()
                time.sleep(2)
                print("玩法切换成功")
                self.game_page.wait_element("返回").click()
            else:
                print("该游戏没有其他玩法")
                self.game_page.wait_element("返回").click()
        else:
            print("没有血战到底游戏")
            self.game_page.wait_element("左三角标").click()

        self.start_step("点击斗牛")
        if (self.common.game_is_exist("斗牛") == True):
            self.game_page.wait_element("斗牛").click()
            time.sleep(3)
            self.common.game_is_download()
            time.sleep(2)
            if (self.game_page.is_exist("玩法切换1") == True):
                self.game_page.wait_element("玩法切换2").click()
                time.sleep(2)
                self.game_page.wait_element("玩法切换1").click()
                time.sleep(2)
                self.game_page.screenshot("2.png")
                print("玩法切换成功")
                self.game_page.wait_element("返回").click()
            else:
                print("该游戏没有其他玩法")
                self.game_page.screenshot("2.png")
                self.game_page.wait_element("返回").click()
        else:
            print("没有斗牛游戏")
            self.game_page.wait_element("左三角标").click()

        self.start_step("点击闷鸡")
        if (self.common.game_is_exist("闷鸡") == True):
            self.game_page.wait_element("闷鸡").click()
            time.sleep(3)
            self.common.game_is_download()
            time.sleep(2)
            if (self.game_page.is_exist("玩法切换4") == True):
                self.game_page.wait_element("玩法切换2").click()
                time.sleep(2)
                self.game_page.wait_element("玩法切换3").click()
                time.sleep(2)
                self.game_page.wait_element("玩法切换4").click()
                time.sleep(2)
                self.game_page.wait_element("玩法切换1").click()
                time.sleep(2)
                self.game_page.screenshot("3.png")
                print("玩法切换成功")
                self.game_page.wait_element("返回").click()
                time.sleep(2)
            else:
                print("该游戏没有其他玩法")
                self.game_page.screenshot("3.png")
                self.game_page.wait_element("返回").click()

        else:
            print("没有闷鸡游戏")
            self.game_page.wait_element("左三角标").click()

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        self.common.deletefile(self.luadriver)
        self.common.closedriver()
Esempio n. 12
0
class C30973_DFQP_Share1(TestCase):
    '''
    领取微信任务奖励
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 8
    def pre_test(self):
        self.common = Common()
        self.hall_page = Hall_Page()
        self.task_page = Task_Page()
        # global user_info
        # user_info = self.common.get_user()
        # print user_info
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()
        # 每个用例都需要关闭活动,把这个放在初始化里面实现
        self.common.closeactivity_switchserver(self.luadriver, "预发布")

        cid = self.common.get_cid()
        global mid
        mid = PHPInterface.get_mid(cid, region=1)
        print "用户mid为:%s" % mid
        PHPInterface.set_mission_to_complete(mid, 103000, 541)
        # self.common.deletefile(self.luadriver)
        # self.start_step("判断是否登陆")
        # if not self.common.isloginuser(self.luadriver):
        #     self.common.loginuser(user_info['user'], user_info['password'])
        #     self.common.closeactivity_switchserver(self.luadriver, "预发布")
        # else:
        #     if self.personinfo_page.wait_element("账号ID").get_attribute('text') != user_info['cid']:
        #         self.common.loginuser(user_info['user'], user_info['password'])
        #         self.common.closeactivity_switchserver(self.luadriver, "预发布")
        # try:
        #     self.personinfo_page.wait_element("关闭").click()
        # except:
        #     print "已关闭窗口"

    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()
Esempio n. 13
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()
        self.hall_page = Hall_Page()
        self.task_page = Task_Page()
        self.game_page = Game_Page()
        self.personinfo_page = Personinfo_Page()
        # global user_info
        # user_info = self.common.get_user()
        # print user_info
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity_switchserver(self.luadriver, "预发布")
        self.start_step("获取用户mid")
        cid = self.common.get_cid()
        global mid
        mid = PHPInterface.get_mid(cid, region=1)
        PHPInterface.set_mission_to_complete(mid, 103000, 369, 1)
        # self.common.closeactivitytest(self.luadriver)
        # self.start_step("判断是否登陆")
        # if not self.common.isloginuser(self.luadriver):
        #     self.common.loginuser(user_info['user'], user_info['password'])
        # else:
        #     if self.personinfo_page.wait_element("账号ID").get_attribute('text') != user_info['cid']:
        #         self.common.loginuser(user_info['user'], user_info['password'])
        #         self.common.closeactivity_switchserver(self.luadriver, "预发布")
        # try:
        #     self.personinfo_page.wait_element("关闭").click()
        # except:
        #     print "已关闭窗口"

    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):
        # PHPInterface.add_money(mid, 10000)
        PHPInterface.set_mission_to_complete(mid, 103000, 369, -1)
        # self.common.release_user(user_info['mid'])
        # self.common.deletefile(self.luadriver)
        self.common.closedriver()
Esempio n. 14
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 user_info
        # user_info = self.common.get_user()
        # print user_info
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity_switchserver(self.luadriver, "预发布")
        self.hall_page = Hall_Page()
        self.task_page = Task_Page()
        self.game_page = Game_Page()
        self.personinfo_page = Personinfo_Page()
        self.start_step("获取用户mid")
        cid = self.common.get_cid()
        global mid
        mid = PHPInterface.get_mid(cid, region=1)
        # self.hall_page.wait_element("头像").click()
        # time.sleep(5)
        # if self.personinfo_page.wait_element("账号ID").get_attribute('text') != user_info['cid']:
        #     self.common.loginuser(user_info['user'], user_info['password'])
        # try:
        #     self.personinfo_page.wait_element("关闭").click()
        # except:
        #     print "已关闭窗口"
        # self.start_step("获取当前用户的银币值")
        dict = PHPInterface.get_user_info(mid)  # 获取玩家信息
        coin = eval(dict).get('result', {'coin': None}).get('coin')  # 获取当前银币值
        print coin
        AddMoney = 2000 - coin
        PHPInterface.add_money(mid, AddMoney)

    def 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):
        PHPInterface.add_money(mid, 10000)
        # self.common.release_user(user_info['mid'])
        # self.common.deletefile(self.luadriver)
        self.common.closedriver()
Esempio n. 15
0
class C31264_DFQP_Match_MyMatch(TestCase):
    '''
    大厅比赛场---查看我创建的邀请赛
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 15

    def pre_test(self):
        global coin, totalmoney, safebox_crystal
        self.common = Common()
        global user_info
        user_info = self.common.get_user()
        print user_info
        # 初始化luadriver
        print ("pre_test")
        self.luadriver = self.common.setupdriver()
        # PHPInterface.set_env(env=PHPInterface.PRE_REPUBLISH_ENV)
        self.common.closeactivityprepublish(self.luadriver)  # 关闭活动弹框
        time.sleep(15)
        self.hall_page = Hall_Page()
        self.match_page = Match_Page()
        self.personinfo_page = Personinfo_Page()
        self.start_step("获取用户ID信息")
        self.match_page.wait_element("头像").click()
        time.sleep(3)
        cid = self.personinfo_page.wait_element("账号ID").get_attribute('text')
        print "获取的用户cid为:%s" % cid
        if (cid != user_info['cid']):
            self.common.loginuser(user_info['user'], user_info['password'])
            time.sleep(10)
            self.common.closeActivityBtn()
            # if (self.match_page.element_is_exist("关闭") == True):
            #     self.match_page.wait_element("关闭").click()
            #     time.sleep(3)
        else:
            self.match_page.wait_element("关闭").click()
            time.sleep(3)
        cid1 = user_info['cid']
        mid = PHPInterface.get_mid(cid1, region=1)
        print "用户mid为:%s" % mid

        self.start_step("获取用户银币信息")
        dict = PHPInterface.get_user_info(mid)
        coin = eval(dict).get('result', {'coin': None}).get('coin')
        print "用户银币数为:%s" % coin
        if(coin < 53000):
            PHPInterface.add_money(mid,(53000-coin))
            self.common.closeactivityprepublish(self.luadriver)
            time.sleep(10)

    def 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.closedriver()
Esempio n. 16
0
class C31154_DFQP_GameRoom_Agenda(TestCase):
    '''
    子游戏房间列表---点击今日赛程
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):

        self.common = Common()
        #初始化luadriver
        print("pre_test")
        self.luadriver = self.common.setupdriver()
        time.sleep(10)
        self.common.closeactivityprepublish(self.luadriver)  #关闭活动弹框

        self.hall_page = Hall_Page()
        self.match_page = Match_Page()
        self.game_page = Game_Page()

    def run_test(self):
        '''
        测试用例
        '''

        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        time.sleep(5)
        self.start_step("点击血战到底:")
        if (self.common.game_is_exist("血战到底") == True):
            self.game_page.wait_element("血战到底").click()
            time.sleep(3)
            self.common.game_is_download()
            time.sleep(2)
            self.start_step("点击今日赛程按钮")
            self.match_page.wait_element("今日赛程").click()
            time.sleep(3)
            self.match_page.screenshot("1.png")
            time.sleep(3)
            if (self.match_page.is_exist("比赛详情1") == True):
                self.match_page.wait_element("比赛详情1").click()
                time.sleep(3)
                self.match_page.screenshot("2.png")
                self.match_page.wait_element("关闭").click()
                time.sleep(2)
                self.luadriver.keyevent(4)
                time.sleep(2)
            else:
                print("无赛程")
                self.luadriver.keyevent(4)
                time.sleep(2)

        else:
            print("没有血战到底游戏")
            self.game_page.wait_element("左三角标").click()

    def post_test(self):
        '''
        测试用例执行完后,清理测试环境
        '''
        self.common.deletefile(self.luadriver)
        self.common.closedriver()
Esempio n. 17
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()
        self.hall_page = Hall_Page()
        self.match_page = Match_Page()
        self.personinfo_page = Personinfo_Page()
        global user_info
        user_info = self.common.get_user()
        print user_info
        #初始化luadriver
        print ("pre_test")
        self.luadriver = self.common.setupdriver()
        # PHPInterface.set_env(env=PHPInterface.PRE_REPUBLISH_ENV)
        self.common.closeactivityprepublish(self.luadriver) #关闭活动弹框
        time.sleep(15)

        self.start_step("获取用户ID信息")
        self.match_page.wait_element("头像").click()
        time.sleep(3)
        cid = self.personinfo_page.wait_element("账号ID").get_attribute('text')
        print "获取的用户cid为:%s" % cid
        if(cid != user_info['cid']):
            self.common.loginuser(user_info['user'],user_info['password'])
            time.sleep(10)
            if(self.match_page.element_is_exist("关闭")==True):
                self.match_page.wait_element("关闭").click()
                time.sleep(3)
        else:
            self.match_page.wait_element("关闭").click()
            time.sleep(3)
        cid1 = user_info['cid']
        mid = PHPInterface.get_mid(cid1, region=1)
        print "用户mid为:%s" % mid
        time.sleep(5)
        self.start_step("获取用户银币信息")
        dict = PHPInterface.get_user_info(mid)
        coin = eval(dict).get('result',{'coin':None}).get('coin')
        print "用户银币数为:%s" % coin
        crystal = eval(dict).get('result',{'crystal':None}).get('crystal')
        print "用户金条数为:%s" % crystal
        time.sleep(5)
        self.start_step("获取用户保险箱存款信息")
        safebox_info = PHPInterface.get_safebox(mid)
        safebox_money = safebox_info.get('safebox')
        print "保险箱银币存款为:%s" % safebox_money
        safebox_crystal = safebox_info.get('crystalsafebox')
        print "保险箱金条存款为:%s" % safebox_crystal
        totalmoney = safebox_info.get('totalmoney')
        print "用户银币总数量为:%s" % totalmoney
        time.sleep(10)

    def 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.deletefile(self.luadriver)
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
        finally:
            self.common.release_user(user_info['mid'])
Esempio n. 18
0
 def pre_test(self):
     self.common = Common()
     self.hall_page = Hall_Page()
     self.start_step("初始化环境")
     self.luadriver = self.common.setupdriver()
     self.common.closeactivity_switchserver(self.luadriver)
class C30987_DFQP_PersonInfo_Interface_Sex1(TestCase):
    """
    头像为默认头像,修改性别
    """
    owner = "Lucyliu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.common = Common()
        self.start_step("重置默认头像")
        PHPInterface.reset_img(self.casedata['mid'])
        self.start_step("初始化Luadriver")
        self.luadriver = self.common.setupdriver()
        # 每个用例都需要关闭活动,把这个放在初始化里面实现
        self.common.closeactivity_switchserver(self.luadriver, "预发布")
        self.hall_page = Hall_Page()
        self.personinfo_page = Personinfo_Page()

    def run_test(self):
        self.hall_page.wait_element("同步标志")
        self.start_step("进入头像页面")
        time.sleep(2)
        self.start_step("判断是否登陆")
        if not self.common.isloginuser(self.luadriver):
            self.common.loginuser(self.casedata['user'],
                                  self.casedata['password'])
            self.common.closeactivity_switchserver(self.luadriver, "预发布")
        else:
            if self.personinfo_page.wait_element("账号ID").get_attribute(
                    'text') != self.casedata['cid']:
                self.common.loginuser(self.casedata['user'],
                                      self.casedata['password'])
                self.common.closeactivity_switchserver(self.luadriver, "预发布")
        try:
            self.personinfo_page.wait_element("关闭").click()
        except:
            print "已关闭窗口"
        self.common.closeactivity_switchserver(self.luadriver, "预发布")
        self.personinfo_page.screenshot("sex1.png")
        self.start_step("进入头像页面")
        self.personinfo_page.wait_element("头像").click()
        self.start_step("修改性别")
        print self.personinfo_page.wait_element("女").get_attribute('selected')
        if (self.personinfo_page.wait_element("女").get_attribute('selected')):
            self.personinfo_page.wait_element("男").click()
        else:
            self.personinfo_page.wait_element("女").click()
        time.sleep(1)
        if (self.personinfo_page.wait_element("女").get_attribute('selected')):
            a = 1
        else:
            a = 0
        print a
        # 重新登陆
        self.personinfo_page.screenshot("sex2.png")
        self.personinfo_page.wait_element("关闭").click()
        time.sleep(1)
        self.start_step("重启游戏查看性别")
        self.common.restart()
        self.personinfo_page.wait_element("头像").click()
        time.sleep(2)
        if (a == 1):
            self.personinfo_page.wait_element("女").get_attribute('selected')
        else:
            self.personinfo_page.wait_element("男").get_attribute('selected')
        self.personinfo_page.screenshot('sex3.png')

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        self.common.deletefile(self.luadriver)
        self.common.closedriver()
Esempio n. 20
0
class C31122_DFQP_Rank_Userinfodetail(TestCase):
    '''
    点击查看每个排行榜玩家头像、id、昵称、性别、vip标志、数据
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 5

    def pre_test(self):
        self.common = Common()
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()
        # 每个用例都需要关闭活动,把这个放在初始化里面实现
        self.common.closeactivity_switchserver(self.luadriver, "预发布")
        self.rank_page = Rank_Page()
        self.hall_page = Hall_Page()

    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(3)
        if (self.rank_page.is_exist("用户头像")):
            self.start_step("查看个人信息")
            self.rank_page.wait_element("用户头像").click()
            self.start_step("加好友")
            self.rank_page.wait_element("加好友").click()
            time.sleep(2)
            self.rank_page.wait_element("关闭对话框").click()
            self.start_step("举报功能")
            self.rank_page.wait_element("用户头像").click()
            self.rank_page.wait_element("举报").click()
            time.sleep(2)
            self.start_step("取消举报")
            self.rank_page.wait_element("色情昵称").click()
            time.sleep(2)
            self.rank_page.wait_element("取消举报").click()
            time.sleep(5)
            self.start_step("确定举报")
            self.rank_page.wait_element("用户头像").click()

            self.rank_page.wait_element("举报").click()
            time.sleep(2)
            self.rank_page.wait_element("色情头像").click()
            time.sleep(2)
            self.rank_page.wait_element("确定举报").click()
            self.rank_page.screenshot('Userinfodetail.png')
            time.sleep(2)
            self.rank_page.wait_element("返回").click()
            self.hall_page.wait_element("同步标志")
        else:
            self.rank_page.screenshot("userinfo_fail")

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        self.common.closedriver()
Esempio n. 21
0
class C31005_DFQP_Login_UseLogin2(TestCase):
    '''
    老手机账号切换老手机账号
    '''
    owner = "Lucyliu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 8

    def pre_test(self):
        # 初始化nativeDriver
        self.common = Common()
        global user_info1, user_info2, mid1, mid2
        user_info1 = self.common.get_user()
        print user_info1
        user_info2 = self.common.get_user()
        print user_info2
        self.luadriver = self.common.setupdriver()
        # 声明方法
        self.login_page = Login_Page()
        self.setting_page = Setting_Page()
        self.hall_page = Hall_Page()
        #关闭活动页面
        self.common.closeactivity_switchserver(self.luadriver)
        self.start_step("判断是否登陆")
        self.hall_page.wait_element("头像").click()
        time.sleep(5)
        if not self.common.isloginuser(self.luadriver):
            self.common.loginuser(user_info1['user'], user_info1['password'])
            self.common.closeActivityBtn()

    def run_test(self):
        self.hall_page.wait_element("同步标志")
        self.hall_page.wait_element("头像").click()
        time.sleep(8)
        self.hall_page.screenshot('Login_UseLogin1.png')
        self.start_step("登陆")
        self.common.loginuser(user_info2['user'], user_info2['password'])
        #关闭活动页面
        self.common.closeActivityBtn()
        self.hall_page.wait_element("同步标志")
        self.hall_page.wait_element("头像").click()
        time.sleep(3)
        self.hall_page.screenshot('Login_UseLogin2.png')

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        try:
            self.common.deletefile(self.luadriver)
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
        finally:
            self.common.release_user(user_info1['mid'])
            self.common.release_user(user_info2['mid'])
Esempio n. 22
0
class C31034_DFCP_Backpack_Interface_GetPro(TestCase):
    '''
    购买道具,商城购买道具,查看物品箱
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 5

    def pre_test(self):
        self.common = Common()
        self.luadriver = self.common.setupdriver()
        self.hall_page = Hall_Page()
        self.mall_page = Mall_Page()
        self.sign_page = Sign_Page()
        self.backpack_page = Backpack_Page()
        self.personinfo_page = Personinfo_Page()
        time.sleep(1)
        PHPInterface.add_money(self.casedata['mid'], 53000)
        # 每个用例都需要关闭活动,把这个放在初始化里面实现
        self.common.closeactivityprepublish(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 run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step("进入物品箱页面")
        time.sleep(2)
        self.hall_page.wait_element("物品箱").click()
        time.sleep(2)
        self.hall_page.screenshot('Backpack_Enterpack1.png')
        self.luadriver.keyevent(4)
        self.start_step("进入商城页面")
        self.hall_page.wait_element("商城").click()
        time.sleep(2)
        self.mall_page.wait_element("道具页签").click()
        time.sleep(2)
        self.start_step("购买道具")
        self.mall_page.wait_element("提示卡").click()
        time.sleep(5)
        self.sign_page.wait_element("购买").click()
        time.sleep(3)
        self.mall_page.wait_element("返回").click()
        time.sleep(3)
        self.start_step("进入物品箱页面")
        time.sleep(2)
        self.hall_page.wait_element("物品箱").click()
        time.sleep(2)
        self.hall_page.screenshot('Backpack_Enterpack2.png')

    def post_test(self):
        self.common.deletefile(self.luadriver)
        self.common.closedriver()
Esempio n. 23
0
class C31196_DFQP_Yuepai_CreateCoinRoom_Broke(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='0')
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()
        self.yuepai_page = Yuepai_Page()
        self.hall_page = Hall_Page()
        self.personinfo_page = Personinfo_Page()
        self.common.closeactivity(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step('进入约牌房界面')
        self.yuepai_page.wait_element('约牌').click()
        self.start_step('进入银币/金条房界面')
        self.yuepai_page.wait_element('银币/金条房').click()
        self.start_step('点击银币单选按钮')
        self.yuepai_page.wait_element('银币单选按钮').click()
        self.start_step('点击开房按钮')
        self.yuepai_page.wait_element('开房').click()
        self.start_step('点击确定')
        try:
            self.yuepai_page.wait_element('确定').click()
        except:
            print '未找到确定按钮'
        Flag = True
        while Flag:
            self.yuepai_page.wait_element('开房').click()
            try:
                self.yuepai_page.wait_element('支付1')
                self.yuepai_page.screenshot('.png')
                Flag = False
            except:
                print '游戏下载中'
            # self.start_step("退出约牌房")
            # self.yuepai_page.wait_element("菜单键").click()
            # time.sleep(3)
            # self.yuepai_page.wait_element("退出键").click()
            # time.sleep(4)
            # self.yuepai_page.screenshot('exit.png')

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        try:
            self.common.recover_user(mid)
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
Esempio n. 24
0
class C31036_DFQP_Backpack_Sendpro(TestCase):
    '''
    私信发送道具,鲜花
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10
    def pre_test(self):
        self.start_step("初始化环境")
        self.common = Common()
        # 初始化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()
        self.start_step("接口交互道具私信")
        # 每个用例都需要关闭活动,并切换到测试服
        self.common.closeactivity_switchserver(self.luadriver,"预发布")
        # PHPInterface.set_env(PHPInterface.PRE_REPUBLISH_ENV)
        print self.casedata['mid']
        return1 = PHPInterface.send_message(int(self.casedata['mid']), "接口交互道具私信","接口交互道具私信",200,1,0)
        print return1
        self.start_step("判断是否登陆")
        if not self.common.isloginuser(self.luadriver):
            self.common.loginuser(self.casedata['user'], self.casedata['password'])
            self.common.closeactivity_switchserver(self.luadriver, "预发布")
        else:
            if self.personinfo_page.wait_element("账号ID").get_attribute('text') != self.casedata['cid']:
                self.common.loginuser(self.casedata['user'], self.casedata['password'])
                self.common.closeactivity_switchserver(self.luadriver, "预发布")
        try:
            self.personinfo_page.wait_element("关闭").click()
        except:
            print "已关闭窗口"

    def run_test(self):
        '''
        测试用例
        '''
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step("进入物品箱页面")
        time.sleep(2)
        self.hall_page.wait_element("物品箱").click()
        time.sleep(2)
        self.hall_page.screenshot('Backpack_Enterpack2.png')
        self.luadriver.keyevent(4)
        time.sleep(4)
        self.start_step("进入消息页面")
        self.hall_page.wait_element("消息").click()
        time.sleep(2)
        self.start_step("查看消息")
        try:
            try:
                element = self.message_page.get_elements("小琪妹")
                element[1].click()
            except:
                self.message_page.wait_element("小琪妹").click()
            time.sleep(3)

            self.message_page.screenshot('getcalls1.png')
            self.message_page.wait_element("立即领取").click()
            time.sleep(3)
            self.message_page.screenshot('getcalls2.png')
            self.message_page.wait_element("知道了").click()
            time.sleep(2)
            self.message_page.wait_element('已领取').get_attribute('text') == "已领取"
        except:
            print ("没有消息")
        time.sleep(3)
        self.hall_page.wait_element("头像").click()
        time.sleep(3)
        self.hall_page.wait_element("头像").click()
        self.hall_page.wait_element("同步标志")
        self.start_step("进入物品箱页面")
        time.sleep(2)
        self.hall_page.wait_element("物品箱").click()
        time.sleep(2)
        self.hall_page.screenshot('Backpack_Enterpack2.png')

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        self.common.deletefile(self.luadriver)
        self.common.closedriver()
Esempio n. 25
0
class C199_DFQP_Yuepai_CoinCrystalRoom_Display(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.common.set_crystal(mid=mid, value="1000")
        # 初始化Luadriver
        self.luadriver = self.common.setupdriver()
        self.yuepai_page = Yuepai_Page()
        self.hall_page = Hall_Page()
        self.personinfo_page = Personinfo_Page()
        self.common.closeactivity(self.luadriver)

    def run_test(self):
        self.start_step("等待页面加载完成")
        self.hall_page.wait_element("同步标志")
        self.start_step('进入约牌房界面')
        self.yuepai_page.wait_element('约牌').click()
        time.sleep(2)
        self.start_step('进入银币/金条房界面')
        self.yuepai_page.wait_element('银币/金条房').click()
        time.sleep(2)
        self.start_step('点击银币单选按钮')
        self.yuepai_page.wait_element('银币单选按钮').click()
        time.sleep(2)
        self.start_step('点击开房按钮')
        self.yuepai_page.wait_element('开房').click()
        time.sleep(2)
        self.start_step('点击确定')
        try:
            self.yuepai_page.wait_element('确定').click()
        except:
            print '未找到确定按钮'
        Flag = True
        while Flag:
            try:
                self.yuepai_page.wait_element('开房').click()
            except:
                Flag = False
        try:
            self.yuepai_page.wait_element('准备')
            print '成功创建银币房'
        except:
            print '创建银币房失败'
        time.sleep(3)
        self.start_step('点击菜单键')
        self.yuepai_page.wait_element('菜单键').click()
        time.sleep(2)
        self.yuepai_page.screenshot('1.png')
        self.yuepai_page.wait_element('银币框').click()
        time.sleep(2)
        self.start_step('点击二维码按钮')
        self.yuepai_page.wait_element('二维码').click()
        time.sleep(2)
        self.yuepai_page.screenshot('2.png')
        self.yuepai_page.wait_element('银币框').click()
        time.sleep(2)
        self.start_step('点击广播邀人按钮')
        self.yuepai_page.wait_element('广播邀人').click()
        time.sleep(2)
        self.yuepai_page.screenshot('3.png')
        self.yuepai_page.wait_element('银币框').click()
        time.sleep(2)
        self.start_step('点击更多按钮')
        self.yuepai_page.wait_element('更多').click()
        time.sleep(2)
        self.yuepai_page.screenshot('4.png')
        self.yuepai_page.wait_element('银币框').click()
        time.sleep(2)
        self.start_step('点击邀请按钮')
        self.yuepai_page.wait_element('邀请-银币/金条房').click()
        time.sleep(2)
        self.yuepai_page.screenshot('5.png')
        self.yuepai_page.wait_element('银币框').click()
        time.sleep(2)
        self.start_step('点击记牌器按钮')
        self.yuepai_page.wait_element('记牌器').click()
        time.sleep(2)
        self.yuepai_page.screenshot('6.png')
        self.yuepai_page.wait_element('银币框').click()
        self.start_step('点击聊天按钮')
        self.yuepai_page.wait_element('聊天').click()
        time.sleep(2)
        self.yuepai_page.screenshot('7.png')
        self.yuepai_page.wait_element('银币框').click()
        time.sleep(2)
        self.start_step('退出银币房,进入金条房')
        self.yuepai_page.wait_element('菜单键').click()
        time.sleep(2)
        self.yuepai_page.wait_element('退出键').click()
        time.sleep(3)
        self.yuepai_page.wait_element('银币/金条房').click()
        time.sleep(2)
        self.start_step('点击金条单选按钮')
        self.yuepai_page.wait_element('金条单选按钮').click()
        time.sleep(2)
        self.start_step('点击开房按钮')
        self.yuepai_page.wait_element('开房').click()
        time.sleep(3)
        self.yuepai_page.screenshot('8.png')
        self.start_step("退出约牌房")
        self.yuepai_page.wait_element("菜单键").click()
        time.sleep(3)
        self.yuepai_page.wait_element("退出键").click()
        time.sleep(4)
        self.yuepai_page.screenshot('exit.png')
        self.yuepai_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")
Esempio n. 26
0
class C31261_DFQP_Match_Invitational1(TestCase):
    '''
    大厅比赛场---邀请赛创建页面
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):

        self.common = Common()
        #初始化luadriver
        print("pre_test")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity_switchserver(self.luadriver)
        self.hall_page = Hall_Page()
        self.match_page = Match_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(3)
        self.start_step("点击邀请赛")
        self.match_page.wait_element("比赛场-邀请赛").click()
        time.sleep(3)
        self.match_page.screenshot("1.png")
        time.sleep(3)
        self.start_step("创建邀请赛")
        self.match_page.wait_element("创建邀请赛").click()
        time.sleep(3)
        self.match_page.screenshot("2.png")
        time.sleep(3)
        if (self.match_page.element_is_exist("立即升级") == True):
            self.match_page.wait_element("立即升级").click()
            time.sleep(3)
            # self.match_page.wait_element("已有账号登录").click()
            # time.sleep(3)
            #self.common.loginuser(self.casedata['user'],self.casedata['password'])
            self.match_page.wait_element("手机号码").click()
            time.sleep(2)
            # self.match_page.wait_element("手机号码").send_keys('18028781683')
            # self.match_page.wait_element("密码").send_keys('111111')
            self.match_page.wait_element("确定").click()
            time.sleep(10)
            self.match_page.wait_element("关闭").click()
            time.sleep(2)
        else:
            self.match_page.screenshot("3.png")
            time.sleep(2)
            self.match_page.wait_element("箭头返回").click()
        self.match_page.wait_element("箭头返回").click()
        time.sleep(3)
        self.match_page.wait_element("返回").click()
        self.hall_page.wait_element("同步标志")

    def post_test(self):
        '''
        测试用例执行完后,清理测试环境
        '''
        # self.common.deletefile(self.luadriver)
        self.common.closedriver()
Esempio n. 27
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 user_info
        user_info = self.common.get_user()
        print user_info
        print user_info['mid']
        # 初始化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()
        self.start_step("接口发送vip私信")
        # 每个用例都需要关闭活动,并切换到预发布
        self.common.closeactivity_switchserver(self.luadriver)
        return1 = PHPInterface.send_message(int(user_info['mid']), "接口发送vip私信",
                                            "接口发送vip私信", 4, 1, 0)
        self.start_step("判断是否登陆")
        if not self.common.isloginuser(self.luadriver):
            self.common.loginuser(user_info['user'], user_info['password'])
            self.common.closeActivityBtn()
        else:
            if self.personinfo_page.wait_element("账号ID").get_attribute(
                    'text') != user_info['cid']:
                self.common.loginuser(user_info['user'], user_info['password'])
                self.common.closeActivityBtn()
        try:
            self.personinfo_page.wait_element("关闭").click()
        except:
            print "已关闭窗口"

    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.deletefile(self.luadriver)
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
        finally:
            self.common.release_user(user_info['mid'])
Esempio n. 28
0
class C31229_DFQP_Match_MatchType(TestCase):
    '''
    大厅比赛场---比赛类型Tab页切换
    '''
    owner = "MindyZhang"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):

        self.common = Common()
        #初始化luadriver
        print("pre_test")
        self.luadriver = self.common.setupdriver()
        self.common.closeactivity_switchserver(self.luadriver)

        self.hall_page = Hall_Page()
        self.match_page = Match_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(3)
        self.match_page.screenshot("1.png")
        time.sleep(3)
        self.start_step("点击切换比赛tab")
        if (self.match_page.element_is_exist("话费赛") == True):
            self.match_page.wait_element("话费赛").click()
            time.sleep(3)
            self.match_page.screenshot("2.png")
        else:
            print("没有话费赛")
        if (self.match_page.element_is_exist("实物赛") == True):
            self.match_page.wait_element("实物赛").click()
            time.sleep(3)
            self.match_page.screenshot("3.png")
        else:
            print("没有实物赛")
        if (self.match_page.element_is_exist("iphone赛") == True):
            self.match_page.wait_element("iphone赛").click()
            time.sleep(3)
            self.match_page.screenshot("4.png")
        else:
            print("没有iphone赛")

        self.match_page.wait_element("全部比赛").click()
        time.sleep(3)
        self.match_page.wait_element("返回").click()
        self.hall_page.wait_element("同步标志")

    def post_test(self):
        '''
        测试用例执行完后,清理测试环境
        '''
        # self.common.deletefile(self.luadriver)
        self.common.closedriver()
Esempio n. 29
0
class C31031_DFQP_Message_Object(TestCase):
    '''
    实物私信
    '''
    owner = "LucyLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    timeout = 10

    def pre_test(self):
        self.start_step("初始化环境")
        self.common = Common()
        global user_info
        user_info = self.common.get_user()
        print user_info
        print user_info['mid']
        # 初始化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()
        self.start_step("实物私信")
        # 每个用例都需要关闭活动,并切换到预发布
        self.common.closeactivity_switchserver(self.luadriver)
        return1 = PHPInterface.send_message(int(user_info['mid']), "实物私信",
                                            "实物私信", 10045, 1, 0)
        print return1
        self.start_step("判断是否登陆")
        if not self.common.isloginuser(self.luadriver):
            self.common.loginuser(user_info['user'], user_info['password'])
            self.common.closeActivityBtn()
        else:
            if self.personinfo_page.wait_element("账号ID").get_attribute(
                    'text') != user_info['cid']:
                self.common.loginuser(user_info['user'], user_info['password'])
                self.common.closeActivityBtn()
        try:
            self.personinfo_page.wait_element("关闭").click()
        except:
            print "已关闭窗口"

    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.hall_page.screenshot('Backpack.png')
        self.luadriver.keyevent(4)
        time.sleep(4)
        self.start_step("进入消息页面")
        self.hall_page.wait_element("消息").click()
        time.sleep(2)
        self.start_step("查看消息")
        try:
            try:
                element = self.message_page.get_elements("小琪妹")
                element[1].click()
            except:
                self.message_page.wait_element("小琪妹").click()
            time.sleep(3)

            self.message_page.screenshot('Object.png')
            self.message_page.wait_element("立即领取").click()
            time.sleep(3)
            self.message_page.screenshot('Object2.png')
            self.message_page.wait_element("知道了").click()
            time.sleep(2)
            self.message_page.wait_element('已领取').get_attribute(
                'text') == "已领取"
        except:
            print("没有消息")
        time.sleep(6)
        self.message_page.wait_element("返回").click()
        self.hall_page.wait_element("头像").click()
        self.hall_page.wait_element("同步标志")
        self.start_step("查看物品箱")
        self.hall_page.wait_element("物品箱").click()
        time.sleep(2)
        self.hall_page.screenshot('Backpack2.png')

    def post_test(self):
        '''
        测试用例执行完成后,清理测试环境
        '''
        try:
            self.common.deletefile(self.luadriver)
            self.common.closedriver()
        except:
            self.log_info("close driver fail")
        finally:
            self.common.release_user(user_info['mid'])
Esempio n. 30
0
class C302_DFCP_Login_Interface_AccountSignIn(TestCase):
    '''
    注册用户被封账号登录
    '''
    owner = "RealLiu"
    status = EnumStatus.Design
    priority = EnumPriority.High
    # 用例超时时间,单位:分钟
    # 其他配置时间的地方,单位均为:秒
    timeout = 5

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

    def run_test(self):
        self.start_step("寻找弹框并确认标题文本为:账号禁用")
        time.sleep(30)
        self.hall_page.wait_element("头像").click()
        time.sleep(6)
        try:
            self.hall_page.wait_element("账号禁用")
            self.hall_page.screenshot("jinyong.png")
            self.start_step("切换其他账号")
            self.hall_page.wait_element("账号切换").click()
            time.sleep(2)
            self.setting_page.wait_element("手机号码").send_keys(
                self.casedata['user1'])
            time.sleep(1)
            self.setting_page.wait_element("密码").send_keys(
                self.casedata['password1'])
            time.sleep(1)
            self.setting_page.wait_element("确认登陆").click()
            time.sleep(10)
            self.hall_page.wait_element("同步标志")
        except:
            print "未出现封停提示"

    def post_test(self):
        self.start_step("调用接口解封账号")
        resultBanUser = PHPInterface.shutdown_user(int(self.casedata['mid']),
                                                   0)
        if resultBanUser:
            print "解封账号成功"
        else:
            raise "解封账号失败"
        self.common.closedriver()