一键导入
playwright-explorer
Explores web application using Playwright MCP and documents pages for testing. Also adds/updates data-testid selectors in code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Explores web application using Playwright MCP and documents pages for testing. Also adds/updates data-testid selectors in code.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Manage OpenShift instance deployments: deploy, teardown, list, build images, backup/restore databases, and setup service accounts. Trigger phrases: deploy instance, teardown instance, list instances, build images, backup database, restore database, setup service account, oc deploy, instance management. Do NOT invoke for: local development setup, docker-compose, writing application code, database migrations.
Splits a feature branch into multiple sequential draft PRs targeting develop. Trigger phrases: split branch into PRs, break branch into PRs, create stacked PRs, split into multiple PRs. Do NOT invoke for: creating a single PR, cherry-picking individual commits, or rebasing.
Requirements Refiner: Iteratively questions the user to clarify vague requirements and outputs a single consolidated requirements document in feature-docs.
Implements user stories from a user_stories directory in dependency order using subagents. Reads README.md to find the next unchecked story, spawns Agent tool subagents to implement each one, tracks progress via scenario checkboxes in story files and story checkboxes in README. Trigger phrases: implement stories, implement user stories, story implementer, work on stories, implement next story. Do NOT invoke for: writing user stories (use write-user-stories), general code changes, checklist execution.
User Story Writer: Converts refined requirements into individual User Story files following a strict template, plus a README.md with phase breakdown. Trigger phrases: write user stories, generate user stories, create user stories from requirements.
Converts a user-provided list of issues, bugs, or tasks into a structured markdown checklist file in docs-md/. Trigger phrases: create checklist, make a checklist, turn these into a checklist, create todo file, checklist from these items. Do NOT invoke for: executing/working through checklist items, editing existing checklists, or general markdown file creation.
| name | playwright-explorer |
| description | Explores web application using Playwright MCP and documents pages for testing. Also adds/updates data-testid selectors in code. |
Systematically explore a web application to document its structure, elements, and interactions for test generation. Automatically adds data-testid attributes to improve test reliability.
feature-docs/003-benchmarking-system/)http://localhost:3000)true)For Playwright Exploration:
await page.evaluate(() => {
const createFakeJWT = (payload) => {
const header = { alg: 'none', typ: 'JWT' };
const base64UrlEncode = (obj) => {
const json = JSON.stringify(obj);
const base64 = btoa(json);
return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
};
return `${base64UrlEncode(header)}.${base64UrlEncode(payload)}.fake-signature`;
};
const fakeIdToken = createFakeJWT({
name: 'Test User',
preferred_username: 'testuser',
email: 'test@example.com',
sub: 'test-user',
});
const mockAuthTokens = {
access_token: 'mock-access-token',
refresh_token: 'mock-refresh-token',
id_token: fakeIdToken,
expires_in: 3600,
expires_at: Math.floor(Date.now() / 1000) + 3600,
};
localStorage.setItem('auth_tokens', JSON.stringify(mockAuthTokens));
});
{feature-dir}/playwright/test-plans/ directory (all .md files except README.md){feature-dir}/playwright/exploration/exploration-progress.md for already completed test plans{feature-dir}/playwright/exploration/ (e.g., dataset-list.page-doc.md, dataset-detail.page-doc.md, etc.)
data-testid attributes to those elements in the source codeexploration/exploration-progress.mdCreate/update {feature-dir}/playwright/exploration/exploration-progress.md:
# Exploration Progress
- [x] US-001.md - Completed 2026-02-15
- [x] US-003.md - Completed 2026-02-15
- [ ] US-004.md - In progress
- [ ] US-006.md
- [ ] US-008.md
**Status**: 2/5 test plans explored
**Last Updated**: 2026-02-15 3:42 PM
BEFORE STARTING EXPLORATION: Check if test data exists in the database for the pages you're exploring.
apps/shared/prisma/seed.ts to see what test data is availableapps/shared/prisma/seed.ts to add needed test datacd apps/backend-services && PRISMA_USER_CONSENT_FOR_DANGEROUS_AI_ACTION="yes" npx prisma migrate reset --force to reset databasecd apps/backend-services && npm run db:seed to populate databaseseed-project-id) for predictable testingNOTE: switch back to project root after resetting database.
seed- prefix (e.g., seed-dataset-invoices)When exploring a page, check if core functionality works as expected per requirements:
If issues detected:
npm run db:seed if needed{feature-dir}/requirements.md or {feature-dir}/REQUIREMENTS.md{feature-dir}/user-stories/ for this pagedata-testid attributes from the startFor each interactive element without a robust selector:
data-testid AttributeNaming Convention: Use kebab-case, descriptive names
{action}-btn (e.g., create-benchmark-btn, submit-form-btn){field}-input (e.g., benchmark-name-input, email-input){destination}-link (e.g., datasets-link, home-link){content}-container (e.g., benchmark-list-container){item-type}-item (e.g., benchmark-item, dataset-item){name}-table, rows: {name}-rowExample Addition:
// Before
<button onClick={handleSubmit}>Submit</button>
// After
Submit
When exploring, prefer in this order:
data-testid - Use as-isrole, label, aria-* attributesdata-testid - If above don't exist for critical elementsFor each page, create files in {feature-dir}/playwright/exploration/:
{page-name}.page-doc.md (Human-readable documentation)# Page: [Page Name]
**URL Pattern**: /dashboard/events
**Purpose**: [What this page does]
## Key Elements
### Navigation
- **Header**: `[data-testid="app-header"]`
- **Logo link**: `a[aria-label="Home"]`
### Forms
- **Event Name Input**: `input[name="eventName"]` (required)
- **Date Picker**: `[data-testid="date-picker"]`
- **Submit Button**: `button[type="submit"]`
### Interactive Elements
- **Create Button**: `button:has-text("Create Event")`
- **Delete Icons**: `[aria-label="Delete"]`
## State Behaviors
- **Loading state**: `.spinner` appears during save
- **Success message**: `.toast-success` appears on completion
- **Error validation**: `.error-message` under invalid fields
## Navigation Flows
- **From**: Dashboard → Click "Create Event"
- **To**: Event List → After successful creation
{page-name}.selectors.md (Machine-readable)# Selectors for [Page Name]
## Primary Actions
CREATE_BUTTON|button:has-text("Create Event")
SUBMIT_FORM|button[type="submit"]
CANCEL_BUTTON|button:has-text("Cancel")
## Form Fields
EVENT_NAME|input[name="eventName"]
EVENT_DATE|[data-testid="date-picker"]
ROLE_SELECT|select[name="role"]
## Validation & Feedback
ERROR_MESSAGE|.error-message
SUCCESS_TOAST|.toast-success
LOADING_SPINNER|.spinner
## Lists & Tables
EVENT_ROW|[data-testid="event-row"]
DELETE_BUTTON|[aria-label="Delete"]
EDIT_BUTTON|[aria-label="Edit"]
Modified React/TypeScript component files with added data-testid attributes.
Process one test plan at a time:
data-testidrequirements.md to understand what elements SHOULD exist on each pageuser-stories/ folder to verify the page matches user story acceptance criteria