Pruebas automatizadas de apps iOS
Use Synapse + Computer Control API para automatizar pruebas de apps iOS vía Simulator.
Pruebas automatizadas de apps iOS
Combine el sistema de memoria de Synapse con la Computer Control API para construir pruebas de apps iOS dirigidas por LLM. El LLM recuerda escenarios de test, aprende de fallos pasados y se adapta a cambios de UI.
Arquitectura
┌──────────────┐ commands ┌──────────────┐ screenshots ┌──────────────┐
│ LLM Agent │ ─────────────▶│ Synapse │ ────────────────▶ │ iOS Sim │
│ (Claude) │ │ Computer │ ◀──────────────── │ (via agent) │
└──────────────┘ │ Control │ results └──────────────┘
│ └──────────────┘
│ store/recall
▼
┌──────────────┐
│ Memories │ (test scenarios, past failures, UI patterns)
└──────────────┘Requisitos previos
- Cuenta de Synapse + Mind Key
- Servidor MCP de Synapse configurado en Claude Desktop
- iOS Simulator con
screen-remote-agentinstalado - Computadora registrada en Synapse (consulte API de Computer Control)
Paso 1: Registrar la computadora Simulator
En el Mac que ejecuta iOS Simulator:
# Get install code from Synapse
curl -X POST https://synapse.schaefer.zone/computers/install-code \
-H "Authorization: Bearer YOUR_MIND_KEY" \
-d '{"computer_name":"ios-sim"}'
# → { "install_code": "ic_..." }
# Run screen-remote-agent on the Mac
# (uses the install code to register)Paso 2: Almacenar escenarios de test en memoria
Almacene escenarios de test reutilizables como memorias:
import requests
def store_test_scenario(name, steps, app):
requests.post(f"{URL}/memory",
headers={"Authorization": f"Bearer {MIND_KEY}"},
json={
"category": "skill",
"key": f"test_scenario_{name}",
"content": f"App: {app}\nSteps:\n" + "\n".join(steps),
"tags": ["test", "ios", app],
"priority": "high"
})
store_test_scenario("login_flow", [
"Launch app",
"Tap email field",
"Type test@example.com",
"Tap password field",
"Type password123",
"Tap Login button",
"Verify home screen appears"
], "MyApp")Paso 3: Ejecución de tests dirigida por LLM
En Claude Desktop (con Synapse MCP configurado):
Run the login_flow test scenario on the iOS Simulator.
Take a screenshot after each step and verify the expected UI.
If any step fails, store the failure as a memory so we can
avoid it next time.Claude hará:
- Llamar a
memory_searchpara encontrar la memoriatest_scenario_login_flow - Llamar a
computer_screenshotpara ver el estado actual - Ejecutar cada paso vía
computer_command_queue(clic, escribir) - Verificar resultados vía capturas de pantalla
- Almacenar cualquier fallo como memorias
mistake
Paso 4: Tests autoreparables
Cuando un test falla, almacene el fallo y la recuperación:
def store_test_failure(scenario, step, error, recovery):
requests.post(f"{URL}/memory",
headers={"Authorization": f"Bearer {MIND_KEY}"},
json={
"category": "mistake",
"key": f"failure_{scenario}_{step}",
"content": f"Scenario: {scenario}\nStep: {step}\nError: {error}\nRecovery: {recovery}",
"tags": ["test", "failure", "ios", scenario],
"priority": "high"
})
# Example
store_test_failure("login_flow", "tap_login",
"Login button not found at expected coordinates",
"Button moved due to new logo. Search by accessibility label instead.")La próxima vez que el LLM ejecute el test, recupera el fallo y aplica la recuperación automáticamente.
Paso 5: Seguimiento de resultados de test
Haga seguimiento de las ejecuciones de test como tareas:
def track_test_run(scenario, status, duration):
requests.post(f"{URL}/mind/task",
headers={"Authorization": f"Bearer {MIND_KEY}",
"Content-Type": "application/json"},
json={
"title": f"Test: {scenario}",
"description": f"Status: {status}, Duration: {duration}s",
"priority": "normal"
})Comandos comunes
| Acción | Comando |
|---|---|
| Lanzar Simulator | xcrun simctl launch booted com.example.app |
| Captura de pantalla | computer_screenshot (vía Synapse MCP) |
| Tap en (x,y) | computer_command_queue {type:"click", payload:{x,y}} |
| Escribir texto | computer_command_queue {type:"type", payload:{text:"..."}} |
| Pulsar Home | computer_command_queue {type:"key", payload:{keys:["Cmd","Shift","H"]}} |