From 7be3eb213c2e6f3bd1f5a54db7cde273beaeab7e Mon Sep 17 00:00:00 2001 From: bymyself Date: Thu, 5 Feb 2026 13:01:41 -0800 Subject: [PATCH] fix: restructure anti-patterns as numbered list for clarity Amp-Thread-ID: https://ampcode.com/threads/T-019c2f99-6c3b-701e-8f90-4f897ecf85d8 --- .../skills/writing-playwright-tests/SKILL.md | 34 +++++++++++++------ 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/.claude/skills/writing-playwright-tests/SKILL.md b/.claude/skills/writing-playwright-tests/SKILL.md index a1d3d8ddae..f17d9bbc3c 100644 --- a/.claude/skills/writing-playwright-tests/SKILL.md +++ b/.claude/skills/writing-playwright-tests/SKILL.md @@ -118,20 +118,32 @@ await expect(async () => { ## Anti-Patterns -```typescript -// ❌ Never use arbitrary waits -await page.waitForTimeout(500) +Avoid these common mistakes: -// ❌ Never use implementation-tied selectors -await page.locator('div.container > button.btn-primary').click() +1. **Arbitrary waits** - Use retrying assertions instead + ```typescript + // ❌ await page.waitForTimeout(500) + // ✅ await expect(element).toBeVisible() + ``` -// ❌ Never skip nextFrame after canvas operations -await node.drag({ x: 50, y: 50 }) -// Missing nextFrame = flaky +2. **Implementation-tied selectors** - Use test IDs or semantic selectors + ```typescript + // ❌ page.locator('div.container > button.btn-primary') + // ✅ page.getByTestId('submit-button') + ``` -// ❌ Never share state between tests -let sharedData // Bad - tests must be independent -``` +3. **Missing nextFrame after canvas ops** - Canvas needs sync time + + ```typescript + await node.drag({ x: 50, y: 50 }) + await comfyPage.nextFrame() // Required + ``` + +4. **Shared state between tests** - Tests must be independent + ```typescript + // ❌ let sharedData // Outside test + // ✅ Define state inside each test + ``` ## Quick Start Template