@leejungkiin/awkit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +146 -0
  3. package/VERSION +1 -0
  4. package/bin/awf.js +549 -0
  5. package/bin/awk.js +1759 -0
  6. package/core/AGENTS.md +39 -0
  7. package/core/GEMINI.md +202 -0
  8. package/core/GEMINI.md.bak +244 -0
  9. package/core/orchestrator.md +58 -0
  10. package/package.json +46 -0
  11. package/schemas/brain.schema.json +342 -0
  12. package/schemas/preferences.schema.json +95 -0
  13. package/schemas/session.schema.json +112 -0
  14. package/skill-packs/neural-memory/README.md +111 -0
  15. package/skill-packs/neural-memory/pack.json +35 -0
  16. package/skill-packs/neural-memory/schemas/brain-snapshot.json +167 -0
  17. package/skill-packs/neural-memory/skills/nm-memory-audit/SKILL.md +157 -0
  18. package/skill-packs/neural-memory/skills/nm-memory-evolution/SKILL.md +202 -0
  19. package/skill-packs/neural-memory/skills/nm-memory-intake/SKILL.md +135 -0
  20. package/skill-packs/neural-memory/skills/nm-memory-sync/SKILL.md +184 -0
  21. package/skill-packs/neural-memory/workflows/nm-import.md +73 -0
  22. package/skill-packs/neural-memory/workflows/nm-recall.md +67 -0
  23. package/skill-packs/neural-memory/workflows/nm-snapshot.md +69 -0
  24. package/skills/adaptive-language/SKILL.md +189 -0
  25. package/skills/ambient-brain/SKILL.md +314 -0
  26. package/skills/ambient-brain/brain-router.md +185 -0
  27. package/skills/ambient-brain/brain-templates.md +201 -0
  28. package/skills/auto-save/SKILL.md +223 -0
  29. package/skills/awf-adaptive-language/SKILL.md +189 -0
  30. package/skills/awf-context-help/SKILL.md +180 -0
  31. package/skills/awf-error-translator/SKILL.md +153 -0
  32. package/skills/awf-session-restore/SKILL.md +270 -0
  33. package/skills/awf-version-tracker/SKILL.md +32 -0
  34. package/skills/awf-version-tracker/scripts/snapshot.sh +22 -0
  35. package/skills/beads-manager/SKILL.md +323 -0
  36. package/skills/brainstorm-agent/SKILL.md +295 -0
  37. package/skills/context-help/SKILL.md +180 -0
  38. package/skills/error-translator/SKILL.md +153 -0
  39. package/skills/ios-engineer/SKILL.md +101 -0
  40. package/skills/memory-sync/SKILL.md +378 -0
  41. package/skills/memory-sync/memory-router.md +185 -0
  42. package/skills/memory-sync/memory-templates.md +201 -0
  43. package/skills/orchestrator/SKILL.md +193 -0
  44. package/skills/session-restore/SKILL.md +240 -0
  45. package/templates/CODEBASE.md +80 -0
  46. package/templates/brain.example.json +321 -0
  47. package/templates/preferences.example.json +21 -0
  48. package/templates/project-identity/android.json +28 -0
  49. package/templates/project-identity/backend-nestjs.json +24 -0
  50. package/templates/project-identity/expo.json +27 -0
  51. package/templates/project-identity/ios.json +27 -0
  52. package/templates/project-identity/web-nextjs.json +24 -0
  53. package/templates/session.example.json +53 -0
  54. package/templates/specs/design-template.md +166 -0
  55. package/templates/specs/requirements-template.md +65 -0
  56. package/templates/specs/tasks-template.md +132 -0
  57. package/templates/structures/android.txt +10 -0
  58. package/templates/structures/backend-nestjs.txt +6 -0
  59. package/templates/structures/expo.txt +9 -0
  60. package/templates/structures/ios.txt +9 -0
  61. package/templates/structures/web-nextjs.txt +6 -0
  62. package/templates/workflow_dual_mode_template.md +87 -0
  63. package/workflows/_uncategorized/README.md +339 -0
  64. package/workflows/_uncategorized/ads-creative.md +357 -0
  65. package/workflows/_uncategorized/ads-full-optimization.md +308 -0
  66. package/workflows/_uncategorized/ads-plan.md +247 -0
  67. package/workflows/_uncategorized/ads-user-analysis.md +337 -0
  68. package/workflows/_uncategorized/skill-health.md +35 -0
  69. package/workflows/_uncategorized/skill-rollback.md +35 -0
  70. package/workflows/ads/admob.md +62 -0
  71. package/workflows/ads/ads-analyst.md +201 -0
  72. package/workflows/ads/ads-audit.md +106 -0
  73. package/workflows/ads/ads-optimize.md +97 -0
  74. package/workflows/ads/ads-targeting.md +241 -0
  75. package/workflows/ads/adsExpert.md +160 -0
  76. package/workflows/ads/smali-ads-config.md +400 -0
  77. package/workflows/ads/smali-ads-flow.md +331 -0
  78. package/workflows/ads/smali-ads-interstitial.md +377 -0
  79. package/workflows/ads/smali-ads-native.md +382 -0
  80. package/workflows/context/auto-execution-workflow.md +291 -0
  81. package/workflows/context/auto-implement.md +211 -0
  82. package/workflows/context/codebase-sync.md +163 -0
  83. package/workflows/context/logic-reasoning-workflow.md +260 -0
  84. package/workflows/context/next.md +195 -0
  85. package/workflows/context/recap.md +212 -0
  86. package/workflows/context/save-brain.md +285 -0
  87. package/workflows/context/user-intent-analysis-workflow.md +206 -0
  88. package/workflows/expert/codeExpert.md +126 -0
  89. package/workflows/expert/debugExpert.md +136 -0
  90. package/workflows/expert/planExpert.md +112 -0
  91. package/workflows/git/cloudflare-tunnel.md +135 -0
  92. package/workflows/git/git-commit-workflow.md +75 -0
  93. package/workflows/git/hotfix.md +357 -0
  94. package/workflows/git/release-notes.md +160 -0
  95. package/workflows/git/rollback.md +52 -0
  96. package/workflows/git/smart-git-ops.md +103 -0
  97. package/workflows/lifecycle/brainstorm.md +377 -0
  98. package/workflows/lifecycle/code.md +663 -0
  99. package/workflows/lifecycle/debug.md +116 -0
  100. package/workflows/lifecycle/deploy.md +95 -0
  101. package/workflows/lifecycle/init.md +152 -0
  102. package/workflows/lifecycle/master-code-workflow.md +300 -0
  103. package/workflows/lifecycle/migration.md +196 -0
  104. package/workflows/lifecycle/plan.md +91 -0
  105. package/workflows/lifecycle/refactor.md +165 -0
  106. package/workflows/lifecycle/run.md +52 -0
  107. package/workflows/lifecycle/test.md +91 -0
  108. package/workflows/meta/customize.md +346 -0
  109. package/workflows/meta/file-protection-rules.md +129 -0
  110. package/workflows/meta/help.html +350 -0
  111. package/workflows/meta/project-identity-enforcement.md +180 -0
  112. package/workflows/mobile/app-analysis.md +64 -0
  113. package/workflows/mobile/maestro-qa-workflow.md +470 -0
  114. package/workflows/mobile/maestro-test-workflow.md +84 -0
  115. package/workflows/mobile/structure-clean-architect.md +271 -0
  116. package/workflows/mobile/turbo-mobile-build.md +190 -0
  117. package/workflows/quality/accessibility-audit.md +311 -0
  118. package/workflows/quality/audit.md +217 -0
  119. package/workflows/quality/bug-hunter.md +243 -0
  120. package/workflows/quality/code-janitor.md +209 -0
  121. package/workflows/quality/code-quality-rules.md +132 -0
  122. package/workflows/quality/performance-audit.md +343 -0
  123. package/workflows/quality/project-audit.md +61 -0
  124. package/workflows/quality/self-healing-test.md +192 -0
  125. package/workflows/quality/ui-review.md +130 -0
  126. package/workflows/quality/ux-audit.md +213 -0
  127. package/workflows/quality/visual-debug.md +34 -0
  128. package/workflows/roles/oracle.md +267 -0
  129. package/workflows/roles/product-manager-workflow.md +52 -0
  130. package/workflows/roles/qa-engineer-workflow.md +41 -0
  131. package/workflows/roles/tech-lead-workflow.md +45 -0
  132. package/workflows/roles/ui-ux-designer-workflow.md +42 -0
  133. package/workflows/roles/vibe-coding-master-workflow.md +52 -0
  134. package/workflows/ui/app-screen-analyzer.md +152 -0
  135. package/workflows/ui/create-feature.md +332 -0
  136. package/workflows/ui/create-spec-architect.md +184 -0
  137. package/workflows/ui/design-to-ui.md +308 -0
  138. package/workflows/ui/ui-first-methodology.md +279 -0
  139. package/workflows/ui/visualize.md +298 -0
@@ -0,0 +1,470 @@
1
+ ---
2
+ description: 🧪 QA Testing chuyên nghiệp với Maestro
3
+ ---
4
+
5
+ # WORKFLOW: /maestro-qa - The Professional QA Engineer
6
+
7
+ Bạn là **Antigravity QA Engineer** - chuyên gia kiểm thử sử dụng Maestro MCP.
8
+
9
+ **Nhiệm vụ:** Thiết kế và thực thi test cases chuyên nghiệp, đảm bảo app hoạt động đúng trước khi release.
10
+
11
+ ---
12
+
13
+ ## 🎯 Khi nào sử dụng workflow này?
14
+
15
+ - ✅ Sau khi hoàn thành feature mới
16
+ - ✅ Sau khi fix bug (regression testing)
17
+ - ✅ Trước khi release version mới
18
+ - ✅ Khi cần smoke test nhanh
19
+ - ✅ Khi cần test toàn diện (full regression)
20
+
21
+ ---
22
+
23
+ ## Giai đoạn 1: Test Planning
24
+
25
+ ### 1.1. Xác định phạm vi test
26
+
27
+ ```
28
+ 📋 Anh/chị muốn test gì?
29
+
30
+ 1️⃣ Smoke Test (5-10 phút) - Test các flow chính
31
+ 2️⃣ Feature Test - Test 1 feature cụ thể
32
+ 3️⃣ Regression Test (30-60 phút) - Test toàn bộ app
33
+ 4️⃣ Bug Fix Verification - Verify bug đã fix
34
+ 5️⃣ Custom Test - Tự định nghĩa test cases
35
+
36
+ Gõ số (1-5):
37
+ ```
38
+
39
+ ### 1.2. Thu thập thông tin
40
+
41
+ | Thông tin | Cần thiết | Cách lấy |
42
+ |-----------|-----------|----------|
43
+ | App ID | ✅ Bắt buộc | Bundle ID (iOS) hoặc Package Name (Android) |
44
+ | Device ID | ✅ Bắt buộc | Từ `list_devices` hoặc user chọn |
45
+ | Test Scope | ✅ Bắt buộc | User chọn từ menu |
46
+ | Feature Specs | ⚠️ Nếu có | Đọc từ docs/specs |
47
+ | Previous Bugs | 💡 Tốt hơn | Đọc từ bug reports |
48
+
49
+ ---
50
+
51
+ ## Giai đoạn 2: Device Setup
52
+
53
+ ### 2.1. Kiểm tra devices có sẵn
54
+ ```javascript
55
+ // Sử dụng MCP Maestro tools:
56
+ mcp_maestro_list_devices()
57
+ ```
58
+
59
+ ### 2.2. Start device nếu cần
60
+ ```javascript
61
+ // Nếu chưa có device running:
62
+ mcp_maestro_start_device({
63
+ platform: "ios" // hoặc "android"
64
+ })
65
+ ```
66
+
67
+ ### 2.3. Launch app
68
+ ```javascript
69
+ mcp_maestro_launch_app({
70
+ device_id: "[device_id]",
71
+ appId: "com.example.app"
72
+ })
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Giai đoạn 3: Test Case Design
78
+
79
+ ### 3.1. Smoke Test Template (Critical Paths)
80
+
81
+ **Mục tiêu:** Verify app không crash và các flow chính hoạt động
82
+
83
+ ```yaml
84
+ Test Suite: Smoke Test
85
+ Duration: 5-10 minutes
86
+
87
+ Test Cases:
88
+ 1. App Launch
89
+ - Launch app
90
+ - Assert: Home screen visible
91
+
92
+ 2. Navigation
93
+ - Tap each main tab
94
+ - Assert: Each screen loads
95
+
96
+ 3. Core Feature #1 (e.g., Login)
97
+ - Navigate to login
98
+ - Input credentials
99
+ - Assert: Login successful
100
+
101
+ 4. Core Feature #2 (e.g., Create Item)
102
+ - Navigate to create
103
+ - Fill form
104
+ - Submit
105
+ - Assert: Item created
106
+
107
+ 5. App Stability
108
+ - Navigate back/forth
109
+ - Assert: No crashes
110
+ ```
111
+
112
+ ### 3.2. Feature Test Template
113
+
114
+ **Mục tiêu:** Test toàn diện 1 feature cụ thể
115
+
116
+ ```yaml
117
+ Feature: [Feature Name]
118
+ User Story: As a [user], I want to [action], so that [benefit]
119
+
120
+ Test Scenarios:
121
+ 1. Happy Path
122
+ - Steps: [...]
123
+ - Expected: Success
124
+
125
+ 2. Edge Cases
126
+ - Empty input
127
+ - Maximum input
128
+ - Special characters
129
+ - Expected: Proper validation
130
+
131
+ 3. Error Handling
132
+ - Network error
133
+ - Invalid data
134
+ - Expected: Error message shown
135
+
136
+ 4. UI/UX
137
+ - Loading states
138
+ - Animations
139
+ - Responsive layout
140
+ ```
141
+
142
+ ### 3.3. Regression Test Template
143
+
144
+ **Mục tiêu:** Ensure không có bug mới sau khi thay đổi code
145
+
146
+ ```yaml
147
+ Test Suite: Full Regression
148
+ Duration: 30-60 minutes
149
+
150
+ Categories:
151
+ 1. Authentication (10 min)
152
+ - Login/Logout
153
+ - Sign up
154
+ - Password reset
155
+
156
+ 2. Core Features (20 min)
157
+ - [Feature 1]
158
+ - [Feature 2]
159
+ - [Feature 3]
160
+
161
+ 3. Data Operations (10 min)
162
+ - Create
163
+ - Read
164
+ - Update
165
+ - Delete
166
+
167
+ 4. Edge Cases (10 min)
168
+ - Offline mode
169
+ - Poor network
170
+ - Background/Foreground
171
+
172
+ 5. UI/UX (10 min)
173
+ - All screens
174
+ - Animations
175
+ - Accessibility
176
+ ```
177
+
178
+ ---
179
+
180
+ ## Giai đoạn 4: Test Execution với Maestro MCP
181
+
182
+ ### 4.1. Quy trình thực thi
183
+
184
+ ```javascript
185
+ // Step 1: Inspect UI để hiểu structure
186
+ const hierarchy = await mcp_maestro_inspect_view_hierarchy({
187
+ device_id: "[device_id]"
188
+ });
189
+
190
+ // Step 2: Take screenshot để document
191
+ const screenshot = await mcp_maestro_take_screenshot({
192
+ device_id: "[device_id]"
193
+ });
194
+
195
+ // Step 3: Execute test steps
196
+ // Example: Login flow
197
+ await mcp_maestro_tap_on({
198
+ device_id: "[device_id]",
199
+ text: "Login"
200
+ });
201
+
202
+ await mcp_maestro_input_text({
203
+ device_id: "[device_id]",
204
+ text: "test@example.com"
205
+ });
206
+
207
+ await mcp_maestro_tap_on({
208
+ device_id: "[device_id]",
209
+ text: "Submit"
210
+ });
211
+
212
+ // Step 4: Verify result
213
+ const finalHierarchy = await mcp_maestro_inspect_view_hierarchy({
214
+ device_id: "[device_id]"
215
+ });
216
+ // Check if success message exists in hierarchy
217
+ ```
218
+
219
+ ### 4.2. Best Practices
220
+
221
+ | Practice | Why | Example |
222
+ |----------|-----|---------|
223
+ | **Screenshot Before/After** | Document state | Take screenshot at each major step |
224
+ | **Inspect Hierarchy** | Find exact selectors | Before tapping, verify element exists |
225
+ | **Wait for elements** | Avoid flaky tests | Check element visible before interaction |
226
+ | **Use descriptive text** | Easier debugging | Prefer `text: "Submit"` over `id: "btn_1"` |
227
+ | **Handle dynamic content** | Robust tests | Use partial text matching |
228
+
229
+ ---
230
+
231
+ ## Giai đoạn 5: Bug Detection & Reporting
232
+
233
+ ### 5.1. Bug Detection Checklist
234
+
235
+ ```
236
+ 🔍 Kiểm tra các vấn đề phổ biến:
237
+
238
+ UI Issues:
239
+ - [ ] Text bị cắt/overflow
240
+ - [ ] Buttons không clickable
241
+ - [ ] Images không load
242
+ - [ ] Layout broken trên các màn hình khác nhau
243
+
244
+ Functional Issues:
245
+ - [ ] Feature không hoạt động
246
+ - [ ] Data không save
247
+ - [ ] Navigation sai
248
+ - [ ] Crash khi thực hiện action
249
+
250
+ Performance Issues:
251
+ - [ ] Loading quá lâu (>3s)
252
+ - [ ] Animation lag
253
+ - [ ] Memory leak
254
+
255
+ UX Issues:
256
+ - [ ] Không có loading indicator
257
+ - [ ] Không có error message
258
+ - [ ] Confusing flow
259
+ ```
260
+
261
+ ### 5.2. Bug Report Template
262
+
263
+ ```markdown
264
+ # 🐛 Bug Report - [Bug Title]
265
+
266
+ ## Environment
267
+ - Platform: iOS/Android
268
+ - Device: [Device model]
269
+ - OS Version: [Version]
270
+ - App Version: [Version]
271
+
272
+ ## Steps to Reproduce
273
+ 1. [Step 1]
274
+ 2. [Step 2]
275
+ 3. [Step 3]
276
+
277
+ ## Expected Result
278
+ [What should happen]
279
+
280
+ ## Actual Result
281
+ [What actually happened]
282
+
283
+ ## Screenshots/Videos
284
+ [Attach screenshots from test]
285
+
286
+ ## Severity
287
+ - [ ] Critical (App crash/Data loss)
288
+ - [ ] High (Feature broken)
289
+ - [ ] Medium (UX issue)
290
+ - [ ] Low (Cosmetic)
291
+
292
+ ## Additional Notes
293
+ [Any other relevant info]
294
+ ```
295
+
296
+ ---
297
+
298
+ ## Giai đoạn 6: Test Report Generation
299
+
300
+ ### 6.1. Test Summary Report
301
+
302
+ ```markdown
303
+ # 🧪 QA Test Report - [Date]
304
+
305
+ ## Test Scope
306
+ - Type: [Smoke/Feature/Regression]
307
+ - Duration: [X minutes]
308
+ - Platform: [iOS/Android]
309
+
310
+ ## Test Results Summary
311
+ - ✅ Passed: X tests
312
+ - ❌ Failed: Y tests
313
+ - ⚠️ Blocked: Z tests
314
+ - 📊 Pass Rate: XX%
315
+
316
+ ## Test Cases Executed
317
+
318
+ ### ✅ Passed Tests
319
+ 1. [Test Case 1] - PASS
320
+ 2. [Test Case 2] - PASS
321
+
322
+ ### ❌ Failed Tests
323
+ 1. [Test Case 3] - FAIL
324
+ - Bug: [Bug ID/Description]
325
+ - Severity: High
326
+ - Screenshot: [Link]
327
+
328
+ ### ⚠️ Blocked Tests
329
+ 1. [Test Case 4] - BLOCKED
330
+ - Reason: [Why blocked]
331
+
332
+ ## Bugs Found
333
+ - Critical: X
334
+ - High: Y
335
+ - Medium: Z
336
+ - Low: W
337
+
338
+ ## Recommendations
339
+ 1. [Recommendation 1]
340
+ 2. [Recommendation 2]
341
+
342
+ ## Sign-off
343
+ - [ ] Ready for release
344
+ - [ ] Needs bug fixes
345
+ - [ ] Needs re-test
346
+ ```
347
+
348
+ ---
349
+
350
+ ## Giai đoạn 7: Automation & CI/CD Integration
351
+
352
+ ### 7.1. Tạo Maestro Flow Files
353
+
354
+ Sau khi test thủ công thành công, convert sang Maestro YAML:
355
+
356
+ ```yaml
357
+ # flows/smoke-test.yaml
358
+ appId: com.example.app
359
+ ---
360
+ # Test 1: App Launch
361
+ - launchApp
362
+ - assertVisible: "Home"
363
+
364
+ # Test 2: Login
365
+ - tapOn: "Login"
366
+ - tapOn: "Email"
367
+ - inputText: "test@example.com"
368
+ - tapOn: "Password"
369
+ - inputText: "password123"
370
+ - tapOn: "Submit"
371
+ - assertVisible: "Welcome"
372
+
373
+ # Test 3: Create Item
374
+ - tapOn: "Create"
375
+ - tapOn: "Title"
376
+ - inputText: "Test Item"
377
+ - tapOn: "Save"
378
+ - assertVisible: "Item created"
379
+ ```
380
+
381
+ ### 7.2. Run Flow via MCP
382
+
383
+ ```javascript
384
+ // Execute the flow file
385
+ await mcp_maestro_run_flow_files({
386
+ device_id: "[device_id]",
387
+ flow_files: "flows/smoke-test.yaml"
388
+ });
389
+ ```
390
+
391
+ ---
392
+
393
+ ## 🎯 Test Strategy Matrix
394
+
395
+ | Scenario | Test Type | Frequency | Duration | Tools |
396
+ |----------|-----------|-----------|----------|-------|
397
+ | After feature complete | Feature Test | Per feature | 10-15 min | MCP Manual |
398
+ | After bug fix | Bug Verification | Per fix | 5 min | MCP Manual |
399
+ | Before PR merge | Smoke Test | Per PR | 5-10 min | Maestro Flow |
400
+ | Before release | Full Regression | Per release | 30-60 min | Maestro Flow |
401
+ | Nightly build | Smoke Test | Daily | 10 min | CI/CD + Maestro |
402
+
403
+ ---
404
+
405
+ ## ⚠️ NEXT STEPS (Menu số):
406
+
407
+ ```
408
+ 📋 Test hoàn thành! Anh muốn làm gì tiếp?
409
+
410
+ 1️⃣ Tạo bug reports cho issues tìm được
411
+ 2️⃣ Convert test cases sang Maestro flows
412
+ 3️⃣ Chạy lại test cho 1 feature cụ thể
413
+ 4️⃣ Lưu test report → /save-brain
414
+ 5️⃣ Setup CI/CD automation
415
+ 6️⃣ Test trên platform khác (iOS ↔ Android)
416
+
417
+ Gõ số (1-6):
418
+ ```
419
+
420
+ ---
421
+
422
+ ## 💡 Pro Tips
423
+
424
+ ### Tip 1: Test Data Management
425
+ ```yaml
426
+ # Sử dụng environment variables cho test data
427
+ env:
428
+ TEST_EMAIL: "test@example.com"
429
+ TEST_PASSWORD: "password123"
430
+ ---
431
+ - inputText: ${TEST_EMAIL}
432
+ ```
433
+
434
+ ### Tip 2: Reusable Subflows
435
+ ```yaml
436
+ # flows/login.yaml
437
+ appId: com.example.app
438
+ ---
439
+ - tapOn: "Login"
440
+ - inputText: ${EMAIL}
441
+ - tapOn: "Password"
442
+ - inputText: ${PASSWORD}
443
+ - tapOn: "Submit"
444
+ ```
445
+
446
+ ```yaml
447
+ # flows/main-test.yaml
448
+ appId: com.example.app
449
+ ---
450
+ - runFlow: login.yaml
451
+ env:
452
+ EMAIL: "test@example.com"
453
+ PASSWORD: "password123"
454
+ ```
455
+
456
+ ### Tip 3: Visual Regression
457
+ ```javascript
458
+ // Take screenshots at key points
459
+ await mcp_maestro_take_screenshot({ device_id, output_path: "baseline/home.png" });
460
+ // Compare với baseline sau này
461
+ ```
462
+
463
+ ### Tip 4: Parallel Testing
464
+ ```javascript
465
+ // Test trên nhiều devices cùng lúc
466
+ const devices = await mcp_maestro_list_devices();
467
+ await Promise.all(devices.map(device =>
468
+ runTestSuite(device.id)
469
+ ));
470
+ ```
@@ -0,0 +1,84 @@
1
+ ---
2
+ description: 🧪 Tạo bài kiểm tra UI tự động với Maestro
3
+ alwaysApply: false
4
+ priority: "high"
5
+ ---
6
+
7
+ # Maestro Test Creation Workflow
8
+
9
+ ## 🎯 Purpose
10
+ Automate UI testing for Android and iOS applications using [Maestro](https://maestro.dev). This workflow guides the creation of robust, readable, and maintainable test flows.
11
+
12
+ ## 📋 Prerequisites
13
+ - Maestro CLI installed (`curl -Ls "https://get.maestro.mobile.dev" | bash`).
14
+ - Android Emulator or iOS Simulator running.
15
+ - Target app installed on the device.
16
+
17
+ ## 🛠️ Workflow Steps
18
+
19
+ ### 1. Analysis & Setup
20
+ - **Identify the User Flow**: What are we testing? (e.g., "Add Contact", "Login", "Checkout").
21
+ - **Determine App ID**: Find the package name (Android) or bundle ID (iOS).
22
+ - Android: `adb shell dumpsys window | grep -E 'mCurrentFocus|mFocusedApp'`
23
+ - **Create File**: Create a new `.yaml` file (e.g., `flows/add-contact.yaml`).
24
+
25
+ ### 2. Flow Definition (The Script)
26
+
27
+ Start with the header:
28
+ ```yaml
29
+ appId: com.example.app
30
+ ---
31
+ - launchApp:
32
+ clearState: true # Optional: Reset app state
33
+ ```
34
+
35
+ ### 3. Implementing Steps
36
+
37
+ Use the following commands to interact with the UI:
38
+
39
+ #### Basic Interactions
40
+ - **Tap**: `tapOn: "Text on Screen"` or `tapOn: id: "view_id"`
41
+ - **Input text**: `inputText: "Hello World"`
42
+ - **Input Random**: `inputRandomPersonName`, `inputRandomEmail`
43
+ - **Wait**: `assertVisible: "Success"` (Maestro waits automatically, but assertions confirm state).
44
+
45
+ #### Example Structure (Contacts Flow)
46
+ ```yaml
47
+ appId: com.android.contacts
48
+ ---
49
+ - launchApp
50
+ - tapOn: "Create new contact"
51
+ - tapOn: "First name"
52
+ - inputRandomPersonName
53
+ - tapOn: "Last name"
54
+ - inputRandomPersonName
55
+ - tapOn: "Phone"
56
+ - inputRandomNumber:
57
+ length: 10
58
+ - back # Hide keyboard if needed
59
+ - tapOn: "Save"
60
+ - assertVisible: "Contact saved" # Verification
61
+ ```
62
+
63
+ ### 4. Refining Selectors
64
+ If text matches are ambiguous, use `maestro studio` to find precise selectors:
65
+ 1. Run `maestro studio` in terminal.
66
+ 2. Open web browser to the provided URL.
67
+ 3. Click elements to get their ID or precise text.
68
+
69
+ ### 5. Execution & Debugging
70
+ - **Run the flow**: `maestro test flows/add-contact.yaml`
71
+ - **Continuous Run** (Dev Mode): `maestro test -c flows/add-contact.yaml`
72
+ - **Debug**: If it fails, check the emulator screen. Maestro takes screenshots on failure.
73
+
74
+ ## 💡 Best Practices
75
+ - **Atomic Flows**: Keep flows focused on one main task.
76
+ - **Subflows**: Use `runFlow` for reusable components (e.g., Login).
77
+ - **Clean State**: Prefer `clearState: true` for deterministic tests.
78
+ - **Assertions**: Always end with an assertion (`assertVisible`) to prove the test succeeded.
79
+ - **Constants**: Use `env` variables for dynamic data if needed.
80
+
81
+ ## 🗣️ QA/Dev Guidelines
82
+ - "Don't just run it, `assert` it."
83
+ - "If you can't tap it, check the text visibility."
84
+ - "Use `inputRandom...` for data that needs to be unique."