Files
fn_registry/bash/functions/infra/gradle_screenshot_test.md

2.1 KiB

name, kind, lang, domain, version, purity, signature, description, tags, params, output, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path, notes
name kind lang domain version purity signature description tags params output uses_functions uses_types returns returns_optional error_type imports tested tests test_file_path file_path notes
gradle_screenshot_test function bash infra 1.0.0 impure gradle_screenshot_test(project_dir: string, module: string, flag: string) -> int Corre screenshot tests Roborazzi de Composables (JVM, no necesita emulador).
android
gradle
test
compose
roborazzi
screenshot
name desc
project_dir Raiz del proyecto Android (debe contener gradlew)
name desc
module Modulo Gradle a testear. Default: app
name desc
--record Re-grabar goldens en lugar de verificar
Stdout build log. Si verify y diff: linea 'DIFF: <path>'. Si record: linea 'RECORDED: <path>'. Exit 0 OK, 1 mismatch.
gradle_run_bash_infra
false error_go_core
false
bash/functions/infra/gradle_screenshot_test.sh 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

# 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: <project>/<module>/build/outputs/roborazzi/, exit 1
Record OK log + RECORDED: <project>/<module>/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.