проектdocs/Agents/rules/testing-playwright.md
Run all E2E tests
Обновлён 1 апр. 2026 г., 12:41 · 0 комментариев
title: Playwright E2E Test Execution impact: MEDIUM impactDescription: Ensures critical user flows work end-to-end tags: testing, playwright, e2e
Паспорт документа
- Статус документа: living standard
- Актуально на: 28 марта 2026 года
- Владелец: backend/platform-команда
- Пересмотр: при изменении инженерной практики, CI/CD, архитектурных правил или локального workflow
- Область применения: внутренние rule/reference-card документы для инженерной команды
- Связанные документы:
Playwright E2E Test Execution
Impact: MEDIUM
Critical Paths to Cover
- Catalog browsing: Home → Filter → Item detail
- Lead submission: Item detail → Lead form → Confirmation
- Seller flow: Login → Dashboard → Create item → Publish
- Admin flow: Login → Moderation → Approve/Reject item
Test Structure
// tests/catalog.spec.ts
import { test, expect } from '@playwright/test';
test.describe('Catalog', () => {
test('displays published items', async ({ page }) => {
await page.goto('/');
await expect(page.locator('[data-testid="item-card"]')).toHaveCount.greaterThan(0);
});
test('filters by subject', async ({ page }) => {
await page.goto('/');
await page.click('[data-testid="filter-subject-math"]');
await expect(page).toHaveURL(/subject=mathematics/);
});
test('opens item detail page', async ({ page }) => {
await page.goto('/');
await page.click('[data-testid="item-card"]:first-child');
await expect(page.locator('h1')).toBeVisible();
});
});
Running E2E Tests
# Run all E2E tests
pnpm e2e
# Run specific file
pnpm e2e -- tests/catalog.spec.ts
# Run with UI mode (debugging)
pnpm e2e -- --ui
# Run specific test by name
pnpm e2e -- --grep "filters by subject"
Rules
- E2E tests run against a seeded test database
- Use
data-testidattributes for reliable selectors - Tests must be independent — no shared state between tests
- Keep E2E tests focused on critical paths, not edge cases