golden_toolkit library


Copyright 2019-2020 eBay Inc.

Use of this source code is governed by a BSD-style license that can be found in the LICENSE file or at https://opensource.org/licenses/BSD-3-Clause


Classes

Device
This Device is a configuration for golden test. Can be provided for multiScreenGolden
GoldenBuilder
GoldenBuilder builds column/grid layout for it's children
GoldenToolkit
Manages global state & behavior for the Golden Toolkit This is a singleton so that it can be easily configured in one place and shared across tests
GoldenToolkitConfiguration
Represents configuration options for the GoldenToolkit. These are akin to environmental flags.

Extensions

TestingToolsExtension
Extensions for a WidgetTester

Constants

textScaleFactorMaxSupported → const double
as of iOS 13.2.3 the max textScaleFactor a user can set is ~3.1176
3.2

Functions

loadAppFonts() Future<void>
By default, flutter test only uses a single "test" font called Ahem. [...]
materialAppWrapper({TargetPlatform platform = TargetPlatform.android, Iterable<LocalizationsDelegate> localizations, NavigatorObserver navigatorObserver, Iterable<Locale> localeOverrides, ThemeData theme}) WidgetWrapper
This materialAppWrapper is a convenience function to wrap your widget in MaterialApp Wraps your widget in MaterialApp, inject custom theme, localizations, override surfaceSize and platform [...]
multiScreenGolden(WidgetTester tester, String goldenFileName, {Finder finder, bool autoHeight, double overrideGoldenHeight, CustomPump customPump, DeviceSetup deviceSetup, List<Device> devices = const [Device.phone, Device.tabletLandscape], bool skip}) Future<void>
This multiScreenGolden will run scenarios for given devices list [...]
noWrap() WidgetWrapper
This noWrap is a convenience function if you don't want to wrap widgets in default materialAppWrapper
screenMatchesGolden(WidgetTester tester, String goldenFileName, {bool autoHeight, Finder finder, CustomPump customPump, bool skip}) Future<void>
This screenMatchesGolden is wrapper on top of matchesGoldenFile [...]
testGoldens(String description, Future<void> test(WidgetTester), {bool skip = false}) → void
This testGoldens method exists as a way to enforce the proper naming of tests that contain golden diffs so that we can reliably run all goldens [...]

Typedefs

CustomPump = Future<void> Function(WidgetTester)
CustomPump is a function that lets you do custom pumping before golden evaluation. Sometimes, you want to do a golden test for different stages of animations, so its crucial to have a precise control over pumps and durations
DeviceSetup = Future<void> Function(Device device, WidgetTester tester)
SkipGoldenAssertion = bool Function()
WidgetWrapper = Widget Function(Widget)