Skip to content

Commit 4caf298

Browse files
committed
Merge branch 'main' into feat/passport-prefab
2 parents 90d3de0 + 6a4e655 commit 4caf298

File tree

8 files changed

+96
-9
lines changed

8 files changed

+96
-9
lines changed

sample/Tests/README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# UI Tests
2+
3+
## Prerequisites
4+
5+
### Passport SDK Log Level Configuration
6+
7+
For the authentication flow tests to work properly, the Passport SDK must be configured with an appropriate log level that enables auth URL capture. The test automation relies on capturing authentication URLs from Unity's Player.log.
8+
9+
**Required Configuration:**
10+
11+
In your Unity project's Passport initialisation script, ensure the log level is set to `Info` or `Debug`:
12+
13+
**File:** `src/Packages/Passport/Runtime/Scripts/Passport/PassportInitialisation/PassportInitialisationScript.cs`
14+
15+
```csharp
16+
// Set the log level for the SDK (required for test automation)
17+
Passport.LogLevel = LogLevel.Info; // or LogLevel.Debug
18+
```
19+
20+
**Why This Is Required:**
21+
22+
- The test framework captures authentication URLs from Unity logs using `PassportLogger.Info()` calls
23+
- Without proper logging, authentication URL interception will fail
24+
- This enables the workaround for browser process isolation issues in automated testing environments
25+
26+
**Log Patterns Captured:**
27+
28+
The tests monitor Unity's `Player.log` for these patterns:
29+
30+
- `[Immutable] PASSPORT_AUTH_URL: <url>`
31+
- `[Immutable] [Browser Communications Manager] LaunchAuthURL : <url>`
32+
33+
If authentication tests fail to capture URLs, verify that:
34+
35+
1. The Passport SDK log level is set correctly
36+
2. Unity's Player.log is being written to the expected location
37+
3. The authentication flow is actually being triggered

sample/Tests/test/test_windows.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
"""
2+
Unity Passport Windows UI Tests
3+
4+
For test setup and configuration requirements (especially Passport SDK log level),
5+
see: sample/Tests/README.md
6+
7+
These tests require proper authentication URL logging to work correctly.
8+
"""
9+
110
import time
211

312
from alttester import *
@@ -192,8 +201,8 @@ def test_4_imx_functions(self):
192201
print("=" * 60)
193202
print("STARTING TEST: test_4_imx_functions")
194203
print("=" * 60)
195-
# self.test_2_imx_functions() # TODO: Fix this test - needs NFTs to pass the test
196-
print("SKIPPING TEST: test_4_imx_functions")
204+
self.test_2_imx_functions()
205+
print("COMPLETED TEST: test_4_imx_functions")
197206
print("=" * 60)
198207

199208
def test_5_zkevm_functions(self):

sample/Tests/test/test_windows_helpers.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def get_auth_url_from_unity_logs():
8080
content = f.read()
8181
# Look for either our custom message or the existing LaunchAuthURL message
8282
# Get the LAST occurrence (most recent) and make sure it's a login URL, not logout
83-
matches = re.findall(r'(?:PASSPORT_AUTH_URL: |LaunchAuthURL : )(https?://[^\s]+)', content)
83+
# Now includes [Immutable] tag from PassportLogger
84+
matches = re.findall(r'(?:\[Immutable\] PASSPORT_AUTH_URL: |PASSPORT_AUTH_URL: |LaunchAuthURL : )(https?://[^\s]+)', content)
8485
if matches:
8586
# Get the last URL and make sure it's not a logout URL
8687
for url in reversed(matches):
@@ -124,8 +125,9 @@ def get_logout_url_from_unity_logs():
124125
try:
125126
with open(log_path, 'r', encoding='utf-8', errors='ignore') as f:
126127
content = f.read()
127-
# Look for logout URLs in Unity logs
128-
matches = re.findall(r'(?:PASSPORT_LOGOUT_URL: |LaunchAuthURL : )(https?://[^\s]+)', content)
128+
# Look for logout URLs in Unity logs (uses same PASSPORT_AUTH_URL pattern)
129+
# Now includes [Immutable] tag from PassportLogger
130+
matches = re.findall(r'(?:\[Immutable\] PASSPORT_AUTH_URL: |PASSPORT_AUTH_URL: |LaunchAuthURL : )(https?://[^\s]+)', content)
129131
if matches:
130132
# Get the last URL and make sure it's a logout URL
131133
for url in reversed(matches):
@@ -573,7 +575,28 @@ def open_sample_app(clear_data=False):
573575
clear_unity_data()
574576

575577
print(f"Opening {product_name}...")
576-
subprocess.Popen([f"{product_name}.exe"], shell=True)
578+
579+
# Look for the executable in build folder first, then current directory
580+
exe_paths = [
581+
f"../build/{product_name}.exe", # Relative to Tests folder
582+
f"{product_name}.exe" # Current directory (fallback)
583+
]
584+
585+
exe_launched = False
586+
for exe_path in exe_paths:
587+
if os.path.exists(exe_path):
588+
print(f"Found executable at: {exe_path}")
589+
subprocess.Popen([exe_path], shell=True)
590+
exe_launched = True
591+
break
592+
593+
if not exe_launched:
594+
print(f"ERROR: Could not find {product_name}.exe in any of these locations:")
595+
for path in exe_paths:
596+
abs_path = os.path.abspath(path)
597+
print(f" - {abs_path} (exists: {os.path.exists(abs_path)})")
598+
raise FileNotFoundError(f"Unity executable not found")
599+
577600
time.sleep(10)
578601
print(f"{product_name} opened successfully.")
579602

src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/Immutable.Browser.Core.asmdef

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"name": "Immutable.Browser.Core",
33
"rootNamespace": "Immutable.Browser.Core",
44
"references": [
5-
"GUID:f51ebe6a0ceec4240a699833d6309b23"
5+
"UniTask",
6+
"Immutable.Passport.Core.Logging"
67
],
78
"includePlatforms": [],
89
"excludePlatforms": [],

src/Packages/Passport/Runtime/ThirdParty/ImmutableBrowserCore/WindowsWebBrowserClientAdapter.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using UnityEngine;
55
using Immutable.Browser.Core;
6+
using Immutable.Passport.Core.Logging;
67
using Cysharp.Threading.Tasks;
78

89
namespace Immutable.Browser.Core
@@ -51,7 +52,7 @@ public void ExecuteJs(string js)
5152
public void LaunchAuthURL(string url, string? redirectUri)
5253
{
5354
// Log the auth URL for test automation to capture
54-
Debug.Log($"PASSPORT_AUTH_URL: {url}");
55+
PassportLogger.Info($"PASSPORT_AUTH_URL: {url}");
5556
Application.OpenURL(url);
5657
}
5758

src/Packages/ZkEvmApi/Documentation~/FeedItemFollowGame.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Name | Type | Description | Notes
2323
**Description** | **string** | Description of the CTA button |
2424
**Logo** | **string** | URL of the quiz logo |
2525
**Title** | **string** | Title of the video |
26+
**SimilarGames** | **List&lt;string&gt;** | Similar games to display | [optional]
2627

2728
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
2829

src/Packages/ZkEvmApi/Runtime/Model/FeedItemFollowGame.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ protected FeedItemFollowGame() { }
7979
/// <param name="description">Description of the CTA button (required).</param>
8080
/// <param name="logo">URL of the quiz logo (required).</param>
8181
/// <param name="title">Title of the video (required).</param>
82-
public FeedItemFollowGame(string id = default(string), string name = default(string), string questId = default(string), int priority = default(int), int gemsEarnable = default(int), bool bypass = default(bool), bool dayZero = default(bool), Guid gameId = default(Guid), string gameName = default(string), string questCompletedPopupText = default(string), List<string> tags = default(List<string>), List<string> categories = default(List<string>), string onboardingExperience = default(string), TypeEnum type = default(TypeEnum), string image = default(string), string label = default(string), string description = default(string), string logo = default(string), string title = default(string))
82+
/// <param name="similarGames">Similar games to display.</param>
83+
public FeedItemFollowGame(string id = default(string), string name = default(string), string questId = default(string), int priority = default(int), int gemsEarnable = default(int), bool bypass = default(bool), bool dayZero = default(bool), Guid gameId = default(Guid), string gameName = default(string), string questCompletedPopupText = default(string), List<string> tags = default(List<string>), List<string> categories = default(List<string>), string onboardingExperience = default(string), TypeEnum type = default(TypeEnum), string image = default(string), string label = default(string), string description = default(string), string logo = default(string), string title = default(string), List<string> similarGames = default(List<string>))
8384
{
8485
// to ensure "id" is required (not null)
8586
if (id == null)
@@ -140,6 +141,7 @@ protected FeedItemFollowGame() { }
140141
this.Tags = tags;
141142
this.Categories = categories;
142143
this.OnboardingExperience = onboardingExperience;
144+
this.SimilarGames = similarGames;
143145
}
144146

145147
/// <summary>
@@ -268,6 +270,13 @@ protected FeedItemFollowGame() { }
268270
[DataMember(Name = "title", IsRequired = true, EmitDefaultValue = true)]
269271
public string Title { get; set; }
270272

273+
/// <summary>
274+
/// Similar games to display
275+
/// </summary>
276+
/// <value>Similar games to display</value>
277+
[DataMember(Name = "similar_games", EmitDefaultValue = false)]
278+
public List<string> SimilarGames { get; set; }
279+
271280
/// <summary>
272281
/// Returns the string presentation of the object
273282
/// </summary>
@@ -295,6 +304,7 @@ public override string ToString()
295304
sb.Append(" Description: ").Append(Description).Append("\n");
296305
sb.Append(" Logo: ").Append(Logo).Append("\n");
297306
sb.Append(" Title: ").Append(Title).Append("\n");
307+
sb.Append(" SimilarGames: ").Append(SimilarGames).Append("\n");
298308
sb.Append("}\n");
299309
return sb.ToString();
300310
}

src/Packages/ZkEvmApi/api~/openapi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9167,6 +9167,11 @@ components:
91679167
title:
91689168
description: Title of the video
91699169
type: string
9170+
similar_games:
9171+
description: Similar games to display
9172+
items:
9173+
type: string
9174+
type: array
91709175
required:
91719176
- description
91729177
- image

0 commit comments

Comments
 (0)