Your phone, on your command. Gotcha is world's first fully on-device AI copilot for Android that turns natural language into real device actions — safely.
chore: consolidate test tooling and fixtures under testing/
Durganshu Mishra85738f119f4b
diff --git a/.gitignore b/.gitignoreindex 57dfb0f..490c4fe 100644--- a/.gitignore+++ b/.gitignore@@ -39,7 +39,7 @@ proguard/*.log# ...except the sample log fixture used by the document-attachment tests-!sample-documents/app.log+!testing/sample-documents/app.log# Android Studio Navigation editor temp files.navigation/@@ -118,4 +118,4 @@ MARKETING_PLAYBOOK.mddocs/benchmarkdocs/WAKE_WORD_PLAN.md.freebuff-scripts/wake_battery_idle.sh\ No newline at end of file+testing/scripts/wake_battery_idle.sh\ No newline at end of filediff --git a/.maestro/flows/01-launch.yaml b/.maestro/flows/01-launch.yamlindex 3bda918..f98ecbe 100644--- a/.maestro/flows/01-launch.yaml+++ b/.maestro/flows/01-launch.yaml@@ -1,6 +1,6 @@appId: com.gotcha----# Requires scripts/maestro_run.sh to have seeded settings first (configured route).+# Requires testing/scripts/maestro_run.sh to have seeded settings first (configured route).- launchApp- assertVisible: "Gotcha"- assertVisible:diff --git a/.maestro/flows/03-chat-roundtrip.yaml b/.maestro/flows/03-chat-roundtrip.yamlindex 72baf27..689d182 100644--- a/.maestro/flows/03-chat-roundtrip.yaml+++ b/.maestro/flows/03-chat-roundtrip.yaml@@ -1,6 +1,6 @@appId: com.gotcha----# Requires scripts/maestro_run.sh: mock_llm_server.py reachable via `adb reverse tcp:8080 tcp:8080`.+# Requires testing/scripts/maestro_run.sh: mock_llm_server.py reachable via `adb reverse tcp:8080 tcp:8080`.- launchApp- tapOn:text: "Let's Go"diff --git a/.maestro/flows/04-assistive-ball.yaml b/.maestro/flows/04-assistive-ball.yamlindex 8d49c82..144f62e 100644--- a/.maestro/flows/04-assistive-ball.yaml+++ b/.maestro/flows/04-assistive-ball.yaml@@ -1,6 +1,6 @@appId: com.gotcha----# Requires scripts/maestro_run.sh to have granted the SYSTEM_ALERT_WINDOW appop first+# Requires testing/scripts/maestro_run.sh to have granted the SYSTEM_ALERT_WINDOW appop first# (Maestro cannot send shell/appops commands itself).- launchApp# The toggle lives in Settings ▸ Assistive Ball.diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex f84c50d..5f64fd4 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -123,9 +123,12 @@ Gotcha/│ ├── data/ # Persistence, encrypted credential storage│ └── ui/ # Compose screens├── app/src/test/ # JVM unit + Robolectric tests-├── detekt-rules/ # Custom static-analysis rules+├── detekt-rules/ # Custom static-analysis rules + detekt.yml├── docs/ # Setup guides, model card, coverage manifest-└── scripts/ # Development utilities+├── .maestro/ # Maestro end-to-end flows+└── testing/+ ├── scripts/ # Test-matrix runner, Maestro runner, mock LLM server+ └── sample-documents/ # Attachment fixtures (also the manual test kit)```## Help & documentationdiff --git a/app/build.gradle.kts b/app/build.gradle.ktsindex 5ae6d4d..9ccc680 100644--- a/app/build.gradle.kts+++ b/app/build.gradle.kts@@ -183,10 +183,13 @@ android {unitTests.all { test ->val updatingCoverageDocs = providers.gradleProperty("updateCoverageDocs").getOrElse("false")test.systemProperty("gotcha.coverage.update", updatingCoverageDocs)- // sample-documents/ doubles as the fixtures for SampleDocumentsTest; pass the- // absolute path so the test reads the single committed copy instead of keeping+ // testing/sample-documents/ doubles as the fixtures for SampleDocumentsTest; pass+ // the absolute path so the test reads the single committed copy instead of keeping// a second one under src/test/resources.- test.systemProperty("gotcha.sampleDocsDir", rootProject.file("sample-documents").absolutePath)+ test.systemProperty(+ "gotcha.sampleDocsDir",+ rootProject.file("testing/sample-documents").absolutePath,+ )// The generated doc is an *input* to the drift assertion, so hand-editing it has to// invalidate the task — otherwise Gradle reports UP-TO-DATE and the gate never runs.// Skipped while regenerating, when the task writes that same file.diff --git a/app/src/androidTest/java/com/gotcha/testutil/MockLlm.kt b/app/src/androidTest/java/com/gotcha/testutil/MockLlm.ktindex 07fd66b..650341f 100644--- a/app/src/androidTest/java/com/gotcha/testutil/MockLlm.kt+++ b/app/src/androidTest/java/com/gotcha/testutil/MockLlm.kt@@ -5,14 +5,14 @@ import okhttp3.mockwebserver.MockResponseimport okhttp3.mockwebserver.MockWebServerimport okhttp3.mockwebserver.RecordedRequest-/** Canned reply asserted by [com.gotcha.ChatRoundTripTest]; mirrors scripts/mock_llm_server.py. */+/** Canned reply asserted by [com.gotcha.ChatRoundTripTest]; mirrors testing/scripts/mock_llm_server.py. */const val MOCK_REPLY_OK = "MOCK_REPLY_OK"/*** In-process MockWebServer standing in for an OpenAI-compatible backend during* androidTest runs. Serves the same two routes the Kotlin unit tests* (app/src/test/java/com/gotcha/llm/LLMClientTest.kt) and the standalone- * scripts/mock_llm_server.py (used by Maestro) exercise.+ * testing/scripts/mock_llm_server.py (used by Maestro) exercise.*/class MockLlm {diff --git a/app/src/test/java/com/gotcha/tools/SampleDocumentsTest.kt b/app/src/test/java/com/gotcha/tools/SampleDocumentsTest.ktindex 8adcfee..fdb6784 100644--- a/app/src/test/java/com/gotcha/tools/SampleDocumentsTest.kt+++ b/app/src/test/java/com/gotcha/tools/SampleDocumentsTest.kt@@ -14,13 +14,13 @@ import java.io.File/*** Runs [DocumentParser] against the real sample files committed under- * `sample-documents/` at the repo root — the same kit users transfer to a device+ * `testing/sample-documents/` — the same kit users transfer to a device* to manually test chat attachments. The directory is handed to the test via the* `gotcha.sampleDocsDir` system property (see `app/build.gradle.kts`) so the files* live in one place. PDF needs pdfbox-android, so this runs under Robolectric* like [DocumentParserPdfTest].*- * Each assertion mirrors what the README in `sample-documents/` promises, so a+ * Each assertion mirrors what the README in `testing/sample-documents/` promises, so a* regression in extraction (or a silent format change) fails here first.*/@RunWith(RobolectricTestRunner::class)@@ -34,7 +34,7 @@ class SampleDocumentsTest {DocumentParser.init(ApplicationProvider.getApplicationContext())val path = System.getProperty("gotcha.sampleDocsDir")dir = File(checkNotNull(path) { "gotcha.sampleDocsDir system property missing" })- assertTrue("sample-documents must exist", dir.isDirectory)+ assertTrue("testing/sample-documents must exist", dir.isDirectory)}private fun extract(name: String): ExtractedDocument {diff --git a/docs/RUNNING_TESTS.md b/docs/RUNNING_TESTS.mdindex be4162e..27e9923 100644--- a/docs/RUNNING_TESTS.md+++ b/docs/RUNNING_TESTS.md@@ -154,14 +154,19 @@ making a visible AVD from it):## 6. Other test-suite paths (less exercised — verify before relying on them)-- **`scripts/test_matrix.sh`** — the local full-matrix script (Phase 5).+- **`testing/scripts/test_matrix.sh`** — the local full-matrix script (Phase 5).Boots real AVDs serially via `adb`/`emulator` directly. GMD covers thewhole supported range (API 30+) now that `minSdk` is 30, so this is aconvenience path rather than a required one. Not run end-to-endin this session — check it works before depending on it.-- **`scripts/maestro_run.sh`** + **`.maestro/flows/*.yaml`** — the Maestro+- **`testing/scripts/maestro_run.sh`** + **`.maestro/flows/*.yaml`** — the Maestrosmoke layer. Requires Maestro installed separately. Not exercised in thissession either.+- **[`testing/sample-documents/`](../testing/sample-documents/README.md)** — the+ document-attachment fixture kit. `SampleDocumentsTest` parses these files+ directly (the directory is passed in via the `gotcha.sampleDocsDir` system+ property), and the same folder is what you transfer to a device to test chat+ attachments by hand. Its README lists the expected extraction for every file.- **CI** (`.github/workflows/ci.yml`) — **disabled by default** to conserve GitHub Actionsbudget: automatic triggers (push, PRs, the nightly full-matrix schedule) are removed. Theworkflow still runs on manual `workflow_dispatch` (Actions → **Run workflow**, opt-in anddiff --git a/sample-documents/.gitignore b/testing/sample-documents/.gitignoresimilarity index 100%rename from sample-documents/.gitignorerename to testing/sample-documents/.gitignorediff --git a/sample-documents/Main.kt b/testing/sample-documents/Main.ktsimilarity index 100%rename from sample-documents/Main.ktrename to testing/sample-documents/Main.ktdiff --git a/sample-documents/README.md b/testing/sample-documents/README.mdsimilarity index 100%rename from sample-documents/README.mdrename to testing/sample-documents/README.mddiff --git a/sample-documents/app.log b/testing/sample-documents/app.logsimilarity index 100%rename from sample-documents/app.logrename to testing/sample-documents/app.logdiff --git a/sample-documents/app.properties b/testing/sample-documents/app.propertiessimilarity index 100%rename from sample-documents/app.propertiesrename to testing/sample-documents/app.propertiesdiff --git a/sample-documents/budget.xlsx b/testing/sample-documents/budget.xlsxsimilarity index 100%rename from sample-documents/budget.xlsxrename to testing/sample-documents/budget.xlsxdiff --git a/sample-documents/config.ini b/testing/sample-documents/config.inisimilarity index 100%rename from sample-documents/config.inirename to testing/sample-documents/config.inidiff --git a/sample-documents/config.json b/testing/sample-documents/config.jsonsimilarity index 100%rename from sample-documents/config.jsonrename to testing/sample-documents/config.jsondiff --git a/sample-documents/corrupt.pdf b/testing/sample-documents/corrupt.pdfsimilarity index 100%rename from sample-documents/corrupt.pdfrename to testing/sample-documents/corrupt.pdfdiff --git a/sample-documents/data.csv b/testing/sample-documents/data.csvsimilarity index 100%rename from sample-documents/data.csvrename to testing/sample-documents/data.csvdiff --git a/sample-documents/data.tsv b/testing/sample-documents/data.tsvsimilarity index 100%rename from sample-documents/data.tsvrename to testing/sample-documents/data.tsvdiff --git a/sample-documents/data.xml b/testing/sample-documents/data.xmlsimilarity index 100%rename from sample-documents/data.xmlrename to testing/sample-documents/data.xmldiff --git a/sample-documents/deck.pptx b/testing/sample-documents/deck.pptxsimilarity index 100%rename from sample-documents/deck.pptxrename to testing/sample-documents/deck.pptxdiff --git a/sample-documents/document.rtf b/testing/sample-documents/document.rtfsimilarity index 100%rename from sample-documents/document.rtfrename to testing/sample-documents/document.rtfdiff --git a/sample-documents/legacy.doc b/testing/sample-documents/legacy.docsimilarity index 100%rename from sample-documents/legacy.docrename to testing/sample-documents/legacy.docdiff --git a/sample-documents/legacy.xls b/testing/sample-documents/legacy.xlssimilarity index 100%rename from sample-documents/legacy.xlsrename to testing/sample-documents/legacy.xlsdiff --git a/sample-documents/long.txt b/testing/sample-documents/long.txtsimilarity index 100%rename from sample-documents/long.txtrename to testing/sample-documents/long.txtdiff --git a/sample-documents/notes.md b/testing/sample-documents/notes.mdsimilarity index 100%rename from sample-documents/notes.mdrename to testing/sample-documents/notes.mddiff --git a/sample-documents/page.html b/testing/sample-documents/page.htmlsimilarity index 100%rename from sample-documents/page.htmlrename to testing/sample-documents/page.htmldiff --git a/sample-documents/proposal.docx b/testing/sample-documents/proposal.docxsimilarity index 100%rename from sample-documents/proposal.docxrename to testing/sample-documents/proposal.docxdiff --git a/sample-documents/queries.sql b/testing/sample-documents/queries.sqlsimilarity index 100%rename from sample-documents/queries.sqlrename to testing/sample-documents/queries.sqldiff --git a/sample-documents/readme.txt b/testing/sample-documents/readme.txtsimilarity index 100%rename from sample-documents/readme.txtrename to testing/sample-documents/readme.txtdiff --git a/sample-documents/report.pdf b/testing/sample-documents/report.pdfsimilarity index 100%rename from sample-documents/report.pdfrename to testing/sample-documents/report.pdfdiff --git a/sample-documents/sample.env b/testing/sample-documents/sample.envsimilarity index 100%rename from sample-documents/sample.envrename to testing/sample-documents/sample.envdiff --git a/sample-documents/server.py b/testing/sample-documents/server.pysimilarity index 100%rename from sample-documents/server.pyrename to testing/sample-documents/server.pydiff --git a/sample-documents/settings.yaml b/testing/sample-documents/settings.yamlsimilarity index 100%rename from sample-documents/settings.yamlrename to testing/sample-documents/settings.yamldiff --git a/sample-documents/styles.css b/testing/sample-documents/styles.csssimilarity index 100%rename from sample-documents/styles.cssrename to testing/sample-documents/styles.cssdiff --git a/scripts/maestro_run.sh b/testing/scripts/maestro_run.shsimilarity index 88%rename from scripts/maestro_run.shrename to testing/scripts/maestro_run.shindex 3ace638..cff566f 100644--- a/scripts/maestro_run.sh+++ b/testing/scripts/maestro_run.sh@@ -3,14 +3,14 @@# start the mock LLM server, reverse its port to the device, install the debug# APK, grant the overlay appop, and seed settings via the debug broadcast hook.#-# Usage: scripts/maestro_run.sh [maestro test args...]+# Usage: testing/scripts/maestro_run.sh [maestro test args...]# Defaults to running every flow in .maestro/flows.set -euo pipefailANDROID_HOME="${ANDROID_HOME:-${LOCALAPPDATA:-}/Android/Sdk}"ADB="$ANDROID_HOME/platform-tools/adb"-REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"DEBUG_APK="$REPO_ROOT/app/build/outputs/apk/debug/app-debug.apk"PACKAGE_NAME="com.gotcha"MOCK_PORT=8080@@ -21,7 +21,7 @@ if [[ ! -f "$DEBUG_APK" ]]; thenfiecho "Starting mock LLM server on :$MOCK_PORT…"-python3 "$REPO_ROOT/scripts/mock_llm_server.py" "$MOCK_PORT" &+python3 "$REPO_ROOT/testing/scripts/mock_llm_server.py" "$MOCK_PORT" &MOCK_SERVER_PID=$!trap 'kill "$MOCK_SERVER_PID" 2>/dev/null || true' EXITdiff --git a/scripts/mock_llm_server.py b/testing/scripts/mock_llm_server.pysimilarity index 97%rename from scripts/mock_llm_server.pyrename to testing/scripts/mock_llm_server.pyindex d8f309b..11ac5bc 100644--- a/scripts/mock_llm_server.py+++ b/testing/scripts/mock_llm_server.py@@ -6,7 +6,7 @@ exercises, so androidTest (MockWebServer, in-process) and Maestro (this server,reached via `adb reverse tcp:8080 tcp:8080`) assert against the same reply text.Usage:- python3 scripts/mock_llm_server.py [port]+ python3 testing/scripts/mock_llm_server.py [port]"""import jsonimport sysdiff --git a/scripts/test_matrix.sh b/testing/scripts/test_matrix.shsimilarity index 96%rename from scripts/test_matrix.shrename to testing/scripts/test_matrix.shindex 9d83b91..881fff2 100644--- a/scripts/test_matrix.sh+++ b/testing/scripts/test_matrix.sh@@ -6,7 +6,7 @@# coverage path — Gradle Managed Devices (Phase 3) supports API 27+ only.## Usage:-# scripts/test_matrix.sh [--connected] [--maestro] [avd-name ...]+# testing/scripts/test_matrix.sh [--connected] [--maestro] [avd-name ...]## With no AVD names, every AVD returned by `emulator -list-avds` is run.set -uo pipefail@@ -15,7 +15,7 @@ ANDROID_HOME="${ANDROID_HOME:-${LOCALAPPDATA:-}/Android/Sdk}"EMULATOR="$ANDROID_HOME/emulator/emulator"ADB="$ANDROID_HOME/platform-tools/adb"-REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"+REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"RESULTS_ROOT="$REPO_ROOT/build/matrix-results"DEBUG_APK="$REPO_ROOT/app/build/outputs/apk/debug/app-debug.apk"@@ -159,7 +159,7 @@ run_one_avd() {if [[ "$run_maestro" == true && "$status" == "pass" ]]; thenecho "[$avd] running Maestro flows…"- if ! "$REPO_ROOT/scripts/maestro_run.sh" > "$avd_dir/maestro.log" 2>&1; then+ if ! "$REPO_ROOT/testing/scripts/maestro_run.sh" > "$avd_dir/maestro.log" 2>&1; thenstatus="fail-maestro"fifi