mirror of
https://github.com/flutter/packages.git
synced 2025-08-06 00:42:13 +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/gradle.dart';
|
||||
import 'common/package_looping_command.dart';
|
||||
import 'common/plugin_utils.dart';
|
||||
import 'common/process_runner.dart';
|
||||
import 'common/repository_package.dart';
|
||||
|
||||
@ -158,8 +159,13 @@ class FirebaseTestLabCommand extends PackageLoopingCommand {
|
||||
.childDirectory('androidTest');
|
||||
if (!uiTestDirectory.existsSync()) {
|
||||
printError('No androidTest directory found.');
|
||||
return PackageResult.fail(
|
||||
<String>['No tests ran (use --exclude if this is intentional).']);
|
||||
if (isFlutterPlugin(package)) {
|
||||
return PackageResult.fail(
|
||||
<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
|
||||
|
@ -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>[
|
||||
'example/integration_test/foo_test.dart',
|
||||
'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 {
|
||||
const String javaTestFileRelativePath =
|
||||
'example/android/app/src/androidTest/MainActivityTest.java';
|
||||
|
Reference in New Issue
Block a user