Chuyển đến nội dung
Skillpedia
Kiểm thử15k · #10932

control-ui

Skill này làm gì

Cho phép trợ lý chạy một ứng dụng web hoặc Electron cục bộ dưới tự động hóa, bấm qua nó và thu thập bằng chứng. Dành cho lập trình viên muốn xác minh thay đổi giao diện bằng ảnh chụp màn hình và log.

Khi nào nên dùng

  • ✓Khi bạn muốn kiểm tra một lỗi giao diện phụ thuộc vào tiêu điểm, cuộn hoặc thay đổi kích thước.
  • ✓Khi bạn muốn ảnh chụp màn hình hoặc ảnh chụp trợ năng để xác minh thay đổi trực quan.
  • ✓Khi bạn cần log console, log mạng hoặc profile hiệu năng của một ứng dụng cục bộ.

Liên kết skill

https://github.com/cursor/plugins/blob/main/cursor-team-kit/skills/control-ui/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/cursor/plugins/blob/main/cursor-team-kit/skills/control-ui/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Mở máy chủ phát triển cục bộ, bấm qua form đăng ký và chụp ảnh màn hình từng bước.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Trợ lý dùng lại các kiểm thử trình duyệt của repo nếu có. Nếu không, nó kết nối với ứng dụng đang chạy, chọn đúng trang bằng các dấu hiệu ổn định, và thao tác qua vai trò, nhãn hoặc bộ chọn ổn định.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Control UI

Use local browser automation to verify UI behavior with evidence. First reuse the repo's own Playwright, browser, or Electron harness if it exists; otherwise assemble a temporary local harness around the app's dev server or Chromium debug port.

What It Is Used For

  • Reproducing UI bugs that depend on real browser focus, keyboard input, scrolling, resizing, or rendering.
  • Verifying visual or accessibility changes with screenshots and snapshots.
  • Checking local web, IDE, or Electron behavior before shipping.
  • Capturing console logs, network logs, CPU profiles, traces, or heap snapshots.
  • Creating before/after evidence for verify-this.

Setup Pattern

  1. Start the app locally using the repo's documented dev command.
  2. Discover existing local harnesses: Playwright tests, Cypress specs, Storybook, browser scripts, Electron launch scripts, or snapshot tools.
  3. For a web app, connect to the local URL with the existing browser tooling.
  4. For Electron/Chromium, enable a remote debugging port when supported.
  5. Select the correct page by stable app markers, not by tab order alone.
  6. Prefer accessibility roles, labels, and stable data-* selectors over coordinates.

Generic Web Harness

Use the repo's installed browser tooling when possible. If the repo already has Playwright, a minimal one-off probe looks like:

import { chromium } from "playwright";

const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
await page.goto("http://127.0.0.1:<port>");
await page.getByRole("button", { name: /submit/i }).click();
await page.screenshot({ path: "/tmp/ui-harness-after.png", fullPage: true });
await browser.close();

Do not add Playwright as a project dependency just for this probe unless the user asks. Prefer existing dev dependencies or external browser tools already available in the environment.

Generic CDP Harness

For Electron or a Chromium app launched with --remote-debugging-port=<port>, connect over CDP:

import { chromium } from "playwright";

const browser = await chromium.connectOverCDP("http://127.0.0.1:<debug-port>");
const pages = browser.contexts().flatMap((context) => context.pages());
let page;
for (const candidate of pages) {
  if (await candidate.locator("<app-root-selector>").count()) {
    page = candidate;
    break;
  }
}

if (!page) {
  console.log(await Promise.all(pages.map(async (p) => ({
    title: await p.title(),
    url: p.url(),
  }))));
  throw new Error("No matching app page found");
}

await page.screenshot({ path: "/tmp/ui-harness-cdp.png", fullPage: true });
await browser.close();

Replace <app-root-selector> with a stable marker from the current repo, such as a root app node, landmark, or product-specific data-* attribute.

Interaction Loop

  1. Capture a page snapshot or screenshot before acting.
  2. Choose a target from the latest page structure.
  3. Perform exactly one structural action: click, type, keypress, drag, scroll, navigate, or resize.
  4. Capture a fresh snapshot/screenshot.
  5. Verify the expected state change.
  6. Save artifacts for before/after comparisons when the user asked for proof.

CDP Capabilities

Use raw CDP only when higher-level browser APIs are insufficient:

  • Performance: CPU profiles, traces, paint flashing, FPS meter, layout shift inspection.
  • Memory: heap snapshots and forced GC for leak investigations.
  • Network: request blocking, throttling, cache disablement, request/response logs.
  • Rendering: viewport changes, color scheme emulation, reduced motion, accessibility checks.
  • Debugging: console streaming, exception capture, DOM snapshots.

Page Selection

When multiple app windows/tabs share a debug port:

  • Prefer a positive marker for the surface under test, such as an app root selector.
  • Use a negative marker to avoid the wrong surface when necessary.
  • If no page matches, list available page titles and URLs instead of guessing.

Guardrails

  • Do not rely on stale element references after navigation or structural changes.
  • Avoid coordinate clicks unless a fresh screenshot was captured immediately before the click.
  • Keep test data local and disposable.
  • Do not store screenshots or heap snapshots from privacy-sensitive workspaces unless the user explicitly agrees.
  • Do not hard-code selectors, ports, or script paths from another repository. Discover the current repo's local app markers.
  • Clean up dev serve
Câu hỏi thường gặp

Ứng dụng có cần đang chạy không?

Có. Nó khởi động ứng dụng cục bộ bằng lệnh phát triển của dự án, rồi kết nối với nó.

Nó có làm việc được với ứng dụng Electron không?

Có, khi có thể bật cổng gỡ lỗi từ xa.

Nó thu thập bằng chứng gì?

Ảnh chụp màn hình, ảnh chụp trợ năng, log console và mạng, trace và profile, tùy nhu cầu.

Chi tiết

Mô tả gốc của tác giả

Build or adapt a local browser/CDP harness to drive and inspect a web, IDE, or Electron UI. Use for local UI verification, screenshots, accessibility snapshots, perf profiles, visual diffs, or reproducing UI bugs.

repo: cursor/plugins

Độ phổ biến

Sao GitHub
15k
Vị trí xếp hạng
#10932
Giấy phép
—
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự