一键导入
fe-testing
Frontend testing patterns using Playwright — navigation, interaction, assertions, screenshots on failure, and common UI testing scenarios.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Frontend testing patterns using Playwright — navigation, interaction, assertions, screenshots on failure, and common UI testing scenarios.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Backend testing patterns — API request construction, response verification, database state checks, error handling testing, and adaptive tool detection.
Test report format with QA-XXX issue IDs compatible with code-review plugin. Defines report structure, severity levels, issue format with canonical fields, and detailed results.
Test plan structure, naming conventions, edge case generation rules, and file saving conventions for QA test plans.
Enforces AppVerk Swift coding standards across all code.
Structured concurrency and thread safety patterns in modern Swift.
Data persistence patterns for Swift apps using SwiftData, CoreData, UserDefaults, and Keychain.
| name | fe-testing |
| description | Frontend testing patterns using Playwright — navigation, interaction, assertions, screenshots on failure, and common UI testing scenarios. |
| activation | Load when testing frontend UI with Playwright |
| allowed-tools | playwright_browser_navigate, playwright_browser_click, playwright_browser_fill_form, playwright_browser_snapshot, playwright_browser_take_screenshot, playwright_browser_press_key, playwright_browser_select_option, playwright_browser_hover, playwright_browser_wait_for, playwright_browser_evaluate, playwright_browser_console_messages, playwright_browser_navigate_back, playwright_browser_tabs, playwright_browser_handle_dialog, playwright_browser_resize, playwright_browser_close, playwright_browser_drag, playwright_browser_type, playwright_browser_file_upload, playwright_browser_network_requests, Write, Read, Bash(mkdir:*) |
Priority order:
playwright_browser_navigate, playwright_browser_click, playwright_browser_snapshot, etc.playwright CLI — playwright screenshot, playwright open, JS eval via nodeFor each FE scenario from the test plan:
Screenshot for visual verification:
playwright screenshot --viewport-size=1280,720 "http://localhost:3000/page" /tmp/page-screenshot.png
Inspect the screenshot to verify the page loaded correctly.
Open page in browser (for interactive debugging):
playwright open "http://localhost:3000/page"
Create a temporary script to evaluate JS on the page:
cat > /tmp/eval.js << 'EOF'
const { chromium } = require('playwright');
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
await page.goto('http://localhost:3000/page');
// Evaluate JS
const result = await page.evaluate(() => {
return {
title: document.title,
itemsCount: document.querySelectorAll('.item').length,
hasError: !!document.querySelector('.error-message')
};
});
console.log(JSON.stringify(result));
await browser.close();
})();
EOF
node /tmp/eval.js
mkdir -p docs/testing/reports/screenshots
playwright screenshot --viewport-size=1280,720 "http://localhost:3000/page" docs/testing/reports/screenshots/fe-XX-fail.png
These are the primary testing tools in OpenCode. Use them whenever available.
playwright_browser_navigate(url: "http://localhost:3000/page")
playwright_browser_snapshot()
Navigating back:
playwright_browser_navigate_back()
Clicking elements:
playwright_browser_click(element: "Submit button", target: "<element-ref>")
playwright_browser_click(element: "Link with text 'Sign In'", target: "<element-ref>")
Filling forms:
playwright_browser_fill_form(fields: [
{ name: "email", type: "textbox", target: "<ref>", value: "test@example.com" },
{ name: "password", type: "textbox", target: "<ref>", value: "TestPass123!" }
])
If playwright_browser_fill_form doesn't work for a field, fall back to:
playwright_browser_click(element: "email input", target: "<ref>")
playwright_browser_type(target: "<ref>", text: "test@example.com")
Selecting options:
playwright_browser_select_option(element: "Country dropdown", target: "<ref>", values: ["PL"])
Keyboard actions:
playwright_browser_press_key(key: "Enter")
playwright_browser_press_key(key: "Escape")
playwright_browser_press_key(key: "Tab")
File uploads:
playwright_browser_file_upload(paths: ["/path/to/file.pdf"])
Drag and drop:
playwright_browser_drag(startTarget: "<source-ref>", endTarget: "<target-ref>", startElement: "Draggable item", endElement: "Drop zone")
Primary method — snapshot and inspect:
playwright_browser_snapshot()
After taking a snapshot, inspect the returned accessibility tree for:
JavaScript evaluation for complex checks:
playwright_browser_evaluate(function: "() => document.querySelector('.items-list').children.length")
playwright_browser_evaluate(function: "() => document.title")
playwright_browser_evaluate(function: "() => window.location.pathname")
Accept or dismiss dialogs:
playwright_browser_handle_dialog(accept: true)
playwright_browser_handle_dialog(accept: false)
playwright_browser_handle_dialog(accept: true, promptText: "user input")
accept: true clicks OK/Yes; accept: false clicks Cancel/NopromptText to fill the input fieldconfirm(), alert(), prompt()playwright_browser_wait_for(text: "Success", time: 5)
playwright_browser_wait_for(textGone: ".loading-spinner", time: 10)
playwright_browser_take_screenshot(type: "png")
Close the browser:
playwright_browser_close()
For each scenario, return results in this format:
### FE-XX: <scenario name>
- **Status:** PASS / FAIL / SKIP
- **Details:** <what was verified / what went wrong>
- **Screenshot:** <path, only if FAIL>
- **Edge cases:**
- <edge case 1>: PASS / FAIL — <details>
- <edge case 2>: PASS / FAIL — <details>