Skip to content

Commit 7bb9bf0

Browse files
committed
Docs: Update Playwright MCP Usage
Signed-off-by: Michael Mayer <michael@photoprism.app>
1 parent 71c0137 commit 7bb9bf0

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

AGENTS.md

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PhotoPrism® Repository Guidelines
22

3-
**Last Updated:** October 14, 2025
3+
**Last Updated:** October 15, 2025
44

55
## Purpose
66

@@ -148,21 +148,37 @@ Note: Across our public documentation, official images, and in production, the c
148148

149149
### Playwright MCP Usage
150150

151-
- **Endpoint & Navigation** — Playwright MCP is preconfigured to reach the dev server at `http://localhost:2342/`.
151+
- **Endpoint & Navigation** — Playwright MCP is preconfigured to reach the dev server at `http://localhost:2342/`.
152152
Use `playwright__browser_navigate` to open `/library/login`, sign in, and then call `playwright__browser_take_screenshot` to capture the page state.
153-
- **Viewport Defaults** — Desktop sessions open with a `1280×900` viewport by default.
153+
- **Viewport Defaults** — Desktop sessions open with a `1280×900` viewport by default.
154154
Use `playwright__browser_resize` if the viewport is not preconfigured or you need to adjust it mid-run.
155155
- **Mobile Workflows** — When testing responsive layouts, use the `playwright_mobile` server (for example, `playwright_mobile__browser_navigate`).
156156
It launches with a `375×667` viewport, matching a typical smartphone display, so you can capture mobile layouts without manual resizing.
157-
- **Authentication** — Default admin credentials are `admin` / `photoprism`.
158-
If login fails, check your active Compose file or container environment for `PHOTOPRISM_ADMIN_USER` and `PHOTOPRISM_ADMIN_PASSWORD`.
159-
- **Capturing Artifacts**
160-
- Keep screenshots limited to the visible viewport (`fullPage: false` or unset) unless a full-page capture is explicitly required.
161-
- Copy the MCP output file into `.local/screenshots/` (create the folder if it doesn’t exist).
162-
- To reduce context size, avoid embedding large screenshots in chat history—reference the file path instead.
163-
- **Sidebar Navigation** — The sidebar nests items such as `Library → Errors`.
164-
Expand a parent entry by clicking its chevron before selecting links inside.
157+
- **Authentication** — Default admin credentials are `admin` / `photoprism`:
158+
- If login fails, check your active Compose file or container environment for `PHOTOPRISM_ADMIN_USER` and `PHOTOPRISM_ADMIN_PASSWORD`.
159+
- Tip: if your MCP supports it, persist a storage state after login and reuse it in later steps to skip re-authentication.
160+
- **Sidebar Navigation** — The sidebar nests items such as `Library → Errors`:
161+
- Expand a parent entry by clicking its chevron before selecting links inside.
165162
- **Session Cleanup** — After scripted interactions, close the browser tab with `playwright__browser_close` (or `playwright_mobile__browser_close`) to keep the MCP session tidy for subsequent runs.
163+
- **Stability / Waiting** — Prefer robust waits over sleeps:
164+
- After navigation: `waitUntil: 'networkidle'` (or wait for a key locator).
165+
- Before clicking: ensure the locator is `visible` and `enabled`.
166+
- Use role/label/text selectors over brittle XPaths.
167+
- **Screenshot Format & Size** — Keep artifacts small and reproducible:
168+
- Prefer **JPEG** with quality (e.g., `quality: 80`) instead of PNG.
169+
- Limit to the visible viewport (`fullPage: false`), unless explicitly required.
170+
- Name files deterministically, e.g., `.local/screenshots/<case>/<step>__<viewport>.jpg` (create the folder if it doesn’t exist).
171+
- Avoid embedding large screenshots in chat history—reference the file path instead.
172+
- **Desktop example** (if your MCP tool exposes Playwright options 1:1):
173+
```json
174+
{
175+
"path": ".local/screenshots/fix-event-leaks/login__desktop.jpg",
176+
"type": "jpeg",
177+
"quality": 80,
178+
"fullPage": false
179+
}
180+
```
181+
- **Non-interactive runs** — If `npx` is fetching the MCP server at runtime, add `--yes` to its args (or preinstall and use `--no-install`) to avoid prompts in CI.
166182

167183
### FFmpeg Tests & Hardware Gating
168184

0 commit comments

Comments
 (0)