Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
d047d108
Unverified
Commit
d047d108
authored
Dec 03, 2020
by
Dan Field
Committed by
GitHub
Dec 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add integration_test template to create template (#70240)
parent
2520d53e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
126 additions
and
0 deletions
+126
-0
app_test.dart.tmpl
...r_tools/templates/app/integration_test/app_test.dart.tmpl
+48
-0
driver.dart.tmpl
...ter_tools/templates/app/integration_test/driver.dart.tmpl
+8
-0
pubspec.yaml.tmpl
packages/flutter_tools/templates/app/pubspec.yaml.tmpl
+2
-0
template_manifest.json
packages/flutter_tools/templates/template_manifest.json
+2
-0
create_test.dart
...tter_tools/test/commands.shard/permeable/create_test.dart
+4
-0
integration_test_test.dart
...r_tools/test/integration.shard/integration_test_test.dart
+62
-0
No files found.
packages/flutter_tools/templates/app/integration_test/app_test.dart.tmpl
0 → 100644
View file @
d047d108
// This is a basic Flutter integration test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:{{projectName}}/main.dart' as app;
void main() => run(_testMain);
void _testMain() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
app.main();
// Trigger a frame.
await tester.pumpAndSettle();
{{^withPluginHook}}
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
{{/withPluginHook}}
{{#withPluginHook}}
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data.startsWith('Running on:'),
),
findsOneWidget,
);
{{/withPluginHook}}
});
}
packages/flutter_tools/templates/app/integration_test/driver.dart.tmpl
0 → 100644
View file @
d047d108
// This file is provided as a convenience for running integration tests via the
// flutter drive command.
//
// flutter drive --driver integration_test/driver.dart --target integration_test/app_test.dart
import 'package:integration_test/integration_test_driver.dart';
Future<void> main() => integrationDriver();
packages/flutter_tools/templates/app/pubspec.yaml.tmpl
View file @
d047d108
...
...
@@ -43,6 +43,8 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
...
...
packages/flutter_tools/templates/template_manifest.json
View file @
d047d108
...
...
@@ -33,6 +33,8 @@
"templates/app/android.tmpl/gradle/wrapper/gradle-wrapper.properties"
,
"templates/app/android.tmpl/gradle.properties.tmpl"
,
"templates/app/android.tmpl/settings.gradle"
,
"templates/app/integration_test/app_test.dart.tmpl"
,
"templates/app/integration_test/driver.dart.tmpl"
,
"templates/app/ios-objc.tmpl/Runner/AppDelegate.h"
,
"templates/app/ios-objc.tmpl/Runner/AppDelegate.m"
,
"templates/app/ios-objc.tmpl/Runner/main.m"
,
...
...
packages/flutter_tools/test/commands.shard/permeable/create_test.dart
View file @
d047d108
...
...
@@ -299,6 +299,8 @@ void main() {
'ios/Runner/main.m'
,
'lib/main.dart'
,
'test/widget_test.dart'
,
'integration_test/app_test.dart'
,
'integration_test/driver.dart'
,
],
);
},
overrides:
<
Type
,
Generator
>{
...
...
@@ -364,6 +366,8 @@ void main() {
'ios/Runner/main.m'
,
'lib/main.dart'
,
'test/widget_test.dart'
,
'integration_test/app_test.dart'
,
'integration_test/driver.dart'
,
],
);
return
_runFlutterTest
(
projectDir
);
...
...
packages/flutter_tools/test/integration.shard/integration_test_test.dart
0 → 100644
View file @
d047d108
// Copyright 2014 The Flutter 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:flutter_tools/src/base/file_system.dart'
;
import
'package:flutter_tools/src/base/io.dart'
;
import
'../src/common.dart'
;
import
'test_utils.dart'
;
final
String
flutterBin
=
fileSystem
.
path
.
join
(
getFlutterRoot
(),
'bin'
,
platform
.
isWindows
?
'flutter.bat'
:
'flutter'
);
void
main
(
)
{
Directory
tempDir
;
setUpAll
(()
{
tempDir
=
createResolvedTempDirectorySync
(
'int_test.'
);
});
tearDownAll
(()
{
tryToDelete
(
tempDir
);
});
testWithoutContext
(
'flutter project default integration_test smoke test'
,
()
async
{
const
String
projectName
=
'integration_test_sample'
;
ProcessResult
result
=
await
processManager
.
run
(
<
String
>[
flutterBin
,
'create'
,
projectName
,
],
workingDirectory:
tempDir
.
path
,
);
expect
(
result
.
exitCode
,
0
);
final
Directory
projectDir
=
tempDir
.
childDirectory
(
projectName
);
expect
(
projectDir
.
existsSync
(),
true
);
final
Directory
integrationTestDir
=
projectDir
.
childDirectory
(
'integration_test'
);
expect
(
integrationTestDir
.
existsSync
(),
true
);
expect
(
integrationTestDir
.
childFile
(
'driver.dart'
).
existsSync
(),
true
);
expect
(
integrationTestDir
.
childFile
(
'app_test.dart'
).
existsSync
(),
true
);
result
=
await
processManager
.
run
(
<
String
>[
flutterBin
,
'drive'
,
'-d'
,
'flutter-tester'
,
'--driver'
,
'integration_test/driver.dart'
,
'-t'
,
'integration_test/app_test.dart'
,
],
workingDirectory:
projectDir
.
path
,
);
if
(
result
.
exitCode
!=
0
)
{
print
(
'================================= STDOUT ======================================='
);
print
(
result
.
stdout
);
print
(
'================================= STDERR ======================================='
);
print
(
result
.
stderr
);
fail
(
'flutter drive failed, see output.'
);
}
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment