mirror of
https://github.com/flutter/packages.git
synced 2025-08-06 17:28:42 +08:00
[tool] Skip non-plugin packages in FTL command (#3209)
The `firebase-test-lab` expectations were written for flutter/plugins, where everything was supposed to have an integration test. This makes non-plugin packages skip, not fail, if they don't have native Android integration tests. Fixes https://github.com/flutter/flutter/issues/120450
This commit is contained in:
@ -1,11 +1 @@
|
|||||||
# Manually exclude all non-plugin packages until
|
[]
|
||||||
# https://github.com/flutter/flutter/issues/120450
|
|
||||||
# is fixed.
|
|
||||||
- animations
|
|
||||||
- dynamic_layouts
|
|
||||||
- extension_google_sign_in_as_googleapis_auth
|
|
||||||
- flutter_adaptive_scaffold
|
|
||||||
- flutter_markdown
|
|
||||||
- go_router
|
|
||||||
- palette_generator
|
|
||||||
- rfw
|
|
||||||
|
@ -12,6 +12,7 @@ import 'package:uuid/uuid.dart';
|
|||||||
import 'common/core.dart';
|
import 'common/core.dart';
|
||||||
import 'common/gradle.dart';
|
import 'common/gradle.dart';
|
||||||
import 'common/package_looping_command.dart';
|
import 'common/package_looping_command.dart';
|
||||||
|
import 'common/plugin_utils.dart';
|
||||||
import 'common/process_runner.dart';
|
import 'common/process_runner.dart';
|
||||||
import 'common/repository_package.dart';
|
import 'common/repository_package.dart';
|
||||||
|
|
||||||
@ -158,8 +159,13 @@ class FirebaseTestLabCommand extends PackageLoopingCommand {
|
|||||||
.childDirectory('androidTest');
|
.childDirectory('androidTest');
|
||||||
if (!uiTestDirectory.existsSync()) {
|
if (!uiTestDirectory.existsSync()) {
|
||||||
printError('No androidTest directory found.');
|
printError('No androidTest directory found.');
|
||||||
|
if (isFlutterPlugin(package)) {
|
||||||
return PackageResult.fail(
|
return PackageResult.fail(
|
||||||
<String>['No tests ran (use --exclude if this is intentional).']);
|
<String>['No tests ran (use --exclude if this is intentional).']);
|
||||||
|
} else {
|
||||||
|
return PackageResult.skip(
|
||||||
|
'${example.displayName} has no native Android tests.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure that the Dart integration tests will be run, not just native UI
|
// Ensure that the Dart integration tests will be run, not just native UI
|
||||||
|
@ -420,7 +420,7 @@ public class MainActivityTest {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('fails for packages with no androidTest directory', () async {
|
test('fails for plugins with no androidTest directory', () async {
|
||||||
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
|
createFakePlugin('plugin', packagesDir, extraFiles: <String>[
|
||||||
'example/integration_test/foo_test.dart',
|
'example/integration_test/foo_test.dart',
|
||||||
'example/android/gradlew',
|
'example/android/gradlew',
|
||||||
@ -452,6 +452,30 @@ public class MainActivityTest {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('skips for non-plugin packages with no androidTest directory',
|
||||||
|
() async {
|
||||||
|
createFakePackage('a_package', packagesDir, extraFiles: <String>[
|
||||||
|
'example/integration_test/foo_test.dart',
|
||||||
|
'example/android/gradlew',
|
||||||
|
]);
|
||||||
|
|
||||||
|
final List<String> output = await runCapturingPrint(runner, <String>[
|
||||||
|
'firebase-test-lab',
|
||||||
|
'--device',
|
||||||
|
'model=redfin,version=30',
|
||||||
|
]);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
output,
|
||||||
|
containsAllInOrder(<Matcher>[
|
||||||
|
contains('Running for a_package'),
|
||||||
|
contains('No androidTest directory found.'),
|
||||||
|
contains('No examples support Android.'),
|
||||||
|
contains('Skipped 1 package'),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test('fails for packages with no integration test files', () async {
|
test('fails for packages with no integration test files', () async {
|
||||||
const String javaTestFileRelativePath =
|
const String javaTestFileRelativePath =
|
||||||
'example/android/app/src/androidTest/MainActivityTest.java';
|
'example/android/app/src/androidTest/MainActivityTest.java';
|
||||||
|
Reference in New Issue
Block a user