Skip to content

Show a failure screenshot under the error, on request - #58

Merged
Mpdreamz merged 3 commits into
mainfrom
feature/console-screenshot
Nov 11, 2026
Merged

Mpdreamz merged 3 commits into
mainfrom
feature/console-screenshot

Conversation

@Mpdreamz

Copy link
Copy Markdown
Contributor

--screenshot-on-failure takes a screenshot when a journey step fails, writes it to failure.png, and draws it under the error on a terminal that can show images.

Why

A failing journey says which step broke and what the error was, but not what the page looked like. nullean/cdp#44 (released as 0.10.0) records the page's URL and, on request, a PNG of the viewport. The console runner from nullean/snapshots#56 did not use either.

What

The option and the flag

JourneySnapshotOptions.ScreenshotOnFailure and JourneyRunOptions.ScreenshotOnFailure turn the capture on, and snap journey run takes --screenshot-on-failure. It is off unless asked for, because a page can show private data. A journey that fails writes failure.png into its artifacts folder (the one next to its received transcript for snap), and the failure message names the file.

The image under the error

On a terminal, the reporter draws the screenshot after the error and before the page, screenshot and rerun rows, with Nullean.TerminalImages (Kitty, Ghostty, iTerm2, WezTerm, Sixel, half blocks otherwise), at most 100 columns and 30 rows. In CI, in a pipe, with NULLEAN_TERMINAL_IMAGES=none, or when the terminal cannot show images, it draws nothing, and a failure to draw never fails a run.

The page a step stopped on

A failure now shows Page: with the address the step stopped on, from Nullean.Cdp 0.10.0. It replaces the Last open: line when the failure has one. The runner also says Every selected journey was skipped, so nothing was checked. itself, so a wrapper tool does not have to.

Verify

dotnet test -c Release
dotnet run -c Release --project src/Nullean.Snapshots.Cli -- journey run 'tests/Nullean.Snapshots.Browser.Tests/cli-journeys/expect-fails.journey' --base-url "file://$PWD/tests/Nullean.Snapshots.Browser.Tests/site/" --screenshot-on-failure

NULLEAN_TERMINAL_IMAGES=blocks forces half blocks, which also draw in a pty. Dropping the option from the run options fails TheScreenshotOptionReachesTheJourneyRun. The two verified snapshots of failing runs change by one line each (Last open: becomes Page:).

🤖 Generated with Claude Code

Mpdreamz and others added 3 commits November 10, 2026 21:53
JourneySnapshotOptions gains ScreenshotOnFailure, and the console runner and snap journey run take --screenshot-on-failure. The image is written to failure.png in the journey's artifacts folder and drawn under the error with Nullean.TerminalImages on a terminal that can show images. A failure names the page it stopped on, from Nullean.Cdp 0.10.0.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@Mpdreamz
Mpdreamz merged commit 8c3fbb2 into main Nov 11, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant