Logotipo de Generate Automation From Ui Flow

Generate Automation From Ui Flow

Comunidad
anhtester
generate-automation-from-ui-flow

Thực thi UI flow trực tiếp trên browser, thu thập locators từ DOM thực tế, và sinh automation scripts. Hỗ trợ Playwright, Selenium, Appium.

Descripción general

Editoranhtester
Repositoriocodex-testing-kit
Nombre de la habilidadgenerate-automation-from-ui-flow
Estrellas
34
Forks
14
Archivos incluidos
1
LicenciaMIT
Enlaces
  • Instrucciones en Markdown

    Un archivo SKILL.md que el modelo carga cuando lo necesita, de modo que solo consume tokens cuando la petición encaja con la habilidad.

  • Funciona con cualquier LLM

    Las habilidades de IA están en Markdown, no en código específico de un proveedor, por lo que funcionan con GPT, Claude, Gemini, Grok o un modelo local.

  • Archivos incluidos: 1

    Scripts, plantillas y referencias que el modelo puede leer mientras trabaja. Los archivos son de solo lectura y nunca se ejecutan.

  • Código abierto

    Publicada por anhtester en GitHub. Revisa el contenido original antes de instalarla.

Instalación

Instala la habilidad de IA Generate Automation From Ui Flow en TypingMind para usarla con cualquier LLM, o añádela a otro agente que lea SKILL.md.

1

Instalar en TypingMind

TypingMind instala una habilidad directamente desde su carpeta de GitHub: lee SKILL.md, empaqueta los archivos de recursos y guarda el resultado localmente.

  1. Abre la aplicación y ve a Plugins → Habilidades.
  2. Elige «Instalar desde GitHub».
  3. Pega la URL de la carpeta de la habilidad que se muestra a continuación y confirma.
    https://github.com/anhtester/codex-testing-kit/tree/main/.agents/skills/generate-automation-from-ui-flow
  4. Activa la habilidad en cada chat en el que quieras tenerla disponible.
Plugins → Habilidades → Añadir habilidad → URL de GitHub; después, pega la URL de la carpeta y pulsa Continuar.
2

Instalar en otro agente

Cualquier agente que lea el formato Agent Skills puede usar esta habilidad: copia la carpeta en el directorio de habilidades de ese agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/anhtester/codex-testing-kit.git /tmp/codex-testing-kit
mkdir -p .claude/skills
cp -r /tmp/codex-testing-kit/.agents/skills/generate-automation-from-ui-flow .claude/skills/generate-automation-from-ui-flow
Reinicia Claude Code después de copiarla para que detecte la nueva habilidad.

Úsala en TypingMind

Activa Generate Automation From Ui Flow en cualquier chat de TypingMind y el modelo se encargará del resto. Su nombre y descripción se incluyen en el prompt del sistema y, en cuanto una petición encaja con la habilidad, el modelo carga las instrucciones completas por sí solo. No tienes que invocarla manualmente y no consume tokens hasta que se utiliza.

El modelo carga Generate Automation From Ui Flow automáticamente en cuanto una petición es relevante para esa habilidad.

Funciona con cualquier modelo de IA

Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que Generate Automation From Ui Flow no está vinculada al modelo para el que se creó. Instálala una sola vez en TypingMind y úsala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modelo local que ejecutes tú, todo con tus propias claves API.

  • Se carga solo cuando se necesita

    El prompt del sistema solo incluye el nombre y la descripción. Las instrucciones se cargan con la primera petición que encaja con la habilidad, por lo que una habilidad que no se usa no supone ningún coste.

  • Cambia de modelo durante el chat

    Como la habilidad contiene instrucciones y no código, cambiar de modelo no impide que funcione: el nuevo modelo lee el mismo archivo SKILL.md.

Instrucciones de la habilidad

Este es el contenido de SKILL.md que carga el modelo. Léelo antes de instalar la habilidad: contiene instrucciones que tu modelo seguirá.

Workflow: Sinh Automation từ UI Flow

BẮT BUỘC (MANDATORY SKILL): Bạn PHẢI nạp và đọc kỹ nội dung của skill $ui-debug-agent (tại .agents/skills/ui-debug-agent/SKILL.md) trước khi bắt đầu. Ngoài ra tham khảo thêm skill $smart-locator-agent để sinh locator ổn định và $qa-automation-engineer cho quy tắc automation chung.

Workflow này giúp agent thực thi trực tiếp một chuỗi thao tác UI trên browser thật, thu thập locators từ DOM thực tế, và sinh automation scripts hoàn chỉnh — tất cả trong một luồng tự động, không cần manual test case có sẵn.

⚠️ Nguyên tắc thực thi

  • Tất cả output bằng Tiếng Việt
  • TUYỆT ĐỐI KHÔNG ĐOÁN locator — phải lấy từ DOM thực tế bằng MCP browser tools
  • Phải chạy từng bước UI trên browser thật trước khi sinh code
  • Desktop viewport 1920×1080 cho tất cả UI debugging
  • ⚠️ Rule E3: Khi test FAIL → tự đọc log → phân tích → sửa → chạy lại. KHÔNG hỏi user

Workflow này khác gì $generate-automation-from-testcases?

from_testcasesfrom_ui_flow (workflow này)
InputFile manual test cases có sẵnMô tả UI steps bằng lời hoặc URL + hành động
ApproachĐọc TC → inspect UI → sinh codeChạy thật trên browser → thu thập locator → sinh code
Khi nào dùngĐã có test case documentChưa có TC, chỉ biết "vào trang này, click cái kia"

Input cần thu thập

Agent cần ít nhất 1 trong các input sau từ user:

InputVí dụĐộ ưu tiên
URL + UI steps mô tả"Vào https://example.com, login, tạo user mới"⭐ Phổ biến nhất
URL + recording/videoUser cung cấp video thao tácTùy chọn
URL + screenshotsUser cung cấp ảnh chụp từng bướcTùy chọn
Chỉ URL"Automate login flow của trang này"Agent tự khám phá

Nếu user chưa cung cấp đủ → hỏi:

  • URL ứng dụng?
  • Mô tả flow cần automate (từng bước)?
  • Credentials nếu cần đăng nhập?
  • Framework mong muốn? (mặc định: Playwright + TypeScript)

Các bước thực hiện

Bước 1: Tiếp nhận & Chuẩn bị (Setup)

  1. Parse UI steps từ user input:

    • Chuyển mô tả bằng lời thành danh sách steps có cấu trúc:
      Step 1: Navigate to https://example.com/login
      Step 2: Enter username "admin@test.com"
      Step 3: Enter password "***"
      Step 4: Click Login button
      Step 5: Verify dashboard is displayed
  2. Xác nhận tech stack với user (nếu chưa rõ):

    FrameworkNgôn ngữKhi nào dùng
    PlaywrightTypeScriptMặc định cho web automation
    PlaywrightPythonKhi user dùng Python stack
    SeleniumJavaKhi user yêu cầu Java/Selenium
    AppiumJavaMobile app automation
  3. Tạo artifact task.md để theo dõi tiến độ:

    markdown
    # UI Flow Automation Progress
    - [ ] Bước 1: Chuẩn bị — parse UI steps
    - [ ] Bước 2: Chạy UI flow trên browser — thu thập locators
    - [ ] Bước 3: Sinh Page Objects + Test scripts
    - [ ] Bước 4: Chạy test + Auto-heal

Bước 2: Chạy UI Flow trên Browser & Thu thập Locators (Live Recon)

⚡ Đây là bước quan trọng nhất — phân biệt workflow này với các workflow khác.

  1. Mở browser bằng MCP và navigate đến URL:

    browser_navigate → URL
    browser_resize → 1920 × 1080
    browser_wait_for → page load hoàn tất
    browser_snapshot → thu thập DOM ban đầu
  2. Thực thi từng step theo danh sách, với mỗi step:

    a. browser_snapshot → đọc DOM, xác định element cần tương tác
    b. Xác định locator tốt nhất (theo locator priority)
    c. Thực thi action (click / type / select / hover)
    d. browser_snapshot → xác nhận kết quả action
    e. Ghi nhận vào bảng locator collection
  3. Bảng Locator Collection (ghi nhận sau mỗi step):

    StepActionElementPrimary LocatorFallback LocatorVerified
    1Navigate———✅
    2TypeUsername inputgetByLabel('Email')#email✅
    3TypePassword inputgetByLabel('Password')#password✅
    4ClickLogin buttongetByRole('button', {name: 'Login'})button[type=submit]✅
    5AssertDashboard titlegetByRole('heading', {name: 'Dashboard'}).dashboard-title✅
  4. Locator Priority (tuân thủ .agents/rules/locator_strategy.md):

    Playwright: getByRole() → getByLabel() → getByPlaceholder() → getByText() → getByTestId() → CSS → XPath

    Selenium: id → data-testid → name → CSS selector → XPath

    Appium: accessibility-id → id → name → xpath (relative)

  5. Xử lý tình huống khi chạy UI:

    Tình huốngCách xử lý
    Element không tìm thấybrowser_snapshot lại → kiểm tra DOM → thử locator khác
    Page chưa load xongbrowser_wait_for text/element → retry
    Modal/popup xuất hiệnXử lý popup trước → tiếp tục flow
    Redirect/navigationbrowser_snapshot lại ở page mới
    Cần scrollbrowser_evaluate → scrollIntoView
    Cần đăng nhậpHỏi user credentials hoặc dùng fixture sẵn có
    CAPTCHA / 2FAThông báo user — không thể automate
  6. Screenshot evidence — chụp lại ở các milestone quan trọng:

    • Sau khi login thành công
    • Sau khi hoàn thành flow chính
    • Khi gặp lỗi/unexpected state

Bước 3: Sinh Automation Scripts (Code Generation)

  1. Sinh Page Object classes từ locator collection:

    Playwright TypeScript:

    typescript
    // src/pages/login.page.ts
    import { Page, Locator } from '@playwright/test';
    
    export class LoginPage {
      readonly page: Page;
      readonly emailInput: Locator;
      readonly passwordInput: Locator;
      readonly loginButton: Locator;
    
      constructor(page: Page) {
        this.page = page;
        this.emailInput = page.getByLabel('Email');
        this.passwordInput = page.getByLabel('Password');
        this.loginButton = page.getByRole('button', { name: 'Login' });
      }
    
      async login(email: string, password: string) {
        await this.emailInput.fill(email);
        await this.passwordInput.fill(password);
        await this.loginButton.click();
      }
    }

    Selenium Java:

    java
    // src/main/java/.../pages/LoginPage.java
    public class LoginPage extends BasePage {
      @FindBy(id = "email")
      private WebElement emailInput;
    
      @FindBy(id = "password")
      private WebElement passwordInput;
    
      @FindBy(css = "button[type='submit']")
      private WebElement loginButton;
    
      public void login(String email, String password) {
        waitAndType(emailInput, email);
        waitAndType(passwordInput, password);
        waitAndClick(loginButton);
      }
    }
  2. Sinh Test class:

    • Import Page Objects
    • Structure: Arrange → Act → Assert
    • Assertions rõ ràng với message mô tả
    • Test data unique + traceable (dùng timestamp/random)
  3. Nguyên tắc sinh code:

    • Locator PHẢI lấy từ Bước 2 (đã verify trên DOM) — KHÔNG ĐOÁN
    • Không hardcode test data (credentials đọc từ env/config)
    • Không dùng waitForTimeout() / Thread.sleep() — chỉ smart waits
    • Method names mô tả hành vi user, không mô tả thao tác DOM
    • Mỗi page → 1 file, mỗi test → 1 file

Bước 4: Chạy Test & Tự sửa lỗi (Execution & Auto-Heal)

  1. Chạy test bằng run_command:

    bash
    # Playwright TS
    npx playwright test <test_file> --headed
    
    # Playwright Python
    python -m pytest <test_file> --headed
    
    # Selenium Java
    mvn test -Dtest=<TestClass>
  2. Theo dõi kết quả qua command_status:

    • Nếu PASS → chuyển sang verify stability
    • Nếu FAIL → vào vòng lặp Auto-Heal:
    WHILE test FAIL (tối đa 5 vòng):
      1. Đọc error log → xác định step fail
      2. Phân loại lỗi:
         - Locator sai → mở browser MCP, inspect lại DOM, thay locator
         - Timing issue → thêm smart wait hoặc adjust assertion timeout
         - Page state sai → kiểm tra flow, thêm wait cho navigation
         - Test data conflict → sinh data mới (unique)
      3. Sửa code bằng replace_file_content / multi_replace_file_content
      4. Chạy lại test
  3. Verify stability — chạy test 2 lần liên tiếp PASS:

    bash
    # Playwright
    npx playwright test <test_file> --repeat-each=2
    
    # Pytest
    python -m pytest <test_file> --count=2
  4. ⚠️ Rule E3: KHÔNG hỏi user trong quá trình fix lỗi. Chỉ hỏi khi:

    • URL bị chặn / cần captcha
    • Business logic mâu thuẫn (không rõ expected behavior)
    • Đã hết 5 vòng auto-heal mà vẫn fail

Bước 5: Cleanup & Delivery

  1. Code cleanup (bắt buộc trước khi bàn giao):

    • Xóa console.log() / print() / debug log
    • Xóa locator không dùng
    • Xóa commented-out code
    • Không còn waitForTimeout() / Thread.sleep()
    • Import không thừa
  2. Cập nhật artifact task.md với kết quả:

    markdown
    ## Kết quả
    - ✅ Pages created: LoginPage, DashboardPage
    - ✅ Tests created: login.spec.ts
    - ✅ Test status: 2/2 PASS (stable)
    - 📊 Locators collected: 8 elements, all verified
  3. Báo cáo cho user:

    • Danh sách files đã tạo
    • Số test PASS/FAIL
    • Bảng locator collection (để user reference)
    • Known limitations (nếu có)

Output

  • Artifact task.md — checklist tiến độ + kết quả
  • Page Object classes — 1 file per page/screen, locators verified từ DOM
  • Test classes — script automation hoàn chỉnh, đã test PASS
  • Bảng Locator Collection — tất cả elements đã thu thập + primary/fallback locators
  • Evidence screenshots — chụp tại các milestone quan trọng

Archivos incluidos

El modelo los lee según los necesita mientras la habilidad está cargada. Son archivos de solo lectura y nunca se ejecutan.

Preguntas frecuentes

¿Qué hace la habilidad de IA Generate Automation From Ui Flow?

Thực thi UI flow trực tiếp trên browser, thu thập locators từ DOM thực tế, và sinh automation scripts. Hỗ trợ Playwright, Selenium, Appium.

¿Por qué usar Generate Automation From Ui Flow en TypingMind?

Porque la instalas una vez y la usas con cualquier modelo. Generate Automation From Ui Flow está escrita en Markdown, no en código específico de un proveedor, por lo que la misma habilidad funciona con GPT-5, Claude, Gemini, Grok o un modelo local, y puedes cambiar de modelo en mitad del chat sin que deje de funcionar. TypingMind utiliza tus propias claves API, de modo que pagas directamente a los proveedores en lugar de pagar una suscripción por puesto, y tus habilidades y chats permanecen en tu propio almacenamiento.

¿Cómo instalo Generate Automation From Ui Flow en TypingMind?

Abre Plugins → Habilidades → Instalar desde GitHub en TypingMind y pega https://github.com/anhtester/codex-testing-kit/tree/main/.agents/skills/generate-automation-from-ui-flow. TypingMind lee el archivo SKILL.md de esa carpeta, empaqueta los archivos de la carpeta e instala el conjunto como una habilidad que puedes activar en cada chat.

¿Qué modelos de IA pueden usar Generate Automation From Ui Flow?

Cualquier modelo que conectes en TypingMind. Las habilidades de IA son instrucciones en Markdown, no código específico de un proveedor, por lo que GPT, Claude, Gemini, Grok y los modelos locales pueden cargar esta habilidad cuando una solicitud se corresponda con ella.

¿Con cuántos modelos de IA puedo usar Generate Automation From Ui Flow?

Con tantos como quieras. Siempre que un modelo admita habilidades, puedes usar Generate Automation From Ui Flow con él: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama y muchos más, todos en TypingMind con tus propias claves API.

¿Es gratuita la habilidad de IA Generate Automation From Ui Flow?

Sí. anhtester la ha publicado en GitHub bajo la licencia MIT. Solo pagas a tu proveedor de IA por los tokens que utilizas.

¿Qué son las habilidades de IA?

Una habilidad de IA es un conjunto de instrucciones reutilizables que enseña a un modelo de IA a realizar una tarea concreta. Sigue el formato abierto Agent Skills: un archivo SKILL.md con un nombre y una descripción, además de los scripts, plantillas o archivos de referencia que pueda necesitar el modelo. El modelo solo lee las instrucciones cuando tu solicitud se corresponde con la habilidad, por lo que una habilidad instalada no supone ningún coste hasta que se utiliza.

¿En qué se diferencian las habilidades de IA de los plugins o los servidores MCP?

Un plugin o un servidor MCP proporciona al modelo nuevas herramientas que puede invocar: código que se ejecuta en algún lugar y devuelve un resultado. En cambio, una habilidad de IA aporta conocimientos y procedimientos al modelo: cómo abordar una tarea, qué pasos seguir y qué se considera un buen resultado. Las habilidades son instrucciones en Markdown, por lo que no necesitan servidor, clave API ni entorno de ejecución, y funcionan con cualquier modelo.

Ver el directorio

Crea ya tu propio espacio de trabajo con IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇