Exemplo n.º 1
0
def monkey_run(device_id, count):
    package = Config.get_package_info()[0]
    brand = Adb.get_brand(device_id)
    monkey_log = LogPath(brand, device_id).get_monkey_log_path()
    args = f"adb -s {device_id} shell monkey -p {package} -s 100 --throttle 100 " \
               f"--ignore-crashes --ignore-timeouts --monitor-native-crashes --pct-appswitch 20 " \
               f"--pct-majornav 15 --pct-nav 10 --pct-touch 40 --pct-motion 15 -v -v -v {count} " \
               f"> {monkey_log}"

    Shell.run(args)
Exemplo n.º 2
0
 def is_install(did):
     """判断是否安装爱库存"""
     out = Shell.run(
         f"adb -s {did} shell pm list package -e com.aikucun.akapp")
     if out:
         return True
     return False
Exemplo n.º 3
0
    def uninstall(did, package):
        """卸载APP"""
        out = Shell.run(f"adb -s {did} uninstall {package}")

        if "Success" in out:
            return True
        else:
            return False
Exemplo n.º 4
0
    def install(did, file_name):
        """安装APP"""
        out = Shell.run(f"adb -s {did} install -r {APK_PATH}/{file_name}")

        if "Success" in out:
            return True
        else:
            return False
Exemplo n.º 5
0
def check_file_exits(file_path, file_name):
    """检查文件是否存在"""
    logger.info(f"{file_path}/{file_name}")
    result = Shell.run(f"find {file_path} -name {file_name}")

    if result:
        return True
    logger.info("发现最新安装包")
    return False
Exemplo n.º 6
0
    def get_device_list():
        """获取连接的设备列表"""
        out = Shell.run("adb devices")
        o_list = out.split("\n")[1:]
        device_list = []
        for each in o_list:
            e = each.split("\t")
            if e[1] == "device":
                device_list.append(e[0])

        return device_list
Exemplo n.º 7
0
 def get_os_version(did):
     """获取手机系统版本"""
     return Shell.run(
         f"adb -s {did} shell getprop ro.build.version.release")
Exemplo n.º 8
0
 def get_brand(did):
     """获取手机品牌"""
     return Shell.run(f"adb -s {did} shell getprop ro.product.brand")
Exemplo n.º 9
0
 def quit_app(did, package):
     """退出APP"""
     Shell.run(f"adb -s {did} shell am force-stop {package}")
Exemplo n.º 10
0
 def start_app(did, package):
     """启动APP"""
     activity = f"{package}.activity.StartActivity"
     Shell.run(f"adb -s {did} shell am start -n {package}/{activity}")
Exemplo n.º 11
0
Arquivo: files.py Projeto: Eylaine/ast
 def clear_directory(del_path):
     Shell.run(f"rm -rf {del_path}/*.apk")
Exemplo n.º 12
0
Arquivo: files.py Projeto: Eylaine/ast
 def check_exist(des_path, apk_name):
     result = Shell.run(f"find {des_path} -name {apk_name}")
     if result == "":
         return False
     return True
Exemplo n.º 13
0
    def du_sh(path):
        """Get the description about the size of a path.

    :param path: the path, could be a file or a directory.
    """
        return Shell.run('du -sh {}'.format(path))
Exemplo n.º 14
0
 def run(self):
     # Adb.start_app(self.did, self.package)
     Adb.cat_log(self.did, self.log_path.get_cat_log_path())
     Shell.run(self.get_args())
     Adb.quit_app(self.did, self.package)