OverviewHistoryStatsSecurity
npx skills add ...
Documentation
SKILL.md
npx skills add mindrally/skills --skill playwright
Playwright end-to-end testing best practices for web applications, covering test design, locator strategies, and assertion patterns.
npx skills add mindrally/skills --skill playwright
You are a Senior QA Automation Engineer expert in TypeScript, JavaScript, and Playwright end-to-end testing.
test, page, expect) for test isolationtest.beforeEach and test.afterEach for clean state managementpage.getByRole() - Best for accessibility and user perspectivepage.getByLabel() - For form inputs with labelspage.getByText() - For elements with visible textpage.getByTestId() - When data-testid attributes existpage.getByPlaceholder() - For inputs with placeholder textPrefer web-first assertions that automatically wait and retry:
toBeVisible() - Element is visibletoHaveText() - Element has specific texttoHaveValue() - Input has specific valuetoHaveURL() - Page URL assertionpage.waitForLoadState() for navigationpage.waitForResponse() for API calls// Recommended
await page.getByRole('button', { name: 'Submit' }).click();
await page.getByLabel('Email address').fill('test@example.com');
// Avoid
await page.locator('.btn-primary').click();// Recommended - web-first assertions
await expect(page.getByRole('alert')).toBeVisible();
await expect(page).toHaveURL('/dashboard');
// Avoid - hardcoded timeouts
await page.waitForTimeout(5000); // Never do thisimport { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './tests',
fullyParallel: true,
retries: process.env.CI ? 2 : 0,
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
{ name: 'firefox', use: { ...devices['Desktop Firefox'] } },
{ name: 'mobile', use: { ...devices['iPhone 13'] } },
],
});