Playwright
Save a Playwright screenshot and trace of a local page, upload the closed files, and check those same bytes from a later process.
A Playwright worker can save a screenshot and a trace on its own disk. When that process exits, the disk is gone.
mountable.io is a persistent filesystem for AI agents. This recipe uploads the closed screenshot and the closed trace. A later process reads those same files.
mountable.io maintains the runnable example, separately from Playwright. The browser opens one local page in the example. It does not visit another site. This is not a Playwright plugin.
Prerequisites
Use an existing mountable.io account with a saved payment method, an existing filesystem and an API key that can access it. Storage and file operations follow the usage prices. The example creates no account, filesystem or credits.
You also need Node.js 20 or newer. Set MOUNTABLE_API_KEY in your private
environment or secret manager. Never put a key in a command argument.
Use your filesystem ID in place of FS_ID below. Pick a new run id for
each capture. A run id is 1 to 40 lowercase letters, digits or hyphens,
and it must start with a letter or digit.
git clone https://github.com/writeitai/mountable.git
cd mountable/examples/playwright-artifacts
npm ci
npx playwright install chromium
export FS_ID="your-filesystem-id"
export RUN="run1"Your backend chooses the filesystem and the run id. Do not take either from the page.
The example uses the TypeScript SDK and the Files API. It does not mount the filesystem.
Keep the screenshot and the trace
capture opens the local fixture, stops tracing, and closes the browser.
It then uploads playwright/<run>/screenshot.png and
playwright/<run>/trace.zip.
node artifacts.mjs capture \
--filesystem "$FS_ID" \
--run "$RUN" \
--dir ./outThe command writes both files into ./out and prints each remote path,
its SHA-256 and its size. It does not print the API key.
Each file has to be at most 4 MiB. The Files API allows up to 5 GiB. This recipe refuses anything larger before it uploads.
The write uses If-None-Match: *, so an existing file is left as it is.
After a timeout, read the path before writing it again. Use a new run id
for the next capture.
A 402 with filesystem_spending_cap_reached stops that user's billable
mountable.io work. Other filesystems keep working.
Check them from a fresh run
check is a new process. It opens the filesystem read-only, downloads both
files, and compares them with the files in --dir.
node artifacts.mjs check \
--filesystem "$FS_ID" \
--run "$RUN" \
--dir ./outThe command prints match and the size of each file when every byte
matches.
Clean up
node artifacts.mjs cleanup \
--filesystem "$FS_ID" \
--run "$RUN"This deletes both files, the run directory, and playwright/ when that
directory is empty. A file that is already gone is left gone.
Offline checks
From the example directory:
npm testThe tests run headless Chromium against the local fixture and a fake files API. They make no paid cloud calls.
Sources: Playwright tracing, Files API.