agentleFS
danmestasdanmestas/wardrobe/skills/midscene-testing/SKILL.md

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

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
  1. Very specific:

    Every command requires env vars: MIDSCENE_MODEL_API_KEY, MIDSCENE_MODEL_NAME, MIDSCENE_MODEL_BASE_URL, MIDSCENE_MODEL_FAMILY.

    line 47
  2. Distinctive:

    After each step: record what worked, what broke, exact error text.

    line 81
  3. Distinctive:

    Always supplement visual testing with source code reading for ambiguous results.

    line 111
  4. Very specific:

    Run from the midscene_run/ directory where reports are generated.

    line 129

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

CommandPurpose
connect --url <url>Open page in headless Chrome (persistent session)
act --prompt "..."Interact with page via natural language
take_screenshotCapture current state
closeShut 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 proceeding

3. 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.html

Hard-Won Lessons

LessonDetail
Always use Puppeteer modeCDP mode loses page context between CLI calls. Headless Puppeteer persists the session.
Inline env vars on every commandShell state doesn't persist between Bash tool calls.
Read every screenshot yourselfMidscene's model sometimes reports "task finished" when nothing happened.
Use URL navigation as fallbackact --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 sessionsForm 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

SeverityCriteriaExample
HIGHBlocks a core workflow entirelySearch returns no results, dialog never loads
MEDIUMWorkflow completes but with errors or wrong stateStatus button stale after payment, error page with no nav
LOWCosmetic or minor UX issueDouble-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_title HTML attributes for the dropdown

Run from the midscene_run/ directory where reports are generated. See merge-reports.mjs in this skill directory.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.