示例#1
0
文件: Gameplay.py 项目: Sinxs/JDHCR
def head():
    start()
    poco = UnityPoco()
    poco("btn_setting").click()
    print("点击设置")
    if poco("btn_head").exists():
        poco("btn_head").click()
        print("头像")
    else:
        print("没有头像")
    for i in range(35, 37):
        print(i)
        if i >= 21:
            print("up")
            x, y = poco(texture="team_20").get_position()
            dir = [0, -0.5]
            poco.swipe([x, y], direction=dir)
            poco("Batch_bg").child("img_head_bg")[i].click()
            if i < 36:
                poco("btn_head").click()
                print("切换%s号头像test成功" % i)
        else:
            print(i)
            poco("Batch_bg").child("img_head_bg")[i].click()
            poco("btn_head").click()
            print("切换%s号头像test成功" % i)
    print("测试完成")
    return poco("img_icon")
示例#2
0
import time
import csv

from poco.drivers.android.uiautomation import AndroidUiautomationPoco
poco = AndroidUiautomationPoco(use_airtest_input=True,
                               screenshot_each_action=False)
fp = open('自己所设的csv文件位置', 'wt', newline='', encoding='utf_8_sig')
writer = csv.writer(fp)
for i in range(0, 100):
    for j in range(0, 6):
        poco(name="com.ss.android.ugc.aweme:id/dls")[j].click()

        usr = poco(name="com.ss.android.ugc.aweme:id/bqe").get_text()
        douyin_num = poco(name="com.ss.android.ugc.aweme:id/dnn").get_text()
        nd = poco(name="android.widget.TextView")
        nd_text = [a.get_text() for a in nd]
        huozan = poco(name="com.ss.android.ugc.aweme:id/a4f").get_text()
        guanzhu = poco(name="com.ss.android.ugc.aweme:id/ah0").get_text()
        fans = poco(name="com.ss.android.ugc.aweme:id/agw").get_text()
        zdx = poco(name="com.ss.android.ugc.aweme:id/title")
        zdx_text = [b.get_text() for b in zdx]
        writer.writerow(
            (usr, douyin_num, nd_text, huozan, guanzhu, fans, zdx_text))

        poco(name="com.ss.android.ugc.aweme:id/j4").click()

    print(i)
    poco.swipe([0.5, 0.8], [0.5, 0.2])

fp.close()
示例#3
0
class MakeLvCase(Login):
    @classmethod
    def setUpClass(cls):
        super(MakeLvCase, cls).setUpClass()

    @classmethod
    def teardownclass(cls):
        super(MakeLvCase, cls).tearDownClass()

    #     stop_app("com.gameholic.drawsomethingbyspider")

    def setUp(self):
        stop_app("com.gameholic.drawsomethingbyspider")
        clear_app("com.gameholic.drawsomethingbyspider")
        wake()
        home()
        start_app("com.gameholic.drawsomethingbyspider")
        sleep(7)
        self.poco = UnityPoco()
        print("make level test start")

    def enterMakelevel(self):
        # self.poco = UnityPoco()
        self.poco("MakeLV").click()
        sleep(1)
        if self.poco("Up").child("Text").exists():
            print("enter make level successfully")

    def lookHelp(self):
        # self.poco = UnityPoco()
        self.poco("Explain").click()
        sleep(1)
        if self.poco("txt").exists():
            print("look help interface successfully")
            self.poco(text="OK").click()
            if not self.poco("txt").exists():
                print("exit help interface successfully")

    def exitMylevel(self):
        # self.poco = UnityPoco()
        self.poco("Return").click()
        sleep(2)
        if not self.poco(text="My level").exists():
            print("exit my level interface successfully")

    def swipeMylevel(self):
        # self.poco = UnityPoco()
        if len(self.poco("Tree").child().nodes) >= 5:
            self.poco("Tree").child()[0].child("idtext").get_position()

            beforeSwipe = self.poco("Tree").child()[0].child(
                "idtext").get_position()
            self.poco.swipe([100.0 / 1920, 100.0 / 1080],
                            [100.0 / 1920, -200.0 / 1080])
            sleep(2)
            afterSwipe = self.poco("Tree").child()[0].child(
                "idtext").get_position()
            if beforeSwipe != afterSwipe:
                print("swipe successfully")
            else:
                print("swipe failed")

    def addLevel(self):
        # self.poco = UnityPoco()
        self.poco("PlayerMakeLevel").click()
        if self.poco(text="Disclaimer").exists():
            print("open disclaimer interface successfully")

    def closeDisclaimer(self):
        # self.poco = UnityPoco()
        self.poco(text="Cancel").click()
        sleep(1)
        if not self.poco(text="Disclaimer").exists():
            print("close disclaimer successfully")

    def agreeDisclaimer(self):
        # self.poco = UnityPoco()
        self.poco(text="I Agree").click()
        sleep(1)
        if self.poco(text="Choose from album").exists():
            print("enter make level interface successfully")

    def switchLebel(self):
        # self.poco = UnityPoco()
        self.poco(text="Monster").click()
        sleep(1)
        if self.poco("SetMonster_D").exists():
            print("switch to monster interface successfully")
        self.poco(text="Publish").click()
        sleep(1)
        if self.poco("Save_Releaseit").exists():
            print("switch to publish interface successfully")
        self.poco(text="Background").click()
        sleep(1)
        if self.poco(text="Choose from album").exists():
            print("switch to background interface successfully")

    def closeMakeLevel(self):
        # self.poco = UnityPoco()
        self.poco("Return").click()
        sleep(2)
        if not self.poco(text="Background").exists():
            print("close make level interface successfully")

    def chooseAlbum(self):
        self.poco(text="Choose from album").click()
        sleep(5)
        self.poco1 = AndroidUiautomationPoco(force_restart=False)
        if self.poco1("android.widget.TextView").exists():
            print("open album successfully")
        shell("input keyevent 4")  #关闭选择图片
        if not self.poco1("android.widget.TextView").exists():
            print("close album successfully")

    def takePhotos(self):
        self.poco(text="Take a photo").click()
        sleep(5)
        self.poco1 = AndroidUiautomationPoco(force_restart=False)
        if self.poco1(
                "com.google.android.GoogleCamera:id/shutter_button").exists():
            print("open camera successfully")
            shell("input keyevent 4")
        if not self.poco1(
                "com.google.android.GoogleCamera:id/shutter_button").exists():
            print("close camera successfully")

    def addSuccessfully(self):
        #红米note2
        self.poco(text="Take a photo").click()
        sleep(5)
        self.poco1 = AndroidUiautomationPoco(force_restart=False)
        if self.poco1(
                "com.android.camera:id/v6_shutter_button_internal").exists():
            self.poco1(
                "com.android.camera:id/v6_shutter_button_internal").click()
            sleep(1)
            self.poco1(
                "com.android.camera:id/v6_btn_done").wait_for_appearance()
            if self.poco1("com.android.camera:id/v6_btn_done").exists():
                self.poco1("com.android.camera:id/v6_btn_done").click()
                sleep(5)
            if self.poco1("com.miui.gallery:id/wallpaper_apply").exists():
                self.poco1("com.miui.gallery:id/wallpaper_apply").click()
                sleep(1)

    def addMonster(self):
        # self.poco = UnityPoco()
        self.poco(text="Monster").click()
        sleep(1)
        #添加怪物预览
        if self.poco("Tree").child().exists():
            self.poco("Tree").child()[0].click()
            sleep(1)
        if self.poco("usedlingdaoli").get_text() != 0:
            print("add monster successfully")
        self.poco(text="Preview").click()
        sleep(2)
        if self.poco("Mask").exists():
            print("preview successfully")
            self.poco.click([0.1, 0.1])
            sleep(2)
            if not self.poco("Mask").exists():
                print("exit preview successfully")
        #滑动怪物选择,添加超出统率力情况
        if self.poco("Monster_1122").exists():
            self.swipeMonster()
        self.poco(text="Reset monster").click()
        sleep(1)
        if self.poco("usedlingdaoli").get_text() == 0:
            print("reset ok")
        self.poco("Monster_1001").click()

    def swipeMonster(self):
        # self.poco = UnityPoco()
        self.poco.swipe([1000.0 / 1080, 1660.0 / 1920],
                        [10.0 / 1080, 1660.0 / 1920],
                        duration=0.2)
        sleep(2)
        pos = self.poco("Monster_1122").get_position()
        if min(pos) > 0:
            for _ in range(3):
                self.poco("Monster_1122").click()
                sleep(1)
            if "Your leadership is not" in self.poco("lable").get_text():
                print("leadership not enough ok")
                self.poco(text="OK").click()
                sleep(1)
                if not self.poco("lable").exists():
                    print("close leadership not enough interface successfully")
            self.poco(text="Reset monster").click()
            self.poco.swipe([10.0 / 1080, 1660.0 / 1920],
                            [1000.0 / 1080, 1660.0 / 1920],
                            duration=0.2)

    def switchPrivacy(self):
        # self.poco = UnityPoco()
        self.poco(text="Public").click()
        sleep(1)
        assert_exists(
            Template(r"tpl1526632435537.png",
                     threshold=0.9,
                     target_pos=5,
                     rgb=False,
                     record_pos=(-0.384, -0.207),
                     resolution=(576, 1024)), "switch to Open pass")
        self.poco("OnlyFriend").click()
        sleep(1)
        assert_exists(
            Template(r"tpl1526632538433.png",
                     threshold=0.9,
                     target_pos=5,
                     rgb=False,
                     record_pos=(-0.295, -0.127),
                     resolution=(576, 1024)), "switch to Just pass")
        self.poco("OnlyMe").click()
        sleep(1)
        assert_exists(
            exists(
                Template(r"tpl1526632587864.png",
                         threshold=0.9,
                         target_pos=5,
                         rgb=False,
                         record_pos=(-0.267, -0.042),
                         resolution=(576, 1024))), "switch to Publicity pass")

    def textLevelInfo(self):
        # self.poco = UnityPoco()
        self.poco("LvNameInput").click()
        sleep(1)
        now = time.strftime('%H%M%S')
        global title
        title = "test" + now
        text(title)
        self.poco1 = AndroidUiautomationPoco(force_restart=False)
        if self.poco1("android.widget.Button").exists():
            self.poco1("android.widget.Button").click()
        self.poco("DesInput").click()
        des = "make at " + now
        text(des)
        if self.poco1("android.widget.Button").exists():
            self.poco1("android.widget.Button").click()
        self.poco("Save_Releaseit").click()

    def publish(self):
        # self.poco = UnityPoco()
        self.poco(text="Publish").click()
        sleep(1)
        self.poco("Save_Releaseit").click()
        sleep(1)
        popupText = self.poco("lable").get_text()
        #提交成功
        if "Your stage has" in popupText:
            print("make a level successfully")
            self.poco(text="OK").click()
            sleep(2)
            if self.poco(text="My level").exists():
                print("return to my level ok")
        #缺少怪物
        if popupText == "The stage must contain a monster":
            print("no monster can't make a level ok")
            self.poco("BG").child("Button").click()
            sleep(1)
            self.addMonster()
        #缺少背景图
        if popupText == "The stage must contain a background image":
            print("no backgroud can't make a level")
            self.poco("BG").child("Button").click()
            sleep(1)
            #切换background标签
            self.poco(text="Background").click()
            sleep(1)
            #添加背景
            #使用相册
            self.chooseAlbum()
            #使用相机
            self.takePhotos()
            #成功添加背景
            self.addSuccessfully()
        #缺少名字
        if popupText == "The stage must have a name":
            print("no name can't make a level pass")
            self.poco("BG").child("Button").click()
            #添加名称
            self.textLevelInfo()

    def modifyLevel(self):
        # self.poco = UnityPoco()
        if self.poco("Tree").child()[0].exists():
            self.poco("Tree").child()[0].child("Lvupdate").child(
                "Text").click()

            sleep(1)
            if self.poco(text="Background").exists():
                print("enter modify interface successfully")
            self.poco(text="Publish").click()
            sleep(1)
            self.poco("Save_Releaseit").click()
            sleep(1)
            popupText = self.poco("lable").get_text()
            if "You have successfully modified" in popupText:
                print("modified level successfully")
                self.poco(text="OK").click()
                sleep(1)

    def updatePrivacy(self):
        # self.poco = UnityPoco()
        self.poco("Tree").child()[0].child("Lvmode").child("Label").click()
        sleep(1)
        self.poco("Item 1: Friends only ").click()
        sleep(1)
        if self.poco("lable").get_text() == "Stage changed successfully":
            print("update to friends only ok")
            self.poco(text="OK").click()
        self.poco(text="Friends only ").click()
        sleep(1)
        self.poco("Item 2: Only yourself").click()
        sleep(1)
        if self.poco("lable").get_text() == "Stage changed successfully":
            print("update to only yourself ok")
            self.poco(text="OK").click()
        self.poco(text="Only yourself").click()
        sleep(1)
        self.poco("Item 0: Public").click()
        sleep(1)
        if self.poco("lable").get_text() == "Stage changed successfully":
            print("update to public ok")
            self.poco(text="OK").click()

    def deleteLevel(self):
        # self.poco = UnityPoco()
        self.poco("Tree").child()[0].child("Lvdelete").child("Text").click()
        sleep(1)
        if self.poco(
                "lable").get_text() == "Please confirm to delete this stage":
            print("open delete interface successfully")
            self.poco(text="Cancel").click()
            sleep(1)
            if not self.poco("lable").exists():
                print("close delete interface successfully")
        beforeDelete = len(self.poco("Tree").child().nodes)
        self.poco("Tree").child()[0].child("Lvdelete").child("Text").click()
        sleep(1)
        self.poco("ConfirmBtn").click()
        sleep(2)
        afterDelete = len(self.poco("Tree").child().nodes)
        if (afterDelete + 1) == beforeDelete:
            sleep(1)
            print("delete level pass")

    def testMakeLv(self):
        self.permissionClick()
        self.autoUpdate()
        self.login("wn10001", "z123456")
        self.waitLogin()
        sleep(5)
        #进入制作关卡
        self.enterMakelevel()
        #查看帮助
        self.lookHelp()
        #退出关卡
        self.exitMylevel()
        #再次进入制作关卡
        self.enterMakelevel()
        #内网可以测试滑动我的关卡
        self.swipeMylevel()
        #添加关卡
        self.addLevel()
        #关闭免责声明
        self.closeDisclaimer()
        self.addLevel()
        #同意免责声明
        self.agreeDisclaimer()
        #测试切换标签
        self.switchLebel()
        #关闭制作关卡
        self.closeMakeLevel()
        self.addLevel()
        self.agreeDisclaimer()
        #发布关卡缺少怪物失败,添加怪物
        self.publish()
        #发布关卡缺少背景失败,添加背景
        self.publish()
        #发布关卡缺少名称失败,添加名称
        self.publish()
        #发布成功
        self.publish()
        #测试关卡修改
        self.modifyLevel()
        self.updatePrivacy()
        self.swipeMylevel()
        self.deleteLevel()

        #结束测试
        stop_app("com.gameholic.drawsomethingbyspider")
        sleep(2.0)
        snapshot(msg="app stopped")
        print("finish test")
示例#4
0
    class UnityPoco():
        def __init__(self):
            self.poco = UnityPoco()

        def login_unity(self, game_server):
            """
            到点击登录按钮的login
            """

            self.poco.click([0.05, 0.163])
            time.sleep(1)
            self.poco.click([0.1, 0.13])
            os.system(r'adb shell input text ' + game_server)
            self.poco.click([0.934, 0.867])
            self.poco.click([0.03, 0.13])
            self.poco("ObjLoginBtns").child("1").child('Image').click()
            try:
                self.poco("horizontalBtns").wait_for_appearance(timeout=5)
                self.poco("BtnOk").click()
            except Exception:
                print('已通过权限检测')

        def login_touch(self):
            self.poco("ObjLoginBtns").child("1").child('Image').click()

        def skip_anime(self):
            try:
                self.poco("UIPopupPlayVideo").wait_for_appearance(timeout=8)
                print('已进入到播放动画界面')
                try:
                    self.poco("txtSkip").click()
                    self.poco("BtnOk").click()
                except Exception:
                    self.poco("UIPopupPlayVideo").click()
                    self.poco("txtSkip").click()
                    self.poco("BtnOk").click()
            except Exception:
                print('本次客户端没有播放动画')

        def board(self):
            try:
                self.poco("UIPopupLoginNotice").wait_for_appearance(timeout=5)
                for _ in range(3):
                    try:
                        fp = self.poco.freeze()
                        try:
                            fp("CloseBtn").click()
                        except:
                            fp("ObjBtns").child("BtnOk").click()
                    except:
                        break
            except Exception:
                print('无游戏公告')

        def get_ready(self):
            """
            到大厅准备好,可以直接调用aico的run的方法,这个写完,前面的连起来就可以用了!!
            """
            def _sign():
                """
                日常签到的关闭
                """
                if self.poco("BtnSignIn").exists():
                    self.poco("BtnSignIn").click()
                    self.poco("btns").child("btnOk").click()
                    self.poco("topBG").child("Back").click()

            def _bfi_close():
                """
                最烦人的拍脸图关闭
                """
                for _ in range(30):
                    if self.poco("btnClose").exists():
                        self.poco("btnClose").click()
                    elif self.poco("UIHallSeasonStart").offspring(
                            "BtnOk").exists():
                        self.poco("UIHallSeasonStart").offspring(
                            "BtnOk").click()
                    elif self.poco("Close").exists() != False:
                        self.poco("Close").click()
                    elif self.poco("nextText").exists():
                        self.poco("nextText").click()
                    elif self.poco("Close").exists():
                        self.poco("Close").click()
                    elif self.poco("CloseBtn").exists():
                        self.poco("CloseBtn").click()
                    elif self.poco("point").offspring("BtnClose").exists():
                        self.poco("point").offspring("BtnClose").click()
                    elif self.poco("X").exists() != False:
                        self.poco("X").click()
                    elif self.poco("EnContent").child("Back").exists():
                        self.poco("EnContent").child("Back").click()
                    elif self.poco("empty").exists():
                        try:
                            self.poco("empty").click()
                        except Exception:
                            pass
                    else:
                        break
                    time.sleep(0.5)

            # 如果是新角色 需要创建角色
            if self.poco("btnCreatPlayer").exists():
                self.poco("btnCreatPlayer").click()
                self.poco("inputName").set_text("萝卜头")
                self.poco("BtnConfirm").click()
                self.poco("Button_Leave").click()
            else:
                print('不是新用户 直接进入到主界面')
            # 如果存在向导
            if self.poco("Panel").child("Guider").exists():
                self.poco.click([0.057, 0.96])

            else:
                print('直接进入到了游戏 又不是新角色 也过了引导')
            # 这里就可以选择模式了
            _bfi_close()
            try:
                _sign()
            except Exception:
                pass
            now_mode = self.poco("txtModeName").child("txt_main").get_text()
            if '单人' not in now_mode:
                self.poco("CityMode").click()
                time.sleep(1)
                self.poco.swipe([0.1, 0.5], [0.55, 0.5])
                for i in range(7):
                    mode_name = \
                    self.poco("UIHallSelectMode").offspring("Mask").child("Content").child("UIModeItem(Clone)")[
                        i].offspring(
                        "PnlCountent1").children()[2].get_text()
                    if '单人休闲模式' in mode_name:
                        self.poco("UIHallSelectMode").offspring("Mask").child(
                            "Content").child("UIModeItem(Clone)")[0].offspring(
                                "PnlCountent1").click()
                        break
                _bfi_close()
                _sign()

        def battle_remind(self):
            """
            处理破势的方法
            """
            def battle_start():
                time.sleep(1)
                self.poco(texture="ui_zy_msxz_ks").click()
                self.poco("Panel").child("BtnOk").wait_for_appearance()
                self.poco("Panel").child("BtnOk").click()

            battle_start()
            self.poco("0").wait_for_appearance()
            time.sleep(4)
            # 卖棋子
            self.poco("0").click()
            Adb_shell.tap([0.26, 0.89])
            time.sleep(0.5)
            Adb_shell.swipe([0.26, 0.89], [0.055, 0.7])
            time.sleep(1)
            try:
                self.poco("Checkmark").click()
                self.poco("Button_Ok").click()
            except Exception:
                pass
            # 刷棋盘
            self.poco("DebugCanvas").child("Button").click()
            Adb_shell.swipe([0.74, 0.4], [0.74, 0.33])
            time.sleep(2)
            self.poco("加满金币").child("Button").click()
            self.poco(text="关闭").click()
            try:
                self.poco("Button_Fresh").click()
            except Exception:
                self.poco("Button_Store").click()
                try:
                    self.poco("Button_Fresh").click()
                except Exception:
                    self.poco("Button_Store").click()
                    self.poco("Button_Fresh").click()

            try:
                self.poco("Checkmark").click()
                self.poco("Button_Ok").click()
            except Exception:
                pass
            # 升人口
            self.poco("Button_ReadChessBook").click()
            if self.poco("Checkmark").exists() == False:
                self.poco("Button_ReadChessBook").click()
            try:
                self.poco("Checkmark").click()
                self.poco("Button_Ok").click()
            except Exception:
                pass

        def battle_finish(self):
            self.poco("DebugCanvas").child("Button").click()
            self.poco("结束战斗").child("Button").click()
            self.poco("Close").child("Text").click()
            time.sleep(2)
            self.poco("Button_Leave").click()
            try:
                self.poco("btns").child("btnOk").click()
            except Exception:
                pass
            time.sleep(2)
            try:
                self.poco("btnContinue").click()
            except Exception:
                pass
            try:
                self.poco("Panle").child("textCloseDes").click()
            except Exception:
                pass
            try:
                self.poco("BtnClose").click()
                self.poco.click([0.02, 0.025])
            except Exception:
                self.poco.click([0.02, 0.025])
                try:
                    self.poco("btnContinue").click()
                    if self.poco("BtnClose").exists():
                        self.poco.click([0.02, 0.025])
                except Exception:
                    pass
            try:
                self.poco.click([0.02, 0.025])
                self.poco("btns").child("btnOk").click()
            except Exception:
                pass
示例#5
0
class BasicLevelCase(Login):
    @classmethod
    def setUpClass(cls):
        super(BasicLevelCase, cls).setUpClass()

    @classmethod
    def tearDownClass(cls):
        super(BasicLevelCase, cls).tearDownClass()

    def setUp(self):
        stop_app("com.gameholic.drawsomethingbyspider")
        clear_app("com.gameholic.drawsomethingbyspider")
        wake()
        home()
        start_app("com.gameholic.drawsomethingbyspider")
        sleep(7)
        self.poco = UnityPoco()
        print("Basic level test start")

    def testBasicLevel(self):
        # init_device()
        self.permissionClick()
        self.autoUpdate()
        self.login("wn10001", "z123456")
        self.waitLogin()
        sleep(5)

        # self.self.poco = Unityself.poco()
        self.poco(text="Basic Stage").click()
        sleep(1)
        if self.poco("Up").child("Text").get_text() == "Select Stage":
            assert ("进入基础关卡成功")
        self.poco("Explain").click()
        sleep(1)
        if self.poco("zi").exists():
            assert ("成功打开帮助")
        self.poco("confirm").click()
        sleep(1)
        if not self.poco("txt").exists():
            assert ("成功关闭帮助界面")
        for _ in range(4):
            self.poco.swipe([50.0 / 720, 400.0 / 1280],
                            [670.0 / 720, 400.0 / 1280])
            sleep(3)
        self.poco("Content").offspring('Levelnum1').click()
        sleep(1)
        if self.poco("HPimage").exists():
            assert ("成功进入具体关卡")
        sleep(1.0)
        self.poco("Return2").click()
        sleep(1)
        exitText = self.poco("lable").get_text()
        if exitText == "Are you sure you want to exit the game?":
            assert ("成功打开退出弹框")
        self.poco(text="Cancel").click()

        sleep(1)
        if not self.poco("lable").exists() and self.poco("HPimage").exists():
            assert ("成功关闭退出弹框")
        self.poco("Return2").click()
        sleep(1)
        if exitText == "Are you sure you want to exit the game?":
            assert ("再次成功打开退出弹框")
        self.poco(text="OK").click()
        if self.poco("Up").child("Text").get_text() == "Select Stage":
            assert ("成功退出具体关卡")
        for _ in range(4):
            self.poco.swipe([670.0 / 720, 400.0 / 1280],
                            [50.0 / 720, 400.0 / 1280])
            sleep(3)
        if self.poco("WaitAfter").exists():
            assert ("所有关卡都可以翻页")
        self.poco("Levelnum40").click()
        sleep(1)
        if not self.poco("HPimage").exists() and self.poco("Up").exists():
            assert ("未解锁关闭无法进入")
        self.poco("Return").click()
        sleep(1)
        if self.poco("StartGame").exists():
            assert ("返回主界面成功")

        stop_app("com.gameholic.drawsomethingbyspider")
        sleep(2.0)
        snapshot(msg="app stopped")
        print("basic level finish test")
示例#6
0
class MonsterBookCase(Login):
    @classmethod
    def setUpClass(cls):
        super(MonsterBookCase, cls).setUpClass()

    @classmethod
    def tearDownClass(cls):
        super(MonsterBookCase, cls).tearDownClass()

    def setUP(self):
        stop_app("com.gameholic.drawsomethingbyspider")
        clear_app("com.gameholic.drawsomethingbyspider")
        wake()
        home()
        start_app("com.gameholic.drawsomethingbyspider")
        sleep(7)
        self.poco = UnityPoco()
        print("monster book test start")

    def testMonsterBook(self):
        self.permissionClick()
        self.autoUpdate()
        self.login("wn10001", "z123456")
        self.waitLogin()
        sleep(5)
        #由于怪物图鉴重新安装游戏后会消失的bug存在,所以先进入一个关卡解锁一个怪物
        self.poco(text="Basic Stage").click()
        sleep(1)
        for _ in range(4):
            self.poco.swipe([16.0 / 576, 400.0 / 1024],
                            [560.0 / 576, 400.0 / 1024])
            sleep(3)

        if self.poco("Levelnum1").child("thumbnail").child("Image").exists():
            self.poco("Levelnum1").child("thumbnail").child("Image").click()
            sleep(1)
        self.poco("Return2").click()
        sleep(1)
        self.poco(text="OK").click()
        sleep(1)
        self.poco("Return").click()
        sleep(1)
        #进入图鉴
        self.poco("MonsterCompose").click()
        sleep(1)
        if self.poco("Tree").child("LvTemplate(Clone)").child(
                "thumbnail").exists():
            print("进入图鉴成功")
        #测试帮助
        self.poco("Explain").click()
        sleep(1)
        helpText = self.poco("txt").get_text()
        if "Monsters illustrated" in helpText:
            print("打开帮助成功")
            self.poco("confirm").click()
            sleep(1)
            if not self.poco("zi").exists():
                print("关闭帮助成功")
        #测试单个怪物
        self.poco("Tree").child("LvTemplate(Clone)").child("thumbnail").click()
        sleep(1)
        if self.poco("MonsterInfo").exists():
            print("查看具体怪物详情成功")
        self.poco("Return").click()
        sleep(1)
        if not self.poco("MonsterInfo").exists():
            print("关闭具体怪物详情成功")
        #测试滑动
        beforeSwipe = self.poco("Tree").child("LvTemplate(Clone)")[0].child(
            "thumbnail").get_position()

        self.poco("Viewport").swipe([0, -0.4])
        sleep(2)
        afterSwipe = self.poco("Tree").child("LvTemplate(Clone)")[0].child(
            "thumbnail").get_position()

        assert_not_equal(beforeSwipe, afterSwipe, "滑动成功")

        #退出图鉴
        self.poco("Return").click()
        sleep(1)
        if not self.poco("Tree").child("LvTemplate(Clone)").child(
                "thumbnail").exists():
            print("退出怪物图鉴成功")

        #测试完成
        stop_app("com.gameholic.drawsomethingbyspider")
        sleep(2.0)
        snapshot(msg="app stopped")
        print("monster handbook finish test")
示例#7
0
def runTest():
    stop_app("com.gameholic.drawsomethingbyspider")
    clear_app("com.gameholic.drawsomethingbyspider")
    wake()
    home()
    start_app("com.gameholic.drawsomethingbyspider")
    sleep(7)
    permissionClick()
    autoUpdate()
    login("wn10001", "z123456")
    waitLogin()
    sleep(5)
    poco = UnityPoco()


    #进入商店
    poco("Shop").click()
    sleep(1)
    #关闭购买去广告提示弹框

    if poco("BitchPopup").child("Image").child("Image").exists():
        print("弹出支付去广告成功")
        poco("Button").child("Text").click()
        if not poco("BitchPopup").child("Image").child("Image").exists():
            print("关闭弹框成功")
        sleep(1)
    #关闭商店
    poco("Return").click()
    sleep(1)
    if not poco(text="Limited").exists():
        print("退出商店成功")
    poco("Shop").click()
    sleep(1)
    #关闭购买去广告提示弹框
    if poco("BitchPopup").child("Image").child("Image").exists():
        print("弹出支付去广告成功")
        poco("Button").child("Text").click()
        sleep(1)
    #切换标签和购买
    #切换所有标签
    poco(text="Gift").click()
    sleep(1)
    if poco("PropName").get_text() == "Marvellous Gift":
        print("切换礼物标签成功")
    poco("Text (2)").click()
    sleep(1)
    if poco("PropName").get_text() == "Speed-up":
        print("切换到道具标签成功")
    poco(text="Diamonds").click()
    sleep(1)
    if poco(text="Super Gems Pack").get_text() == "Super Gems Pack":
        print("切换钻石标签成功")
    poco(text="Limited").click()
    sleep(1)
    if not poco("PropName").exists():
        print("切换到礼包标签成功")
    poco(text="Monster").click()    
    sleep(1)
    if poco(text="Green Fluffy").get_text() == "Green Fluffy":
        print("切换到怪物标签成功")
    #滑动列表
    poco(texture="monster_A1_1").wait_for_appearance()
    poco(texture="monster_A1_1").click()
    beforSwipe = poco(texture="monster_A1_1").get_position()
    
    poco.swipe([300.0/576, 850.0/1024],[300.0/576, 150.0/1024])
    sleep(2)
    afterSwipe = poco(texture="monster_A1_1").get_position()
    if beforSwipe != afterSwipe:
        print("滑动列表成功")
    else:
        print("滑动列表失败")
    #滑动回顶部
    poco.swipe([300.0/576, 150.0/1024],[300.0/576, 850.0/1024])
    sleep(2)
    #购买逻辑
    poco("Tree").child("ShopProp(Clone)")[0].child("BuyIt").child("Text").click()
    sleep(2)
    buyConfirm = poco("lable").get_text()
    if buyConfirm == "Confirm to purchase":
        print("打开确认购买弹框成功")
    #取消购买
    poco(text="Cancel").click()
    sleep(1)
    if not poco(text="Confirm to purchase").exists():
        print("取消购买成功")
    #wn10001购买怪物成功
    buy()
    #切换到钻石标签查看sdk调出
    poco(text="Diamonds").click()
    sleep(1)
    if poco(text="Super Gems Pack").get_text() == "Super Gems Pack":
        print("切换钻石标签成功")
    buy()

    #完成测试
    stop_app("com.gameholic.drawsomethingbyspider")
    sleep(2.0)
    snapshot(msg="app stopped")
    print("shop finish test")
示例#8
0
class RewardLevelCase(Login):
    @classmethod
    def setUpClass(cls):
        super(RewardLevelCase, cls).setUpClass()

    @classmethod
    def tearDownClass(cls):
        super(RewardLevelCase, cls).tearDownClass()

    def setUp(self):
        stop_app("com.gameholic.drawsomethingbyspider")
        clear_app("com.gameholic.drawsomethingbyspider")
        wake()
        home()
        start_app("com.gameholic.drawsomethingbyspider")
        sleep(7)
        self.poco = UnityPoco()
        assert ("reward level test start")

    #进入悬赏关卡
    def enterReward(self):
        self.poco("RewardLV").click()
        sleep(2)
        if self.poco("Upup").child("Text").get_text() == "Reward Stage":
            assert ("进入悬赏关卡成功")

    #悬赏关卡帮助
    def rewardHelp(self):
        self.poco("Explain").click()
        sleep(1)
        if "You can find" in self.poco("txt").get_text():
            assert ("打开悬赏关卡成功")
            self.poco("confirm").click()
            sleep(1)
            if not self.poco("txt").exists():
                assert ("关闭帮助界面成功")

    def sorting(self, whatTabel):
        items = self.poco("Tree").child()
        listReward = []
        listRate = []
        if whatTabel == "Overall":
            for item in items:
                listReward.append(item.child("reward").get_text())
            if listReward[0] == max(listReward):
                assert ("人气排序正确")
        if whatTabel == "Popularity":
            for item in items:
                listReward.append(item.child("AllPlayerCount").get_text())
            if listReward[0] == max(listReward):
                assert ("流行度排序正确")

        if whatTabel == "Difficulty":
            for item in items:
                challenge = item.child("AllPlayerCount").get_text()
                passStage = item.child("PassPlayerCount").get_text()
                if int(challenge) == 0:
                    listRate.append(1)
                else:
                    rate = float(passStage) / float(challenge)
                    listRate.append(rate)
            if listRate[0] == min(listRate):
                assert ("难度排序正确")

    #切换标签
    def changeLabel(self):
        self.poco(text="Popularity").click()
        self.poco("Tree").child().child("LvName").wait_for_appearance()
        self.sorting("Popularity")
        self.poco(text="Difficulty").click()
        self.poco("Tree").child().child("LvName").wait_for_appearance()
        self.sorting("Difficulty")
        self.poco(text="Overall").click()
        self.poco("Tree").child().child("LvName").wait_for_appearance()
        self.sorting("Overall")

    #上下滑动列表
    def swipeList(self):
        if len(self.poco("Tree").child().nodes) > 5:
            beforeSwipe = self.poco("Tree").child()[0].child(
                "idtext").get_position()
            self.poco.swipe([500.0 / 1080, 1500.0 / 1920],
                            [500.0 / 1080, 200.0 / 1920])
            sleep(3)
            afterSwipe = self.poco("Tree").child()[0].child(
                "idtext").get_position()
            if beforeSwipe != afterSwipe:
                assert ("swipe list successfully")
            else:
                assert ("swipe list failed")

    #筛选弹框开启关闭
    def filterOpen(self):
        self.poco(text="Filters").click()
        sleep(1)
        if self.poco(text="mine").exists():
            assert ("筛选界面成功打开")
            self.poco("closed").click()
            sleep(1)
            #存在关闭弹框,但是未销毁弹框对象的bug,所以用get_position方式实现功能
            pos = self.poco("My").get_position()
            if pos == [0.5, 0.5]:
                assert ("关闭筛选界面成功")
                self.poco("Return").click()
                sleep(1)
                self.poco("RewardLV").click()
                sleep(1)

    #进行筛选,去除所有人
    def switchFliters(self):
        self.poco(text="Filters").click()
        sleep(1)
        while exists(
                Template(r"tpl1522138307590.png",
                         threshold=0.85,
                         target_pos=5,
                         rgb=False,
                         record_pos=(-0.188, -0.208),
                         resolution=(1440, 2560))):
            touch(
                Template(r"tpl1522138307590.png",
                         threshold=0.85,
                         target_pos=5,
                         rgb=False,
                         record_pos=(-0.188, -0.208),
                         resolution=(1440, 2560)))
            sleep(1)
        self.poco("My").click()
        sleep(1)
        assert_exists(
            Template(r"tpl1522138307590.png",
                     threshold=0.85,
                     target_pos=5,
                     rgb=False,
                     record_pos=(0.095, -0.21),
                     resolution=(1440, 2560)), "去除mine勾选成功")
        self.poco("My").click()
        sleep(1)
        self.poco("other").click()
        sleep(1)
        assert_exists(
            Template(r"tpl1522138307590.png",
                     threshold=0.85,
                     target_pos=5,
                     rgb=False,
                     record_pos=(0.095, -0.21),
                     resolution=(1440, 2560)), "other可以除去勾选框")
        self.poco("other").click()
        sleep(1)
        self.poco("Played").click()
        sleep(1)
        assert_exists(
            Template(r"tpl1522138307590.png",
                     threshold=0.85,
                     target_pos=5,
                     rgb=False,
                     record_pos=(0.095, -0.21),
                     resolution=(1440, 2560)), "not hide played today可以除去勾选框")

    def cancelAll(self):
        #去除所有勾选
        while exists(
                Template(r"tpl1524898630127.png",
                         threshold=0.9,
                         target_pos=5,
                         rgb=False,
                         record_pos=(0.096, -0.211),
                         resolution=(720, 1280))):
            touch(
                Template(r"tpl1524898630127.png",
                         threshold=0.9,
                         target_pos=5,
                         rgb=False,
                         record_pos=(0.096, -0.211),
                         resolution=(720, 1280)))
            sleep(0.5)
        self.poco.click([360.0 / 720, 700.0 / 1280])
        sleep(1)
        assert ("去掉所有人的关卡")
        if not self.poco("Tree").child().exists():
            assert ("去掉所有人的关卡成功")

    #查看自己关卡
    def onlyMine(self, player):
        self.poco(text="Filters").click()
        sleep(1)
        while exists(
                Template(r"tpl1522138307590.png",
                         threshold=0.85,
                         target_pos=5,
                         rgb=False,
                         record_pos=(-0.188, -0.208),
                         resolution=(1440, 2560))):
            touch(
                Template(r"tpl1522138307590.png",
                         threshold=0.85,
                         target_pos=5,
                         rgb=False,
                         record_pos=(-0.188, -0.208),
                         resolution=(1440, 2560)))
            sleep(0.5)
        self.poco("other").click()
        sleep(1)
        self.poco("Played").click()
        sleep(1)
        self.poco.click([360.0 / 720, 700.0 / 1280])
        sleep(1)
        self.poco(text="Popularity").click()
        sleep(1)
        myLevels = self.poco("Tree").child()
        marklist = []
        # player = self.poco("ToUserInfo").child("Text").get_text()
        for i in myLevels:
            if str(player) in i.child("LvMaker").get_text():
                marklist.append(1)
            else:
                marklist.append(0)
        assert (marklist)
        if max(marklist) == min(marklist) and max(marklist) == 1:
            assert ("只保留自己的关卡成功")

    # 恢复关卡
    def recoveryFilters(self):
        self.poco(text="Filters").click()
        while exists(
                Template(r"tpl1522138307590.png",
                         threshold=0.85,
                         target_pos=5,
                         rgb=False,
                         record_pos=(-0.188, -0.208),
                         resolution=(1440, 2560))):
            touch(
                Template(r"tpl1522138307590.png",
                         threshold=0.85,
                         target_pos=5,
                         rgb=False,
                         record_pos=(-0.188, -0.208),
                         resolution=(1440, 2560)))
            sleep(1)
        self.poco.click([360.0 / 720, 700.0 / 1280])
        sleep(2)

    #进入关卡、退出关卡
    def enterOneReward(self):
        self.poco("Tree").child()[0].child("PlayThisLv").click()
        sleep(1)
        self.poco("lable").wait_for_appearance()
        popText = self.poco("Popup").child("BG").child("lable").get_text()
        print(popText)
        #not enough coins
        if "Not enough coins!" == popText:
            assert ("金币不足无法进入成功")
            self.poco("Popup").child("BG").child("Button").click()
            if not self.poco("lable").exists():
                sleep(10)
                assert ("金币不足弹框关闭成功")
        #coin enough
        if "You need to spend coins" in self.poco("lable").get_text():
            print("打开消耗金币弹框成功")
            self.poco(text="Cancel").click()
            sleep(1)
            if self.poco("lable").get_position() == [0.5, 0.5]:
                assert ("取消关闭弹框成功")
                self.poco("Tree").child()[0].child("PlayThisLv").click()
                self.poco(text="OK").click()
                sleep(2)
            if self.poco("Hp").exists():
                assert ("进入悬赏关卡成功")
                self.poco("Return2").click()
                sleep(1)
                if self.poco("lable").get_text(
                ) == "Are you sure you want to exit the game?":
                    assert ("打开退出关卡弹框成功")
                self.poco(text="Cancel").click()
                sleep(1)
                if not self.poco("lable").exists():
                    assert ("取消退出关卡成功")
                self.poco("Return2").click()
                sleep(1)
                self.poco(text="OK").click()
                sleep(1)
                if self.poco("Upup").exists():
                    assert ("退出悬赏关卡成功")

    #点赞
    def like(self):
        for _ in range(2):
            self.poco.swipe([360.0 / 720, 93.0 / 1280],
                            [360.0 / 720, 870.0 / 1280],
                            duration=0.2)
            sleep(2)
        self.poco("Center").offspring("Tree").child()[0].offspring(
            "Btn_DisAgree").click()
        sleep(1)
        beforeAgree = self.poco("Center").offspring("Tree").child(
        )[0].offspring("Btn_Agree").child("Text_AgreeNum").get_text()
        self.poco("Center").offspring("Tree").child()[0].offspring(
            "Btn_Agree").click()
        sleep(1)
        afterAgree = self.poco("Center").offspring("Tree").child(
        )[0].offspring("Btn_Agree").child("Text_AgreeNum").get_text()
        if int(beforeAgree) + 1 == int(afterAgree):
            assert ("点赞成功")

    #点踩
    def hate(self):
        self.poco("Center").offspring("Tree").child()[0].offspring(
            "Btn_Agree").click()
        sleep(1)
        beforeAgree = self.poco("Center").offspring("Tree").child(
        )[0].offspring("Btn_DisAgree").child("Text_DisAgreeNum").get_text()
        self.poco("Center").offspring("Tree").child()[0].offspring(
            "Btn_DisAgree").click()
        sleep(1)
        afterAgree = self.poco("Center").offspring("Tree").child(
        )[0].offspring("Btn_DisAgree").child("Text_DisAgreeNum").get_text()
        if int(beforeAgree) + 1 == int(afterAgree):
            assert ("点踩成功")

    #评论
    def comment(self):
        self.poco("Btn_Evaluate").click()
        sleep(1)
        popText = self.poco("lable").get_text()
        if popText == "Not enough coins !":
            assert ("金币不足无法评论成功")
            self.poco(text="OK").click()
            sleep(1)
        if popText == "You need to give a score!":
            assert ("评论星级不能为空成功")
            self.poco(text="OK").click()
            sleep(1)
        if popText == "Empty content!":
            assert ("评论不能为空成功")
            self.poco(text="OK").click()
            sleep(1)
        if "1000 coins" in popText:
            assert ("弹出花费金币成功")
            self.poco(text="Cancel").click()
            if not self.poco("lable").exists():
                assert ("关闭花费金币弹框成功")
            self.poco("Btn_Evaluate").click()
            sleep(1)
            self.poco(text="Confirm").click()
            sleep(1)
            if popText == "Comment sent!":
                assert ("评论成功")
                self.poco(text="OK").click()
                sleep(1)
        if "Failed to send comment." in self.poco("lable").get_text():
            assert ("没玩过关卡无法评论成功")
            self.poco(text="OK").click()
            sleep(1)
        #有没费次数时
        if popText == "Comment sent!":
            assert ("评论成功")
            self.poco(text="OK").click()
            sleep(1)

    #评星
    def startRating(self):
        self.poco("Bottom").child("Stars").child("Star3").click()
        sleep(1)
        assert_exists(
            Template(r"tpl1522211570186.png",
                     record_pos=(-0.039, 0.443),
                     resolution=(1440, 2560)), "评级成功")

    #输入评论文字
    def enterCommnet(self):
        self.poco("Placeholder").click()
        sleep(1)
        text("good!")
        self.poco1("android.widget.Button").click()
        sleep(1)

    #举报
    def reportLevel(self):
        self.poco(text="Report Stage").click()
        sleep(1)
        if self.poco("Toogle_EroticismOrPolitics").exists():
            assert ("弹出举报弹框成功")
        self.poco(text="Cancel").click()
        sleep(1)
        if not self.poco("Toogle_EroticismOrPolitics").exists():
            assert ("关闭举报弹框成功")
        self.poco(text="Report Stage").click()
        sleep(1)
        self.poco(text="Confirm").click()
        sleep(1)
        if self.poco("lable").get_text() == "You must choose an option!":
            assert ("不选择理由无法举报成功")
            self.poco(text="OK").click()
            sleep(1)
        self.poco("Toogle_EroticismOrPolitics").click()
        sleep(1)
        assert_exists(
            Template(r"tpl1522225879391.png",
                     record_pos=(-0.313, -0.301),
                     resolution=(1440, 2560)), "选择色情/政治选项成功")
        self.poco("Toogle_Advertisement").click()
        sleep(1)
        assert_exists(
            Template(r"tpl1522225998289.png",
                     threshold=0.85,
                     target_pos=5,
                     rgb=False,
                     record_pos=(-0.138, -0.19),
                     resolution=(1440, 2560)), "选择广告选项成功")
        self.poco("Toogle_Tort").click()
        sleep(1)
        assert_exists(
            Template(r"tpl1522226039045.png",
                     threshold=0.85,
                     target_pos=5,
                     rgb=False,
                     record_pos=(-0.159, -0.082),
                     resolution=(1440, 2560)), "选择侵权选项成功")
        self.poco("Toogle_Other").click()
        sleep(1)
        assert_exists(
            Template(r"tpl1524907944782.png",
                     threshold=0.85,
                     target_pos=5,
                     rgb=False,
                     record_pos=(-0.147, 0.032),
                     resolution=(720, 1280)), "选择其它选项成")
        self.poco(text="Confirm").click()
        sleep(1)
        if self.poco("lable").get_text() == "Reason not specified!":
            assert ("其他理由无文字不能举报")
            self.poco(text="OK").click()
            sleep(1)
        self.poco("InputField_OtherReason").child("Text").click()
        sleep(1)
        text("take")
        self.poco1("android.widget.Button").click()
        sleep(1)
        if self.poco("InputField_OtherReason").child(
                "Text").get_text() == "take":
            assert ("其它输入文字成功")
        self.poco("InputField_Desc").child("Text").click()
        sleep(1)
        text("bad")
        self.poco("InputField_OtherReason").child("Text").click()
        sleep(1)
        if self.poco("InputField_Desc").child("Text").get_text() == 'bad':
            assert ("描述输入文字成功")
        self.poco(text="Confirm").click()
        sleep(1)
        if self.poco("lable").get_text() == "Reported":
            assert ("举报成功")
            self.poco(text="OK").click()
            sleep(1)

    #长按弹出他人信息弹框
    def longPress(self):
        self.poco("Tree").child()[0].long_click()
        sleep(1)
        if self.poco("gotohomepage").exists():
            assert ("弹出他人信息框成功")
            self.poco("share").sibling("Button").click()
            sleep(1)
            if not self.poco("gotohomepage").exists():
                assert ("关闭他人信息框成功")
        self.poco("Tree").child()[0].child("thumbnail").click()
        sleep(1)
        self.poco(text="View author's homepage").click()
        self.poco("Text_Title").wait_for_appearance()
        sleep(1)
        if self.poco("Text_Title").exists():
            assert ("查看他人信息成功")
            self.poco("Btn_Back").click()
            sleep(1)
            if not self.poco("Text_Title").exists():
                assert ("退出他人信息界面成功")
        self.poco("Tree").child()[0].child("thumbnail").click()
        sleep(1)
        self.poco(text="Share this stage").click()
        sleep(1)
        if self.poco(text="Share this stage").get_text() == "Share this stage":
            assert ("分享关卡弹出成功")
        #share功能
        if self.poco(text="Share").exists():
            self.poco(text="Share").click()
            sleep(1)
            if self.poco(text="Shared").get_text() == "Shared":
                assert ("分享成功")
            #关闭分享
            self.poco("sharePopup(Clone)").child("BG").child("Button").click()
            sleep(1)
            if not self.poco(text="Share this stage").exists():
                assert ("关闭分享关卡成功")
        else:
            self.poco.click([355.0 / 720, 924.0 / 1280])
            sleep(1)

    def getUserData(self):
        player = self.poco("ToUserInfo").child("Text").get_text()
        # mycoins = self.poco(texture="tongyong_jinbi").child("Text").get_text()
        return player

    def testRewardLevel(self):
        self.permissionClick()
        self.autoUpdate()
        self.login("wn10001", "z123456")
        self.waitLogin()
        sleep(7)
        player = self.getUserData()
        #进入悬赏关卡
        self.enterReward()
        #查看帮助
        self.rewardHelp()
        #切换标签测试
        self.changeLabel()
        #列表滑动测试
        self.swipeList()
        #筛选测试
        #由于bug会复制filters,所以退出重进
        self.filterOpen()
        self.switchFliters()
        self.cancelAll()
        self.recoveryFilters()
        #由于bug会复制filters,所以退出重进
        self.poco("Return").click()
        sleep(1)
        self.poco("RewardLV").click()
        sleep(1)
        self.onlyMine(player)
        self.recoveryFilters()
        #具体关卡进入和退出
        self.enterOneReward()
        #进入评论
        self.poco("Tree").child()[0].child("Evaluate").click()
        sleep(1)
        #直接评论弹出星级不能为空
        self.comment()
        # #输入星级再评论弹出文字不能为空
        self.startRating()
        self.comment()
        # #输入文字再评论弹出评论成功
        self.enterCommnet()
        self.comment()
        #点赞和踩
        self.like()
        self.hate()
        #举报测试
        self.reportLevel()
        self.poco("Btn_Back").click()
        sleep(1)
        #长按测试
        self.longPress()

        stop_app("com.gameholic.drawsomethingbyspider")
        self.permissionClick()
        self.autoUpdate()
        self.login("wn10008", "z123456")
        self.waitLogin()
        sleep(5)

        self.enterReward()
        self.poco("Tree").child()[0].child("Evaluate").click()
        sleep(1)
        self.startRating()
        self.enterCommnet()
        self.comment()
        self.poco("Return").click()
        sleep(1)
        self.poco("Return").click()
        sleep(1)

        #结束测试
        stop_app("com.gameholic.drawsomethingbyspider")
        sleep(2.0)
        snapshot(msg="app stopped")
        print("finish test")