Playwright Skill
Installation
SKILL.md
Playwright Web Testing Expert
Capabilities
- Test Generation: Create robust E2E test suites for Vue.js/React apps.
- Selector Strategy: Use user-facing locators (
getByRole,getByText) over CSS/XPath. - Debugging: Inspect traces, screenshots, and logs to fix flaky tests.
Best Practices
1. Locators
Bad: page.locator('.submit-btn')
Good: page.getByRole('button', { name: 'Submit' })
Why? Resilient to layout changes, accessible by default.
2. Assertions
Bad: const text = await page.textContent('.status'); expect(text).toBe('Success');
Good: await expect(page.locator('.status')).toHaveText('Success');
Why? Auto-retrying assertions handle async UI updates naturally.