testUI<U extends UIRoot> function

void testUI<U extends UIRoot>(
  1. String testUIName,
  2. U uiRootInstantiator(
    1. UIElement rootContainer
    ),
  3. void body(
    1. UITestContext<U> context
    ), {
  4. String outputDivID = 'test-output',
  5. Duration initialRenderTimeout = const Duration(seconds: 5),
  6. SpawnHybrid? spawnHybrid,
  7. dynamic preSetup()?,
  8. dynamic posSetup(
    1. UITestContext<U> context
    )?,
  9. dynamic teardown(
    1. UITestContext<U> context
    )?,
})

Executes a group of tests using an instnatiated UIRoot.

  • testUIName is the name of the test group.
  • uiRootInstantiator is the function that isntantiates the UIRoot.
  • body is the function that will declare the tests for the UIRoot.
  • outputDivID defines the ID of the div that will render the UIRoot.
  • initialRenderTimeout is the timeout for the initial render. See initializeTestUIRoot.
  • If spawnHybrid is provided it will spawn a VM isolate for the given uri. See function spawnHybridUri.
  • preSetup and posSetup are optinal and are called before and after the group setUpAll.
  • teardown is called after the group tearDownAll.
  • See UITestContext.

NOTE: all the tests declared inside testUI are executed in the declaration order, and if any test fails it will abort the following tests, since the UI will be in an undefined state.

Implementation

void testUI<U extends UIRoot>(
  String testUIName,
  U Function(UIElement rootContainer) uiRootInstantiator,
  void Function(UITestContext<U> context) body, {
  String outputDivID = 'test-output',
  Duration initialRenderTimeout = const Duration(seconds: 5),
  SpawnHybrid? spawnHybrid,
  dynamic Function()? preSetup,
  dynamic Function(UITestContext<U> context)? posSetup,
  dynamic Function(UITestContext<U> context)? teardown,
}) =>
    _chainCapture(() => _testUIImpl(
        testUIName,
        uiRootInstantiator,
        body,
        outputDivID,
        initialRenderTimeout,
        spawnHybrid,
        preSetup,
        posSetup,
        teardown));