Skip to content

Commit 5ac8942

Browse files
committed
test: unity 6 sample app windows app name
1 parent efcd568 commit 5ac8942

File tree

2 files changed

+44
-29
lines changed

2 files changed

+44
-29
lines changed

sample-unity6/ProjectSettings/EditorBuildSettings.asset

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,49 @@ EditorBuildSettings:
55
m_ObjectHideFlags: 0
66
serializedVersion: 2
77
m_Scenes:
8-
- enabled: 1
8+
- enabled: 0
99
path: Assets/Scenes/Passport/Initialisation.unity
1010
guid: bb0668e0c95b745ce8e2f127d5940ede
11-
- enabled: 1
11+
- enabled: 0
1212
path: Assets/Scenes/Passport/InitialisationWithUI.unity
1313
guid: b588e10e8f614e0458aee90c7d02a499
14-
- enabled: 1
14+
- enabled: 0
1515
path: Assets/Scenes/Passport/AuthenticatedScene.unity
1616
guid: 48b17d6cb0b0f409a9edf831addcbc0a
17-
- enabled: 1
17+
- enabled: 0
1818
path: Assets/Scenes/Passport/Imx/ImxNftTransfer.unity
1919
guid: 2f14d9e7f1e6941d3bc021f86377a3c9
20-
- enabled: 1
20+
- enabled: 0
2121
path: Assets/Scenes/Passport/ZkEvm/ZkEvmGetBalance.unity
2222
guid: 996b0bbb9b6464417b845459e3e8d764
23-
- enabled: 1
23+
- enabled: 0
2424
path: Assets/Scenes/Passport/ZkEvm/ZkEvmGetTransactionReceipt.unity
2525
guid: ee999224a19ee442d998a452e74dab8c
26-
- enabled: 1
26+
- enabled: 0
2727
path: Assets/Scenes/Passport/ZkEvm/ZkEvmSendTransaction.unity
2828
guid: a7c5223614c2d4ff7ac5b06a02ef956c
29-
- enabled: 1
29+
- enabled: 0
3030
path: Assets/Scenes/Passport/ZkEvm/ZkEvmSignTypedData.unity
3131
guid: 7947e157cd8d541138343d5eba099466
32-
- enabled: 1
32+
- enabled: 0
3333
path: Assets/Scenes/Passport/UnauthenticatedScene.unity
3434
guid: ac550d22a7a5f4909be272e42b0c7b46
35-
- enabled: 1
35+
- enabled: 0
3636
path: Assets/Scenes/Marketplace/BridgeScene.unity
3737
guid: ce7072a24f12e4c91b658c798755b355
38-
- enabled: 1
38+
- enabled: 0
3939
path: Assets/Scenes/Marketplace/MarketplaceScene.unity
4040
guid: 18f278ca9e9d34901bcc2919a143809c
41-
- enabled: 1
41+
- enabled: 0
4242
path: Assets/Scenes/Marketplace/OnRampScene.unity
4343
guid: 27e0bb5e5d04a4955b88c9f329422c89
44-
- enabled: 1
44+
- enabled: 0
4545
path: Assets/Scenes/Marketplace/SwapScene.unity
4646
guid: a0a7416ea738d4bea8cd720ed33efbde
47-
- enabled: 1
47+
- enabled: 0
4848
path: Assets/Scenes/Passport/Other/SetCallTimeout.unity
4949
guid: 73ba07ed56efd1949b722042d50dc444
50-
- enabled: 1
50+
- enabled: 0
5151
path: Assets/Scenes/Passport/WebViewTest.unity
5252
guid: c8e2712d59c2d9a479d9177e52dd28c5
5353
m_configObjects:

sample/Tests/test/test_windows_helpers.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ def get_auth_url_from_unity_logs():
6464
import tempfile
6565
import os
6666

67+
product_name = os.getenv("UNITY_APP_NAME", get_product_name())
68+
6769
# Unity log file locations on Windows
6870
log_paths = [
69-
os.path.join(os.path.expanduser("~"), "AppData", "LocalLow", "Immutable", "Immutable Sample", "Player.log"),
71+
os.path.join(os.path.expanduser("~"), "AppData", "LocalLow", "Immutable", product_name, "Player.log"),
7072
os.path.join(tempfile.gettempdir(), "UnityPlayer.log"),
7173
"Player.log" # Current directory
7274
]
@@ -112,9 +114,11 @@ def get_logout_url_from_unity_logs():
112114
import tempfile
113115
import os
114116

117+
product_name = os.getenv("UNITY_APP_NAME", get_product_name())
118+
115119
# Unity log file locations on Windows
116120
log_paths = [
117-
os.path.join(os.path.expanduser("~"), "AppData", "LocalLow", "Immutable", "Immutable Sample", "Player.log"),
121+
os.path.join(os.path.expanduser("~"), "AppData", "LocalLow", "Immutable", product_name, "Player.log"),
118122
os.path.join(tempfile.gettempdir(), "UnityPlayer.log"),
119123
"Player.log" # Current directory
120124
]
@@ -210,10 +214,13 @@ def handle_cached_authentication(driver):
210214
print("CI environment - checking if authentication completed automatically")
211215
print("Monitoring Unity logs for authentication completion...")
212216

217+
product_name = os.getenv("UNITY_APP_NAME", get_product_name())
218+
log_path = os.path.join("C:\\Users\\WindowsBuildsdkServi\\AppData\\LocalLow\\Immutable", product_name, "Player.log")
219+
213220
auth_success = False
214221
for check_attempt in range(30): # Check for 30 seconds
215222
try:
216-
with open("C:\\Users\\WindowsBuildsdkServi\\AppData\\LocalLow\\Immutable\\Immutable Sample\\Player.log", 'r', encoding='utf-8', errors='ignore') as f:
223+
with open(log_path, 'r', encoding='utf-8', errors='ignore') as f:
217224
content = f.read()
218225
# Look for signs of successful authentication
219226
if any(phrase in content for phrase in [
@@ -374,10 +381,13 @@ def login():
374381
print("This means authentication was successful, just need to wait for Unity to process it")
375382

376383
# Wait and check Unity logs for authentication success instead of relying on scene changes
384+
product_name = os.getenv("UNITY_APP_NAME", get_product_name())
385+
log_path = os.path.join("C:\\Users\\WindowsBuildsdkServi\\AppData\\LocalLow\\Immutable", product_name, "Player.log")
386+
377387
auth_success = False
378388
for check_attempt in range(20): # Check for 20 seconds
379389
try:
380-
with open("C:\\Users\\WindowsBuildsdkServi\\AppData\\LocalLow\\Immutable\\Immutable Sample\\Player.log", 'r', encoding='utf-8', errors='ignore') as f:
390+
with open(log_path, 'r', encoding='utf-8', errors='ignore') as f:
381391
content = f.read()
382392
# Look for signs of successful authentication in logs
383393
if any(phrase in content for phrase in [
@@ -539,9 +549,10 @@ def login():
539549
except:
540550
pass
541551

542-
# Wait for the deep link dialog to appear and click "Open Immutable Sample.cmd"
552+
# Wait for the deep link dialog to appear and click the button
543553
# Use more specific selector to avoid clicking "Restore" button
544-
deep_link_button = wait.until(EC.element_to_be_clickable((By.XPATH, "//button[text()='Open Immutable Sample.cmd']")))
554+
product_name = os.getenv("UNITY_APP_NAME", get_product_name())
555+
deep_link_button = wait.until(EC.element_to_be_clickable((By.XPATH, f"//button[text()='Open {product_name}.cmd']")))
545556
deep_link_button.click()
546557
print("Clicked deep link permission dialog - Unity should receive redirect")
547558
except Exception as e:
@@ -555,10 +566,12 @@ def clear_unity_data():
555566
"""Clear Unity's persistent data to force fresh start"""
556567
print("Clearing Unity persistent data...")
557568

569+
product_name = os.getenv("UNITY_APP_NAME", get_product_name())
570+
558571
# Clear PlayerPrefs from Windows Registry
559572
try:
560573
import winreg
561-
registry_path = r"SOFTWARE\Immutable\Immutable Sample"
574+
registry_path = f"SOFTWARE\\Immutable\\{product_name}"
562575

563576
# Try both HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE
564577
for root_key in [winreg.HKEY_CURRENT_USER, winreg.HKEY_LOCAL_MACHINE]:
@@ -577,7 +590,7 @@ def clear_unity_data():
577590

578591
# Clear Application.persistentDataPath
579592
try:
580-
data_path = os.path.join(os.path.expanduser("~"), "AppData", "LocalLow", "Immutable", "Immutable Sample")
593+
data_path = os.path.join(os.path.expanduser("~"), "AppData", "LocalLow", "Immutable", product_name)
581594
if os.path.exists(data_path):
582595
import shutil
583596
shutil.rmtree(data_path)
@@ -705,26 +718,28 @@ def setup_protocol_association():
705718
"""Set up immutablerunner:// protocol association to avoid permission dialogs"""
706719
print("Setting up protocol association for immutablerunner://...")
707720

721+
product_name = os.getenv("UNITY_APP_NAME", get_product_name())
722+
708723
# PowerShell script to register the protocol
709-
ps_script = '''
724+
ps_script = f'''
710725
# Register immutablerunner protocol
711726
$protocolKey = "HKCU:\\Software\\Classes\\immutablerunner"
712727
$commandKey = "$protocolKey\\shell\\open\\command"
713728

714729
# Create the registry keys
715-
if (!(Test-Path $protocolKey)) {
730+
if (!(Test-Path $protocolKey)) {{
716731
New-Item -Path $protocolKey -Force | Out-Null
717-
}
718-
if (!(Test-Path $commandKey)) {
732+
}}
733+
if (!(Test-Path $commandKey)) {{
719734
New-Item -Path $commandKey -Force | Out-Null
720-
}
735+
}}
721736

722737
# Set the protocol values
723738
Set-ItemProperty -Path $protocolKey -Name "(Default)" -Value "URL:immutablerunner Protocol"
724739
Set-ItemProperty -Path $protocolKey -Name "URL Protocol" -Value ""
725740

726741
# Find the Unity sample app executable
727-
$sampleAppPath = "C:\\Immutable\\unity-immutable-sdk\\sample\\build\\Immutable Sample.exe"
742+
$sampleAppPath = "C:\\Immutable\\unity-immutable-sdk\\sample\\build\\{product_name}.exe"
728743
if (Test-Path $sampleAppPath) {
729744
Set-ItemProperty -Path $commandKey -Name "(Default)" -Value "`"$sampleAppPath`" `"%1`""
730745
Write-Host "Protocol association set up successfully"

0 commit comments

Comments
 (0)