Files
sanderling/examples/sample-app
pj 8381a98aaf feat(sample-app): ledger spec parity (#18)
* feat(sample-app): add FocusTracker

* feat(sample-app): support description on TextInput

* feat(sample-app): support description on AppButton and Segmented

* feat(sample-app): stable ids on login screen

* feat(sample-app): stable ids on add-account screen

* feat(sample-app): stable ids on add-transaction screen

* feat(sample-app): stable ids on home and ledger screens

* feat(sample-app): hoist error + form state into UiState

* feat(sample-app): register auth_status + accounts snapshots

* feat(sample-app): register ledger_rows + ledger_balance snapshots

* feat(sample-app): register error + focused_input snapshots

* refactor(sample-app): scaffold spec.ts extractors + safety

* feat(sample-app): spec accounting invariants

* feat(sample-app): spec state-machine monotonicity

* feat(sample-app): spec liveness properties

* feat(sample-app): spec auth + account action generators

* feat(sample-app): spec transaction action generators

* feat(sample-app): spec weighted workflow

* feat(sample-app): publish login form input snapshots

* feat(sample-app): publish account + txn input snapshots

* feat(sample-app): register form input snapshots

* fix(sample-app): sequence login + idempotent text inputs in spec

* fix(sample-app): clear UiState on page dispose

* fix(sample-app): tighten adversarial login, allow retype on error

* test(verifier): update sample-app spec integration for new selectors

* feat(sidecar): clear focused field before InputText types

* refactor(sample-app): simplify loginHelper to focus-driven sequencing

* refactor(sample-app): drop input-value UiState mirrors

* refactor(sample-app): drop input-value snapshot registrations

* test(verifier): adjust sample-app integration for replace-on-type
2026-04-20 13:28:41 +07:00
..

uatu sample app

A minimal Kotlin Multiplatform ledger app that mirrors the React reference: login with demo credentials, create accounts, add credits and debits. Same features, monospace look, and demo creds, shared across Android and iOS via Compose Multiplatform.

Stack

  • Kotlin Multiplatform + Compose Multiplatform (shared UI)
  • kotlinx.serialization for file-backed persistence
  • kotlinx.coroutines for state flows
  • uatu sdk-android for harness integration on Android

Everything in composeApp/src/commonMain/kotlin/dev/uatu/sample/ is shared between platforms. Platform-specific I/O (file storage, clock, UUID) lives in androidMain/ and iosMain/ as actuals of the Platform expect object.

Prerequisites

  • just
  • JDK 17
  • Android SDK (auto-discovered under $ANDROID_HOME, ~/Library/Android/sdk, or the Homebrew cask)
  • Xcode 16+ and xcodegen (brew install xcodegen) for iOS

Android

just install      # build + install on a booted emulator / device
just uninstall
just clean

iOS

just ios                          # default device: iPhone 17 Pro
IOS_DEVICE="iPhone 15" just ios   # pick a different simulator

just ios regenerates iosApp/iosApp.xcodeproj from iosApp/project.yml, builds the KMP framework, links it into the SwiftUI host, installs, and launches.

Demo credentials

email:    [email protected]
password: ledger123

Run a uatu test (Android)

just test

If no device is connected, uatu boots the single AVD it finds. With multiple AVDs, pick one:

just AVD=Pixel_7 test

Persistent settings can live in .env alongside the justfile:

AVD=Pixel_7
DURATION=5m

Traces land in ./runs/<timestamp>/.

Layout

composeApp/
  src/commonMain/kotlin/dev/uatu/sample/   shared domain, state, UI
  src/androidMain/                         Android Application + Activity
  src/iosMain/                             iOS UIViewController entry
iosApp/
  project.yml                              xcodegen spec
  iosApp/iOSApp.swift                      SwiftUI host
  iosApp/Info.plist
justfile
spec.ts                                    uatu test spec

How it connects to uatu

  • composeApp/src/androidMain/.../SampleApplication.kt calls Uatu.start(this) and registers snapshot extractors (logged_in, account_count, total_balance, route)
  • spec.ts imports @uatu/spec, reads those snapshots, asserts properties, and weights the actions the fuzzer picks from
  • just test invokes uatu test against the installed APK