Skip to content

Commit 376f035

Browse files
committed
Use playwright MCP as the recommended way to test RDoc end to end
1 parent b2788de commit 376f035

File tree

2 files changed

+46
-17
lines changed

2 files changed

+46
-17
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@
1212
/tmp
1313
/node_modules
1414
Gemfile.lock
15+
16+
# Playwright MCP uses this folder to store screenshots
17+
.playwright-mcp/

AGENTS.md

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -274,15 +274,12 @@ When making changes to theme CSS or templates (e.g., Darkfish or Aliki themes):
274274

275275
1. **Generate documentation**: Run `bundle exec rake rerdoc` to create baseline
276276
2. **Start HTTP server**: Run `cd _site && python3 -m http.server 8000` (use different port if 8000 is in use)
277-
3. **Investigate with sub-agent**: Use Task tool to launch a general-purpose agent to inspect the documentation with Browser MCP
278-
- The agent will connect browser to `http://localhost:8000`, navigate pages, and take screenshots
279-
- Agent reports findings back (styling issues, layout problems, etc.)
280-
- This saves context in main conversation
277+
3. **Investigate with Playwright**: Ask the AI assistant to take screenshots and inspect the documentation visually
278+
- Example: "Navigate to the docs at localhost:8000 and screenshot the RDoc module page"
279+
- See "Playwright MCP for Testing Generated Documentation" section below for details
281280
4. **Make changes**: Edit files in `lib/rdoc/generator/template/<theme>/` as needed
282281
5. **Regenerate**: Run `bundle exec rake rerdoc` to rebuild documentation with changes
283-
6. **Verify with sub-agent**: Use Task tool again to launch agent that uses Browser MCP to verify fixes
284-
- Agent takes screenshots and compares to original issues
285-
- Agent reports back whether issues are resolved
282+
6. **Verify with Playwright**: Take new screenshots and compare to original issues
286283
7. **Lint changes** (if modified):
287284
- ERB templates: `npx @herb-tools/linter "lib/rdoc/generator/template/**/*.rhtml"`
288285
- CSS files: `npm run lint:css -- --fix`
@@ -302,23 +299,47 @@ When making changes to theme CSS or templates (e.g., Darkfish or Aliki themes):
302299
5. **Verify generated files** with `rake verify_generated`
303300
6. **Don't edit generated files** directly (in `lib/rdoc/markdown/` and `lib/rdoc/rd/`)
304301

305-
## Browser MCP for Testing Generated Documentation
302+
## Playwright MCP for Testing Generated Documentation
306303

307-
Browser MCP allows AI agents to visually inspect and interact with the generated HTML documentation. This is useful for verifying CSS styling, layout issues, and overall appearance.
304+
The Playwright MCP server enables visual inspection and interaction with generated HTML documentation. This is useful for verifying CSS styling, layout issues, and overall appearance.
308305

309-
**Repository:** <https://github.com/BrowserMCP/mcp>
306+
**MCP Server:** `@playwright/mcp` (Microsoft's official browser automation server)
310307

311308
### Setup
312309

313-
If Browser MCP is not already installed, users should:
310+
The Playwright MCP server can be used with any MCP-compatible AI tool (Claude Code, Cursor, GitHub Copilot, OpenAI Agents, etc.).
314311

315-
1. Install the BrowserMCP Chrome extension from the Chrome Web Store
316-
2. Run: `claude mcp add --scope user browsermcp npx @browsermcp/mcp@latest`
317-
3. Connect a browser tab by clicking the BrowserMCP extension icon and selecting "Connect"
312+
**Claude Code:**
313+
314+
```bash
315+
/plugin playwright
316+
```
317+
318+
**Other MCP-compatible tools:**
319+
320+
```bash
321+
npx @playwright/mcp@latest
322+
```
323+
324+
Configure your tool to connect to this MCP server. Playwright launches its own browser instance automatically - no manual browser setup or extensions required.
325+
326+
### Troubleshooting: Chrome Remote Debugging Blocked
327+
328+
If you encounter `DevTools remote debugging is disallowed by the system admin`, Chrome's debugging is blocked by the machine's policy. Use Firefox instead:
329+
330+
```bash
331+
# Install Firefox for Playwright
332+
npx playwright install firefox
333+
334+
# Add Playwright MCP with Firefox to your project (creates/updates .mcp.json)
335+
claude mcp add playwright --scope project -- npx -y @playwright/mcp@latest --browser firefox
336+
```
337+
338+
Restart Claude Code after running these commands.
318339

319340
### Testing Generated Documentation
320341

321-
To test the generated documentation with Browser MCP:
342+
To test the generated documentation:
322343

323344
```bash
324345
# Generate documentation
@@ -330,6 +351,11 @@ cd _site && python3 -m http.server 8000
330351

331352
If port 8000 is already in use, try another port (e.g., `python3 -m http.server 9000`).
332353

333-
Then navigate to the appropriate URL (e.g., `http://localhost:8000`) in your connected browser tab and ask Claude to use browser MCP tools (e.g., "use browser MCP to navigate to <http://localhost:8000> and take a screenshot").
354+
Then ask the AI assistant to inspect the documentation. It will use the appropriate Playwright tools (`browser_navigate`, `browser_snapshot`, `browser_take_screenshot`, etc.) based on your request.
355+
356+
**Example requests:**
334357

335-
**Note:** Browser MCP requires a proper HTTP server (not `file://` URLs) for full functionality. The generated documentation must be served via HTTP/HTTPS.
358+
- "Navigate to `http://localhost:8000` and take a screenshot"
359+
- "Take a screenshot of the RDoc module page"
360+
- "Check if code blocks are rendering properly on the Markup page"
361+
- "Compare the index page before and after my CSS changes"

0 commit comments

Comments
 (0)