artifacts property

  1. @override
List<Artifact> get artifacts
override

The frame just before each failure, and nothing else.

Every step's PNG is on the wire as a path already; the reader that can open files opens them. This is for the reader that cannot — an MCP client with no filesystem — and for the one that can but should not have to guess which of fifty pictures matters. A green run offers none: there is nothing to look at.

Implementation

@override
List<Artifact> get artifacts => [
  for (var package in packages)
    for (var scenario in package.scenarios)
      if (!scenario.ok && scenario.steps.isNotEmpty)
        if (scenario.steps.last case var step
            when step.format == 'png' && step.image != null)
          Artifact(
            kind: Artifact.png,
            address: Address.parse(step.address),
            path: step.image!,
            meta: {
              'scenario': scenario.name,
              'file': scenario.file,
              'step': step.index,
              'name': ?step.name,
              'texts': step.texts,
              // The failing transition in full, `system` and all — the
              // digest every step carries is capped and filtered, and this
              // is the one step where the thing that broke it may be the
              // twentieth line. Same reasoning as the frame itself: the
              // reader should not have to make a second call for the answer.
              if (readStepEvents(step) case var events when events.isNotEmpty)
                'events': events,
              if (scenario.errors.firstOrNull case var error?)
                'error': error.error,
            },
          ),
];