예제 #1
0
 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")
예제 #2
0
 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")
예제 #3
0
def push_my_saves(saves_name, package):
    save_from = './saves/' + saves_name

    '''
    save_from = './saves/save_common'
    if test_id == Cases.TUTORIAL_1: save_from = './saves/save_tutorial_1'
    if test_id == Cases.TUTORIAL_2: save_from = './saves/save_tutorial_2'
    if test_id == Cases.TUTORIAL_3: save_from = './saves/save_tutorial_3'
    # if test_id == Cases.TUTORIAL_4: save_from = './saves/save_tutorial_4'
    if test_id == Cases.TUTORIAL_5: save_from = './saves/save_tutorial_5'
    if test_id == Cases.TUTORIAL_6: save_from = './saves/save_tutorial_6'
    if test_id == Cases.TUTORIAL_7: save_from = './saves/save_tutorial_7'
    if test_id == Cases.TUTORIAL_8: save_from = './saves/save_tutorial_8'
    if test_id == Cases.TUTORIAL_9: save_from = './saves/save_tutorial_9'
    if test_id == Cases.TUTORIAL_10: save_from = './saves/save_tutorial_10'
    '''

    clear_app(package)
    
    full_path_to = 'sdcard/Android/data/' + package
    shell('mkdir ' + full_path_to)
    full_path_to = 'sdcard/Android/data/' + package + "/files"
    shell('mkdir ' + full_path_to)
    shell('mkdir ' + full_path_to + '/2020-04-09-17-10-42')
    shell('mkdir ' + full_path_to + '/Settings')
    a = Android()
    a.adb.push(save_from + '/events.tsf', full_path_to + '/2020-04-09-17-10-42/')
    a.adb.push(save_from + '/profile.tsf', full_path_to + '/2020-04-09-17-10-42/')
    a.adb.push('./saves/Settings/settings.tsf', full_path_to + '/Settings/')
    a.adb.push('./saves/nw_save10.save', full_path_to + '/')
예제 #4
0
 def login(self, username, password):
     self.poco1 = AndroidUiautomationPoco()
     if self.poco1(text="Sign in").exists():
         self.poco1(text="Sign in").click()
         sleep(1.0)
         self.poco1("android.widget.LinearLayout").offspring("android.widget.RelativeLayout").child("android.widget.LinearLayout").child("android.widget.LinearLayout").child("android.widget.LinearLayout").child("android.widget.ImageView").click()
         sleep(1)
         self.poco1(text="Username").click()
         sleep(1)
         text(username)
         sleep(1)
         self.poco1("android.widget.LinearLayout").offspring("android.widget.RelativeLayout").child("android.widget.LinearLayout").child("android.widget.LinearLayout")[2].child("android.widget.EditText").click()
         sleep(1)
         #有的手机text()方法不起作用
         shell("input keyboard text %s"%password)
         shell("input keyevent 4")
         sleep(1)
         self.poco1("android.widget.LinearLayout").offspring("android.widget.RelativeLayout").child("android.widget.LinearLayout").child("android.widget.LinearLayout")[3].child("android.widget.TextView").click()
         sleep(7)
     else:
         print("登录弹框未出现")
         start_app("com.gameholic.drawsomethingbyspider")
예제 #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("内网钻石无法购买成功")