---
description: Generate a Playwright Page Object Model for a single live URL using the Playwright MCP bridge
argument-hint: "<URL> [output-dir] [auth-env-file]"
---

Use the `playwright-pom` skill and the Playwright MCP `browser_*` tools to generate a Page Object Model for the single page at $1.

Scope and rules:
- Only generate a POM for the exact page at $1 — do not navigate to or explore any other pages.
- Use `browser_navigate` to open the page and `browser_snapshot` to inspect the accessibility tree.
- Generate one page object for this page (plus small reusable component objects only if the page clearly contains distinct, reusable UI components).
- Use resilient locators: `getByRole`, `getByLabel`, `getByTestId`, `getByPlaceholder`, `getByText` (in that order). Use CSS/XPath only as a last resort.
- Each page object should expose high-level business methods (e.g., `loginAs(user)`, `searchFor(term)`) built from the low-level locators.
- Keep implementation details (selectors, URLs) inside the page object; tests should read like user workflows.
- Save the generated files under `${2:-tests/pom/}` using clear, kebab-case names (e.g., `login-page.ts`).
- Only target applications you own or have explicit authorization to test.
- Do not interact with destructive actions (delete, remove, sign out) unless explicitly requested.
- Report what was covered once the page object is complete.

## Authentication

If the site requires login, handle credentials securely:

1. **Preferred: provide an auth env file** as the third argument (`$3`).
   - The env file should contain variables such as:
     ```bash
     POM_AUTH_URL=https://example.com/login
     POM_USERNAME=user@example.com
     POM_PASSWORD=secret
     ```
   - Load the file in a single bash command, use the values immediately to log in via `browser_navigate` + `browser_fill_form`/`browser_type`, and **do not echo, log, or persist the values anywhere**.
   - Do not include the env file in generated POMs, snapshots, or test code.
   - Mark the env file in `.gitignore` and delete it when the session is complete.

2. **Fallback: manual login**.
   - If no env file is provided, `browser_navigate` to the login page and ask the user to complete login manually in the browser session.
   - Then continue generating POMs from the authenticated state.

3. **Never** ask the user to paste credentials into the chat, and **never** hardcode credentials into generated files.

After generating, summarize:
- The page (and any components) covered
- The output file path(s)
- Any parts of the page that could not be inspected and why
- How authentication was handled (env file or manual)