예제 #1
0
 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)), "评级成功")
예제 #2
0
 def assert_ui_exists(self, ui:Union[Picture,PootUi,PocoUi], msg="",**kw):
     '''
     ui对象,断言ui对象是否存在
     :param ui: 控件
     :param msg: 附加到报告的信息
     :param kw:其他参数
     :return:
     '''
     #参数校验
     self.__para_check(ui, [Picture,PootUi,PocoUi])
     if type(ui)==Picture:
         assert_exists(ui.getTemplate(),msg)
     elif type(ui) in [PocoUi,PootUi]:
         assert_ui_exists(ui.name,self._exists(ui),msg)
예제 #3
0
    def assert_exists(self, timeout=20):
        time_start = time.time()
        while True:
            try:
                if self.exists():
                    return
            except Exception as e:
                logger.error(e)
                time.sleep(1)

            if time.time() - time_start > timeout:
                break

        if isinstance(self.template, Template):
            assert_exists(self.template)
        else:
            assert self.exists()
예제 #4
0
 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")
예제 #5
0
def buy():
    poco = UnityPoco()
    #确定购买
    poco("Tree").child("ShopProp(Clone)")[0].child("BuyIt").click()
    sleep(1)
    poco(text="OK").click()
    sleep(5)
    #弹出sdk界面
    if poco("lable").exists():
        if poco("lable").get_text() == "Top-up failed:3:Billing Unavailable":
            print("内网无法购买")
            poco(text="Confirm").click()
            sleep(1)
    if poco(text="You got").exists():
        print("购买成功")        
        while poco("xxxxxxxx").child("Text").exists():
            poco("xxxxxxxx").child("Text").click()
            sleep(1)
    if poco(text="Not enough diamonds!").exists():
        if poco(text="Not enough diamonds!").get_text() == "Not enough diamonds!":
            print("钻石不足无法购买")
            poco("copypop").child("BG").child("Button").child("Text").click()

    if poco(text="Not enough coins!").exists():
        if poco(text="Not enough coins!").get_text() == "Not enough coins!":
            print("金币不足无法购买")
            poco("copypop").child("BG").child("Button").child("Text").click()
            
    if exists(Template(r"tpl1522392116057.png", threshold=0.9, target_pos=5, rgb=False, record_pos=(-0.215, -0.074), resolution=(1440, 2560))):
        print("弹出购买sdk界面成功")
        #购买失败
        shell("input keyevent 4")
        assert_exists(Template(r"tpl1522392162168.png", threshold=0.9, target_pos=5, rgb=False, record_pos=(0.003, 0.023), resolution=(1440, 2560)), "取消购买成功")
        print("购买成功请手动测试")
    if exists(Template(r"tpl1522399084096.png", threshold=0.9, target_pos=5, rgb=False, record_pos=(0.001, 0.015), resolution=(1440, 2560))):
        print("内网钻石无法购买成功")
예제 #6
0
 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可以除去勾选框")
예제 #7
0
 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)