Skip to content

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/.gitignore
index 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.md
docs/benchmark
docs/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 file
diff --git a/.maestro/flows/01-launch.yaml b/.maestro/flows/01-launch.yaml
index 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.yaml
index 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.yaml
index 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.md
index 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 & documentation
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 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.kt
index 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.MockResponse
import okhttp3.mockwebserver.MockWebServer
import 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.kt
index 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.md
index 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 the
whole supported range (API 30+) now that `minSdk` is 30, so this is a
convenience path rather than a required one. Not run end-to-end
in 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 Maestro
smoke layer. Requires Maestro installed separately. Not exercised in this
session 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 Actions
budget: automatic triggers (push, PRs, the nightly full-matrix schedule) are removed. The
workflow still runs on manual `workflow_dispatch` (Actions → **Run workflow**, opt-in and
diff --git a/sample-documents/.gitignore b/testing/sample-documents/.gitignore
similarity index 100%
rename from sample-documents/.gitignore
rename to testing/sample-documents/.gitignore
diff --git a/sample-documents/Main.kt b/testing/sample-documents/Main.kt
similarity index 100%
rename from sample-documents/Main.kt
rename to testing/sample-documents/Main.kt
diff --git a/sample-documents/README.md b/testing/sample-documents/README.md
similarity index 100%
rename from sample-documents/README.md
rename to testing/sample-documents/README.md
diff --git a/sample-documents/app.log b/testing/sample-documents/app.log
similarity index 100%
rename from sample-documents/app.log
rename to testing/sample-documents/app.log
diff --git a/sample-documents/app.properties b/testing/sample-documents/app.properties
similarity index 100%
rename from sample-documents/app.properties
rename to testing/sample-documents/app.properties
diff --git a/sample-documents/budget.xlsx b/testing/sample-documents/budget.xlsx
similarity index 100%
rename from sample-documents/budget.xlsx
rename to testing/sample-documents/budget.xlsx
diff --git a/sample-documents/config.ini b/testing/sample-documents/config.ini
similarity index 100%
rename from sample-documents/config.ini
rename to testing/sample-documents/config.ini
diff --git a/sample-documents/config.json b/testing/sample-documents/config.json
similarity index 100%
rename from sample-documents/config.json
rename to testing/sample-documents/config.json
diff --git a/sample-documents/corrupt.pdf b/testing/sample-documents/corrupt.pdf
similarity index 100%
rename from sample-documents/corrupt.pdf
rename to testing/sample-documents/corrupt.pdf
diff --git a/sample-documents/data.csv b/testing/sample-documents/data.csv
similarity index 100%
rename from sample-documents/data.csv
rename to testing/sample-documents/data.csv
diff --git a/sample-documents/data.tsv b/testing/sample-documents/data.tsv
similarity index 100%
rename from sample-documents/data.tsv
rename to testing/sample-documents/data.tsv
diff --git a/sample-documents/data.xml b/testing/sample-documents/data.xml
similarity index 100%
rename from sample-documents/data.xml
rename to testing/sample-documents/data.xml
diff --git a/sample-documents/deck.pptx b/testing/sample-documents/deck.pptx
similarity index 100%
rename from sample-documents/deck.pptx
rename to testing/sample-documents/deck.pptx
diff --git a/sample-documents/document.rtf b/testing/sample-documents/document.rtf
similarity index 100%
rename from sample-documents/document.rtf
rename to testing/sample-documents/document.rtf
diff --git a/sample-documents/legacy.doc b/testing/sample-documents/legacy.doc
similarity index 100%
rename from sample-documents/legacy.doc
rename to testing/sample-documents/legacy.doc
diff --git a/sample-documents/legacy.xls b/testing/sample-documents/legacy.xls
similarity index 100%
rename from sample-documents/legacy.xls
rename to testing/sample-documents/legacy.xls
diff --git a/sample-documents/long.txt b/testing/sample-documents/long.txt
similarity index 100%
rename from sample-documents/long.txt
rename to testing/sample-documents/long.txt
diff --git a/sample-documents/notes.md b/testing/sample-documents/notes.md
similarity index 100%
rename from sample-documents/notes.md
rename to testing/sample-documents/notes.md
diff --git a/sample-documents/page.html b/testing/sample-documents/page.html
similarity index 100%
rename from sample-documents/page.html
rename to testing/sample-documents/page.html
diff --git a/sample-documents/proposal.docx b/testing/sample-documents/proposal.docx
similarity index 100%
rename from sample-documents/proposal.docx
rename to testing/sample-documents/proposal.docx
diff --git a/sample-documents/queries.sql b/testing/sample-documents/queries.sql
similarity index 100%
rename from sample-documents/queries.sql
rename to testing/sample-documents/queries.sql
diff --git a/sample-documents/readme.txt b/testing/sample-documents/readme.txt
similarity index 100%
rename from sample-documents/readme.txt
rename to testing/sample-documents/readme.txt
diff --git a/sample-documents/report.pdf b/testing/sample-documents/report.pdf
similarity index 100%
rename from sample-documents/report.pdf
rename to testing/sample-documents/report.pdf
diff --git a/sample-documents/sample.env b/testing/sample-documents/sample.env
similarity index 100%
rename from sample-documents/sample.env
rename to testing/sample-documents/sample.env
diff --git a/sample-documents/server.py b/testing/sample-documents/server.py
similarity index 100%
rename from sample-documents/server.py
rename to testing/sample-documents/server.py
diff --git a/sample-documents/settings.yaml b/testing/sample-documents/settings.yaml
similarity index 100%
rename from sample-documents/settings.yaml
rename to testing/sample-documents/settings.yaml
diff --git a/sample-documents/styles.css b/testing/sample-documents/styles.css
similarity index 100%
rename from sample-documents/styles.css
rename to testing/sample-documents/styles.css
diff --git a/scripts/maestro_run.sh b/testing/scripts/maestro_run.sh
similarity index 88%
rename from scripts/maestro_run.sh
rename to testing/scripts/maestro_run.sh
index 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 pipefail
ANDROID_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" ]]; then
fi
echo "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' EXIT
diff --git a/scripts/mock_llm_server.py b/testing/scripts/mock_llm_server.py
similarity index 97%
rename from scripts/mock_llm_server.py
rename to testing/scripts/mock_llm_server.py
index 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 json
import sys
diff --git a/scripts/test_matrix.sh b/testing/scripts/test_matrix.sh
similarity index 96%
rename from scripts/test_matrix.sh
rename to testing/scripts/test_matrix.sh
index 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" ]]; then
echo "[$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; then
status="fail-maestro"
fi
fi