ff_golden library

Deterministic Flutter golden tests with controlled device and state coverage.

Classes

FfGoldenFileComparator
A Flutter local-file comparator that applies a GoldenTolerance.
FfGoldenTestApp
GoldenCapture
GoldenCaseResult
GoldenCoverage
GoldenCoveragePlan
GoldenCoverageRule
GoldenDevice
A device definition expressed in logical pixels.
GoldenPathStrategy
GoldenReporter
GoldenRunConfiguration
GoldenScenario<T>
GoldenSuitePlan
GoldenTestContext
GoldenTestDriver
Advances Flutter's virtual test clock through bounded, diagnostic waits.
GoldenTester
GoldenTesterBase
GoldenTheme
A named Flutter theme used as a golden coverage axis.
GoldenTolerance
The maximum accepted pixel difference for one golden comparison.
GoldenVariant
One fully resolved combination of golden coverage axes.
JsonGoldenReporter

Enums

GoldenDirection
The text direction requested by one golden variant.
GoldenResultStatus
GoldenSampling

Constants

defaultDevices → const List<GoldenDevice>
defaultLocales → const List<Locale>

Properties

defaultThemes List<GoldenTheme>
final

Functions

expectFfGolden(Finder finder, String goldenPath, {double captureScale = 1, GoldenTolerance tolerance = GoldenTolerance.strict}) Future<void>
ffGoldenSafeName(String value) String
findStaleGoldenFiles({required Uri baseDirectory, required Iterable<String> expectedPaths, required String scope}) List<String>
loadFfGoldenFonts({AssetBundle? bundle, Set<String> excludedFamilies = const <String>{}}) Future<void>
Loads every font declared by the application into the test engine.
testDeviceGoldens(String description, Future<void> builder(WidgetTester, GoldenDevice, Locale, GoldenTheme), {FutureOr<void> setUp()?, FutureOr<void> tearDown()?, List<GoldenDevice> devices = defaultDevices, List<Locale> locales = defaultLocales, List<GoldenTheme>? themes, bool failOnOverflow = true, bool? skip, Timeout? timeout, bool semanticsEnabled = true, TestVariant<Object?> variant = const DefaultTestVariant(), Iterable<String>? tags}) → void
Compatibility API for existing scenario-based suites.
testFfGoldens(String description, {required String scenario, required GoldenWidgetBuilder build, GoldenCoverage? coverage, GoldenAppBuilder? wrapper, GoldenInteraction? interact, GoldenLifecycle? prepare, GoldenLifecycle? dispose, GoldenPump pump = _pumpAndSettle, GoldenRunConfiguration configuration = const GoldenRunConfiguration(), FutureOr<void> before()?, FutureOr<void> after()?, bool? skip, Timeout? timeout, bool semanticsEnabled = true, TestVariant<Object?> variant = const DefaultTestVariant(), Iterable<String> tags = const []}) → void
testFfGoldenScenarios<T>(String description, {required Iterable<GoldenScenario<T>> scenarios, required GoldenScenarioWidgetBuilder<T> build, GoldenCoverage? coverage, GoldenAppBuilder? wrapper, GoldenPump pump = _pumpAndSettle, GoldenRunConfiguration configuration = const GoldenRunConfiguration(), FutureOr<void> before()?, FutureOr<void> after()?, bool? skip, Timeout? timeout, bool semanticsEnabled = true, TestVariant<Object?> variant = const DefaultTestVariant(), Iterable<String> tags = const []}) → void
Registers a typed set of states against one shared golden coverage plan.
withFfGoldenTolerance<T>(GoldenTolerance tolerance, Future<T> body()) Future<T>
Runs body with tolerance installed on Flutter's local comparator.

Typedefs

Device = GoldenDevice
Deprecated compatibility name for GoldenDevice.
GoldenAppBuilder = Widget Function(Widget child, GoldenVariant variant)
GoldenInteraction = FutureOr<void> Function(GoldenTestContext context)
GoldenLegacyWrapper = Widget Function(Widget child, Locale locale, GoldenTheme theme)
GoldenLifecycle = FutureOr<void> Function(GoldenTestContext context)
GoldenPump = Future<void> Function(WidgetTester tester)
GoldenScenarioInteraction<T> = FutureOr<void> Function(GoldenTestContext context, T state)
GoldenScenarioLifecycle<T> = FutureOr<void> Function(GoldenTestContext context, T state)
GoldenScenarioWidgetBuilder<T> = Widget Function(GoldenVariant variant, T state)
GoldenVariantPredicate = bool Function(GoldenVariant variant)
GoldenVariantPriority = int Function(GoldenVariant variant)
GoldenVariantWrapper = Widget Function(Widget child, GoldenVariant variant)
GoldenWaitCondition = bool Function()
GoldenWidgetBuilder = Widget Function(GoldenVariant variant)
NamedTheme = GoldenTheme
Deprecated compatibility name for GoldenTheme.
PumpingCallback = Future<void> Function(WidgetTester tester)