| name | qa-target-setup |
| description | Interactive setup for a new target application. Navigates to the URL, detects auth requirements, walks through login flow creation, auto-detects scope, and saves target config. Use when user says: "setup target", "add target", "configure app", "new target".
|
| allowed-tools | Bash(playwright-cli:*), Bash(npx playwright-cli:*), Read, Write, Glob, Grep |
Target Application Setup
Interactive wizard to create a new target config in data/targets/.
Flow
1. Gather Basic Info
Ask user for:
- Target name (slug for filename, e.g., "company-staging")
- Base URL (e.g., "https://staging.company.com")
- Domain type (ecommerce, saas, fintech, marketing, or auto-detect)
2. Navigate and Analyze
playwright-cli open <base_url>
playwright-cli snapshot
From the snapshot, detect:
- Is this a login page? (look for password fields, "Sign in" buttons)
- What's the main navigation structure?
- What kind of application is this? (helps auto-detect domain)
3. Handle Authentication
If no login detected:
- Set
auth.strategy: none
- Skip to step 4
If login detected:
Ask user which auth strategy to use:
Option A: Storage State (recommended)
- Ask user to provide env var names for credentials
- Login via playwright-cli:
playwright-cli snapshot
playwright-cli fill <email_ref> "$<username_env>"
playwright-cli fill <password_ref> "$<password_env>"
playwright-cli click <submit_ref>
- Verify login succeeded (snapshot shows dashboard/profile)
- Save state:
playwright-cli state-save .auth/<target-name>.json
- Set
auth.strategy: storage_state with state_file: ".auth/<target-name>.json"
Option B: Token
- Ask for token env var name and injection method (cookie/localStorage)
- Set
auth.strategy: token
4. Detect Scope
After login (or on the landing page):
playwright-cli snapshot
From the snapshot, identify:
- Top-level navigation sections → suggest as
start_pages
- Suggest
include_patterns based on URL structure
- Suggest
exclude_patterns for common exclusions (/admin, /api, *.pdf)
Ask user to confirm/modify scope.
5. Configure Browser Settings
Suggest defaults:
headless: false (so user can watch)
viewport: { width: 1280, height: 720 }
- Ask if mobile testing is needed (add device emulation)
6. Safety Settings
Ask if this is a production environment:
- If yes: set
safety.read_only: true, safety.no_form_submit: true
- If no: no safety restrictions
7. Save Config
Write data/targets/<target-name>.yml with all gathered configuration.
Close browser:
playwright-cli close
Update .env.example with any new env var names.
8. Confirm
Present the saved config to user:
- Target name and URL
- Auth strategy configured
- Scope defined
- How to use:
/qa-explore --target <target-name>
9. Optional — Offer Playwright Test Agents Bootstrap
If the user plans to author full Playwright tests against this target later (not just exploratory sessions), offer to scaffold the Test Agents workspace now while you already have credentials and scope loaded:
npx playwright init-agents --loop=claude
This creates the planner / generator / healer agent definitions in the target project (Playwright 1.56+). It is strictly optional — declining does not affect the target config just written. If the user accepts, note in the target config's notes field that Test Agents are scaffolded; if they decline, continue normally.
This step requires @playwright/test to be installed in the target project. If it is not, skip this step silently.