midscene-testing
Skill4 starsChanged 7 months agoMITView on GitHub
Use when performing ad-hoc browser testing, smoke testing workflows, validating UI after frontend changes, or testing Datastar/HTMX/SSE reactive features that unit tests cannot cover. Also use when consolidating Midscene HTML reports into a single navigable document.
- Reads credentials
In this repository124 other files it gives its agents.
- apple-contactsSkill
- atlassian-cli-jiraSkill
- bellardSkill
- brainstormingSkill
- career-interviewSkill
- carmackSkill
- cavecrewSkill
- caveman-commitSkill
- caveman-compressSkill
- caveman-helpSkill
- caveman-reviewSkill
- cavemanSkill
- caveman-statsSkill
- ci-watchSkill
- clone-configSkill
- cloudflare-emailSkill
- course-correctSkill
- datastar-patternsSkill
- datastarSkill
- datastar-taoSkill
- defuddleSkill
- description-linterSkill
- deterministic-simulation-testingSkill
- dispatching-parallel-agentsSkill
- dopplerSkill
- dx-auditSkill
- evolution-changelogSkill
- evolution-engineSkill
- executing-plansSkill
- farleySkill
- finishing-a-bones-leafSkill
- frontend-component-decision-treesSkill
- gh-project-charterSkill
- gh-project-operationsSkill
- gh-project-setupSkill
- gh-project-sharedSkill
- goal-completeSkill
- golang-patternsSkill
- hellandSkill
- hickeySkill
- hippSkill
- investigating-agent-sessionsSkill
- landingSkill
- linear-cliSkill
- linear-methodSkill
- memorizeSkill
- monitoring-the-operatorSkill
- normanSkill
- obsidian-basesSkill
- obsidian-canvasSkill
- obsidian-markdownSkill
- orchestrator-modeSkill
- orchestrator-suitSkill
- ousterhoutSkill
- pikchr-generatorSkill
- pocock-cavemanSkill
- pocock-diagnoseSkill
- pocock-git-guardrailsSkill
- pocock-handoffSkill
- pocock-setup-pre-commitSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 47
Every command requires env vars: MIDSCENE_MODEL_API_KEY, MIDSCENE_MODEL_NAME, MIDSCENE_MODEL_BASE_URL, MIDSCENE_MODEL_FAMILY.
- Distinctive: line 81
After each step: record what worked, what broke, exact error text.
- Distinctive: line 111
Always supplement visual testing with source code reading for ambiguous results.
- Very specific: line 129
Run from the midscene_run/ directory where reports are generated.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Midscene Ad-Hoc Browser Testing
Overview
Use Midscene's headless Puppeteer mode to smoke-test web application workflows through screenshot-driven browser automation. Each CLI call takes a screenshot, sends it to a vision model, and executes natural-language UI interactions. You act as the brain — deciding what to do next based on what you see.
Requires: The browser-automation skill for raw Midscene command reference. This skill covers the testing methodology on top of it.
When to Use
- Smoke-testing multi-step workflows (login → create → edit → submit)
- Validating reactive UI features (SSE, Datastar, HTMX) that need a real browser
- Exploratory testing after a frontend change
- Verifying bug fixes visually before closing a ticket
- Testing form behaviors (double-submit, clear-on-success, validation)
When NOT to Use
- Regression testing (write Puppeteer scripts instead — deterministic, no AI cost)
- Testing backend logic (use Go/unit tests)
- Testing static HTML rendering (use template render tests)
Quick Reference
| Command | Purpose |
connect --url <url> | Open page in headless Chrome (persistent session) |
act --prompt "..." | Interact with page via natural language |
take_screenshot | Capture current state |
close | Shut down browser |
Every command requires env vars: MIDSCENE_MODEL_API_KEY, MIDSCENE_MODEL_NAME, MIDSCENE_MODEL_BASE_URL, MIDSCENE_MODEL_FAMILY.
Testing Workflow
1. Setup
# Build and start the app server
make build && ./bin/server &
# Set env vars (inline on every command since shell state doesn't persist)
export MIDSCENE_VARS="MIDSCENE_MODEL_API_KEY=... MIDSCENE_MODEL_NAME=... MIDSCENE_MODEL_BASE_URL=... MIDSCENE_MODEL_FAMILY=..."2. Connect and Verify
npx @midscene/web@1 connect --url http://localhost:3737/login
# Read the screenshot to verify page loaded before proceeding3. Execute Workflow Steps
# Batch related actions into ONE act call
npx @midscene/web@1 act --prompt "fill email with 'user@example.com' and password with 'test', then click Sign In"
# Read screenshot after EVERY act — don't trust "task finished" message
# Navigate by URL when click-navigation fails
npx @midscene/web@1 act --prompt "navigate to http://localhost:3737/repair-orders/new"4. Document Findings
After each step: record what worked, what broke, exact error text. At the end, compile a bug report with severity ratings.
5. Consolidate Reports
Midscene generates one HTML report per CLI call. Use merge-reports.mjs (included in this skill) to combine them into a single navigable document.
node merge-reports.mjs
open combined-report.htmlHard-Won Lessons
| Lesson | Detail |
| Always use Puppeteer mode | CDP mode loses page context between CLI calls. Headless Puppeteer persists the session. |
| Inline env vars on every command | Shell state doesn't persist between Bash tool calls. |
| Read every screenshot yourself | Midscene's model sometimes reports "task finished" when nothing happened. |
| Use URL navigation as fallback | act --prompt "navigate to <url>" is more reliable than clicking JS-routed links. |
| Batch form interactions | "fill email, fill password, click submit" as one act — faster and more reliable than three. |
| Be specific about UI targets | "click the pencil edit icon on the Oil Filter row" not "click edit". |
| Budget for API flakiness | ~15% of commands fail with transient model errors. Just retry. |
| Page navigation kills sessions | Form submits that redirect will close the CDP page. Reconnect after. |
What Midscene Can't Tell You
- Whether search requires Enter key vs. live filtering (read the source)
- Whether an empty result is "search is broken" vs. "no matching data" (check the DB)
- Whether a status button is stale vs. correct (understand the state machine)
Always supplement visual testing with source code reading for ambiguous results.
Bug Classification
| Severity | Criteria | Example |
| HIGH | Blocks a core workflow entirely | Search returns no results, dialog never loads |
| MEDIUM | Workflow completes but with errors or wrong state | Status button stale after payment, error page with no nav |
| LOW | Cosmetic or minor UX issue | Double-submit creates duplicates, input not cleared |
Report Consolidation
Midscene generates ~2MB HTML reports per command (mostly React boilerplate). The merge script:
- Discards failed reports (black screen, session errors)
- Keeps one copy of the React UI boilerplate
- Collects all action data and deduplicates images
- Injects step names into
playwright_test_titleHTML attributes for the dropdown
Run from the midscene_run/ directory where reports are generated. See merge-reports.mjs in this skill directory.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

