From ebfe6020b8b3bb23f99e8f11b2d7afa9f180e5a9 Mon Sep 17 00:00:00 2001 From: Yegor Date: Mon, 7 Oct 2019 15:05:24 -0700 Subject: [PATCH] Enable more web tests; use blacklist to filter them out (#41922) Add more web tests;use blacklist instead of whitelist --- dev/bots/test.dart | 34 ++++++++++++------- .../gestures/transformed_monodrag_test.dart | 4 +-- packages/flutter_test/lib/src/matchers.dart | 6 ++-- .../flutter_tools/lib/src/web/chrome.dart | 4 --- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/dev/bots/test.dart b/dev/bots/test.dart index bf66f78bcd3..0530da3c7f7 100644 --- a/dev/bots/test.dart +++ b/dev/bots/test.dart @@ -435,18 +435,28 @@ Future _runTests() async { } Future _runWebTests() async { - await _runFlutterWebTest(path.join(flutterRoot, 'packages', 'flutter'), tests: [ - 'test/foundation/', - 'test/physics/', - 'test/services/', - // TODO(yjbanov): re-enable when flakiness is resolved - // 'test/rendering/', - // 'test/painting/', - // 'test/scheduler/', - // 'test/semantics/', - // 'test/widgets/', - // 'test/material/', - ]); + 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 kBlacklist = [ + 'test/cupertino', + 'test/examples', + 'test/material', + 'test/painting', + 'test/rendering', + 'test/semantics', + 'test/widgets', + ]; + + final List directories = testDir + .listSync() + .whereType() + .map((Directory dir) => path.relative(dir.path, from: flutterPackageDir.path)) + .where((String relativePath) => !kBlacklist.contains(relativePath)) + .toList(); + + await _runFlutterWebTest(flutterPackageDir.path, tests: directories); await _runFlutterWebTest(path.join(flutterRoot, 'packages', 'flutter_web_plugins'), tests: ['test']); } diff --git a/packages/flutter/test/gestures/transformed_monodrag_test.dart b/packages/flutter/test/gestures/transformed_monodrag_test.dart index 9f58603fdff..a2668c40a5d 100644 --- a/packages/flutter/test/gestures/transformed_monodrag_test.dart +++ b/packages/flutter/test/gestures/transformed_monodrag_test.dart @@ -334,7 +334,7 @@ void main() { expect(startDetails, hasLength(1)); expect(updateDetails.single.globalPosition, within(distance: 0.0001, from: const Offset(400 + kTouchSlop + 3, 300 + kTouchSlop + 4))); expect(updateDetails.single.delta, within(distance: 0.1, from: const Offset(5, 0.0))); // sqrt(3^2 + 4^2) - expect(updateDetails.single.primaryDelta, within(distance: 0.1, from: 5.0)); // sqrt(3^2 + 4^2) + expect(updateDetails.single.primaryDelta, within(distance: 0.1, from: 5.0)); // sqrt(3^2 + 4^2) }); }); @@ -662,7 +662,7 @@ void main() { expect(startDetails, hasLength(1)); expect(updateDetails.single.globalPosition, within(distance: 0.0001, from: const Offset(400 + kTouchSlop - 4, 300 + kTouchSlop + 3))); expect(updateDetails.single.delta, within(distance: 0.1, from: const Offset(0.0, 5.0))); // sqrt(3^2 + 4^2) - expect(updateDetails.single.primaryDelta, within(distance: 0.1, from: 5.0)); // sqrt(3^2 + 4^2) + expect(updateDetails.single.primaryDelta, within(distance: 0.1, from: 5.0)); // sqrt(3^2 + 4^2) }); }); } diff --git a/packages/flutter_test/lib/src/matchers.dart b/packages/flutter_test/lib/src/matchers.dart index e0518144e51..03b1b421485 100644 --- a/packages/flutter_test/lib/src/matchers.dart +++ b/packages/flutter_test/lib/src/matchers.dart @@ -1026,8 +1026,8 @@ double _sizeDistance(Size a, Size b) { /// The distance is computed by a [DistanceFunction]. /// /// If `distanceFunction` is null, a standard distance function is used for the -/// `runtimeType` of the `from` argument. Standard functions are defined for -/// the following types: +/// `T` generic argument. Standard functions are defined for the following +/// types: /// /// * [Color], whose distance is the maximum component-wise delta. /// * [Offset], whose distance is the Euclidean distance computed using the @@ -1050,7 +1050,7 @@ Matcher within({ @required T from, DistanceFunction distanceFunction, }) { - distanceFunction ??= _kStandardDistanceFunctions[from.runtimeType]; + distanceFunction ??= _kStandardDistanceFunctions[T]; if (distanceFunction == null) { throw ArgumentError( diff --git a/packages/flutter_tools/lib/src/web/chrome.dart b/packages/flutter_tools/lib/src/web/chrome.dart index 10e056d0cf1..db2fec19031 100644 --- a/packages/flutter_tools/lib/src/web/chrome.dart +++ b/packages/flutter_tools/lib/src/web/chrome.dart @@ -154,10 +154,6 @@ class ChromeLauncher { return chrome; } - /// Connects to an instance of Chrome with an open debug port. - static Future fromExisting(int port) async => - _connect(Chrome._(port, ChromeConnection('localhost', port)), false); - static Future get connectedInstance => _currentCompleter.future; /// Returns the full URL of the Chrome remote debugger for the main page.