Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ui-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ jobs:
# runs-on: [ self-hosted, macOS ]
# test_script: browserstack-sdk pytest -s ./test/test_android.py --browserstack.config "browserstack.android.yml"
concurrency:
group: test-${{ matrix.targetPlatform }}
group: ui-tests-email-inbox
cancel-in-progress: false # Let tests complete rather than canceling
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -146,7 +147,7 @@ jobs:
security list-keychains
build-ios: #test-ios:
name: Run iOS build #UI tests 🧪
needs:
needs:
- build
- test
runs-on: [ self-hosted, macOS ]
Expand All @@ -170,4 +171,3 @@ jobs:
# BROWSERSTACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
# working-directory: sample/Tests/test/ios
# run: browserstack-sdk pytest -xs ./test_ios.py --browserstack.config "browserstack.ios.yml"

37 changes: 37 additions & 0 deletions sample/Tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# UI Tests

## Prerequisites

### Passport SDK Log Level Configuration

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.

**Required Configuration:**

In your Unity project's Passport initialisation script, ensure the log level is set to `Info` or `Debug`:

**File:** `src/Packages/Passport/Runtime/Scripts/Passport/PassportInitialisation/PassportInitialisationScript.cs`

```csharp
// Set the log level for the SDK (required for test automation)
Passport.LogLevel = LogLevel.Info; // or LogLevel.Debug
```

**Why This Is Required:**

- The test framework captures authentication URLs from Unity logs using `PassportLogger.Info()` calls
- Without proper logging, authentication URL interception will fail
- This enables the workaround for browser process isolation issues in automated testing environments

**Log Patterns Captured:**

The tests monitor Unity's `Player.log` for these patterns:

- `[Immutable] PASSPORT_AUTH_URL: <url>`
- `[Immutable] [Browser Communications Manager] LaunchAuthURL : <url>`

If authentication tests fail to capture URLs, verify that:

1. The Passport SDK log level is set correctly
2. Unity's Player.log is being written to the expected location
3. The authentication flow is actually being triggered
4 changes: 3 additions & 1 deletion sample/Tests/src/fetch_otp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
def get_mailslurp_client():
configuration = mailslurp_client.Configuration()
configuration.api_key['x-api-key'] = os.getenv('MAILSLURP_API_KEY')
# Use the correct API base URL as per official docs
configuration.host = "https://api.mailslurp.com"
api_client = mailslurp_client.ApiClient(configuration)
waitfor_controller = WaitForControllerApi(api_client)
return waitfor_controller
Expand All @@ -23,7 +25,7 @@ def extract_otp_from_email(email_body):

def fetch_code():
waitfor_controller = get_mailslurp_client()
email = waitfor_controller.wait_for_latest_email(inbox_id=INBOX_ID, timeout=30000, unread_only=True)
email = waitfor_controller.wait_for_latest_email(inbox_id=INBOX_ID, timeout=60000, unread_only=True)
if email:
otp = extract_otp_from_email(email.body)
return otp
Expand Down
Loading
Loading