charly

Guías › Pruebas en vivo

Prepara un proyecto para las pruebas en vivo

10 de octubre de 2026 · Carlos Silva

Cuando un agente corre pruebas con pantalla, Charly las muestra en el panel En vivo del Chat: las páginas web, el simulador de iOS y el emulador de Android, en vídeo. Para que se vean, el proyecto tiene que correrlas de cierta forma. Esta guía dice cuál, y trae un texto para que tu agente lo deje listo solo.

Lo rápido: pídeselo al agente

En un proyecto nuevo, o en uno donde el panel no muestra lo que esperas, copia este texto y envíaselo al agente del proyecto. Revisa qué pruebas hay, cambia lo necesario, las corre una vez en cada plataforma y te cuenta qué hizo.

Prepara este proyecto para que sus pruebas con pantalla se vean en el panel «En vivo» de Charly. Sigue la guía https://getcharly.dev/docs/live-tests y aplica solo lo que corresponda a este proyecto:

1. Mira qué pruebas de UI tiene (Playwright, XCUITest, Compose/Espresso, Robolectric, Maestro) y cómo se lanzan hoy.
2. Charly reconoce la prueba por el INICIO del comando. Usa estas formas (pueden ir tras «cd … &&»):
   - Web: «npx playwright test …» o «pnpm test:e2e».
   - iOS: «xcodebuild test …», «pnpm test:ios» o un script llamado «test-ios.sh».
   - Android en el emulador: «./gradlew … connectedDebugAndroidTest» directamente, nunca dentro de un script.
   - Android en la JVM (Robolectric): «./gradlew … testDebugUnitTest» o un script llamado «test-android.sh».
   - Maestro: «maestro test …».
3. iOS: corre las pruebas en un simulador; no abras Simulator.app (no hace falta verlo: Charly lo muestra).
4. Android: si las pruebas de pantallas son Robolectric, hazlas correr TAMBIÉN en el emulador sin reescribirlas: muévelas a src/sharedTest (añadida a los source sets test y androidTest), usa @RunWith(AndroidJUnit4::class), ApplicationProvider en lugar de RuntimeEnvironment, lleva @Config/@GraphicsMode a robolectric.properties, y añade testInstrumentationRunner y las dependencias androidTest. Arranca el emulador sin ventana y con vídeo:
   emulator -avd <AVD> -no-window -grpc 8554 -grpc-use-token -no-boot-anim
5. Que las pruebas no dependan de un servidor real: un backend falso dentro de la prueba (en Android, con HTTP a 127.0.0.1 permitido en debug).
6. Deja los comandos en el README y córrelas una vez por plataforma (una clase basta) para comprobarlo. Cuéntame qué cambiaste y qué no se pudo.

Funciona con Claude Code, OpenCode o cualquier agente que pueda leer una web. Si tu agente no navega, el texto ya trae lo esencial.

Qué se ve en el panel

PruebasQué vesNecesita
Web (Playwright)Cada página, en vídeoNada: Charly lo prepara al abrir el agente
iOS (XCUITest)El simulador en vídeo, y sus copias si corren en paraleloUn simulador (no un iPhone conectado)
Android instrumentadasEl emulador en vídeoUn emulador abierto con -grpc
Android con RobolectricLas pantallas a medida que se dibujan, como imágenesNada; no hay emulador que grabar
MaestroEl simulador o el emulador que esté encendidoLo mismo que iOS o Android

Un teléfono conectado por cable no tiene vídeo en directo: solo simuladores y emuladores. Detox y las pruebas de integración de Flutter todavía no se muestran en el panel.

Todo esto se ajusta en Ajustes → Pruebas en vivo: calidad, qué pasa cuando nadie mira y cuánto le cuesta al Mac.

Web (Playwright)

No hay que cambiar nada. Cada agente que abre Charly arranca preparado: mientras Playwright corre, cada página se ve en el panel, en vídeo y con su nombre. Solo cuenta cómo empieza el comando:

npx playwright test
pnpm test:e2e

En un servidor por SSH también se ve, por la conexión del proyecto, con imágenes más pequeñas. Se elige por servidor en Ajustes → Pruebas en vivo → Servidores remotos.

iOS (XCUITest)

xcodebuild test -scheme MiApp -destination 'platform=iOS Simulator,name=iPhone 17 Pro'

Android

Con vídeo: pruebas instrumentadas en el emulador

  1. Abre el emulador sin ventana y con vídeo. Solo se ve en Charly, no aparece en el Dock:
    ~/Library/Android/sdk/emulator/emulator -avd Medium_Phone_API_36.0 -no-window -grpc 8554 -grpc-use-token -no-boot-anim &
  2. Corre las pruebas con Gradle directamente, no dentro de un script (si no, Charly no las reconoce):
    ./gradlew --console=plain :app:connectedDebugAndroidTest

Si el agente abrió el emulador sin -grpc, el Chat lo dice y ofrece «Reabrir con vídeo»: lo reinicia sin ventana y con vídeo, en segundos.

En Linux (Fedora, Ubuntu…)

Lo mismo: Android y web con Playwright (iOS solo existe en el Mac). El SDK va donde lo pone Android Studio, ~/Android/Sdk, y el emulador necesita KVM (/dev/kvm). En un equipo sin pantalla, o si el emulador se cierra solo al arrancar, ábrelo con -gpu guest:

~/Android/Sdk/emulator/emulator -avd Medium_Phone_API_36.0 -no-window -grpc 8554 -grpc-use-token -no-boot-anim -gpu guest &

En Linux el panel muestra la pantalla como imágenes seguidas (unas 12 por segundo del emulador, hasta 40 de una página) en vez de vídeo H.264: no hace falta instalar nada más.

Si tus pruebas son Robolectric

Robolectric dibuja las pantallas dentro de la JVM: es rápido, pero no hay pantalla que grabar, así que el panel muestra imágenes. No hace falta reescribirlas para verlas en vídeo: las mismas pruebas de Compose pueden correr también en el emulador.

  1. Mueve las pruebas de pantallas y su código de apoyo a src/sharedTest/java (y sus recursos a src/sharedTest/resources). Las de lógica pura se quedan en src/test.
  2. En app/build.gradle.kts, añade esa carpeta a los dos tipos de prueba y el runner del emulador:
    android {
        defaultConfig {
            testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        }
        sourceSets {
            listOf("test", "androidTest").forEach {
                getByName(it) {
                    kotlin.directories.add("src/sharedTest/java")
                    resources.directories.add("src/sharedTest/resources")
                }
            }
        }
    }
    dependencies {
        testImplementation("androidx.test.ext:junit:1.3.0")
        androidTestImplementation("androidx.test:runner:1.7.0")
        androidTestImplementation("androidx.test.ext:junit:1.3.0")
        androidTestImplementation(platform("androidx.compose:compose-bom:2026.09.00"))
        androidTestImplementation("androidx.compose.ui:ui-test-junit4")
        // y lo que ya usen tus pruebas: junit, mockwebserver…
    }
  3. En la clase base de las pruebas: @RunWith(AndroidJUnit4::class) (sirve para los dos), ApplicationProvider.getApplicationContext() en lugar de RuntimeEnvironment, y lo que iba en @Config o @GraphicsMode, a src/test/resources/robolectric.properties:
    sdk=35
    qualifiers=w402dp-h874dp-xxhdpi
  4. Si las pruebas usan un backend falso local, permite HTTP a 127.0.0.1 en debug (network_security_config).

Así tienes las dos: testDebugUnitTest en segundos y sin emulador para el día a día, y connectedDebugAndroidTest cuando quieras verlas.

Con AGP 9, usa kotlin.directories: con java.directories las pruebas en Kotlin no se compilan. Y si mueves archivos, borra app/build/intermediates/built_in_kotlinc una vez: la compilación incremental puede seguir usando las clases viejas.

Progreso: «12 de 40»

Charly sabe que hay pruebas corriendo y cómo acabaron por el comando. Para mostrar también cuántas van (en la pestaña, en el iPhone y en la pantalla bloqueada), el proyecto puede escribir .aiko/progress.json mientras corren, como mucho cada 300 ms:

{ "v": 1, "runner": "playwright", "done": 12, "total": 40, "failed": 0, "updated": 1791712345678, "finished": false }

Es opcional: sin él, todo lo demás funciona igual.

Si no se ve

Qué pasaCausa probableQué hacer
Android solo muestra imágenesLas pruebas son Robolectric: no hay emuladorCórrelas también en el emulador (Android)
No aparece el panelEl comando va dentro de un script con otro nombre, o no empieza como Charly esperaUsa una de las formas de la lista
«Este emulador se abrió sin transmisión de vídeo»Se abrió sin -grpcPulsa «Reabrir con vídeo» al terminar las pruebas
El emulador aparece en el Dock además de en CharlySe abrió con ventanaÁbrelo con -no-window
INSTALL_FAILED_INSUFFICIENT_STORAGE, pero Gradle dice «BUILD SUCCESSFUL»El emulador está llenoLibera espacio en el emulador (desinstala apps o actualizaciones que no uses) y mira el resultado en app/build/outputs/androidTest-results
«Los teléfonos conectados no tienen vídeo en directo»Las pruebas corren en un teléfono por cableUsa un simulador o un emulador
«El simulador no deja leer su pantalla»El simulador se colgó«Reiniciar el simulador» en el Chat

¿Otra cosa? Escríbenos desde Ajustes → General → Enviar comentarios o a hola@getcharly.dev.

Guides › Live tests

Get a project ready for live tests

October 10, 2026 · Carlos Silva

When an agent runs tests with a screen, Charly shows them in the Chat's Live panel: web pages, the iOS Simulator and the Android emulator, as video. For them to show, the project has to run them a certain way. This guide says which, and has a prompt so your agent can set it up by itself.

The quick way: ask your agent

In a new project, or one where the panel doesn't show what you expect, copy this and send it to the project's agent. It looks at the tests there, changes what's needed, runs them once on each platform and tells you what it did.

Get this project ready so its tests with a screen show in Charly's “Live” panel. Follow the guide https://getcharly.dev/docs/live-tests and apply only what fits this project:

1. Find its UI tests (Playwright, XCUITest, Compose/Espresso, Robolectric, Maestro) and how they're run today.
2. Charly recognizes a test run by the START of its command. Use these forms (they may follow “cd … &&”):
   - Web: “npx playwright test …” or “pnpm test:e2e”.
   - iOS: “xcodebuild test …”, “pnpm test:ios” or a script named “test-ios.sh”.
   - Android on the emulator: “./gradlew … connectedDebugAndroidTest” itself, never inside a script.
   - Android in the JVM (Robolectric): “./gradlew … testDebugUnitTest” or a script named “test-android.sh”.
   - Maestro: “maestro test …”.
3. iOS: run the tests on a simulator; don't open Simulator.app (no need to see it: Charly shows it).
4. Android: if the screen tests are Robolectric, make them ALSO run on the emulator without rewriting them: move them to src/sharedTest (added to both the test and androidTest source sets), use @RunWith(AndroidJUnit4::class), ApplicationProvider instead of RuntimeEnvironment, move @Config/@GraphicsMode into robolectric.properties, and add testInstrumentationRunner and the androidTest dependencies. Start the emulator without a window and with video:
   emulator -avd <AVD> -no-window -grpc 8554 -grpc-use-token -no-boot-anim
5. Tests shouldn't depend on a real server: a fake backend inside the test (on Android, with HTTP to 127.0.0.1 allowed in debug).
6. Put the commands in the README and run them once per platform (one class is enough) to check. Tell me what you changed and what couldn't be done.

It works with Claude Code, OpenCode or any agent that can read a web page. If yours can't browse, the prompt already has what matters.

What the panel shows

TestsWhat you seeNeeds
Web (Playwright)Each page, as videoNothing: Charly sets it up when it opens the agent
iOS (XCUITest)The simulator as video, and its copies when they run in parallelA simulator (not a plugged-in iPhone)
Android instrumentedThe emulator as videoAn emulator started with -grpc
Android with RobolectricThe screens as they're drawn, as imagesNothing; there's no emulator to record
MaestroWhichever simulator or emulator is upThe same as iOS or Android

A phone plugged in by cable has no live video: only simulators and emulators. Detox and Flutter integration tests don't show in the panel yet.

All of it is tuned in Settings → Live tests: quality, what happens when nobody's looking, and how hard the Mac works.

Web (Playwright)

Nothing to change. Every agent Charly opens starts ready: while Playwright runs, each page shows in the panel, as video and with its name. Only how the command starts matters:

npx playwright test
pnpm test:e2e

On a server over SSH it shows too, over the project's connection, with smaller images. Pick it per server in Settings → Live tests → Remote servers.

iOS (XCUITest)

xcodebuild test -scheme MyApp -destination 'platform=iOS Simulator,name=iPhone 17 Pro'

Android

With video: instrumented tests on the emulator

  1. Start the emulator without a window and with video. It shows only in Charly, not in the Dock:
    ~/Library/Android/sdk/emulator/emulator -avd Medium_Phone_API_36.0 -no-window -grpc 8554 -grpc-use-token -no-boot-anim &
  2. Run the tests with Gradle itself, not inside a script (otherwise Charly doesn't recognize them):
    ./gradlew --console=plain :app:connectedDebugAndroidTest

If the agent started the emulator without -grpc, the Chat says so and offers “Reopen with video”: it restarts it without a window and with video, in seconds.

On Linux (Fedora, Ubuntu…)

The same: Android and web with Playwright (iOS only exists on the Mac). The SDK goes where Android Studio puts it, ~/Android/Sdk, and the emulator needs KVM (/dev/kvm). On a machine with no screen, or if the emulator closes as it starts, open it with -gpu guest:

~/Android/Sdk/emulator/emulator -avd Medium_Phone_API_36.0 -no-window -grpc 8554 -grpc-use-token -no-boot-anim -gpu guest &

On Linux the panel shows the screen as images in a row (about 12 a second from the emulator, up to 40 from a page) instead of H.264 video: nothing else to install.

If your tests are Robolectric

Robolectric draws screens inside the JVM: it's fast, but there's no screen to record, so the panel shows images. You don't have to rewrite them to see them as video: the same Compose tests can also run on the emulator.

  1. Move the screen tests and their support code to src/sharedTest/java (and their resources to src/sharedTest/resources). Pure-logic tests stay in src/test.
  2. In app/build.gradle.kts, add that folder to both kinds of tests, and the emulator's runner:
    android {
        defaultConfig {
            testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        }
        sourceSets {
            listOf("test", "androidTest").forEach {
                getByName(it) {
                    kotlin.directories.add("src/sharedTest/java")
                    resources.directories.add("src/sharedTest/resources")
                }
            }
        }
    }
    dependencies {
        testImplementation("androidx.test.ext:junit:1.3.0")
        androidTestImplementation("androidx.test:runner:1.7.0")
        androidTestImplementation("androidx.test.ext:junit:1.3.0")
        androidTestImplementation(platform("androidx.compose:compose-bom:2026.09.00"))
        androidTestImplementation("androidx.compose.ui:ui-test-junit4")
        // plus whatever your tests already use: junit, mockwebserver…
    }
  3. In the tests' base class: @RunWith(AndroidJUnit4::class) (it works for both), ApplicationProvider.getApplicationContext() instead of RuntimeEnvironment, and what was in @Config or @GraphicsMode goes to src/test/resources/robolectric.properties:
    sdk=35
    qualifiers=w402dp-h874dp-xxhdpi
  4. If the tests use a local fake backend, allow HTTP to 127.0.0.1 in debug (network_security_config).

Now you have both: testDebugUnitTest in seconds and without an emulator for every day, and connectedDebugAndroidTest when you want to watch them.

With AGP 9, use kotlin.directories: with java.directories Kotlin tests aren't compiled. And after moving files, delete app/build/intermediates/built_in_kotlinc once: incremental compilation may keep using the old classes.

Progress: “12 of 40”

Charly knows tests are running, and how they ended, from the command. To also show how far along they are (on the tab, the iPhone and the lock screen), the project can write .aiko/progress.json while they run, at most every 300 ms:

{ "v": 1, "runner": "playwright", "done": 12, "total": 40, "failed": 0, "updated": 1791712345678, "finished": false }

It's optional: without it, everything else works the same.

If it doesn't show

What happensLikely causeWhat to do
Android only shows imagesThe tests are Robolectric: there's no emulatorRun them on the emulator too (Android)
The panel doesn't appearThe command is inside a script with another name, or doesn't start the way Charly expectsUse one of the forms in the list
“This emulator was opened without video streaming”It was started without -grpcPress “Reopen with video” once the tests end
The emulator shows in the Dock as well as in CharlyIt was started with a windowStart it with -no-window
INSTALL_FAILED_INSUFFICIENT_STORAGE, yet Gradle says “BUILD SUCCESSFUL”The emulator is fullFree space on the emulator (uninstall apps or updates you don't use) and read the result in app/build/outputs/androidTest-results
“Connected phones have no live video”The tests run on a phone by cableUse a simulator or an emulator
“The simulator won't let its screen be read”The simulator is stuck“Restart the simulator” in the Chat

Anything else? Write to us from Settings → General → Send feedback or at hola@getcharly.dev.