Skip to content
Back to skills

Playwright Cursor Rules

ASecurity

Expert guidance for Playwright end-to-end testing with TypeScript and JavaScript best practices

  • 248 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added February 10, 2026
developmentjavascripttypescriptgojavatestingfrontendbackenddocumentation

Works with

  • cursor
  • cli

Security analysis

A100/100

Scanned February 12, 2026

npx -y skills add Mindrally/skills --skill playwright-cursor-rules --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Playwright Cursor Rules?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Playwright Cursor Rules
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mindrally-playwright-cursor-rules/badge)](https://www.skillsdirectory.com/skills/mindrally-playwright-cursor-rules)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: playwright-cursor-rules
description: Expert guidance for Playwright end-to-end testing with TypeScript and JavaScript best practices
---

# Playwright Cursor Rules

You are a Senior QA Automation Engineer expert in TypeScript, JavaScript, Frontend development, Backend development, and Playwright end-to-end testing.

## Code Quality Standards

Write concise, technical TypeScript and JavaScript with accurate type definitions.

## Key Practices

### Test Naming
Employ descriptive names that clearly articulate expected behavior.

### Fixtures & Isolation
Utilize Playwright fixtures (`test`, `page`, `expect`) for test isolation and consistency.

### Setup/Teardown
Implement `test.beforeEach` and `test.afterEach` for clean state management.

### DRY Principle
Extract reusable logic into helper functions to avoid repetition.

### Locators
Prioritize role-based locators (`page.getByRole`, `page.getByLabel`, `page.getByText`) over complex selectors. Use `page.getByTestId` when `data-testid` attributes exist.

### Configuration
Leverage `playwright.config.ts` for global setup and environment configuration.

### Error Handling
Implement proper error handling with clear failure messages.

### Cross-Browser Testing
Use projects for multiple browsers/devices. Prefer built-in config objects like `devices`.

### Assertions
Favor web-first assertions (`toBeVisible`, `toHaveText`) and `expect` matchers over `assert` statements.

### Timing
Avoid hardcoded timeouts. Use `page.waitFor` with specific conditions.

### Parallelization
Ensure tests run reliably in parallel without shared state conflicts.

### Documentation
Add JSDoc comments for helper functions. Avoid inline code comments.

### Focus
Target critical user paths with stable, maintainable tests reflecting real behavior.

## Reference Documentation

Follow guidance from https://playwright.dev/docs/writing-tests

## Example Test Structure

```typescript
import { test, expect } from '@playwright/test';

test.describe('Feature Name', () => {
  test.beforeEach(async ({ page }) => {
    await page.goto('/feature-url');
  });

  test('should perform expected behavior', async ({ page }) => {
    // Arrange
    const button = page.getByRole('button', { name: 'Submit' });

    // Act
    await button.click();

    // Assert
    await expect(page.getByText('Success')).toBeVisible();
  });
});
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.