Skip to main content
Save what the sandbox screen shows right now as a PNG file. Use it to record a checkpoint you want to look at later.
To capture every step without calling it yourself, turn on autoScreenshots instead. See Screenshots.

Signature

Parameters

string
The file name. TestDriver adds .png if it’s missing. Without it, the file is named screenshot-<timestamp>.png.

Returns

Promise<string>. The absolute path of the saved file.

Where files are saved

Screenshots go to .testdriver/screenshots/<test file>/ in the directory you run tests from. <test file> is the test file’s name without its last extension, so tests/login.test.mjs saves to .testdriver/screenshots/login.test/.
TestDriver clears each test file’s folder at the start of every run. Copy any screenshot you want to keep.
Add the folder to .gitignore:
.gitignore

Examples

Save a named checkpoint

Log the path

Complete example

tests/login.test.mjs