اختبار تطبيقات iOS المؤتمت
استخدم Synapse + Computer Control API لأتمتة اختبارات تطبيقات iOS عبر Simulator.
اختبار تطبيقات iOS المؤتمت
اجمع نظام ذاكرة Synapse مع Computer Control API لبناء اختبارات تطبيقات iOS مدفوعة بـ LLM. يتذكر الـ LLM سيناريوهات الاختبار، يتعلّم من الإخفاقات السابقة، ويتكيّف مع تغييرات الواجهة.
البنية
┌──────────────┐ commands ┌──────────────┐ screenshots ┌──────────────┐
│ LLM Agent │ ─────────────▶│ Synapse │ ────────────────▶ │ iOS Sim │
│ (Claude) │ │ Computer │ ◀──────────────── │ (via agent) │
└──────────────┘ │ Control │ results └──────────────┘
│ └──────────────┘
│ store/recall
▼
┌──────────────┐
│ Memories │ (test scenarios, past failures, UI patterns)
└──────────────┘المتطلبات المسبقة
- حساب Synapse + Mind Key
- خادم Synapse MCP مُعدّ في Claude Desktop
- iOS Simulator مع
screen-remote-agentمثبت - جهاز مسجّل في Synapse (راجع Computer Control API)
الخطوة 1: سجّل جهاز Simulator
على الـ Mac الذي يشغّل iOS Simulator:
# احصل على رمز التثبيت من 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_..." }
# شغّل screen-remote-agent على الـ Mac
# (يستخدم رمز التثبيت للتسجيل)الخطوة 2: خزّن سيناريوهات الاختبار في الذاكرة
خزّن سيناريوهات اختبار قابلة لإعادة الاستخدام كذكريات:
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")الخطوة 3: تنفيذ الاختبار المدفوع بـ LLM
في Claude Desktop (مع Synapse MCP مُعدًا):
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:
- يستدعي
memory_searchلإيجاد ذاكرةtest_scenario_login_flow - يستدعي
computer_screenshotلرؤية الحالة الحالية - ينفّذ كل خطوة عبر
computer_command_queue(click، type) - يتحقق من النتائج عبر لقطات الشاشة
- يخزّن أي إخفاقات كذكريات
mistake
الخطوة 4: اختبارات ذاتية الإصلاح
عند فشل اختبار، خزّن الفشل والتعافي:
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"
})
# مثال
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.")في المرة التالية التي يُشغّل فيها الـ LLM الاختبار، يستدعي الفشل ويطبّق التعافي تلقائيًا.
الخطوة 5: تتبع نتائج الاختبار
تتبع عمليات تشغيل الاختبار كمهام:
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"
})الأوامر الشائعة
| الإجراء | الأمر |
|---|---|
| تشغيل Simulator | xcrun simctl launch booted com.example.app |
| لقطة شاشة | computer_screenshot (عبر Synapse MCP) |
| النقر عند (x,y) | computer_command_queue {type:"click", payload:{x,y}} |
| كتابة نص | computer_command_queue {type:"type", payload:{text:"..."}} |
| ضغط Home | computer_command_queue {type:"key", payload:{keys:["Cmd","Shift","H"]}} |