Skip to content

Commit 166e482

Browse files
committed
test: use provided app name in windows ui tests
1 parent bd4a5bb commit 166e482

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

sample/Tests/test/test_windows_helpers.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -598,16 +598,27 @@ def open_sample_app(clear_data=False):
598598

599599
print(f"Opening {product_name}...")
600600

601-
# Look for the executable in build folder first, then current directory
602-
exe_paths = [
603-
f"../build/{product_name}.exe", # Relative to Tests folder
604-
f"{product_name}.exe" # Current directory (fallback)
605-
]
601+
# Check if UNITY_APP_PATH is provided (takes precedence)
602+
app_path_env = os.getenv("UNITY_APP_PATH")
603+
604+
# Look for the executable in multiple locations
605+
exe_paths = []
606+
607+
# First priority: use UNITY_APP_PATH if provided
608+
if app_path_env:
609+
exe_paths.append(app_path_env)
610+
611+
# Then check standard locations
612+
exe_paths.extend([
613+
f"{product_name}.exe", # Current directory (for Unity 6 builds in Tests/)
614+
f"../build/{product_name}.exe", # Relative to Tests folder (for Unity 2021)
615+
f"./{product_name}.exe", # Explicit current directory
616+
])
606617

607618
exe_launched = False
608619
for exe_path in exe_paths:
609620
if os.path.exists(exe_path):
610-
print(f"Found executable at: {exe_path}")
621+
print(f"Found executable at: {os.path.abspath(exe_path)}")
611622
subprocess.Popen([exe_path], shell=True)
612623
exe_launched = True
613624
break

0 commit comments

Comments
 (0)