testing library Testing

Testing utilities for TUI widgets.

Provides WidgetTester for mounting widgets, sending input events, and asserting on rendered output — similar to Flutter's widget testing.

import 'package:artisanal_widgets/testing.dart';

void main() {
  testWidgets('counter increments on tap', (tester) async {
    await tester.pumpWidget(MyCounterWidget());
    expect(tester.find.text('count: 0'), isTrue);

    tester.tap(tester.find.textLocation('count: 0'));
    expect(tester.find.text('count: 1'), isTrue);
  });
}

Classes

Finder
Query helper for locating text in the rendered output.
FlickerAnalysis
Result from scanning terminal output for flicker-prone patterns.
FlickerAnalyzer
Analyzer for synchronized-output gaps, partial clears, and broken frames.
FlickerEvent
One event detected while scanning terminal output.
FlickerStats
Aggregate counts from a flicker scan.
HarnessArtifactEntry
One artifact entry in a harness manifest.
HarnessArtifactManifest
Manifest for a reproducible harness run bundle.
HarnessArtifactValidation
Validation result for one artifact entry.
ManualClock
A manually advanced clock intended for deterministic tests.
TapTarget
A lazy reference to a screen position, resolved at tap time.
WidgetFuzzer
Deterministic random input harness for WidgetTester.
WidgetFuzzOptions
Configuration for a deterministic widget fuzz run.
WidgetFuzzResult
Result of a deterministic widget fuzz run.
WidgetFuzzStep
One generated fuzz action.
WidgetGauntlet
Runs named storm, flicker, and artifact-manifest checks for a widget.
WidgetGauntletConfig
Configuration for WidgetGauntlet.
WidgetGauntletResult
Result from one WidgetGauntlet run.
WidgetStormProfile
A deterministic, named stress profile for WidgetTester.
WidgetStormResult
Result from running a WidgetStormProfile.
WidgetStormRunner
Runner that applies WidgetStormProfile instances to one tester.
WidgetStormStep
One generated storm action.
WidgetTester
A testing harness for TUI widgets that drives events through a real Program instance.
WidgetTestFrame
One deterministic frame snapshot captured by WidgetTester.

Enums

FlickerEventType
Flicker-analysis event families.
FlickerSeverity
Severity for a flicker-analysis event.
HarnessArtifactClass
Artifact classes emitted by widget harness and gauntlet runs.
HarnessArtifactRetention
Retention class for an artifact.
WidgetFuzzAction
Scripted action families generated by WidgetFuzzer.
WidgetStormAction
Action emitted by a WidgetStormProfile.
WidgetStormPattern
Named deterministic storm families.

Extensions

HarnessArtifactClassMetadata on HarnessArtifactClass
Metadata helpers for HarnessArtifactClass.
HarnessArtifactRetentionMetadata on HarnessArtifactRetention
Suggested retention days for HarnessArtifactRetention.
WidgetTesterFlickerAnalysis on WidgetTester
Convenience extension for analyzing captured widget-test terminal output.
WidgetTesterFuzzing on WidgetTester
Convenience extension for running deterministic fuzz input.
WidgetTesterStorming on WidgetTester
Convenience extension for running deterministic storm profiles.

Functions

shouldRedactHarnessField(String fieldName) → bool
Returns true when fieldName should be redacted before sharing artifacts.
testWidgets(String description, Future<void> callback(WidgetTester tester), {Object? skip}) → Future<void>
Runs callback with a fresh WidgetTester, managing setup/teardown automatically.

Exceptions / Errors

FlickerFailure
Exception wrapper for failed flicker analyses.
WidgetFuzzFailure
Exception thrown by WidgetFuzzResult.throwIfFailed.
WidgetStormFailure
Exception wrapper for failed storm results.