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§
- Page
State - 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
StepResultmessages 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, orNonewhen the screenshot fails (best effort — never fails the step). - slugify
- Sanitizes a test/step name for use in artifact file names.