testScreenUI function

  1. @isTestGroup
void testScreenUI(
  1. Object description,
  2. Future<Widget> createScreen(), {
  3. Future<void> onTest(
    1. WidgetTester tester
    )?,
  4. String? goldenDir,
  5. TestScreenConfig? config,
  6. UITargetPlatform? onlyPlatform,
})

Use this function for testing custom StatelessWidgets and StatefulWidgets that represent screens.

description is a test description. createScreen is a callback function that creates the screen to test. onTest is a callback function called after the screen creation. Use it to change the state of your screen. goldenDir is the name of the subdirectory created inside the screens directory when the golden files are created. config use this config instead of the global configuration defined by initializeDefaultTestScreenConfig. onlyPlatform execute the tests only for the platform specified, ignoring the specified on config or initializeDefaultTestScreenConfig.

Implementation

@isTestGroup
void testScreenUI(Object description, Future<Widget> Function() createScreen,
    {Future<void> Function(WidgetTester tester)? onTest,
    String? goldenDir,
    TestScreenConfig? config,
    UITargetPlatform? onlyPlatform}) async {
  _internalTestScreen(description, createScreen, onTest,
      config: config,
      onlyPlatform: onlyPlatform,
      testUI: true,
      uiGolderDir: goldenDir);
}