Token导航 LogoToken导航

Agent Skill · 研究检索

frontend-testing(前端测试)

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

frontend-testing 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 59,803。

总安装 376周安装 16GitHub Stars 3下载 132核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:frontend-testing(前端测试)
来源仓库:https://github.com/schalkneethling/webdev-agent-skills
仓库路径:skills/frontend-testing
安装命令:
npx skills add https://github.com/schalkneethling/webdev-agent-skills --skill frontend-testing
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/schalkneethling/webdev-agent-skills --skill frontend-testing

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于辅助前端组件的测试用例编写和执行。frontend-testing 属于研究检索类 Skill,可作为该场景下的辅助能力补充。适合在 React、Vue 等项目中验证 UI 行为和兼容性。可生成 Jest、Cypress 等框架的测试片段。安装依赖 GitHub 仓库,需确认项目结构支持测试集成。

测试结果应结合手动验证,避免自动化误判。

来源仓库内路径:skills/frontend-testing

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/schalkneethling/webdev-agent-skills --skill fr…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

frontend-testing 怎么安装?

在终端执行 npx skills add https://github.com/schalkneethling/webdev-agent-skills --skill frontend-tes…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

frontend-testing 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

frontend-testing 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

frontend-testing 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

frontend-testing 用的人多吗?

公开数据是累计安装 376 次,近一周安装 16 次,下载 132 次,GitHub 3 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

frontend-testing 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
frontend-testing

前端测试 · 本页

3763操作浏览器MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Frontend Testing

Start by writing tests that validate acceptance criteria. Then add implementation tests where they provide value.

Core Principle

"The more your tests resemble the way your software is used, the more confidence they can give you." — Kent C. Dodds

This principle guides testing decisions, but isn't the whole picture:

  • Acceptance criteria tests verify the system does what users/stakeholders need. These should be stable across refactors.
  • Implementation tests verify the pieces are robust — edge cases, error handling, complex logic. These may change when you refactor.

Both have value. The anti-pattern to avoid is tests that *only* mirror implementation without validating meaningful behavior.

When to Load References

Load reference files based on test type:

  • Unit tests with DOM: references/locator-strategies.md
  • E2E tests: references/locator-strategies.md, references/aria-snapshots.md
  • Visual regression tests: references/visual-regression.md
  • Accessibility audits: references/accessibility-testing.md
  • Structure validation: references/aria-snapshots.md — consolidate multiple assertions into one
  • All tests: Start with this file for core workflow

Workflow

Step 1: Start with Acceptance Criteria

Before writing any test, identify what the code should do from the user's perspective.

Ask for or extract criteria from:

  • Ticket description or user story
  • Figma annotations
  • Functional requirements
  • Product owner clarification

Document criteria as a checklist. These become your first tests.

Write acceptance tests before reading implementation. This prevents circular validation where tests just confirm "code does what code does."

Step 2: Map Criteria to Test Cases

For each criterion, identify:

  • Happy path: Normal expected behavior
  • Edge cases: Boundary conditions
  • Error cases: Invalid inputs, failures

Example mapping:

Criterion: "User can filter products by category"
├─ Happy path: Select category, products filter correctly
├─ Edge case: No products match filter, show empty state
├─ Edge case: Clear filter, all products show again
├─ Error case: Filter API fails, show error message
└─ Accessibility: Filter controls are keyboard accessible

Step 3: Add Implementation Tests (Unit Tests)

After acceptance tests pass, add unit tests for implementation robustness:

  • Edge cases the criteria don't cover (null, undefined, empty arrays, boundary values)
  • Algorithm correctness for complex calculations
  • Error handling paths (exceptions, network failures, parse errors)
  • Complex branching logic hard to exercise through integration tests
  • Performance-sensitive code that needs specific validation
Function: filterProducts(products, category)
├─ Acceptance: Returns matching products (from criteria)
├─ Implementation: Returns empty array when products is null
├─ Implementation: Returns all products when category is empty string
├─ Implementation: Handles case-insensitive category matching
└─ Implementation: Does not mutate original array

The distinction: acceptance tests should rarely change on refactor; implementation tests may need updates when internals change.

Step 4: Choose Test Type

ScenarioTest TypeTool
Pure logic (no DOM)Unit testVitest
Component behaviorUnit test with DOMVitest + Testing Library
User flows, real browserE2E testPlaywright
Semantic structure validationARIA snapshotPlaywright toMatchAriaSnapshot
Visual appearanceVRTPlaywright screenshots
Accessibility complianceA11y testPlaywright + axe-core

ARIA snapshots are particularly valuable for E2E tests. A single snapshot can replace multiple individual assertions while validating the accessibility tree structure.

DOM Environment for Unit Tests: Prefer happy-dom over jsdom. It's faster, and its API limitations serve as a useful signal — if happy-dom doesn't support what you're testing, consider whether it belongs in an E2E test instead.

Step 5: Write Tests Before/Alongside Code

  • Ideal: Write test first, then implementation (TDD)
  • Acceptable: Write test immediately after implementing each criterion
  • Avoid: Write all tests after implementation is "done"

Test Structure

Unit Tests (Vitest)

describe("calculateDiscount", () => {
  describe("when customer has premium membership", () => {
    it("applies 20% discount to order total", () => {
      // Arrange - Set up test data matching criterion
      const order = { total: 100, membership: "premium" };

      // Act - Call the function
      const result = calculateDiscount(order);

      // Assert - Verify expected outcome from requirements
      expect(result).toBe(80);
    });
  });
});

Component Tests (Vitest + Testing Library)

import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";

describe("LoginForm", () => {
  describe("when credentials are invalid", () => {
    it("displays error message to user", async () => {
      const user = userEvent.setup();
      render(<LoginForm />);

      // Interact using accessible queries
      await user.type(
        screen.getByLabelText(/email/i),
        "invalid@test.com"
      );
      await user.type(
        screen.getByLabelText(/password/i),
        "wrong"
      );
      await user.click(
        screen.getByRole("button", { name: /sign in/i })
      );

      // Assert on user-visible outcome
      expect(
        await screen.findByRole("alert")
      ).toHaveTextContent(/invalid credentials/i);
    });
  });
});

E2E Tests (Playwright)

import { test, expect } from "@playwright/test";

test.describe("Product Catalog", () => {
  test.describe("filtering by category", () => {
    test("shows only matching products", async ({ page }) => {
      await page.goto("/products");

      // Use semantic locators
      await page.getByRole("combobox", { name: /category/i }).selectOption("Electronics");

      // Assert count, then spot-check first/last
      const products = page.getByRole("article");
      await expect(products).toHaveCount(5);
      await expect(products.first()).toContainText(/electronics/i);
      await expect(products.last()).toContainText(/electronics/i);
    });
  });
});

When you need to verify all items, use Promise.all for parallel assertions:

test("all products match filter", async ({ page }) => {
  await page.goto("/products");
  await page.getByRole("combobox", { name: /category/i }).selectOption("Electronics");

  const products = await page.getByRole("article").all();

  // Parallel assertions — faster than sequential await in a loop
  await Promise.all(
    products.map(product =>
      expect(product.getByText(/electronics/i)).toBeVisible()
    )
  );
});

E2E Tests with ARIA Snapshots

ARIA snapshots consolidate multiple assertions into one, validating semantic structure:

test.describe("Login Page", () => {
  test("has correct form structure", async ({ page }) => {
    await page.goto("/login");

    // One snapshot replaces 5+ individual assertions
    await expect(page.getByRole("main")).toMatchAriaSnapshot(`
      - heading "Sign In" [level=1]
      - textbox "Email"
      - textbox "Password"
      - button "Sign In"
      - link "Forgot password?"
    `);
  });

  test("shows validation errors on empty submit", async ({ page }) => {
    await page.goto("/login");
    await page.getByRole("button", { name: /sign in/i }).click();

    await expect(page.getByRole("form")).toMatchAriaSnapshot(`
      - textbox "Email"
      - text "Email is required"
      - textbox "Password"
      - text "Password is required"
      - button "Sign In"
    `);
  });
});

Locator Priority

Use locators that reflect how users and assistive technologies find elements:

  1. getByRole — First choice. Queries accessibility tree.
  2. getByLabelText — Best for form fields. Users find inputs by labels.
  3. getByPlaceholderText — When no label exists (not ideal).
  4. getByText — For non-interactive elements.
  5. getByAltText — For images.
  6. getByTestId — Last resort escape hatch.

If you can't find an element with semantic queries, the UI may have accessibility issues.

Anti-Patterns

Testing Only Implementation Details

Tests that only verify internals without validating meaningful behavior:

// BAD: Tests internal method exists, provides no behavior guarantee
it("has a validateFields method", () => {
  expect(form.#validateFields).toBeDefined();
});

// BAD: Asserts implementation without verifying outcome
it("calls the validator", () => {
  expect(mockValidator).toHaveBeenCalledWith(data);
});

// GOOD: Tests observable behavior (acceptance)
it("prevents submission with invalid email", async () => {
  await user.type(emailInput, "not-an-email");
  await user.click(submitButton);
  expect(screen.getByRole("alert")).toHaveTextContent(/valid email/i);
});

// ALSO GOOD: Tests implementation robustness (unit)
it("returns validation errors for malformed email", () => {
  const result = validateEmail("not-an-email");
  expect(result.valid).toBe(false);
  expect(result.error).toBe("Invalid email format");
});

The key distinction: implementation tests should verify *meaningful* behavior of units, not just that code paths execute.

Circular Validation

// BAD: Test data derived from implementation
const expected = formatPrice(100); // Don't compute expected from code!
expect(formatPrice(100)).toBe(expected);

// GOOD: Expected value from requirements
expect(formatPrice(100)).toBe("$100.00");

Over-Mocking

// BAD: Mock everything, test nothing real
jest.mock("./api");
jest.mock("./utils");
jest.mock("./formatter");
// Now just testing mocks talk to each other

// GOOD: Mock only external boundaries
// Mock: APIs, databases, time, file system
// Real: Business logic, components, formatters

Brittle Selectors

// BAD: Implementation-dependent selectors
page.locator(".btn-primary.submit-form");
page.locator("#root > div > form > button:nth-child(3)");

// GOOD: Semantic locators
page.getByRole("button", { name: /submit order/i });

Failing Tests Mean Bugs (Usually)

When a test fails, the investigation depends on the test type:

Acceptance test fails:

  1. Check the code under test first — likely a real bug
  2. Verify the test still matches current requirements — requirements may have changed
  3. Only update the test after confirming the new behavior is correct

Implementation test fails:

  1. If you're refactoring, the test may legitimately need updating
  2. If you're not refactoring, check the code — likely a bug
  3. Consider whether the test is too tightly coupled to implementation

Don't reflexively update tests to pass. Investigate why they fail.

Checklist Before Submitting Tests

  • Each acceptance criterion has at least one test
  • Edge cases from criteria are covered
  • Implementation tests added for complex logic, error handling, boundary conditions
  • Tests are named descriptively (criteria-based or behavior-based)
  • Using semantic locators (getByRole, getByLabelText)
  • No tests that only verify "code runs" without validating meaningful behavior
  • Failing tests investigated appropriately (acceptance vs implementation)
  • Accessibility checks included for interactive components
  • Consider ARIA snapshots for structure validation (consolidates multiple assertions)

References

Load these files for detailed guidance:

  • references/locator-strategies.md — Complete locator hierarchy with examples
  • references/aria-snapshots.md — Structure validation, consolidating assertions
  • references/accessibility-testing.md — axe-core integration, WCAG targeting
  • references/visual-regression.md — Screenshot testing, baseline management

平台分布

Antigravity

29.87%
按下载量换算39

Claude Code

22.79%
按下载量换算30

OpenCode

16.4%
按下载量换算22

windsurf

13.48%
按下载量换算18

github-copilot

6.83%
按下载量换算9

Codex

3.08%
按下载量换算4

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills