Add most of the widget tests; add more web test shards (#42807)

This commit is contained in:
Yegor
2019-10-16 09:18:44 -07:00
committed by GitHub
parent a665393a0d
commit 86f069f1c0
3 changed files with 56 additions and 12 deletions

View File

@@ -434,23 +434,35 @@ Future<void> _runTests() async {
print('${bold}DONE: All tests successful.$reset');
}
// TODO(yjbanov): we're getting rid of these blacklists as part of https://github.com/flutter/flutter/projects/60
const List<String> kWebTestDirectoryBlacklist = <String>[
'test/cupertino',
'test/examples',
'test/material',
];
const List<String> kWebTestFileBlacklist = <String>[
'test/widgets/heroes_test.dart',
'test/widgets/text_test.dart',
'test/widgets/selectable_text_test.dart',
'test/widgets/color_filter_test.dart',
'test/widgets/editable_text_cursor_test.dart',
'test/widgets/shadow_test.dart',
'test/widgets/raw_keyboard_listener_test.dart',
'test/widgets/editable_text_test.dart',
'test/widgets/widget_inspector_test.dart',
'test/widgets/draggable_test.dart',
'test/widgets/shortcuts_test.dart',
];
Future<void> _runWebTests() async {
final Directory flutterPackageDir = Directory(path.join(flutterRoot, 'packages', 'flutter'));
final Directory testDir = Directory(path.join(flutterPackageDir.path, 'test'));
// TODO(yjbanov): we're getting rid of this blacklist as part of https://github.com/flutter/flutter/projects/60
const List<String> kBlacklist = <String>[
'test/cupertino',
'test/examples',
'test/material',
'test/widgets',
];
final List<String> directories = testDir
.listSync()
.whereType<Directory>()
.map<String>((Directory dir) => path.relative(dir.path, from: flutterPackageDir.path))
.where((String relativePath) => !kBlacklist.contains(relativePath))
.where((String relativePath) => !kWebTestDirectoryBlacklist.contains(relativePath))
.toList();
await _runFlutterWebTest(flutterPackageDir.path, tests: directories);
@@ -687,7 +699,7 @@ class EvalResult {
///
/// WARNING: if you change this number, also change .cirrus.yml
/// and make sure it runs _all_ shards.
const int _kWebShardCount = 3;
const int _kWebShardCount = 6;
Future<void> _runFlutterWebTest(String workingDirectory, {
List<String> tests,
@@ -699,7 +711,8 @@ Future<void> _runFlutterWebTest(String workingDirectory, {
testDir.listSync(recursive: true)
.whereType<File>()
.where((File file) => file.path.endsWith('_test.dart'))
.map((File file) => path.relative(file.path, from: workingDirectory))
.map<String>((File file) => path.relative(file.path, from: workingDirectory))
.where((String filePath) => !kWebTestFileBlacklist.contains(filePath)),
);
}