$npx -y skills add anhtester/codex-testing-kit --skill generate-automation-frameworkThiết kế và scaffold automation framework hoàn chỉnh. Hỗ trợ Playwright, Selenium, Appium — Web, Mobile, API.
| 1 | # Workflow: Thiết Kế Automation Framework |
| 2 | |
| 3 | > **BẮT BUỘC (MANDATORY SKILL):** Bạn PHẢI nạp và đọc kỹ nội dung của skill **`$framework-architect`** (tại `.agents/skills/framework-architect/SKILL.md`) trước khi bắt đầu. Ngoài ra, tham khảo thêm skill **`$qa-automation-engineer`** để nắm các quy tắc automation chung. |
| 4 | |
| 5 | Workflow này giúp agent thiết kế, scaffold và triển khai một automation framework hoàn chỉnh từ đầu, phù hợp với nhu cầu cụ thể của project. |
| 6 | |
| 7 | ## ⚠️ Nguyên tắc thực thi |
| 8 | |
| 9 | - **Tất cả output bằng Tiếng Việt** |
| 10 | - **KHÔNG đoán** tech stack — phải hỏi user xác nhận trước khi scaffold |
| 11 | - **PHẢI tạo artifact `task.md`** để theo dõi tiến độ |
| 12 | - Mỗi file sinh ra phải **biên dịch/chạy được ngay** — không để placeholder `// TODO` |
| 13 | - Framework phải tuân thủ design principles trong skill `$framework-architect` |
| 14 | |
| 15 | ## Stacks hỗ trợ |
| 16 | |
| 17 | | Platform | Stack | Ngôn ngữ | Runner | Report | |
| 18 | |---|---|---|---|---| |
| 19 | | 🌐 Web | Playwright | TypeScript | Playwright Test | HTML Report, Allure | |
| 20 | | 🌐 Web | Playwright | Java | TestNG / JUnit5 | Allure | |
| 21 | | 🌐 Web | Playwright | Python | Pytest | pytest-html, Allure | |
| 22 | | 🌐 Web | Selenium | Java | TestNG | Allure, ExtentReports | |
| 23 | | 🌐 Web | Selenium | Python | Pytest | pytest-html, Allure | |
| 24 | | 📱 Mobile | Appium | Java | TestNG | Allure, ExtentReports | |
| 25 | | 📱 Mobile | Appium | Python | Pytest | Allure | |
| 26 | | 🔌 API | REST Assured | Java | TestNG | Allure | |
| 27 | | 🔌 API | Playwright API | TypeScript | Playwright Test | HTML Report | |
| 28 | |
| 29 | ## Các bước thực hiện |
| 30 | |
| 31 | ### Bước 1: Thu thập yêu cầu (Requirements Gathering — ⏸️ CHECKPOINT) |
| 32 | |
| 33 | 1. **Hỏi user** các thông tin cần thiết: |
| 34 | |
| 35 | | Câu hỏi | Mục đích | Mặc định nếu không trả lời | |
| 36 | |---|---|---| |
| 37 | | Ứng dụng cần test là gì? (Web / Mobile / API / Hybrid) | Chọn platform | Web | |
| 38 | | Framework nào? (Playwright / Selenium / Appium) | Chọn tool | Playwright | |
| 39 | | Ngôn ngữ? (TypeScript / Java / Python) | Chọn language | TypeScript (Playwright), Java (Selenium/Appium) | |
| 40 | | Project name? | Đặt tên thư mục | `automation-framework` | |
| 41 | | Có cần CI/CD pipeline không? | Sinh pipeline config | Có (GitHub Actions) | |
| 42 | | Reporting tool? | Tích hợp report | Mặc định theo stack | |
| 43 | | Có test API song song không? | Thêm API testing layer | Không | |
| 44 | | Parallel execution? | Config parallel | Không | |
| 45 | |
| 46 | 2. **Xác nhận lại** với user trước khi scaffold: |
| 47 | ``` |
| 48 | 📋 Tóm tắt framework sẽ tạo: |
| 49 | - Platform: Web |
| 50 | - Framework: Playwright |
| 51 | - Language: TypeScript |
| 52 | - Runner: Playwright Test |
| 53 | - Report: HTML Report + Allure |
| 54 | - CI/CD: GitHub Actions |
| 55 | - Project name: my-automation |
| 56 | |
| 57 | Bạn xác nhận để tôi bắt đầu scaffold không? |
| 58 | ``` |
| 59 | |
| 60 | 3. **Chờ user xác nhận** trước khi sang Bước 2 |
| 61 | |
| 62 | ### Bước 2: Scaffold Project Structure (Foundation) |
| 63 | |
| 64 | 1. **Tạo artifact `task.md`** để theo dõi checklist: |
| 65 | ```markdown |
| 66 | # Framework Setup Progress |
| 67 | - [x] Bước 1: Thu thập yêu cầu |
| 68 | - [ ] Bước 2: Scaffold project structure |
| 69 | - [ ] Bước 3: Sinh base classes |
| 70 | - [ ] Bước 4: Sinh example tests |
| 71 | - [ ] Bước 5: Cấu hình reporting & CI/CD |
| 72 | - [ ] Bước 6: Verify & Deliver |
| 73 | ``` |
| 74 | |
| 75 | 2. **Tạo thư mục project** theo template trong skill `$framework-architect`: |
| 76 | - Tham khảo mục **Project Structure Templates** trong SKILL.md |
| 77 | - Tạo toàn bộ thư mục + file cấu hình gốc |
| 78 | |
| 79 | 3. **Sinh file cấu hình build** (tuỳ stack): |
| 80 | |
| 81 | **Playwright + TypeScript:** |
| 82 | - `package.json` — dependencies: `@playwright/test`, devDependencies phù hợp |
| 83 | - `playwright.config.ts` — baseURL, viewport (1920x1080), timeout, retries, reporter |
| 84 | - `tsconfig.json` — paths, strict mode |
| 85 | - `.env.example` — template environment variables |
| 86 | |
| 87 | **Selenium + Java:** |
| 88 | - `pom.xml` — dependencies: selenium-java, testng, webdrivermanager, allure-testng, log4j |
| 89 | - `testng.xml` — suite configuration, listeners |
| 90 | - `log4j2.xml` — logging configuration |
| 91 | |
| 92 | **Appium + Java:** |
| 93 | - `pom.xml` — dependencies: appium-java-client, selenium-java, testng, allure |
| 94 | - `testng.xml` — suite configuration |
| 95 | - Capabilities config file (JSON/YAML) cho Android + iOS |
| 96 | |
| 97 | **Playwright + Python:** |
| 98 | - `requirements.txt` — playwright, pytest, pytest-playwright, allure-pytest |
| 99 | - `pyproject.toml` — pytest config, tool settings |
| 100 | - `conftest.py` — root fixtures, browser setup |
| 101 | |
| 102 | 4. **Tạo file .gitignore** phù hợp (node_modules, target, __pycache__, .env, reports...) |
| 103 | 5. **Tạo README.md** với hướng dẫn: |
| 104 | - Prerequisites (Node.js, Java, Python version) |
| 105 | - Installation steps |
| 106 | - Cách chạy test |
| 107 | - Project structure overview |
| 108 | - Conventions (naming, coding standards) |
| 109 | |
| 110 | ### Bước 3: Sinh Core Classes (Base Layer) |
| 111 | |
| 112 | 1. **Configuration Management:** |
| 113 | |
| 114 | | Stack | File | Nội dung | |
| 115 | |---|---|---| |
| 116 | | Playwright TS | `src/utils/env.config.ts` | Đọc `.env`, export typed config object | |
| 117 | | Selenium Java | `src/main/.../config/ConfigReader.java` | Đọc properties file, singleton pattern | |