Skip to main content

Module diagnostics

Module diagnostics 

Source
Expand description

Failure diagnostics — page-state capture and artifact writing. Failure diagnostics — page-state capture and artifact writing.

When a step fails, the runner captures the current page state (URL, title, visible text, error-ish alert elements) and saves a screenshot. The formatted context is appended to step messages so CI logs answer the classic “why did the wait time out?” question instead of printing a bare timeout message.

Structs§

PageState
Snapshot of the page at the moment a step failed.

Constants§

DIAGNOSTIC_ALERTS_JS
JavaScript that collects visible “alert-like” elements — error banners, toast/snackbars, validation messages, error cards.

Functions§

capture
Captures the current page state via CDP evaluation. Never fails — every extractor degrades to a default value so diagnostic capture cannot mask the original step failure.
full_context
Multi-line diagnostics block (URL, title, alerts, visible text) shown after a step failure.
inline_excerpt
Compact one-line excerpt of the page state, appended to StepResult messages so the summary line in CI logs stays self-contained.
save_screenshot
Saves a PNG screenshot of the current tab under dir, named after the scenario/test/step. Returns the absolute-ish path, or None when the screenshot fails (best effort — never fails the step).
slugify
Sanitizes a test/step name for use in artifact file names.