예제 #1
0
def witness(start, devices):
    poco = common.deviceconnect(devices)
    if poco("SysG_Live").exists():
        poco("SysG_Live").click()
        freeze_poco = poco.freeze()  # TODO:定义dongjiepoco
        if freeze_poco("SpectateDlg(Clone)").offspring("Name").exists():
            for Label in freeze_poco("SpectateDlg(Clone)").offspring("SpectateFrame").\
                    offspring("Bg").offspring("TextLabel"):
                Label.click()  # 点击观战的多项子页签
            freeze_poco("Refresh").click()  # 点击刷新按钮
            freeze_poco("1").click()  # 点击我的记录
            freeze_poco = poco.freeze()  # TODO:定义dongjiepoco
            if freeze_poco("Watch").exists() and freeze_poco("Commend").exists():
                pass
            poco("Text").click()  # 点击观战设置
            freeze_poco = poco.freeze()  # TODO:定义dongjiepoco
            if freeze_poco("BtnDeny").exists() and freeze_poco("BtnAllow").exists() and freeze_poco("Ok").exists():
                freeze_poco("SpectateDlg(Clone)").offspring("BtnDeny").child("BtnHigh").click()  # 点击不允许被观战
                common.printgreen("点击不允许被观战")
                common.get_screen_shot(start, time.time(), devices, "点击不允许被观战")
                freeze_poco("SpectateDlg(Clone)").offspring("BtnAllow").child("BtnHigh").click()  # 点击允许被观战
                common.printgreen("点击允许被观战")
                sleep(0.5)
                common.get_screen_shot(start, time.time(), devices, "点击允许被观战")
                return poco("Label").get_text()  # 保存设置
        else:
            common.printred("没有进入观战界面,请检查。。。")
            common.get_screen_shot(start, time.time(), devices, "没有进入观战界面")
    else:
        common.printred("主界面没有有观战按钮,请检查。。。")
        common.get_screen_shot(start, time.time(), devices, "主界面没有有观战按钮")
예제 #2
0
def BtnBuild(start, poco, devices):  # 建造
    common.printgreen("进入建造界面")
    poco("NewGuildHall(Clone)").offspring("NewGuildInterior").offspring("item1").child("GO").click()
    freeze_poco = poco.freeze()  # TODO:定义冻结poco
    if freeze_poco(text="公会建设").exists():
        if freeze_poco(text="公会建设").exists() and \
                freeze_poco("title3").exists() and \
                freeze_poco("title1").exists() and \
                freeze_poco("title2").exists() and \
                freeze_poco(texture="public_Flag").exists() and \
                freeze_poco("num").exists() and \
                freeze_poco("Go2").exists() and \
                freeze_poco("GuildGrowthBuildDlg(Clone)").offspring("Go2").child("BtnEnter").exists():
            for item in range(len(freeze_poco("WrapContent").child()) - 8):
                item1 = "item" + str(item)
                if freeze_poco("GuildGrowthBuildDlg(Clone)").offspring(item1).exists():
                    poco("GuildGrowthBuildDlg(Clone)").offspring("Go2").child("Help").click()  # 点击帮助介绍
                    if poco("Title").exists():
                        poco("Btn").click()  # 关闭帮助
                    else:
                        common.printred("帮助界面没有打开,请检查。。。")
                        common.get_screen_shot(start, time.time(), devices, "捐赠今日排行界面元素缺失")
                    poco("GuildGrowthBuildDlg(Clone)").offspring("Go2").child("BtnEnter").click()  # 点击前往捐献
                    freeze_poco = poco.freeze()  # TODO:定义冻结poco
                    for item in range(len(freeze_poco("List").child())):
                        item1 = "item" + str(item)
                        if freeze_poco(item1).exists() and \
                                freeze_poco(item1).child("Do").exists() and \
                                freeze_poco("box").exists():
                            freeze_poco(item1).child("Do").click()  # 点击缴纳
                        else:
                            common.printred("捐赠今日排行界面元素缺失,请检查。。。")
                            common.get_screen_shot(start, time.time(), devices, "捐赠今日排行界面元素缺失")
                    poco("Close").click()
    close(poco)
예제 #3
0
파일: auction.py 프로젝트: zlmone/airtest
def auction(poco):
    for item in range(1):  # 因为apk功能机制问题,所以只选择前10中商品进行抽样测试
        item1 = "item" + str(item)
        if poco("AuctionDlg(Clone)").offspring(item1).exists():
            freeze_poco = poco.freeze()  # TODO:定义dongjiepoco
            common.printgreen(freeze_poco("AuctionDlg(Clone)").offspring(item1).offspring("ItemTpl").offspring(
                "Name").get_text() + "   道具显示正常")
예제 #4
0
파일: chat.py 프로젝트: zlmone/airtest
def chat(start, devices):
    poco = common.deviceconnect(devices)
    poco("Back").click()  # 点击聊天功能
    sleep(1)
    chatlist = [1, 2, 3, 4, 10, 14]
    freeze_poco = poco.freeze()  # TODO:定义冻结poco
    for tab in chatlist:
        tab1 = "tab" + str(tab)
        if freeze_poco("ChatNewDlg_ani").offspring(tab1).offspring("Bg").child(
                "name").exists():
            common.printgreen("检查点 " + freeze_poco("ChatNewDlg_ani").offspring(
                tab1).offspring("Bg").child("name").get_text() + " 聊天选项 显示正确")
            poco("ChatNewDlg_ani").offspring(tab1).offspring("Bg").child(
                "name").click()
            if poco("chattext").exists():
                poco("textinput").wait().set_text("聊五毛钱的天。。。")
                poco("sendchat").click()  # 点击发送
                if poco("addBtn").exists():
                    poco("addBtn").click()  # 表情
                    sleep(1)
                    item1 = "item" + str(random.randint(0, 23))
                    poco(item1).child("template").click()
                    poco("sendchat").click()  # 点击发送
                    sleep(2)
            else:
                common.printgreen("当前聊天选项没有输入选项")
        else:
            common.printred(f"检查点  聊天选项 发{tab1} 不存在,检查一下.一个大选项,大概率是因为没有加工会造成")
            common.get_screen_shot(start, time.time(), devices, "聊天选项控件缺失")
    return poco("ChatNewDlg_ani").offspring("tab4").offspring(
        "Selected").child("name").get_text()
예제 #5
0
def loginreward(start, devices):
    poco = common.deviceconnect(devices)
    if poco("SysISevenActivity").exists():
        poco("SysISevenActivity").click()
        if poco(texture="SevenReward_Title").exists():
            freeze_poco = poco.freeze()  # TODO:定义dongjiepoco
            for WrapItem_ in range(len(freeze_poco("ScrollView").child())):
                WrapItem = "WrapItem_" + str(WrapItem_)
                if freeze_poco(WrapItem).exists() and freeze_poco("Texture").exists():
                    pass
                else:
                    common.printred("登陆奖励缺少元素,请检查。。。")
                    common.get_screen_shot(start, time.time(), devices, "登陆奖励缺少元素")
            if poco("SevenAwardDlg(Clone)").offspring("GetButton").offspring(text="领 取").exists():
                for Label in poco("SevenAwardDlg(Clone)").offspring("GetButton").offspring(text="领 取"):
                    Label.click()
                    for i in range(10):
                        if poco(text="使用").exists():
                            poco(text="使用").click()
                        else:
                            break
                if not poco("SevenAwardDlg(Clone)").offspring("WrapItem_6").offspring(text="领 取").exists():
                    common.printgreen("已经全部领取")
            else:
                common.printgreen("没有可领取的奖励")
        else:
            common.printred("没有弹出登陆奖励,请检查。。。")
            common.get_screen_shot(start, time.time(), devices, "主界面没有登陆奖励按钮")
    else:
        common.printred("主界面没有登陆奖励按钮,请检查。。。")
        common.get_screen_shot(start, time.time(), devices, "主界面没有登陆奖励按钮")
    if poco(texture="SevenReward_Title").exists():
        return poco(texture="SevenReward_Title").get_name()  # Title
    else:  # TODO:说明一下,如果主界面没有登陆奖励按钮,那么报告给一个失败的提示,因为不确定是因为领完了消失还是BUG的原因
        return poco("Alphaboard").offspring("SysA_Friends").child("Name").get_text()  # 社交
예제 #6
0
파일: heraldry.py 프로젝트: zlmone/airtest
def addheraldry(start, poco, devices):
    poco("Btn").click()
    but = poco("EquipCreateDlg(Clone)").offspring("WrapContent").offspring(
        name="Icon")  # 是否存在金属板
    if but.exists():
        but.click()  # 点击金属板
        if poco("EquipCreateDlg(Clone)").offspring("Item").child(
                "Icon").exists():  # 制作窗口是否存在金属板
            common.printgreen("开始进行纹章制作")
            poco("Create").click()  # 纹章制作
            # 是否存在制作纹章的弹窗
            if poco("EquipCreateDlg(Clone)").offspring(
                    "EquipSetCreateConfirmFrame").child("Bg").exists():
                poco("OK").click()  # 点击确定按钮
                sleep(12)  # 制作过程中等待10秒
                if poco("Do").exists():  # 界面是否存在确定按钮
                    poco("Do").click()  # 点击确定
                    sleep(3)
                    poco("Close").click()  # 点击返回,返回到纹章界面
            else:
                common.printred("没有弹出金属板制作弹窗,请检查。。")
                common.get_screen_shot(start, time.time(), devices,
                                       "没有弹出金属板制作弹窗")
    else:
        if not but.exists():  # 如果界面不存在金属板
            common.printred("没有金属板,没办法进行纹章制作", "blue")
            common.get_screen_shot(start, time.time(), devices, "没有金属板")
            poco("Close").click()  # 点击返回,返回到纹章界面
예제 #7
0
def BtnConsider(start, poco, devices):  # 研究
    common.printgreen("进入研究界面")
    poco("NewGuildHall(Clone)").offspring("NewGuildInterior").offspring("item4").child("GO").click()
    freeze_poco = poco.freeze()  # TODO:定义冻结poco
    if freeze_poco("item0").wait().exists() and \
            freeze_poco("item1").wait().exists() and \
            freeze_poco("item2").wait().exists() and \
            freeze_poco("item3").wait().exists():
        freeze_poco("GuildGrowthLabDlg(Clone)").offspring("item0").click()
        sleep(1)
        freeze_poco = poco.freeze()  # TODO:定义冻结poco
        if freeze_poco("T").exists() and \
                freeze_poco("GuildGrowthLabDlg(Clone)").offspring("Detail").child("Icon").exists() and \
                freeze_poco("GuildGrowthLabDlg(Clone)").offspring("Detail").child("Name").exists() and \
                freeze_poco("CurrentLevel").exists() and \
                freeze_poco("CurrentAttr").exists() and \
                freeze_poco("Tip").exists() and \
                freeze_poco("Levelup").exists() and \
                freeze_poco("Cost").exists():
            # TODO:一下是循环点击升级,暂时屏蔽,以免造成不稳定的情况
            # for item in range(len(freeze_poco("SkillList").child())):
            #     item1 = "item" + str(item)
            #     poco("GuildGrowthLabDlg(Clone)").offspring(item1).click()   # 循环点击技能
            #     freeze_poco("Levelup").click()  # 点击研究
            poco("Close").click()
            close(poco)
        else:
            common.printred("工会研究所界面缺少元素,请检查。。。")
            common.get_screen_shot(start, time.time(), devices, "工会研究所界面缺少元素")
            poco("Close").click()
예제 #8
0
파일: award.py 프로젝트: zlmone/airtest
def reward_dragon(start, poco, item, devices):  # 分享奖励
    poco("XSys_Reward_Dragon").click()
    with poco.freeze() as freezepoco:
        if freezepoco(texture="l_frame_02").exists() and \
                freezepoco(text="本周助战次数:").exists() and \
                freezepoco("Time").exists() and \
                freezepoco("Agreement").exists() and \
                freezepoco("Category").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("item0").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("item1").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("item2").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("item0").child("tmp2").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("item1").child("tmp2").exists() and \
                freezepoco("tmp1").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("item1").child("Get").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("item2").child("Get").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("item0").child("Get").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("item0").child("Icon").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("item1").child("Icon").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("item2").child("Icon").exists():
            common.printgreen("龙穴助战界面UI元素显示正常")
        else:
            common.printred("龙穴助战界面缺少UI元素,详情见截图")
            common.get_screen_shot(start, time.time(), devices, "龙穴助战界面缺少UI元素")


# devices = "127.0.0.1:62001"
# reward(devices)
예제 #9
0
def dragonspirit(start, devices):
    poco = common.deviceconnect(devices)
    if poco("SysG_DragonSpirit").exists():  # 龙魂按钮存在
        if poco("SysG_DragonSpirit").get_position()[0] > 1:  # 界面有龙魂按钮
            poco(texture="halln_4").click()
            poco("SysG_DragonSpirit").click()
        else:
            poco("SysG_DragonSpirit").click()
    freeze_poco = poco.freeze()  # TODO:定义冻结poco
    if freeze_poco("DragonSpiritDlg(Clone)").offspring("AvatarPanel").child("item0").exists() and \
        freeze_poco("DragonSpiritDlg(Clone)").offspring("AvatarPanel").child("item1").exists():
        for item in poco("AvatarPanel").offspring("HeadIcon"):
            item.click()
            freeze_poco = poco.freeze()  # TODO:定义冻结poco
            # 程序隐藏了5个控件,所以以下只点击5次
            count = 0
            for icon in freeze_poco("DragonSpiritDlg(Clone)").offspring(
                    "Panel").offspring("lock"):
                icon.click()
                sleep(0.5)
                icon.click()
                count += 1
                if count >= 5:
                    break
            if poco("DragonSpiritSkillPreView").child("Bg").child(
                    "p").exists():
                icon.click()
            # 点击激活按钮
            # poco("ActivationBtn").click()
            if poco(texture="l_frame_00").exists():
                common.printred("没有激活道具。请补充。。")
                poco("ActivationBtn").click()
                break
            if poco("LevelUpBtn").exists():
                common.printgreen("已经激活,开始喂养")
                poco("LevelUpBtn").click()
                if not poco("Title").exists():  # 如果没有弹出就重新点击
                    poco("LevelUpBtn").click()
                if poco("Title").exists():  # 喂养界面
                    if poco("DragonSpiritHandler").offspring(
                            "LevelUpBtn").exists():  # 如果有喂养按钮
                        poco("DragonSpiritHandler").offspring(
                            "LevelUpBtn").click()  # 点击喂养
                        poco(texture="l_close_00").click()  # 点击关闭
                    elif poco("DirectUpBtn").exists():  # 如果有突破按钮
                        poco("DirectUpBtn").click()  # 点击突破
                        poco(texture="l_close_00").click()  # 点击关闭
                else:
                    common.printred("没有弹出喂养界面,请检查。。。")
                    common.get_screen_shot(start, time.time(), devices,
                                           "没有弹出喂养界面")
            if poco("ItemAccessDlg(Clone)").offspring("Title").exists():
                freeze_poco("ActivationBtn").click()
    else:
        common.printred("龙魂界面控件缺失,请检查")
        common.get_screen_shot(start, time.time(), devices, "龙魂界面控件缺失")
    return poco("Total").child("Text").get_text()  # 龙魂总属性
예제 #10
0
def BtnRanking(start, poco, devices):  # 排行
    common.printgreen("进入排行榜界面")
    freeze_poco = poco.freeze()  # TODO:定义冻结poco
    if freeze_poco("16").exists() and freeze_poco("17").exists() and freeze_poco("18").exists():
        freeze_poco("16").click()
        freeze_poco("17").click()
        freeze_poco("18").click()
    else:
        common.printred("进入排行榜界面控件缺失,请检查。。。")
        common.get_screen_shot(start, time.time(), devices, "进入排行榜界面控件缺失")
    close(poco)
예제 #11
0
def Prof1_fenzhi(poco):
    """
    判断当前角色是否已经转职,如果已经转职,则重置当前角色
    :return:
    """
    poco("ResetProf").click()  # 点击重置转职
    for i in range(3):
        if poco("GreyModalDlg(Clone)").child("Bg").exists():
            poco("OK").click()
    else:
        common.printgreen("当前角色还未转职,不需要重新转职")
예제 #12
0
파일: award.py 프로젝트: zlmone/airtest
def share_reward(start, poco, item, devices):  # 分享奖励
    poco("XSys_WeekShareReward").click()
    with poco.freeze() as freezepoco:
        if freezepoco("item0").exists() and \
                freezepoco("BtnShare").exists() and \
                freezepoco("Label").exists() and \
                freezepoco("WeekDesc").exists() and \
                freezepoco("ActivityDes").exists():
            common.printgreen("分享奖励界面UI元素显示正常")
        else:
            common.printred("分享奖励界面缺少UI元素,详情见截图")
            common.get_screen_shot(start, time.time(), devices, "分享奖励界面缺少UI元素")
예제 #13
0
def BtnMall(poco, devices):  # 商店
    freeze_poco = poco.freeze()  # TODO:定义dongjiepoco
    for item in range(len(freeze_poco("Panel").child())):
        item1 = "item" + str(item)
        if freeze_poco("MallDlg(Clone)").offspring(item1).exists():
            pass
    poco("MallDlg(Clone)").offspring("item0").child("BtnBuy").click()  # 购买商品
    if poco("OK").exists():
        poco("OK").click()
    else:
        common.printgreen("不能购买商品")
    close(poco)
예제 #14
0
파일: intensify.py 프로젝트: zlmone/airtest
def Intensify(devices):  # 主界面点击变强按钮
    """
    主界面点击变强按钮
    :return:
    """
    poco = common.deviceconnect(devices)
    if poco("SysIBq").exists():
        poco("SysIBq").click()  # 主界面变强按钮
    else:
        common.printred("主界面没有找到变强按钮")
    for item in range(len(poco("scroll").child())):
        item1 = "item" + str(item)
        pos = poco("FpStrengthenDlg(Clone)").offspring(item1)  # 获取当前控件
        if pos.exists():
            butpos(devices,
                   butpos=pos,
                   pos1=0.32,
                   pos2=0.81,
                   high=158,
                   low=544,
                   lows=290)  # 调用butpos方法
            common.printgreen("进入" + poco("FpStrengthenDlg(Clone)").offspring(
                item1).offspring("TextLabel").get_text() + "功能,开始检查子页签")
            pos.click()  # 点击变强子按钮

        else:
            common.printred("没有找到" + poco("FpStrengthenDlg(Clone)").offspring(
                item1).offspring("TextLabel").get_text() + "按钮,请检查..")
        freeze_poco = poco.freeze()  # TODO:定义dongjiepoco
        for item2 in range(len(freeze_poco("Panel").child())):  # 获取子页签的按钮
            item2 = "item" + str(item2)
            if freeze_poco("FpStrengthenDlg(Clone)").offspring(item2).child(
                    "Strengthen").child("TittleLab").exists():
                pos = freeze_poco("FpStrengthenDlg(Clone)").offspring(
                    item2).child("Strengthen").child("TittleLab")
                # butpos(butpos=pos,pos1=0.33,pos2=0.85,high=1330,low=930,lows=482)  # 调用butpos方法
            elif freeze_poco("FpStrengthenDlg(Clone)").offspring(item2).child(
                    "Other").child("Label").exists():
                pos = freeze_poco("FpStrengthenDlg(Clone)").offspring(
                    item2).child("Other").child("Label")
                # butpos(butpos=pos, pos1=0.33, pos2=0.85, high=1330, low=930, lows=482)  # 调用butpos方法
            if pos.exists():
                common.printgreen(
                    freeze_poco("FpStrengthenDlg(Clone)").offspring(
                        f"{item1}").offspring("TextLabel").get_text() +
                    "-->>" + pos.get_text() + "-->>显示成功")
            else:
                common.printred(
                    "无法获取" + poco("FpStrengthenDlg(Clone)").offspring(
                        f"{item1}").offspring("TextLabel").get_text() +
                    f"选项第{item}个子页签。赶紧检查..")
    return pos.get_text()  # 变强功能最后一个检查点--对应的活跃度宝箱打开随机获得水晶显示成功
예제 #15
0
파일: award.py 프로젝트: zlmone/airtest
def design_achieve(start, poco, item, devices):  # 成就奖励
    poco("XSys_Design_Achieve").click()
    try:
        with poco.freeze() as freezepoco:
            count = freezepoco("padTabs").child()
            for i in range(len(count)):
                TabTpl = "TabTpl" + str(i)
                freezepoco("padTabs").child(TabTpl).click()
        common.printgreen("成就界面按钮点击正常")
    except Exception as e:
        common.printred("成就界面按钮点击异常")
        common.printred(e)
        common.get_screen_shot(start, time.time(), devices, "成就界面按钮点击异常")
예제 #16
0
def mail(start, devices):
    poco = common.deviceconnect(devices)
    if poco("Back").exists():
        poco("Back").click()  # 点击聊天功能
        sleep(1)
        # 点击世界频道按钮
        poco("tab1").click()
        if poco("Mail").exists():
            # 点击邮箱
            poco("Mail").click()
            if poco("MailName").exists():
                common.printgreen("进入邮箱功能")
                common.printgreen("点击邮件收取")
                poco("sqBtn").click()
                sleep(2)
                if poco("GreyModalDlg(Clone)").child("Bg").exists():
                    common.printgreen("没有可领取的邮件")
                    sleep(1)
                    poco("OK").click()
                if poco("MailDlg(Clone)").offspring("item0").exists():
                    common.printgreen(
                        "邮箱有邮件,开始进行删除测试,因为删除是没有反馈的,所以只进行点击测试,拿不到结果")
                    poco("MailDlg(Clone)").offspring("item0").child(
                        "sign").click()
                    poco("deletBtn").click()
            else:
                common.printred("没有进入邮箱界面,请检查")
                common.get_screen_shot(start, time.time(), devices, "没有进入邮箱界面")
    return poco("MailName").get_text()  # 邮 件
예제 #17
0
파일: award.py 프로젝트: zlmone/airtest
def level_reward(start, poco, item, devices):  # 等级奖励
    poco("XSys_LevelReward").click()
    with poco.freeze() as freezepoco:
        if freezepoco("Panel").exists() and \
                freezepoco("T1").exists() and \
                freezepoco("T3").exists() and \
                freezepoco("T4").exists() and \
                freezepoco("Panel").offspring("Name").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("Panel").offspring("Fetch").exists() and \
                freezepoco("RewardDlg(Clone)").offspring("Panel").offspring("ItemReward").exists():
            common.printgreen("等级奖励界面UI元素显示正常")
        else:
            common.printred("等级奖励界面缺少UI元素,详情见截图")
            common.get_screen_shot(start, time.time(), devices, "等级奖励界面缺少UI元素")
예제 #18
0
def Btnfish(start, poco, devices):  # 钓鱼
    common.printgreen("进入钓鱼界面")
    poco("NewGuildHall(Clone)").offspring("NewGuildWelfare").offspring("item4").child("GO").click()
    freeze_poco = poco.freeze()  # TODO:定义冻结poco
    if poco("Title").exists():
        for item in range(len(freeze_poco("ScrollView").child())):
            item1 = "item" + str(item)
            if freeze_poco("NewGuildHall(Clone)").offspring("GuildFishDlg").child("Bg")\
                    .offspring("ScrollView").child(item1).exists():
                pass
        poco(texture="l_close_00").click()  # 点击返回
    else:
        common.printred("没有进入工会钓鱼界面,请检查。。。")
        common.get_screen_shot(start, time.time(), devices, "没有进入工会钓鱼界面")
예제 #19
0
파일: initial.py 프로젝트: zlmone/airtest
def stop_APP(devices, packagename):
    try:
        print("游戏未启动,开始启动游戏...")
        common.stop_app(packagename)
        common.sleep(1)
        common.start_app(packagename)
        common.sleep(3)
        start = time.time()
        while True:
            common.os.system(f"adb -s {devices} shell input tap {100} {100}")
            common.sleep(3)
            common.os.system(f"adb -s {devices} shell input tap {100} {100}")
            poco = common.deviceconnect(devices)
            try:
                if poco("Dialog").exists():
                    poco("OK").click()
                if poco("LabelStatus").exists():
                    common.printgreen("等待更新完成....")
                    poco("AnnouncementDlg(Clone)").child("Bg").child("Enter").wait_for_appearance()
                common.printgreen("请耐心等待...")
                poco("AnnouncementDlg(Clone)").child("Bg").child("Enter").wait_for_appearance(25)
                break
            except:
                if time.time() - start > 120:
                    print(f"游戏启动时间超过 {start}s,现在进行重新启动")
                    stop_APP(devices, packagename)
                    break
                print("正在启动游戏,请稍后...")
        poco(texture="l_button_00").wait_for_appearance()
        poco(texture="l_button_00").click()
        common.sleep(3)
        if poco(text="进入游戏").exists():
            poco(text="进入游戏").click()
            if poco(text="进入游戏").exists():
                poco(text="进入游戏").click()
            print("点击进入游戏,开始选择角色。。。")
            poco("EnterGame").wait_for_appearance(5)
            common.sleep(3)
            if poco("EnterGame").exists():
                poco("EnterGame").click()
                print("角色自动寻找成功,点击开始游戏。。。")
                common.sleep(15)
            else:
                print("进入游戏失败,请检查。。。。")
        else:
            print("进入游戏失败,请检查。。。。")
        interface(devices, packagename)
    except ConnectionAbortedError as e:
        print(f"{e} 主机断开连接,杀掉游戏进程,脚本重新启动")
        restart_app(devices)
예제 #20
0
def Donation(start, poco, devices):  # 捐赠
    common.printgreen("进入捐赠界面")
    poco("NewGuildHall(Clone)").offspring("NewGuildInterior").offspring("item2").child("GO").click()
    freeze_poco = poco.freeze()  # TODO:定义冻结poco
    if freeze_poco("T").exists() and freeze_poco("RankBtn").exists():
        poco("RankBtn").click()  # 点击排行榜
        freeze_poco = poco.freeze()  # TODO:定义冻结poco
        if freeze_poco("Tittle").exists() and \
                freeze_poco("All").exists() and \
                freeze_poco("Self").exists() and \
                freeze_poco(text="排名").exists() and \
                freeze_poco("Top").child("T")[2].exists() and \
                freeze_poco(text="角色").exists():
            poco("Self").child("TextLabel").click()  # 点击历史排名
            freeze_poco = poco.freeze()  # TODO:定义冻结poco
            if freeze_poco(text="排名").exists() and \
                    freeze_poco("Top").child("T")[2].exists() and \
                    freeze_poco(text="角色").exists():
                poco(texture="l_close_00").click()
            else:
                common.printred("捐赠历史排行界面元素缺失,请检查。。。")
                common.get_screen_shot(start, time.time(), devices, "捐赠历史排行界面元素缺失")
                poco(texture="l_close_00").click()
        else:
            common.printred("捐赠今日排行界面元素缺失,请检查。。。")
            common.get_screen_shot(start, time.time(), devices, "捐赠今日排行界面元素缺失")
            poco(texture="l_close_00").click()
    poco("GrowthDonation").click()  # 点击资材收集
    freeze_poco = poco.freeze()  # TODO:定义冻结poco
    for item in range(len(freeze_poco("List").child())):
        item1 = "item" + str(item)
        if freeze_poco(item1).exists() and freeze_poco(item1).child("Do").exists() and freeze_poco("box").exists():
            freeze_poco(item1).child("Do").click()  # 点击缴纳
        else:
            common.printred("捐赠今日排行界面元素缺失,请检查。。。")
            common.get_screen_shot(start, time.time(), devices, "捐赠今日排行界面元素缺失")
    poco("RecordBtn").click()  # 点击捐献记录
    if poco("Tittle").exists():
        poco(texture="l_close_00").click()
    else:
        common.printred("捐赠记录没有弹出,请检查。。。")
        common.get_screen_shot(start, time.time(), devices, "捐赠记录没有弹出")
    poco("WeeklyDonation").click()  # 点击悬赏捐赠
    if poco("Bg2").exists():
        close(poco)
    else:
        common.printred("悬赏捐赠,请检查。。。")
        common.get_screen_shot(start, time.time(), devices, "悬赏捐赠")
예제 #21
0
def fetters(start, devices):
    poco = common.deviceconnect(devices)
    if poco("SysE_NPCFavor").exists():  # 羁绊按钮存在
        if poco("SysE_NPCFavor").get_position()[0] > 1:  # 界面有羁绊按钮
            poco(texture="halln_4").click()
            poco("SysE_NPCFavor").click()
        else:
            poco("SysE_NPCFavor").click()
    freeze_poco = poco.freeze()  # TODO:定义冻结poco
    if freeze_poco("BookBg").exists() and \
            freeze_poco("TabTpl0").exists() and \
            freeze_poco("TabTpl2").exists() and \
            freeze_poco("TabTpl1").exists():
        # 点击好感度
        for TabTp in freeze_poco("Tabs").offspring("Bg"):
            TabTp.click()
            freeze_poco = poco.freeze()  # TODO:定义冻结poco
            try:
                if freeze_poco("WrapContent").offspring("NpcName").exists():
                    for Npcname in freeze_poco("WrapContent").offspring("NpcName"):
                        common.printgreen(f"检查点 {Npcname.get_text()} 显示正确")
                if freeze_poco("WrapContent").offspring("GroupName").exists():
                    for Npcname in freeze_poco("WrapContent").offspring("GroupName"):
                        common.printgreen(f"检查点 {Npcname.get_text()} 显示正确")
            except PocoNoSuchNodeException:
                pass
        # TODO:以下代码为激活状态下的操作
        common.printgreen("点击好感度")
        poco("TabTpl0").click()  # 点击好感度
        if poco("NpcInfo").child("Activation").child("RedPoint").exists():
            if poco("NpcInfo").child("Activation").child("RedPoint").get_position()[0] < 1:  # 可激活按钮存在
                common.printgreen("点击激活")
                poco("NpcInfo").child("Activation").click()  # 点击激活
        if poco("GoBtn").exists():  # 前往赠送按钮存在
            if poco("GoBtn").get_position()[0] < 1:
                common.printgreen("点击前往赠送")
                poco("GoBtn").click()  # 点击前往赠送
                if poco("BtnSend").wait(30).exists():  # 等待出现对话框
                    poco().click([0.5, 0.5])  # 出现了对话框就点击屏幕中间
                    return "羁绊"
                else:
                    common.printred("没有出现对话框,请检查")
                    common.get_screen_shot(start, time.time(), devices, "没有出现对话框")
    else:
        common.printred("羁绊界面控件缺失,请检查")
        common.get_screen_shot(start, time.time(), devices, "羁绊界面控件缺失")

    return poco(texture="l_tip_00").child("T").get_text()  # 羁绊
예제 #22
0
파일: award.py 프로젝트: zlmone/airtest
def reward_target(start, poco, item, devices):  # 目标奖励
    poco("XSys_Reward_Target").click()
    try:
        with poco.freeze() as freezepoco:
            count = freezepoco("padTabs").child("TabList").child()
            for i in range(len(count)):
                if i == 2:
                    TabTpl = "TabTpl3"
                else:
                    TabTpl = "TabTpl" + str(i)
                freezepoco("padTabs").child("TabList").child(TabTpl).click()
        common.printgreen("目标奖励界面按钮点击正常")
    except Exception as e:
        common.printred("目标奖励界面按钮点击异常")
        common.printred(e)
        common.get_screen_shot(start, time.time(), devices, "目标奖励界面按钮点击异常")
예제 #23
0
def test_Archer_5(start, devices):  # Prof2-转职为弓箭手分支、游侠分支、影舞者分支
    """
       Prof2-转职为弓箭手分支、游侠分支、影舞者分支
    :return:
    """
    poco = common.deviceconnect(devices)
    common.printgreen("Prof2-转职为弓箭手分支、游侠分支、影舞者分支")
    Skill_Switchroles(2,poco, devices)
    poco("SkillTree(Clone)").offspring("Tabs").child("item1").click()  # 点击15级转职
    poco("ProDetail2").click()  # 点击选择猎人职业
    Prof1_zhiye(start, poco,devices)  # 转职为弓箭手分支、游侠分支
    poco("SkillTree(Clone)").offspring("Tabs").child("item2").click()  # 点击二转职业
    poco("ProDetail2").click()  # Prof2-转职为弓箭手分支、游侠分支、影舞者分支
    """点击、影舞者职业"""
    Prof1_zhiye(start, poco,devices)  # Prof2-转职为弓箭手分支、游侠分支、影舞者分支
    juexing(poco)  # 点击觉醒
    return Skill(start, poco,devices)  # 测试技能模块
예제 #24
0
def test_pastor_3(start, devices):  # Prof4-转职为牧师分支、贤者分支、十字军分支
    """
        Prof4-转职为牧师分支、贤者分支、十字军分支
    :return:
    """
    poco = common.deviceconnect(devices)
    common.printgreen("Prof4-转职为牧师分支、贤者分支、十字军分支")
    Skill_Switchroles(4,poco, devices)
    poco("SkillTree(Clone)").offspring("Tabs").child("item1").click()  # 点击15级转职
    poco("ProDetail2").click()  # 转职为牧师分支、祭祀分支
    Prof1_zhiye(start, poco,devices)  # 转职为牧师分支、祭祀分支
    poco("SkillTree(Clone)").offspring("Tabs").child("item2").click()  # 点击二转职业
    poco("ProDetail2").click()  # PProf4-转职为牧师分支、贤者分支、十字军分支
    """点击十字军分支职业"""
    Prof1_zhiye(start, poco,devices)  # Prof4-转职为牧师分支、贤者分支、十字军分支
    juexing(poco)  # 点击觉醒
    return Skill(start, poco,devices)  # 测试技能模块
예제 #25
0
def PlayerBg(start, poco, devices):  # 政厅
    common.printgreen("进入政厅界面")
    poco("NewGuildHall(Clone)").offspring("NewGuildInterior").offspring("item3").child("GO").click()
    freeze_poco = poco.freeze()  # TODO:定义冻结poco
    if freeze_poco("GuildGrowthBuffDlg(Clone)").offspring("Detail").child("Name").exists() and \
            freeze_poco("MaxLevel").exists() and \
            freeze_poco("CurrentLevel").exists() and \
            freeze_poco("CurrentAttr").exists() and \
            freeze_poco("Levelup").exists():
        # TODO:一下是循环点击升级,暂时屏蔽,以免造成不稳定的情况
        # for item in range(len(freeze_poco("SkillList").child())):
        #     item1 = "item" + str(item)
        #     poco("GuildGrowthBuffDlg(Clone)").offspring(item1).click()  # 循环点击技能
        #     freeze_poco("Levelup").click()  # 点击升级按钮
        poco("Close").click()
    else:
        common.printred("工会政厅界面缺少元素,请检查。。。")
        common.get_screen_shot(start, time.time(), devices, "工会政厅界面缺少元素")
        poco("Close").click()
예제 #26
0
파일: heraldry.py 프로젝트: zlmone/airtest
def heraldry(start, devices):
    poco = common.deviceconnect(devices)
    if poco("SysAItem").get_position()[0] > 1:
        poco(texture="halln_4").click()
        sleep(1)
    poco("SysAItem").click()  # 点击角色按钮
    if poco("Title").exists():
        common.printgreen("进入角色界面")
        if poco("XSys_Char_Emblem").exists():
            poco("XSys_Char_Emblem").click()  # 点击纹章
            if poco("ItemNewDlg(Clone)").offspring("Items").child(
                    "Frame").offspring("T").exists():
                common.printgreen("进入金属板界面,开始进行纹章制作")
                # TODO:接下来进行纹章制作,纹章装备和卸下的操作已经完成
                addheraldry(start, poco, devices)  # 调用纹章制作

                common.printgreen("进入纹章界面,开始测试纹章")
                but = poco("ItemNewDlg(Clone)").offspring(name="Icon")
                if but.exists():
                    but.click()  # 点击已经装备的纹章
                    if poco("main").exists():
                        poco("Button1").click()  # 点击卸下
                if poco("ItemNewDlg(Clone)").offspring("Items").offspring(
                        "Icon").exists():
                    but = poco("ItemNewDlg(Clone)").offspring(
                        "Items").offspring(name="Icon")
                    if but.exists():
                        but.click()  # 点击第一个纹章
                    if poco("main").exists():  # 打开纹章装备界面
                        poco("Button1").click()  # 点击装备
                        common.get_screen_shot(start, time.time(), devices,
                                               "装备纹章截图验证")
                        but = poco("ItemNewDlg(Clone)").offspring(name="Icon")
                        if but.exists():
                            but.click()  # 点击已经装备的纹章
                            if poco("main").exists():
                                poco("Button1").click()  # 点击卸下
                    else:
                        common.printgreen("点击纹章后没有打开纹章装备界面")
                        common.get_screen_shot(start, time.time(), devices,
                                               "点击纹章后没有打开纹章装备界面")
                else:
                    common.printred("没有纹章,请添加文章后进行操作")
                    common.get_screen_shot(start, time.time(), devices, "没有纹章")
        else:
            common.printred("没有进入角纹章界面,请检查。。")
            common.get_screen_shot(start, time.time(), devices, "没有进入角色")
    else:
        common.printred("没有进入角色,请检查。。")
        common.get_screen_shot(start, time.time(), devices, "没有进入角色")
    return poco("ItemNewDlg(Clone)").offspring("EmblemListPanel").child(
        "Frame").offspring("T").get_text()  # 纹章
예제 #27
0
파일: material.py 프로젝트: zlmone/airtest
def material(start, devices):
    poco = common.deviceconnect(devices)
    if poco("SysGPrepare").exists():
        poco("SysGPrepare").click()
        if poco("UIRoot(Clone)").offspring("DailyDungeonDlg").offspring(
                "SelectedTextLabel").exists():
            common.printgreen("进入物资筹备界面")
            freeze_poco = poco.freeze()  # TODO:定义dongjiepoco
            for Desc in freeze_poco("UIRoot(Clone)").offspring(
                    "DailyDungeonDlg").offspring("Desc"):
                common.printgreen(f"点击{Desc.get_text()}")
                Desc.click()
                if poco("UIRoot(Clone)").offspring(
                        "DailyDungeonDlg").offspring("WrapContent").exists():
                    poco(texture="l_close_00").click()
    else:
        common.printred("主界面没有物资筹备按钮,请检查。。。")
        common.get_screen_shot(start, time.time(), devices, "主界面没有物资筹备按钮")
    return poco("UIRoot(Clone)").offspring("DailyDungeonDlg").offspring(
        "TextLabel").get_text()  # 日常攻略
예제 #28
0
def BtnSkill(start, poco, devices):  # 技能
    common.printgreen("进入技能界面")
    poco("NewGuildHall(Clone)").offspring("NewGuildInterior").offspring("item0").child("GO").click()
    freeze_poco = poco.freeze()  # TODO:定义冻结poco
    for skill in range(1, len(freeze_poco("SkillList").child())):
        skill1 = "Skill" + str(skill)
        if freeze_poco(skill1).exists():
            pass
        else:
            common.printred("工会技能缺失,请检查。。。")
            common.get_screen_shot(start, time.time(), devices, "工会技能缺失")
    if freeze_poco("texbg").exists() and \
            freeze_poco("Name").exists() and \
            freeze_poco("Levelup").exists():
        pass
    else:
        common.printred("工会技能界面元素缺失,请检查。。。")
        common.get_screen_shot(start, time.time(), devices, "工会技能界面元素缺失")
    freeze_poco("Levelup").click()  # 点击升级按钮,没办法做是否成功的判断
    close(poco)
예제 #29
0
def BtnSignIn(start, poco, devices):  # 签到
    freeze_poco = poco.freeze()  # TODO:定义dongjiepoco
    if freeze_poco(texture="public_Flag").exists() and \
            freeze_poco("GuildSignInDlg(Clone)").offspring("SignInButtons").child("item0").child("BtnOK").exists() and \
            freeze_poco("GuildSignInDlg(Clone)").offspring("SignInButtons").child("item0").exists() and \
            freeze_poco("GuildSignInDlg(Clone)").offspring("SignInButtons").child("item1").child("BtnOK").exists() and \
            freeze_poco("GuildSignInDlg(Clone)").offspring("SignInButtons").child("item1").exists() and \
            freeze_poco("GuildSignInDlg(Clone)").offspring("SignInButtons").child("item2").child("BtnOK").exists() and \
            freeze_poco("GuildSignInDlg(Clone)").offspring("SignInButtons").child("item2").exists() and \
            freeze_poco("GuildSignInDlg(Clone)").child("Bg").offspring("item0").exists() and \
            freeze_poco("GuildSignInDlg(Clone)").child("Bg").offspring("item1").exists() and \
            freeze_poco("GuildSignInDlg(Clone)").child("Bg").offspring("item2").exists() and \
            freeze_poco("GuildSignInDlg(Clone)").child("Bg").offspring("item3").exists():
        freeze_poco("GuildSignInDlg(Clone)").offspring("SignInButtons").child(
            "item2").child("BtnOK").click()  # 点击龙币签到
        close(poco)
    else:
        common.printgreen("工会签到界面缺少控件元素")
        common.get_screen_shot(start, time.time(), devices, "工会签到界面缺少控件元素")
        close(poco)
예제 #30
0
def buy(start, devices):
    """
    测试商城购买功能,前提条件,拥有龙币,水晶,水晶GM  item 14 999999
    :param start:
    :param devices:
    :return:
    """
    poco = common.deviceconnect(devices)
    if poco("SysAGameMall").exists():
        poco("SysAGameMall").click()
    else:
        common.printred("主界面找不到商城按钮,请检查")
    Mallbutlist = ["XSys_GameMall_Dragon", "XSys_GameMall_CRYSTAL"]
    for but in Mallbutlist:
        if poco(but).exists():
            common.printgreen("开始点击商城内 " + poco("GameMall(Clone)").offspring(
                but).offspring("SelectedTextLabel").get_text() + " 子页签")
            poco(but).click()
            # 操作装备按钮
            if poco("GameMall(Clone)").offspring("TabsFrame").child(
                    "item1").exists():
                poco("GameMall(Clone)").offspring("TabsFrame").child(
                    "item1").click()
                if int(poco("Count").child(
                        "Label").get_text()) >= 1:  # 判断是否有的卖
                    poco("OK").click()  # 点击购买
                    if poco(texture="l_button_00").exists():
                        common.printred("货币不足,请提供可购买的货币")
                        poco("Cancel").click()  # 点击取消弹窗,否则不好重置换成了
                        common.get_screen_shot(start, time.time(), devices,
                                               "货币不足")
                        return None
                else:
                    common.printred("没有物品可以购买")
                    common.get_screen_shot(start, time.time(), devices,
                                           "没有物品可以购买")
            else:
                common.printred("没有找到装备页签,请检查")
                common.get_screen_shot(start, time.time(), devices,
                                       "主界面没有社交按钮")
    return poco("GameMall(Clone)").child("Bg").child("T").get_text()  # 水晶商城