budget-app/docs/TESTING.md

2.1 KiB

Owner-local test strategy

References inspected before migration:

  • Current Makepad libs/makepad_test/{README.md,src/runtime.rs,src/app_process.rs}.
  • Makepad examples/counter/tests: actual locator wait/click/assert APIs.
  • Nigig crates/apps/nigig-mpesa/tests/ui.rs: direct makepad-test UI tests.
  • Nigig crates/apps/spreadsheet/spreadsheet-ui/tests/ui.rs: per-test configuration.
  • Nigig crates/robius-sms/tests/sms_pipeline.rs: public API integration tests and explicit separation of host tests from device-only JNI/permission claims.

Nigig's older framework notes refer to StudioHub and ignored headless tests. The current Makepad crate owns a release app process and communicates over its remote protocol. Budget uses that current API, with no ignored tests and a Linux display/Xvfb. It does not copy stale hub setup or substitute widget-count mocks.

app/tests/ui.rs drives history navigation, date text inputs, validation buttons and capture-boundary messaging. Each case gets isolated HOME/XDG directories; no real user budget is modified. app/tests/models.rs tests the public application library, replacing the nested, duplicated-source model harness.

budget-capture/tests/ocr.rs executes the real embedded models against a generated product image and a blank image, and checks invalid-buffer rejection. Its fixture is synthetic, not a user screenshot. tests/java/ProductExtractionTest.java retains 12 price/title/currency tests, compiled by javac/JUnit directly. Contract Python tests are explicitly static guards, not device tests.

app/tests/run-clean.sh creates a disposable Rust environment following Nigig's clean-runner pattern. It runs the owner-local suites, builds/links/runs the native app, and with FULL_ANDROID=1 installs the Makepad SDK, builds the actual APK and inspects its classes, manifest, exported JNI function and embedded models. It cleans up even when a command fails. Optional VALIDATION_ARTIFACTS preserves UI failure diagnostics; VALIDATED_LOCKFILE_OUTPUT writes the resolved lockfile.

Android hardware/emulator acceptance remains a separate gate. See ANDROID_CAPTURE.md.