testBrowser function

  1. @isTest
void testBrowser(
  1. String description,
  2. FutureOr<void> callback(
    1. BrowserTester tester
    ), {
  3. String location = '/',
  4. bool? skip,
  5. Timeout? timeout,
  6. dynamic tags,
})

Implementation

@isTest
void testBrowser(
  String description,
  FutureOr<void> Function(BrowserTester tester) callback, {
  String location = '/',
  bool? skip,
  Timeout? timeout,
  dynamic tags,
}) {
  test(
    description,
    () async {
      if (html.window.location.pathname != location) {
        html.window.history.replaceState(null, 'Test', location);
      }

      var binding = TestBrowserComponentsBinding();
      var tester = BrowserTester._(binding);

      return binding.runTest(() async {
        await callback(tester);
      });
    },
    skip: skip,
    timeout: timeout,
    tags: tags,
  );
}