360 Secure SkillHub
360 安全技能中心

playwright

提供 45 条按优先级组织的 Playwright + Next.js E2E 测试规则,覆盖测试架构、选择器、等待与断言、认证状态、网络模拟、Next.js 集成、性能与调试,并附错误与正确代码示例,用于编写、审查和修复不稳定测试。

分类:开发
PyModel
热度 0.00
最近更新 2026-11-10 05:27:21

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add pymodel/react-frontend-skills/playwright
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
playwright
description
Playwright end-to-end tests and flaky-test fixes.

Playwright + Next.js Testing Best Practices

Comprehensive testing optimization guide for Playwright with Next.js applications. Contains 45 rules across 8 categories, prioritized by impact to guide reliable, fast, and maintainable E2E tests. Current: Playwright 1.65 (1.65.0).

When to Apply

Reference these guidelines when:

  • Writing new Playwright tests for Next.js apps
  • Debugging flaky or failing tests
  • Optimizing test execution speed
  • Setting up authentication state reuse
  • Configuring CI/CD pipelines for testing
  • Testing Server Components and App Router features
  • Reviewing test code for reliability issues

Rule Categories by Priority

Priority Category Impact Prefix
1 Test Architecture CRITICAL arch-
2 Selectors & Locators CRITICAL loc-
3 Waiting & Assertions HIGH wait-
4 Authentication & State HIGH auth-
5 Mocking & Network MEDIUM-HIGH mock-
6 Next.js Integration MEDIUM next-
7 Performance & Speed MEDIUM perf-
8 Debugging & CI LOW-MEDIUM debug-

Quick Reference

1. Test Architecture (CRITICAL)

2. Selectors & Locators (CRITICAL)

3. Waiting & Assertions (HIGH)

4. Authentication & State (HIGH)

5. Mocking & Network (MEDIUM-HIGH)

6. Next.js Integration (MEDIUM)

7. Performance & Speed (MEDIUM)

8. Debugging & CI (LOW-MEDIUM)

How to Use

Run in the project root first:

npx -y @pymodel/react-frontend-skills detect   # installed vs. targeted versions

Read references/<rule-id>.md for each rule above that matches the task: why it matters, then incorrect vs. correct code.