From d42d0c5171dd295b8904d41d3f34db51f77173d0 Mon Sep 17 00:00:00 2001 From: Danny Tuppeny Date: Mon, 22 Jul 2019 19:43:37 +0100 Subject: [PATCH] Re-enable `flutter test` expression evaluation tests (#36431) Plus: - Resume the app being run after expression has been evaluated to prevent the test run being forcefully terminated because it didn't end - Skip non-JSON when waiting for JSON (eg. when running in verbose mode for debugging locally) - Pass defaultTimeout in waitForJson (otherwise the assert in _timeoutWithMessages fails when it's not provided) Closes https://github.com/flutter/flutter/issues/26518 (the original reason for skip was fixed in https://github.com/dart-lang/sdk/issues/34224). --- .../test/integration.shard/expression_evaluation_test.dart | 6 ++++-- .../flutter_tools/test/integration.shard/test_driver.dart | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/flutter_tools/test/integration.shard/expression_evaluation_test.dart b/packages/flutter_tools/test/integration.shard/expression_evaluation_test.dart index b5d61a6b00..3a95505b76 100644 --- a/packages/flutter_tools/test/integration.shard/expression_evaluation_test.dart +++ b/packages/flutter_tools/test/integration.shard/expression_evaluation_test.dart @@ -111,6 +111,7 @@ void main() { ); await _flutter.waitForPause(); await evaluateTrivialExpressions(_flutter); + await _flutter.resume(); }); test('can evaluate complex expressions in a test', () async { @@ -120,6 +121,7 @@ void main() { ); await _flutter.waitForPause(); await evaluateComplexExpressions(_flutter); + await _flutter.resume(); }); test('can evaluate expressions returning complex objects in a test', () async { @@ -129,9 +131,9 @@ void main() { ); await _flutter.waitForPause(); await evaluateComplexReturningExpressions(_flutter); + await _flutter.resume(); }); - // Skipped due to https://github.com/flutter/flutter/issues/26518 - }, timeout: const Timeout.factor(10), skip: true, tags: ['integration']); // The DevFS sync takes a really long time, so these tests can be slow. + }, timeout: const Timeout.factor(10), tags: ['integration']); // The DevFS sync takes a really long time, so these tests can be slow. } Future evaluateTrivialExpressions(FlutterTestDriver flutter) async { diff --git a/packages/flutter_tools/test/integration.shard/test_driver.dart b/packages/flutter_tools/test/integration.shard/test_driver.dart index 335903e6f7..ac291204c7 100644 --- a/packages/flutter_tools/test/integration.shard/test_driver.dart +++ b/packages/flutter_tools/test/integration.shard/test_driver.dart @@ -653,10 +653,11 @@ class FlutterTestTestDriver extends FlutterTestDriver { } Future> _waitForJson({ - Duration timeout, + Duration timeout = defaultTimeout, }) async { return _timeoutWithMessages>( - () => _stdout.stream.map>(_parseJsonResponse).first, + () => _stdout.stream.map>(_parseJsonResponse) + .firstWhere((Map output) => output != null), timeout: timeout, task: 'Waiting for JSON', );