SCREENCAST-MCP / CI
Record test runs in CI
Browser tests get a video of every failure for free. Desktop apps on Windows (Electron, WPF, WinUI, WinForms, games) don't. screencast-mcp record runs your test command while it records the runner's desktop, then turns a failure into a GIF and a contact sheet you can open from the run.
The same tools the MCP server exposes, without an MCP client. The command's exit code passes straight through.
npx -y @tmhs/screencast-mcp record --target full -- npm run test:e2e
--target:full(default),monitor:0,window:exe=MyApp.exe, orregion:x,y,w,h.--artifacts failure|always|never: when to makeevidence.gifandcontact-sheet.png(defaultfailure).--last 30: the GIF covers the last 30 s, where the failure usually is;0keeps it all.--out,--fps,--no-gif,--no-contact-sheet,--discard-on-success.--max-duration: whole seconds, 0 to 604800 (0 = no cap; default 3600).--command-env NAME: run the command line stored in an environment variable, so quotes and&reach the shell unchanged.--events,--perf,--log <path>(Action inputsevents,perf,logs): also keep the input-event log, CPU and memory samples, and app log lines on the recording's clock (recording.events.jsonl,.perf.jsonl,.logs.jsonl), so a failure can be lined up with what the app logged.--bug-report(Action inputbug-report): when the command fails, also write abug_reportpackage tobug-report/in the output folder: a secret-scanned clip and GIF, steps from the event log, OCR'd errors andreport.md, linked fromevidence.jsonand the PR comment.--ocr-errors: on failure, OCR the end of the run and add the error lines it finds (secrets masked) toevidence.json.--redact-secrets(Action inputredact-secrets: true): OCR the recording and blur on-screen API keys, tokens andpassword:values in the GIF and contact sheet before they are uploaded;--secret-patternsets your own regex. If the scan fails, those files are skipped rather than uploaded unblurred. Worth turning on for public repos.
Everything lands in screencast-evidence/ with an evidence.json summary. Any single tool works the same way: npx -y @tmhs/screencast-mcp call doctor, or call pipeline @recipe.json.
A composite action wraps it for windows-latest: it checks Node, installs ffmpeg if it is missing, records the command, uploads the evidence folder as an artifact, writes a job summary, and then fails the step with the command's exit code.
jobs:
ui-tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
- run: npm ci
- uses: TMHSDigital/screencast-mcp@v0 # newest 0.x release; pin vX.Y.Z or a SHA to freeze it
with:
command: npm run test:e2e
target: full # or window:exe=MyApp.exe
artifacts: failure # GIF and contact sheet only when it fails
Outputs: exit-code, end-reason, gif, contact-sheet, recording, evidence-dir, artifact-name, and artifact-url. The inputs, from action.yml:
| Input | Default | What it does |
|---|---|---|
command | required | The test command to run while recording, as one line for cmd.exe (so npm test && npm run e2e and -g "a & b" work as written). |
target | full | What to record: full | monitor:<i> | window:<title> | window:exe=<app.exe> | region:x,y,w,h. |
fps | 15 | Capture frame rate (1-120). |
artifacts | failure | When to make the GIF and contact sheet: failure, always, or never. |
last-seconds | 30 | The GIF covers the last this-many seconds of the run (0 = all of it). |
max-duration | Stop recording after this many seconds, an integer up to 604800 (0 = no cap). Empty uses SCREENCAST_MAX_RECORDING_SEC, else 3600. A run longer than the cap gets a warning, since the GIF then shows the end of the recording, not of the run. | |
discard-on-success | true | Delete the recording when the command passes, so green runs upload nothing but evidence.json. |
output-dir | screencast-evidence | Folder for recording.mp4, evidence.gif, contact-sheet.png, and evidence.json. |
upload | true | Upload the output folder as a workflow artifact. |
artifact-name | Name of the uploaded artifact. Empty means screencast-evidence-<job>, plus the matrix index in a matrix and the attempt on a rerun, so matrix legs never collide. | |
retention-days | 14 | Days to keep the artifact. |
package | The npm package (and version) to run with npx. Empty means the version of this action (from its package.json), so pinning the action pins the CLI; @latest only if that version is not on npm. | |
cli-path | Run a local build instead of the npm package, e.g. dist/index.js in a checkout of screencast-mcp. | |
install-ffmpeg | true | Install ffmpeg with Chocolatey when it is not on PATH. |
ocr-errors | On failure, OCR the GIF's window for error lines (Windows OCR) into evidence.json: true, false, or empty to follow comment. | |
redact-secrets | false | OCR the recording and blur on-screen secrets (API keys, tokens, password: values) in evidence.gif and contact-sheet.png before upload (Windows OCR). If the scan fails they are skipped, not uploaded unblurred. |
secret-pattern | With redact-secrets, the regex to blur instead of the default. | |
events | false | Also log clicks, scrolls and typing bursts to recording.events.jsonl, on the recording's clock. |
perf | false | Also sample CPU and memory to recording.perf.jsonl, to line a slow step up with the video. |
logs | App log files to follow into recording.logs.jsonl, one path per line (at most 5). | |
bug-report | false | When the command fails, write a bug_report package (secret-scanned clip and GIF, steps from the event log, OCR'd errors, report.md) to bug-report/ in the output folder. Needs Windows OCR; pairs well with events, logs and perf. |
comment | false | On pull_request events, keep one sticky PR comment per job with the exit code, how the recording ended, OCR'd errors, and a link to the evidence artifact. Created when the command fails, updated on later runs. Needs permissions: pull-requests: write. |
github-token | ${{ github.token }} | Token for the PR comment. |
@v0 is a floating tag that each release moves to the newest 0.x version, so a broken main never reaches your CI; use a full version tag such as @v0.47.0 or a commit SHA to pin exactly. Pinning the action pins the CLI too: by default it runs the npm version the action was released with. Each job and matrix leg uploads its own artifact (screencast-evidence-<job>[-<index>]), so matrices do not collide. The Action is being published to GitHub Marketplace.
comment: true keeps one PR comment per job, created when the command fails and updated on later runs, with the exit code, how the recording ended, OCR'd errors, and a link to the evidence artifact. It needs permissions: pull-requests: write; fork PRs get a read-only token, so the step only warns. GitHub cannot show images stored in artifacts, so the GIF stays in the artifact.
- Hosted Windows runners have an interactive desktop, so
gdigrabrecords what your app draws. This repo records its own capture smoke test with the action on every change to it. - A recording holds whatever is on screen. Keep secrets off the runner's desktop, and remember artifacts are visible to anyone who can read the run.
- For a longer suite, keep the default
discard-on-successso green runs upload onlyevidence.json. evidence.jsonrecordsendReason. If the recording hitmax-durationor crashed before the command finished, the run warns, because the GIF then shows the end of the recording rather than the end of the run.