Unverified Commit d42d0c51 authored by Danny Tuppeny's avatar Danny Tuppeny Committed by GitHub

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).
parent b5fff3b2
...@@ -111,6 +111,7 @@ void main() { ...@@ -111,6 +111,7 @@ void main() {
); );
await _flutter.waitForPause(); await _flutter.waitForPause();
await evaluateTrivialExpressions(_flutter); await evaluateTrivialExpressions(_flutter);
await _flutter.resume();
}); });
test('can evaluate complex expressions in a test', () async { test('can evaluate complex expressions in a test', () async {
...@@ -120,6 +121,7 @@ void main() { ...@@ -120,6 +121,7 @@ void main() {
); );
await _flutter.waitForPause(); await _flutter.waitForPause();
await evaluateComplexExpressions(_flutter); await evaluateComplexExpressions(_flutter);
await _flutter.resume();
}); });
test('can evaluate expressions returning complex objects in a test', () async { test('can evaluate expressions returning complex objects in a test', () async {
...@@ -129,9 +131,9 @@ void main() { ...@@ -129,9 +131,9 @@ void main() {
); );
await _flutter.waitForPause(); await _flutter.waitForPause();
await evaluateComplexReturningExpressions(_flutter); await evaluateComplexReturningExpressions(_flutter);
await _flutter.resume();
}); });
// Skipped due to https://github.com/flutter/flutter/issues/26518 }, timeout: const Timeout.factor(10), tags: <String>['integration']); // The DevFS sync takes a really long time, so these tests can be slow.
}, timeout: const Timeout.factor(10), skip: true, tags: <String>['integration']); // The DevFS sync takes a really long time, so these tests can be slow.
} }
Future<void> evaluateTrivialExpressions(FlutterTestDriver flutter) async { Future<void> evaluateTrivialExpressions(FlutterTestDriver flutter) async {
......
...@@ -653,10 +653,11 @@ class FlutterTestTestDriver extends FlutterTestDriver { ...@@ -653,10 +653,11 @@ class FlutterTestTestDriver extends FlutterTestDriver {
} }
Future<Map<String, dynamic>> _waitForJson({ Future<Map<String, dynamic>> _waitForJson({
Duration timeout, Duration timeout = defaultTimeout,
}) async { }) async {
return _timeoutWithMessages<Map<String, dynamic>>( return _timeoutWithMessages<Map<String, dynamic>>(
() => _stdout.stream.map<Map<String, dynamic>>(_parseJsonResponse).first, () => _stdout.stream.map<Map<String, dynamic>>(_parseJsonResponse)
.firstWhere((Map<String, dynamic> output) => output != null),
timeout: timeout, timeout: timeout,
task: 'Waiting for JSON', task: 'Waiting for JSON',
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment