Skip to content

feat: mobile UAT test enablement - Android automation server + host abstraction - #935

Open
dangershony wants to merge 1 commit into
mainfrom
feat/mobile-uat-enablement
Open

feat: mobile UAT test enablement - Android automation server + host abstraction#935
dangershony wants to merge 1 commit into
mainfrom
feat/mobile-uat-enablement

Conversation

@dangershony

Copy link
Copy Markdown
Member

Summary

Enables running the existing UAT test suite against a USB-connected Android device, driven over adb and the in-app automation server.

Status: Work in Progress

The core infrastructure is in place and smoke-tested, but Android UAT is not fully stable yet. Known issues:

  • adb connection drops: Samsung devices can lose USB connection after am force-stop, requiring adb server restart. The start-uat.ps1 script handles this with wait-for-device, but it is not 100% reliable.
  • APK deployment friction: Fast Deployment can fail on some devices; may need -p:EmbedAssembliesIntoApk=true.
  • Item 4 not done: Mobile-variant assertions/timing (PageSize 4 vs 12, SectionPanel visibility) have not been tuned yet.
  • Multi-profile tests: Only the first host uses Android; remaining hosts fall back to desktop. Not yet tested in mixed mode.

Full end-to-end CreateProjectTest has not been run successfully on Android yet, only smoke-level validation (health check + section navigation).

What is implemented

Item 1 - Lifetime-agnostic window resolution:

  • AutomationRoot.cs: resolves visual root via TopLevel on all platforms
  • All flow helper signatures changed from Window to TopLevel (~45 call sites)
  • NavigateToAsync: detects missing DesktopSidebar, drives ShellViewModel directly on mobile

Item 2 - AndroidTestHost:

  • Simple connect-only host (no adb management from C#) that polls /health on a pre-configured port
  • start-uat.ps1 script handles device setup (setprop, launch, forward)

Item 3 - Config injection:

  • DebugTestConfig.cs (#if DEBUG): reads debug.angor.* system properties via Android JNI, maps to ANGOR_* env vars before DI builds
  • ProfileNameResolver: falls back to ANGOR_PROFILE env var

Item 5 - Security gate:

  • Android automation server now requires ANGOR_TEST_API=1 (was unconditional in Debug builds)
  • Binds to loopback only (was IPAddress.Any)

Host abstraction:

  • ITestHost interface + TestHostFactory set ANGOR_UAT_HOST=android to switch all tests
  • All 9 test files updated to use TestHostFactory.LaunchAsync

Verification

  • CreateProjectTest passes on desktop (no regression)
  • Android smoke check: health + navigation to all sections (Settings, Funds, Find Projects, My Projects)
  • All projects build: App, App.Android, App.Test.Uat (0 errors)

How to use (Android)

# 1. Deploy Debug APK
dotnet build src/design/App.Android/App.Android.csproj -t:Install -f net10.0-android -c Debug -p:AndroidAttachDebugger=false

# 2. Start automation server on device
./src/design/App.Android/scripts/start-uat.ps1

# 3. Run tests
$env:ANGOR_UAT_HOST = "android"
dotnet test src/design/App.Test.Uat/App.Test.Uat.csproj -c Debug

…bstraction

Lifetime-agnostic automation (Item 1):
- AutomationRoot.cs: resolves visual root via TopLevel on all platforms
- AutomationFlows: Window -> TopLevel for all flow helpers (~45 signatures)
- NavigateToAsync: detects mobile layout, drives ShellViewModel directly
- App.axaml.cs: captures App.MainView for Android/iOS/WASM

Config injection (Item 3):
- DebugTestConfig.cs: reads debug.angor.* system properties via JNI,
  maps to ANGOR_* env vars before DI container builds
- ProfileNameResolver: falls back to ANGOR_PROFILE env var

Security (Item 5):
- AutomationServer: requires ANGOR_TEST_API=1 on all platforms (was
  unconditional on Android), binds loopback-only

Host abstraction (Item 2):
- ITestHost interface extracted from TestProcessHost
- AndroidTestHost: connects to already-running Android automation server
- TestHostFactory: ANGOR_UAT_HOST=android switches all tests to Android
- All 9 test files updated to use TestHostFactory.LaunchAsync
- start-uat.ps1: setup script for Android device

Verified: CreateProjectTest passes on desktop after refactor.
Smoke-tested on Samsung device: health + navigation all sections.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant