playwright-automation-shop-app
AGENTS.md4 starsChanged 13 days agoMITView on GitHub
This document provides essential information for AI coding agents working in this Playwright TypeScript test automation repository.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,542 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- grill-me-qaSkill
- playwright-cliSkill
- qa-test-plannerSkill
- webapp-testingSkill
The file
We split this AGENTS.md into the rules it gives an agent
10 rules. About 0 are common, 3 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 43
No explicit linting: Follow Playwright best practices and TypeScript strict mode
- Very specific: line 113
Use web-first assertions with await: await expect(locator).toHaveText()
- Very specific: line 114
Prefer toHaveText() over toContainText() for exact matches
- Very specific: line 115
Use toMatchAriaSnapshot() for accessibility tree verification
- Very specific: line 116
Use toHaveCount() for element counts
- Very specific: line 117
Use toHaveURL() for navigation verification
- Very specific: line 126
Use expect().toPass() for flaky assertions with retries
- Distinctive: line 130
Use JSDoc for public methods in Page Objects
- Very specific: line 131
Add section dividers in Page Objects: // ── Section Name ───
- Distinctive: line 133
Keep test titles descriptive enough to minimize inline comments
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Guidelines for Playwright Automation Shop
This document provides essential information for AI coding agents working in this Playwright TypeScript test automation repository.
Project Overview
- Framework: Playwright v1.64.1 with TypeScript
- Package Manager: pnpm (v12.5.1)
- Target Application: https://music-tech-shop.vercel.app
- Test Directory:
./tests
Build/Test/Lint Commands
# Run all tests (headless)
npx playwright test
# Run a single test file
npx playwright test tests/e2e/auth/login.spec.ts
# Run tests matching a pattern
npx playwright test --grep "login"
# Run tests by tag
npx playwright test --grep @smoke
npx playwright test --grep @regression
# Run with visible browser (headed mode)
npx playwright test --headed
# Debug mode (opens Playwright Inspector)
npx playwright test --debug
# View HTML report
npx playwright show-reportCode Style Guidelines
TypeScript Configuration
- Target: ESNext with NodeNext module resolution
- Strict mode: Enabled
- No explicit linting: Follow Playwright best practices and TypeScript strict mode
Import Conventions
// Tests: Import from custom test base
import { test, expect } from '../fixtures/test-base';
// Page Objects: Import type-only for Locator/Page
import { type Locator, type Page } from '@playwright/test';
// Data: Use named imports
import { CUSTOMER_USER, ADMIN_USER } from '../../data/users.data';Locator Strategy (Priority Order)
- Role-based (preferred):
page.getByRole('button', { name: 'Submit' }) - Label/Text:
page.getByLabel('Email'),page.getByText('Welcome') - Test IDs:
page.getByTestId('submit-button') - AVOID: CSS selectors (
.btn-primary) and XPath
Naming Conventions
- Test files:
<feature>.spec.ts(e.g.,login.spec.ts) - Page Objects:
<page>.page.tswith PascalCase class names - Fixtures:
<name>.fixture.ts - Data files:
<name>.data.ts - Constants: UPPER_SNAKE_CASE (e.g.,
ADMIN_USER) - Methods: camelCase with descriptive verbs (e.g.,
goto(),login())
Page Object Model Pattern
export class LoginPage extends BasePage {
// Use getters for locators
get emailInput(): Locator {
return this.page.getByRole('textbox', { name: 'Email' });
}
// Fluent interface - return this for chaining
async goto(): Promise<this> {
return this.navigateTo('/login');
}
// Actions are async methods
async login(email: string, password: string): Promise<void> {
await this.emailInput.fill(email);
await this.passwordInput.fill(password);
await this.signInButton.click();
}
}Test Structure
test.describe('Feature Name @smoke', () => {
test.beforeEach(async ({ loginPage }) => {
await loginPage.goto();
});
test('Descriptive test name', async ({ loginPage, page }) => {
await test.step('Action description', async () => {
await loginPage.login(CUSTOMER_USER.email, CUSTOMER_USER.password);
});
await test.step('Verification', async () => {
await expect(page).toHaveURL('/');
});
});
});Assertions
- Use web-first assertions with
await:await expect(locator).toHaveText() - Prefer
toHaveText()overtoContainText()for exact matches - Use
toMatchAriaSnapshot()for accessibility tree verification - Use
toHaveCount()for element counts - Use
toHaveURL()for navigation verification
Test Tags
@smoke- Critical path tests (20 tests)@regression- Full test suite (121 tests)@a11y- Accessibility tests (14 tests)
Error Handling
- Rely on Playwright's auto-waiting; avoid hard-coded waits
- Use
expect().toPass()for flaky assertions with retries - Let assertions fail naturally; don't catch errors unless testing error scenarios
Comments & Documentation
- Use JSDoc for public methods in Page Objects
- Add section dividers in Page Objects:
// ── Section Name ─── - Comments should explain WHY, not WHAT
- Keep test titles descriptive enough to minimize inline comments
Project Structure
tests/
├── e2e/ # Test specs organized by feature
│ ├── auth/
│ ├── cart/
│ ├── products/
│ └── ...
├── pages/ # Page Object Model classes
├── fixtures/ # Custom Playwright fixtures
├── data/ # Test data (users, products, etc.)
└── helpers/ # Utility functionsVSCode Integration
The project has MCP server configuration for Playwright tools in .vscode/mcp.json.
Key Files to Reference
playwright.config.ts- Test configurationtests/fixtures/test-base.ts- Central test fixture exporttests/pages/base.page.ts- Base Page Object class.github/instructions/playwright-typescript.instructions.md- Detailed test writing guidelines
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

