Update plugin test template. (#13516)

* Update plugin test template.

* Add flutter test run verification.

* Tweak and test runs for package projects.
This commit is contained in:
Phil Quitslund
2017-12-14 08:51:33 -08:00
committed by GitHub
parent 5e18c07614
commit 3346c5c736
2 changed files with 51 additions and 16 deletions

View File

@@ -9,6 +9,7 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:{{projectName}}/main.dart';
{{^withPluginHook}}
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
@@ -27,3 +28,20 @@ void main() {
expect(find.text('1'), findsOneWidget);
});
}
{{/withPluginHook}}
{{#withPluginHook}}
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(new MyApp());
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) =>
widget is Text && widget.data.startsWith('Running on:'),
),
findsOneWidget);
});
}
{{/withPluginHook}}