mirror of
https://github.com/flutter/packages.git
synced 2025-05-28 19:26:50 +08:00
Ensure that integration tests are actually being run (#3857)
Many of our integration tests weren't actually being run on CI because they were in the wrong place and/or missing the driver file, and it seems we've just never noticed. This makes a number of changes: - Ensures that all packages with integration tests also have a driver file in the right location. - Also standardizes the format of those files, as the boilerplate `main()` is available in `integration_test`. - Ensures that all integration_test directories are in the right place. - In a couple of places, removes a duplicate copy of the integration test file. - Makes it an error for a plugin that's not excluded to not have integration tests, so this can't easily happen again. - Adds logging of what's being run and skipped, so if something does go wrong in the future it's easy to determine what from the logs. - Excludes `*_platform_interface` since the logging was (potentially confusingly) reporting that they were skipped because they don't support the current platform. Skipping them is correct, just not for that reason. - Excludes the plugins that currently have no integration tests, with references to issues about adding them. Fixes https://github.com/flutter/flutter/issues/81929
This commit is contained in:
@ -55,6 +55,7 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
@ -100,6 +101,7 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
@ -143,6 +145,25 @@ void main() {
|
||||
throwsA(const TypeMatcher<ToolExit>()));
|
||||
});
|
||||
|
||||
test('a plugin without any integration test files is reported as an error',
|
||||
() async {
|
||||
createFakePlugin('plugin',
|
||||
withExtraFiles: <List<String>>[
|
||||
<String>['example', 'lib', 'main.dart'],
|
||||
],
|
||||
isAndroidPlugin: true,
|
||||
isIosPlugin: true);
|
||||
|
||||
final Directory pluginExampleDirectory =
|
||||
mockPackagesDir.childDirectory('plugin').childDirectory('example');
|
||||
|
||||
createFakePubspec(pluginExampleDirectory, isFlutter: true);
|
||||
|
||||
await expectLater(
|
||||
() => runCapturingPrint(runner, <String>['drive-examples']),
|
||||
throwsA(const TypeMatcher<ToolExit>()));
|
||||
});
|
||||
|
||||
test(
|
||||
'driving under folder "test_driver" when targets are under "integration_test"',
|
||||
() async {
|
||||
@ -168,6 +189,7 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
@ -223,6 +245,8 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'Not supported for the target platform; skipping.',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
@ -255,6 +279,7 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
@ -300,6 +325,8 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'Not supported for the target platform; skipping.',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
@ -332,6 +359,7 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
@ -379,6 +407,8 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'Not supported for the target platform; skipping.',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
@ -411,6 +441,7 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
@ -460,6 +491,8 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'Not supported for the target platform; skipping.',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
@ -492,6 +525,7 @@ void main() {
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
@ -535,6 +569,29 @@ void main() {
|
||||
'drive-examples',
|
||||
]);
|
||||
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
'\n==========\nChecking plugin...',
|
||||
'Not supported for the target platform; skipping.',
|
||||
'\n\n',
|
||||
'All driver tests successful!',
|
||||
]),
|
||||
);
|
||||
|
||||
print(processRunner.recordedCalls);
|
||||
// Output should be empty since running drive-examples --macos with no macos
|
||||
// implementation is a no-op.
|
||||
expect(processRunner.recordedCalls, <ProcessCall>[]);
|
||||
});
|
||||
|
||||
test('platform interface plugins are silently skipped', () async {
|
||||
createFakePlugin('aplugin_platform_interface');
|
||||
|
||||
final List<String> output = await runCapturingPrint(runner, <String>[
|
||||
'drive-examples',
|
||||
]);
|
||||
|
||||
expect(
|
||||
output,
|
||||
orderedEquals(<String>[
|
||||
|
Reference in New Issue
Block a user