Make the instrumented tests capable of failing #61

Merged
paulhitt merged 2 commits from fix/a-skipped-instrumented-test-must-not-pass into main 2026-09-04 20:49:05 +00:00
2 Commits
Author SHA1 Message Date
Paul Hitt df00bea388 Grant notification permission before the activity launches
Every instrumented test died with "No compose hierarchies found in the
app". MainActivity.onCreate asks for POST_NOTIFICATIONS before it calls
setContent, and the permission dialog is a separate activity that takes
focus — so the Compose rule attached to a window with no hierarchy yet.

GrantPermissionRule at order = 0, outside the Compose rule at order = 1, so
the grant happens first and no dialog ever appears.

With this, the three fixes in the previous commit, and a relay on the host,
aPersonCanCreateAnAccountOnASelfHostedRelay passes: a real account created
on a real relay, driven by test tags. That is the first end-to-end pass this
harness has produced.

  ./gradlew :app:connectedDebugAndroidTest \
      -Pandroid.testInstrumentationRunnerArguments.relay=10.0.2.2:18810
2026-09-02 21:05:03 -04:00
Paul Hitt 16e0101daf Make the instrumented tests capable of failing
Three separate reasons these suites could never catch a regression, all
fixed here. None of them are about the app; all of them are about the tests
being unable to report the truth.

1. A skipped test reported as a pass. Thirteen guards were bare returns —
   `if (!relayReachable()) return` — so with no relay the method returned
   immediately and the runner recorded PASSED. Now `assumeTrue`, which
   reports SKIPPED, and the run says "(2 skipped)" where it used to say
   nothing at all. Only the guards that abandon a whole test were changed;
   helper loop exits like `if (found) return` are control flow and were
   left alone.

2. The relay was hardcoded to relay1.flamenet.io — production. Every run
   that did work created real accounts there. Now `-e relay <host>`, still
   defaulting to production so an unqualified run is unchanged.

3. Android blocks cleartext HTTP, so a debug build could not reach a relay
   on the developer's machine even when one was running. A debug-only
   network security config permits cleartext to 10.0.2.2, 127.0.0.1 and
   localhost, and nothing else. src/debug, so no release APK is affected.

Together these took the sign-up suite from "2 skipped, reported green" to
"2 run, 2 failed" — which is worth more, because it is true. What it
fails on now (no compose hierarchy at launch) is the next thing to fix.

  ./gradlew :app:connectedDebugAndroidTest \
      -Pandroid.testInstrumentationRunnerArguments.relay=10.0.2.2:18810
2026-09-02 20:58:26 -04:00