---
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 документы для инженерной команды
- Связанные документы:
  - [Индекс Agents](../README.md)
  - [Команды разработки](../commands.md)
  - [Инженерные принципы](../../governance/engineering-principles.md)

## Playwright E2E Test Execution

**Impact: MEDIUM**

### Critical Paths to Cover

1. **Catalog browsing**: Home → Filter → Item detail
2. **Lead submission**: Item detail → Lead form → Confirmation
3. **Seller flow**: Login → Dashboard → Create item → Publish
4. **Admin flow**: Login → Moderation → Approve/Reject item

### Test Structure

```typescript
// 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

```bash
# 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-testid` attributes for reliable selectors
- Tests must be independent — no shared state between tests
- Keep E2E tests focused on critical paths, not edge cases
