Skip to content

Provide real hardware fixtures to activate skipped UPS + APK tests #166

Description

@RoiArthurB

Summary

Two real-first tests are written but skipped because they need real hardware-captured data that can't be produced or committed from CI. This issue tracks providing that data so the tests activate.

Both follow the project's real-first testing principle: no fabricated fixtures — we replay real captured bytes / use a real APK, or the test skips.


1. APC UPS HID capture (activates test/adb-style UPS decode test)

src/api/infra/ups/apc-ups-hid.ts decodes everything through HID.getFeatureReport(reportId, len). We can unit-test the real getStatus() decoder by replaying real captured report bytes through a fake node-hid device at the boundary — but the bytes must come from the actual UPS (APC Back-UPS BX2200MI, vendor 0x051d / product 0x0002).

Ask: run a one-time capture on the Mac Mini deployment with the UPS attached, dumping each feature report's raw bytes to test/fixtures/ups/*.json. Capture at least two states:

  • on AC (normal), and
  • on battery (briefly unplug the UPS from the wall).

Report IDs to dump (from apc-ups-hid.ts):

name report id bytes
REMAINING_CAPACITY 0x0c 1
FULL_CHARGE_CAPACITY 0x0d 1
RUNTIME_TO_EMPTY 0x0f 2 LE
AC_PRESENT 0x13 1
INPUT_VOLTAGE 0x30 1
INPUT_VOLTAGE_PRECISE 0x31 2 LE
LOW_VOLTAGE_TRANSFER 0x32 2 LE
HIGH_VOLTAGE_TRANSFER 0x33 2 LE
CONFIG_ACTIVE_POWER 0x52 2 LE
DELAY_BEFORE_SHUTDOWN 0x15 2 LE signed
AUDIBLE_ALARM_CONTROL 0x78 1

Plan once fixtures land: add a small dumpRawReports() capture helper, then a replay test that asserts getStatus() decodes the real bytes (battery %, runtime rounding, AC/on-battery, signed shutdown timer, beeper mapping) and that startPolling emits power-lost/power-restored across the AC→battery captures.

2. Tiny debug APK (activates test/adb/package-lifecycle.test.ts)

The install → version → permission → uninstall cycle test needs a small debug APK at test/fixtures/adb/test-app.apk. It must declare:

  • package = com.example.testapp (or update the constants in the test)
  • a pm-grantable uses-permission = android.permission.WRITE_SECURE_SETTINGS

Ask: provide/commit a minimal signed debug APK (a few KB), or add a CI step that builds one with the Android build-tools. The test skips cleanly until then.


Both tests are already in the branch and gated, so nothing is red — they simply skip until the data is available.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions