testUI function
- @isTest
- String description,
- WidgetTesterCallback callback, {
- bool skip = false,
- Timeout? timeout,
- Duration? initialTimeout,
- bool semanticsEnabled = true,
- TestVariant<
Object?> variant = const DefaultTestVariant(),
Runs the callback
inside the Flutter test environment.
Use this function to create test cases instead of testWidgets to be able to use setUpUI and tearDownUI.
See testWidgets for details
Implementation
@isTest
void testUI(
String description,
WidgetTesterCallback callback, {
bool skip = false,
Timeout? timeout,
Duration? initialTimeout,
bool semanticsEnabled = true,
TestVariant<Object?> variant = const DefaultTestVariant(),
}) {
testWidgets(
description,
(tester) async {
for (final s in _setUpUIs) await s(tester);
await callback(tester);
for (final t in _tearDownUIs.reversed) await t(tester);
},
skip: skip,
timeout: timeout,
initialTimeout: initialTimeout,
semanticsEnabled: semanticsEnabled,
variant: variant,
);
}