--- name: gradle_screenshot_test kind: function lang: bash domain: infra version: "1.0.0" purity: impure signature: "gradle_screenshot_test(project_dir: string, module: string, flag: string) -> int" description: "Corre screenshot tests Roborazzi de Composables (JVM, no necesita emulador)." tags: [android, gradle, test, compose, roborazzi, screenshot] params: - name: project_dir desc: "Raiz del proyecto Android (debe contener gradlew)" - name: module desc: "Modulo Gradle a testear. Default: app" - name: --record desc: "Re-grabar goldens en lugar de verificar" output: "Stdout build log. Si verify y diff: linea 'DIFF: '. Si record: linea 'RECORDED: '. Exit 0 OK, 1 mismatch." uses_functions: [gradle_run_bash_infra] uses_types: [] returns: [] returns_optional: false error_type: "error_go_core" imports: [] tested: false tests: [] test_file_path: "" file_path: "bash/functions/infra/gradle_screenshot_test.sh" notes: "Roborazzi corre en JVM (Robolectric) — rapido, no necesita emulador. Goldens viven en src/test/snapshots/ y se commitean al repo. App debe declarar plugin io.github.takahirom.roborazzi en build.gradle.kts." --- ## Ejemplo ```bash # Verificar screenshots (modo CI) bash bash/functions/infra/gradle_screenshot_test.sh /path/to/MyApp # Modulo no-default bash bash/functions/infra/gradle_screenshot_test.sh /path/to/MyApp feature_login # Re-grabar goldens tras cambio de UI intencional bash bash/functions/infra/gradle_screenshot_test.sh /path/to/MyApp app --record ``` ## Salida | Situacion | Salida | |-----------|--------| | Verify OK | log de Gradle, exit 0 | | Verify FAIL | log + `DIFF: //build/outputs/roborazzi/`, exit 1 | | Record OK | log + `RECORDED: //src/test/snapshots/`, exit 0 | ## Notas Source-able y ejecutable directo. Sourcear `gradle_run.sh` resuelve JAVA_HOME y ANDROID_HOME de forma identica al resto de funciones `gradle_*`. Los diffs en `build/outputs/roborazzi/` muestran imagen original, imagen actual e imagen de diferencia. Util para revisar regresiones visuales antes de hacer `--record`. ---