AgentSkillsCN

playwright

Playwright 端到端测试的最佳实践,包括环境搭建、配置设置以及测试模式

SKILL.md
--- frontmatter
name: playwright
description: Best practices for Playwright E2E testing including setup, configuration, and test patterns
goal: พัฒนา E2E tests ด้วย Playwright ตาม best practices
outcome: E2E test suites ที่มีความน่าเชื่อถือ บำรุงรักษาง่าย และทำงานได้จริง

Playwright

When to Use

ใช้ Skill นี้เมื่อต้องการพัฒนา E2E tests ด้วย Playwright

  • เมื่อสร้าง E2E test suite ใหม่สำหรับ web application
  • เมื่อต้องการตั้งค่า Playwright configuration สำหรับ CI/CD
  • เมื่อต้องการเขียน tests ที่มีความน่าเชื่อถือและ maintainable
  • เมื่อต้องการ integrate Playwright กับ testing frameworks
  • เมื่อต้องการ optimize test performance และ parallel execution

Quick Start

  1. ติดตั้ง Playwright ด้วย npm init playwright@latest
  2. ตั้งค่าโครงสร้าง tests ตาม 1-playwright-project-structure.md
  3. ตั้งค่า Playwright configuration ใน playwright.config.ts ตาม 2-playwright-configuration.md
  4. เขียน tests ตาม patterns ใน 3-playwright-test-patterns.md
  5. รัน npx playwright test เพื่อทดสอบการทำงาน

Rules

PriorityImpactReferenceNameDescriptionPrefixCondition
1CRITICAL1-playwright-project-structure.mdProject Structureโครงสร้างโปรเจกต์ Playwright ที่ถูกต้องplaywright-เมื่อสร้าง project
2HIGH2-playwright-configuration.mdConfigurationตั้งค่า Playwright configuration ให้เหมาะสมplaywright-เมื่อตั้งค่า config
3HIGH3-playwright-test-patterns.mdTest Patternsเขียน tests ตาม best practicesplaywright-เมื่อเขียน tests
4HIGH4-playwright-page-objects.mdPage Objectsใช้ Page Object Model สำหรับ maintainabilityplaywright-เมื่อจัดการ pages
5MEDIUM5-playwright-fixtures.mdFixturesสร้างและใช้ fixtures อย่างมีประสิทธิภาพplaywright-เมื่อใช้ fixtures

Knowledge

ReferenceNameDescriptionPrefix
core-concepts.mdCore Conceptsความรู้เกี่ยวกับ concepts หลักของ Playwrightplaywright-
all-features.mdAll Featuresความรู้เกี่ยวกับฟีเจอร์ทั้งหมดของ Playwrightplaywright-
best-practices.mdBest Practicesbest practices สำหรับการใช้ Playwrightplaywright-

Verification

  1. ตรวจสอบว่า Playwright ติดตั้งและตั้งค่าถูกต้องด้วย npx playwright --version
  2. ทดสอบด้วยการรัน npx playwright test และตรวจสอบว่า tests ทำงานได้
  3. ตรวจสอบว่า test reports สร้างได้ถูกต้องใน playwright-report
  4. ตรวจสอบว่า CI/CD integration ทำงานได้ถ้ามีการตั้งค่า