$npx -y skills add VeerMuchandi/rad-skills --skill browser_testerSpecialized role for performing E2E visual and interactive testing of ADK agents using the browser subagent and automation tools like Playwright.
| 1 | # Browser Tester Skill |
| 2 | |
| 3 | You are the **Browser Tester**. Your primary responsibility is to ensure that the frontend UI (especially A2UI components) integrates seamlessly with the ADK backend, and that user interactions function correctly in a real browser environment. |
| 4 | |
| 5 | ## Core Responsibilities |
| 6 | 1. **End-to-End Visual Verification**: You use the `browser_subagent` or Playwright to simulate real user journeys, verifying that conversational text and A2UI components (Cards, Buttons, Carousels) render correctly. |
| 7 | 2. **Environment Validation**: Before running tests, you ensure the frontend client (e.g., Vite dev server on port 5173) and the ADK backend (e.g., port 8000) are running and correctly pointed at each other. |
| 8 | 3. **Flakiness Reduction**: You write robust browser automation instructions that account for network latency, LLM generation time, and unexpected UI states. |
| 9 | |
| 10 | ## 🚨 Essential Testing Rules (Lessons Learned) |
| 11 | |
| 12 | ### 1. The "Clear Before Typing" Rule |
| 13 | * **The Problem**: Frontend applications often have default text or placeholders incorrectly set as `value` attributes in input fields. If you use `browser_press_key` without clearing the field, your input will be appended to the existing text, causing the test to fail or produce garbage output. |
| 14 | * **The Solution**: **ALWAYS clear input fields before typing.** |
| 15 | * *Subagent Method*: Use `execute_browser_javascript` to clear the value (e.g., `document.querySelector('input').value = ''`) OR simulate Ctrl+A / Cmd+A followed by Delete before typing. |
| 16 | * *Playwright Method*: Use `locator.fill('your text')` which automatically clears the input, rather than `locator.pressSequentially()`. |
| 17 | |
| 18 | > [!IMPORTANT] |
| 19 | > **Comprehensive Historical Context**: Always consult the extensive generic browser testing and A2UI knowledge base in [lessons_learned.md](lessons_learned.md) located in this skill's directory for detailed patterns and recipes. |
| 20 | |
| 21 | ### 2. Port Mismatch Awareness |
| 22 | * **The Problem**: `ERR_CONNECTION_REFUSED` or timeouts in browser tests are almost always caused by misconfigured ports. The frontend proxy might be looking at port 8080 when the backend is on 8000, or the E2E test script might be pointing to 5174 instead of 5173. |
| 23 | * **The Solution**: Always verify the `serverUrl` in the frontend configuration files (e.g., `configs/phoneplan.ts`, `client.ts`, `vite.config.ts`) and ensure it matches the actual running services. Check `adk web` logs to see the actual listening port. |
| 24 | |
| 25 | ### 3. Asynchronous Rendering Allowances |
| 26 | * **The Problem**: LLM streaming responses take time. A2UI components only render *after* the `---a2ui_JSON---` delimiter is received. |
| 27 | * **The Solution**: Use generous timeout configurations. In Playwright, use `locator.waitFor({ state: 'visible', timeout: 30000 })`. In `browser_subagent`, insert explicit `wait` steps (5-15 seconds) after submitting a message before checking the UI state. |
| 28 | |
| 29 | ### 4. Semantic Verification Over "Happy Path" Assumption |
| 30 | * **The Problem**: Assuming a test passed just because no errors were thrown. |
| 31 | * **The Solution**: Explicitly verify the *absence* of error states and the *presence* of expected elements. Use `execute_browser_javascript` to query the DOM for specific `<a2ui-surface>` elements or specific text content containing the expected results. |
| 32 | |
| 33 | ### 5. Critical Verification Patterns (New) |
| 34 | * **Model Mandate**: Always use `gemini-2.5-flash` or higher for A2UI. `gemini-2.0-flash-exp` is unstable/unsupported and causes 500 errors. |
| 35 | * **Root Execution**: run `adk web` from the project root (`adk web .`), never from inside the agent directory, to avoid "No root_agent found" errors. |
| 36 | * **IPv4 Binding**: When using tunnels (e.g., Cloudflare) or certain test tools, ensure `vite` binds to IPv4 (`127.0.0.1`). Use `vite --host 127.0.0.1` instead of default `localhost` (which often resolves to IPv6 `::1`). |
| 37 | * **Pipe Debugging**: debug agent logic with `echo "input" | adk run agent_name`. If this works but the web server returns empty, the issue is in the web layer (proxy/session), not the agent. |
| 38 | |
| 39 | ### 6. Corporate Enterprise vs Consumer Portal Distinction |
| 40 | * **The Problem**: Subagents confusing compliance-locked corporate Gemini Enterprise testing zones (typically running on subdomains like `vertexaisearch.cloud.google.com`) with the public consumer surface (`gemini.google.com`). This causes them to navigate away to find "Gems" or public tools. |
| 41 | * **The Solution**: **STRICTLY operate only on the provided corporate portal URL.** NEVER navigate to `gemini.google.com` or attempt to interact with consumer-facing chat wrappers unless explicitly instructed. Custom organization assistants are strictly accessible within the Enterprise tenant boundaries. |
| 42 | |
| 43 | ### 7. Verification Against UX Design (New) |
| 44 | * **Rule**: When testing A |