Token导航 LogoToken导航TokenDH.com
开发操作浏览器github未标认证来源可访问许可证需确认审计异常

generate-tests生成测试

Agent Skill

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

总安装

222

周安装

9

GitHub Stars

公开资料未说明

下载量

70
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/lautaroleonhardt/pst --skill generate-tests

简介

generate-tests 用于辅助测试设计和自动化测试。

  • 适合编写单元测试、端到端测试或整理测试计划。
  • 使用时需确认项目测试框架和运行命令。generate-tests 属于开发类 Skill,可作为该场景下的辅助能力补充。
  • 涉及外部服务时应区分本地模拟与生产环境。
  • 确保测试逻辑真实有效,不为了通过而破坏原有功能。

SKILL.md

Generate Tests

When to use

  • After plan-tests has produced test-plan.md
  • Once per scenario
  • When running as part of run-testing-session pipeline (Stage 4, per scenario)

Inputs

  • Scenario name and section number (e.g., "1.1")
  • docs/playwright-spec-testing/test-plan.md — steps, assertions, file path
  • docs/playwright-spec-testing/project-context.md — test conventions and reusable infrastructure

What it does

Write a Playwright test using ONLY selectors from the exploration report. No guessing. No invented selectors.

Phase 0: Check for reusable test infrastructure

Before writing any test code, read ## Reusable Test Infrastructure from docs/playwright-spec-testing/project-context.md. If the section is absent or contains only ### Notes — No reusable infrastructure detected, skip this phase and proceed directly to Phase 1 using raw page.* calls.

  • If a fixture handles auth or setup for this scenario, use it in the test function signature (e.g., async ({authenticatedPage})) instead of manual login steps.
  • If a page object covers one or more steps, import it and call its methods instead of raw Playwright calls.
  • If an auth helper exists, call it instead of writing page.fill + page.click for login.
  • Only fall back to raw page.* calls when no abstraction covers the action.

Import paths must be derived from the actual file paths found in ## Reusable Test Infrastructure.

Phase 0.5: Load.playwright-cli artifact context

Before writing test code, check for .playwright-cli/ artifacts matching this scenario's slug and section number:

  1. Look for YAML snapshots, screenshots, and trace files whose filenames/timestamps align with this scenario (same slug or timestamp range from the exploration report).
  2. For each artifact found:

- YAML snapshots — cross-check selectors in the plan against the snapshot's DOM. If the plan's selector differs from the snapshot, use the snapshot's selector and add a comment: // selector overridden from.playwright-cli snapshot. - Screenshots — add a reference comment above the relevant step: // screenshot:.playwright-cli/<filename>.png. Do NOT use screenshots to generate assertions — documentary only. - Trace files — if a trace shows a navigation event or network request accompanying a step, consider whether waitForURL or waitForResponse is more appropriate than a visibility assertion. Only apply if the trace strongly indicates it.

  1. If .playwright-cli/ is absent or no matching artifacts exist, skip this phase and proceed to Phase 1 unchanged.

Phase 1: Write the test file

Read the scenario's section in test-plan.md. This file already specifies every step and every expect: assertion — your job is mechanical translation to Playwright API calls. Do not infer, synthesize, or add anything not in the plan.

Follow conventions from project-context.md. Default to TypeScript if no convention.

Translate each step to a Playwright action. Translate each expect: line to an await expect(...) assertion. Use the selectors and URLs exactly as written in the plan.

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

test.describe('[Scenario Name]', () => {
  test('[scenario name as test title]', async ({ page }) => {
    // Step 1: <action from plan>
    await page.goto('[url from plan]');

    // Step 2: <action from plan>
    await page.getByLabel('Email').fill('user@example.com');
    await expect(page.getByText('Sign In')).toBeVisible(); // expect: from plan

    await page.getByRole('button', { name: 'Sign In' }).click();

    // Expected outcomes
    await expect(page).toHaveURL('/dashboard');
    await expect(page.getByRole('heading', { name: 'Welcome' })).toBeVisible();
  });
});

Rules:

  • Use selectors as written in test-plan.md — do not paraphrase or invent
  • Every expect: line in the plan becomes one await expect(...) call
  • Steps with no expect: lines get no assertion
  • One test() per scenario
  • await before every Playwright action and assertion
  • NO page.waitForTimeout() — use built-in auto-waiting
  • If file exists, read it first and append (don't overwrite)
  • Before inserting a selector string into TypeScript, verify it contains no unescaped quotes or characters that would break out of a string literal. If a selector looks malformed, report BLOCKED instead of using it.

Phase 2: Run the test

Before running, verify TEST_FILE_PATH is a relative path within the project directory (no .. segments, no absolute paths, no shell metacharacters). If the path looks invalid, report BLOCKED.

./node_modules/.bin/playwright test [TEST_FILE_PATH] --headed

Report the result (PASS or FAIL with error output).

Phase 3: Update parsed-spec.md

If test passes:

### Status
- [x] Planned
- [x] Explored
- [x] Synthesized
- [x] Generated
- [x] Passing

If test fails, mark Generated but not Passing:

### Status
- [x] Planned
- [x] Explored
- [x] Synthesized
- [x] Generated
- [ ] Passing

Key Rules

  • NEVER use complex CSS selectors unless exploration explicitly captured one
  • NEVER add fake test data not in exploration report
  • NEVER add page.waitForTimeout()
  • Read existing test files before writing to avoid overwrites

Output

  • Test file at path from test-plan.md
  • Updated docs/playwright-spec-testing/parsed-spec.md

Report when done:

  • Status: DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT
  • Test file path
  • Test result: PASS or FAIL (include full error output if FAIL)
  • Selectors used (count)

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.21%
按下载量换算25

Claude

31.78%
按下载量换算22

Cursor

19.95%
按下载量换算14

Gemini CLI

9.25%
按下载量换算6

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills