From 71e102c083c89eb38faf9f6a9bf5ad39817eae4b Mon Sep 17 00:00:00 2001 From: Kenzie Davisson <43759233+kenzieschmoll@users.noreply.github.com> Date: Wed, 8 Nov 2023 10:59:03 -0800 Subject: [PATCH] Add a test target to the app_that_uses_foo/ example (#6687) * Add a test target to the app_that_uses_foo/ example * changelog --- packages/devtools_extensions/CHANGELOG.md | 2 ++ .../test/app_that_uses_foo_test.dart | 25 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 packages/devtools_extensions/example/app_that_uses_foo/test/app_that_uses_foo_test.dart diff --git a/packages/devtools_extensions/CHANGELOG.md b/packages/devtools_extensions/CHANGELOG.md index 08a3e28308c..e782808d141 100644 --- a/packages/devtools_extensions/CHANGELOG.md +++ b/packages/devtools_extensions/CHANGELOG.md @@ -1,4 +1,6 @@ ## 0.0.10 +* Add a test target to the `app_that_uses_foo` example that can also be debugged +with the DevTools extension provided by `package:foo`. * Add an example of performing expression evaluations from a DevTools extension. * Add an example of registering a service extension and calling it from a DevTools extension. * Document the DevTools extension examples. diff --git a/packages/devtools_extensions/example/app_that_uses_foo/test/app_that_uses_foo_test.dart b/packages/devtools_extensions/example/app_that_uses_foo/test/app_that_uses_foo_test.dart new file mode 100644 index 00000000000..0ac9053c0c3 --- /dev/null +++ b/packages/devtools_extensions/example/app_that_uses_foo/test/app_that_uses_foo_test.dart @@ -0,0 +1,25 @@ +// Copyright 2023 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:app_that_uses_foo/main.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:foo/foo.dart'; + +// This test can be run to verify that the `package:foo` DevTools extension +// loads properly when debugging a test target with DevTools. +// +// To test this, run the following command and copy the VM service URI to +// connect to DevTools: +// +// flutter run test/app_that_uses_foo_test.dart --start-paused + +void main() { + testWidgets('Builds $MyAppThatUsesFoo', (tester) async { + await tester.pumpWidget(const MyAppThatUsesFoo()); + await tester.pumpAndSettle(); + + expect(find.byType(MyAppThatUsesFoo), findsOneWidget); + expect(find.byType(FooWidget), findsOneWidget); + }); +}