Communitygithub.com

JantonioFC/skillsbank

生產級的 Playwright 測試工具包。當使用者提及 Playwright 測試、端到端測試、瀏覽器自動化、修復不穩定測試、測試遷移、CI/CD 測試或測試套件時使用。可產生測試、修復不穩定的失敗、從 Cypress/Selenium 遷移、與 TestRail 同步...

skillsbank 是什麼?

這是一個專為 AI 編碼代理設計的生產級 Playwright 測試工具包,提供從測試初始化到報告產生的完整工作流程。技能包含 9 個可透過 `/pw:` 指令存取的命令,涵蓋 Playwright 專案設置、根據使用者故事或 URL 產生測試、審查測試反模式、診斷與修復不穩定測試、從 Cypress/Selenium 遷移、分析測試覆蓋率、與 TestRail 同步測試案例及結果、在 BrowserStack 上執行跨瀏覽器測試,以及產生自訂報告。它遵循 10 條黃金規則,例如優先使用 `getByRole()` 而非 CSS/XPath、禁止使用 `page.waitForTimeout()`、使用 web-first 斷言等。工具包還包含 55 個測試範本、3 個專門代理(測試架構師、測試除錯器、遷移規劃者)、2 個 MCP 伺服器(TestRail 和 BrowserStack 整合),以及 6 份參考文件,協助開發人員建立穩定、可維護的端到端測試。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/JantonioFC/skillsbank/tree/HEAD/skills/pw

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

Playwright Pro

專為 AI 編碼代理設計的生產級 Playwright 測試工具包。

可用指令

作為 Claude Code 外掛安裝後,這些指令可透過 /pw: 使用:

指令功能說明
/pw:init設定 Playwright — 偵測框架、產生設定檔、CI、第一個測試
/pw:generate <spec>從使用者故事、URL 或元件產生測試
/pw:review審查測試,找出反模式和覆蓋率缺口
/pw:fix <test>診斷並修復失敗或不穩定的測試
/pw:migrate從 Cypress 或 Selenium 遷移至 Playwright
/pw:coverage分析已測試與遺漏的部分
/pw:testrail與 TestRail 同步 — 讀取測試案例、提交結果
/pw:browserstack在 BrowserStack 上執行,提取跨瀏覽器報告
/pw:report以偏好的格式產生測試報告

快速入門工作流程

多數專案建議的順序:

1. /pw:init          → 建立設定檔、CI pipeline 和第一個冒煙測試
2. /pw:generate      → 根據你的規格或 URL 產生測試
3. /pw:review        → 驗證品質並標記反模式      ← 每次 generate 後務必執行
4. /pw:fix <test>    → 診斷並修復任何失敗或不穩定的測試  ← 當 CI 變紅時執行

驗證檢查點:

  • 執行 /pw:generate 後 — 在提交前務必執行 /pw:review;它會自動捕捉定位器反模式和遺漏的斷言。
  • 執行 /pw:fix 後 — 在本機重新執行完整測試套件(npx playwright test),以確認修復不會引入回歸。
  • 執行 /pw:migrate 後 — 執行 /pw:coverage 以確認與舊套件的功能一致性,再淘汰 Cypress/Selenium 測試。

範例:產生 → 審查 → 修復

# 1. 從使用者故事產生測試
/pw:generate "As a user I can log in with email and password"

# 已產生:tests/auth/login.spec.ts
# → Playwright Pro 使用 auth 範本建立該檔案。

# 2. 審查產生的測試
/pw:review tests/auth/login.spec.ts

# → 標記:一個測試使用了 page.locator('input[type=password]') — 建議改用 getByLabel('Password')
# → 自動套用修復。

# 3. 在本機執行以確認
npx playwright test tests/auth/login.spec.ts --headed

# 4. 若測試在 CI 中不穩定,進行診斷
/pw:fix tests/auth/login.spec.ts
# → 識別遺漏的 web-first 斷言;將 waitForTimeout(2000) 取代為 expect(locator).toBeVisible()

黃金規則

  1. 優先使用 getByRole() 而非 CSS/XPath — 對標記變更更具韌性
  2. 絕不使用 page.waitForTimeout() — 使用 web-first 斷言
  3. expect(locator) 會自動重試;expect(await locator.textContent()) 則不會
  4. 每個測試皆獨立 — 測試之間不共用狀態
  5. 在設定中使用 baseURL — 杜絕硬編碼 URL
  6. 重試次數:CI 環境設為 2,本機環境設為 0
  7. 追蹤:設定為 'on-first-retry' — 豐富除錯資訊且不影響速度
  8. 使用 Fixture 而非全域變數 — 透過 test.extend() 共用狀態
  9. 每個測試一個行為 — 多個相關斷言可以接受
  10. 僅模擬外部服務 — 絕不模擬自己的應用程式

定位器優先順序

1. getByRole()        — 按鈕、連結、標題、表單元素
2. getByLabel()       — 附有標籤的表單欄位
3. getByText()        — 非互動式文字
4. getByPlaceholder() — 附有佔位符的輸入框
5. getByTestId()      — 當無語義選項時使用
6. page.locator()     — CSS/XPath 作為最後手段

包含內容

  • 9 個技能,附有詳細的逐步說明
  • 3 個專門代理:測試架構師、測試除錯器、遷移規劃者
  • 55 個測試範本:驗證、CRUD、結帳、搜尋、表單、儀表板、設定、入門引導、通知、API、無障礙
  • 2 個 MCP 伺服器(TypeScript):TestRail 和 BrowserStack 整合
  • 智慧鉤子:自動驗證測試品質、自動偵測 Playwright 專案
  • 6 份參考文件:黃金規則、定位器、斷言、Fixture、常見陷阱、不穩定測試
  • 遷移指南:Cypress 和 Selenium 對照表

整合設定

TestRail(選用)

export TESTRAIL_URL="https://your-instance.testrail.io"
export TESTRAIL_USER="[email protected]"
export TESTRAIL_API_KEY="your-api-key"

BrowserStack(選用)

export BROWSERSTACK_USERNAME="your-username"
export BROWSERSTACK_ACCESS_KEY="your-access-key"

快速參考

請參閱 reference/ 目錄:

  • golden-rules.md — 10 條不容妥協的規則
  • locators.md — 完整的定位器優先順序與速查表
  • assertions.md — Web-first 斷言參考
  • fixtures.md — 自訂 Fixture 與 storageState 模式
  • common-pitfalls.md — 10 大常見錯誤與修正
  • flaky-tests.md — 診斷指令與快速修復

請參閱 templates/README.md 取得完整的範本索引。

使用時機

當你需要 Playwright-pro 的指導或自動化時,請使用此技能。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

JantonioFC/skillsbank

AI-powered image editing with style transfer and object removal

JantonioFC/skillsbank

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

JantonioFC/skillsbank

Analise e auditoria de editais de leilao judicial e extrajudicial. Riscos ocultos, clausulas perigosas, debitos, ocupante e classificacao da oportunidade.

JantonioFC/skillsbank

Embed Photopea in web apps using photopea.js. Covers embedding, file I/O, scripting, exporting, layers, text, filters, and the full Photoshop-compatible API.

JantonioFC/skillsbank

Best practices for Remotion - Video creation in React

JantonioFC/skillsbank

Generate walkthrough videos from Stitch projects using Remotion with smooth transitions, zooming, and text overlays

JantonioFC/skillsbank

Seek and analyze video content using Memories.ai Large Visual Memory Model for persistent video intelligence

JantonioFC/skillsbank

Writes complete, structured landing pages optimized for SEO ranking, AEO citation, and visitor conversion. Activate when the user wants to write or generate a landing page for a product, service, or offer.

JantonioFC/skillsbank

Video and audio perception, indexing, and editing. Ingest files/URLs/live streams, build visual/spoken indexes, search with timestamps, edit timelines, add overlays/subtitles, generate media, and create real-time alerts.

JantonioFC/skillsbank

Upload, stream, search, edit, transcribe, and generate AI video and audio using the VideoDB SDK.

JantonioFC/skillsbank

Skill for discovering and researching autonomous AI agents, tools, and ecosystems using the AgentFolio directory.

JantonioFC/skillsbank

Expert in building portfolios that actually land jobs and clients - not just showing work, but creating memorable experiences. Covers developer portfolios, designer portfolios, creative portfolios, and portfolios that convert visitors into opportunities.

JantonioFC/skillsbank

Tool lifecycle UI components for React/Next.js from ui.inference.sh. Display tool calls: pending, progress, approval required, results. Capabilities: tool status, progress indicators, approval flows, results display. Use for: showing agent tool calls, human-in-the-loop approvals, tool output. Triggers: tool ui, tool calls, tool status, tool approval, tool results, agent tools, mcp tools ui, function calling ui, tool lifecycle, tool pending

JantonioFC/skillsbank

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

JantonioFC/skillsbank

When the user wants help with paid advertising campaigns on Google Ads, Meta (Facebook/Instagram), LinkedIn, Twitter/X, or other ad platforms. Also use when the user mentions 'PPC,' 'paid media,' 'ROAS,' 'CPA,' 'ad campaign,' 'retargeting,' 'audience targeting,' 'Google Ads,' 'Facebook ads,'...

JantonioFC/skillsbank

Create AI avatar and talking head videos with OmniHuman, Fabric, PixVerse via inference.sh CLI. Models: OmniHuman 1.5, OmniHuman 1.0, Fabric 1.0, PixVerse Lipsync. Capabilities: audio-driven avatars, lipsync videos, talking head generation, virtual presenters. Use for: AI presenters, expla...

JantonioFC/skillsbank

Create AI marketing videos for ads, promos, product launches, and brand content. Models: Veo, Seedance, Wan, FLUX for visuals, Kokoro for voiceover. Types: product demos, testimonials, explainers, social ads, brand videos. Use for: Facebook ads, YouTube ads, product launches, brand awarene...

JantonioFC/skillsbank

Generate AI videos with Google Veo, Seedance, Wan, Grok and 40+ models via inference.sh CLI. Models: Veo 3.1, Veo 3, Seedance 1.5 Pro, Wan 2.5, Grok Imagine Video, OmniHuman, Fabric, HunyuanVideo. Capabilities: text-to-video, image-to-video, lipsync, avatar animation, video upscaling, fole...

JantonioFC/skillsbank

Production-ready CI/CD configurations for Playwright — GitHub Actions, GitLab CI, CircleCI, Azure DevOps, Jenkins, Docker, parallel sharding, reporting, code coverage, and global setup/teardown.

JantonioFC/skillsbank

You are an expert copy editor specializing in marketing and conversion copy. Your goal is to systematically improve existing copy through focused editing passes while preserving the core message.

相關技能