From b7ae0c966f55135ca455e5fcc0145b49e34cb126 Mon Sep 17 00:00:00 2001 From: yongkunhuang <50130180+e790a8@users.noreply.github.com> Date: Thu, 9 Nov 2023 15:34:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DWDA=20bundleID=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=BC=82=E5=B8=B8=EF=BC=8C=E5=90=8Ctidevice=E4=B8=80?= =?UTF-8?q?=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- airtest/core/ios/ios.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airtest/core/ios/ios.py b/airtest/core/ios/ios.py index a88b5781a..860e8e0e4 100644 --- a/airtest/core/ios/ios.py +++ b/airtest/core/ios/ios.py @@ -151,7 +151,7 @@ def list_wda(udid): wda_list = [] for app in app_list: bundle_id, display_name, _ = app - if ".xctrunner" in bundle_id or display_name == "WebDriverAgentRunner-Runner": + if (bundle_id.startswith('com.') and bundle_id.endswith(".xctrunner")) or display_name == "WebDriverAgentRunner-Runner": wda_list.append(bundle_id) return wda_list From 652ce9da1f11efe272632ec2ad84b0943702d3a4 Mon Sep 17 00:00:00 2001 From: yongkunhuang Date: Mon, 13 Jan 2025 20:24:38 +0800 Subject: [PATCH 2/2] fix:adb push fail --- airtest/core/android/adb.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/airtest/core/android/adb.py b/airtest/core/android/adb.py index f0cc006e2..798c22dcd 100644 --- a/airtest/core/android/adb.py +++ b/airtest/core/android/adb.py @@ -494,17 +494,15 @@ def push(self, local, remote): >>> adb.push("test_dir", "/sdcard/Android/data/com.test.package/files/test_dir") """ - _, ext = os.path.splitext(remote) - if ext: - # The target path is a file + if os.path.isfile(local): + # The local path is a file dst_parent = os.path.dirname(remote) else: dst_parent = remote # If the target file already exists, delete it first to avoid overwrite failure src_filename = os.path.basename(local) - _, src_ext = os.path.splitext(local) - if src_ext: + if os.path.isfile(local): dst_path = f"{dst_parent}/{src_filename}" else: if src_filename == os.path.basename(remote): @@ -512,7 +510,7 @@ def push(self, local, remote): else: dst_path = f"{dst_parent}/{src_filename}" try: - self.shell(f"rm -r {dst_path}") + self.shell(f"rm -r {remote}") except: pass @@ -530,14 +528,11 @@ def push(self, local, remote): self.cmd(["push", local, dst_parent]) else: try: - if src_ext: - try: - self.shell(f'mv "{tmp_path}" "{remote}"') - except: - self.shell(f'mv "{tmp_path}" "{remote}"') + if os.path.isfile(local): + self.shell(f'mv "{tmp_path}" "{remote}"') else: try: - self.shell(f'cp -frp "{tmp_path}/*" "{remote}"') + self.shell(f'cp -frp {tmp_path}/* {remote}') except: self.shell(f'mv "{tmp_path}" "{remote}"') finally: