**TL;DR**: `/e2e [test-name]` - Generate and run Playwright E2E tests with Page Object Model.

---

## Usage

```bash
/e2e                        # Generate E2E for current feature
/e2e login-flow             # Generate specific test
/e2e run                    # Run all E2E tests
/e2e debug login.spec.ts    # Debug specific test
/e2e update-snapshots       # Update visual regression snapshots
```

## What Gets Generated

### Page Objects
```typescript
// tests/e2e/pages/login.page.ts
export class LoginPage {
  readonly page: Page;
  readonly emailInput: Locator;
  readonly passwordInput: Locator;
  readonly submitButton: Locator;

  constructor(page: Page) {
    this.page = page;
    this.emailInput = page.getByLabel('Email');
    this.passwordInput = page.getByLabel('Password');
    this.submitButton = page.getByRole('button', { name: 'Sign in' });
  }

  async login(email: string, password: string) {
    await this.emailInput.fill(email);
    await this.passwordInput.fill(password);
    await this.submitButton.click();
  }
}
```

### Test Specs
```typescript
// tests/e2e/login.spec.ts
test('user can login with valid credentials', async ({ page }) => {
  const loginPage = new LoginPage(page);
  await loginPage.goto();
  await loginPage.login('user@example.com', 'password');
  await expect(page.getByTestId('dashboard')).toBeVisible();
});
```

## Locator Priority

1. `getByRole()` - Semantic, accessible
2. `getByLabel()` - Form elements
3. `getByText()` - Content-based
4. `getByTestId()` - Last resort

## Python Support

```python
# tests/e2e/test_login.py
from playwright.sync_api import Page, expect

class TestLogin:
    def test_user_can_login(self, page: Page):
        login_page = LoginPage(page)
        login_page.goto()
        login_page.login("user@example.com", "password")
        expect(page.get_by_test_id("dashboard")).to_be_visible()
```

## Integration

This command invokes the **E2E Runner Agent** which:
- Generates Page Object Model tests
- Handles flaky test detection
- Runs tests with smart retry
