Unverified Commit 460dd00b authored by jcollins-g's avatar jcollins-g Committed by GitHub

Make automated_tests mostly ignore extraneous error messages (#14170)

* Ignore extraneous error messages outside of one skipped test

* Fix analysis error
parent f77826c5
[^═]*(this line contains the test framework's output with the clock and so forth)? <<skip until matching line>>
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════ ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following message was thrown running a test: The following message was thrown running a test:
Who lives, who dies, who tells your story\? Who lives, who dies, who tells your story\?
......
[^═]*(this line contains the test framework's output with the clock and so forth)? <<skip until matching line>>
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════ ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test: The following assertion was thrown running a test:
Guarded function conflict\. You must use "await" with all Future-returning test APIs\. Guarded function conflict\. You must use "await" with all Future-returning test APIs\.
......
[^═]*(this line contains the test framework's output with the clock and so forth)? [^═]*(this line contains the test framework's output with the clock and so forth)?
<<skip until matching line>>
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════ ══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following assertion was thrown running a test: The following assertion was thrown running a test:
Guarded function conflict\. You must use "await" with all Future-returning test APIs\. Guarded function conflict\. You must use "await" with all Future-returning test APIs\.
......
[^═]*(this line contains the test framework's output with the clock and so forth)? <<skip until matching line>>
══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════ ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════
The following message was thrown: The following message was thrown:
An animation is still running even after the widget tree was disposed. An animation is still running even after the widget tree was disposed.
......
[0-9]+:[0-9]+ [+]0: - A trivial widget test
[0-9]+:[0-9]+ [+]1: All tests passed!
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('A trivial widget test', (WidgetTester tester) async {});
}
...@@ -23,6 +23,11 @@ void main() { ...@@ -23,6 +23,11 @@ void main() {
final String automatedTestsDirectory = fs.path.join('..', '..', 'dev', 'automated_tests'); final String automatedTestsDirectory = fs.path.join('..', '..', 'dev', 'automated_tests');
final String flutterTestDirectory = fs.path.join(automatedTestsDirectory, 'flutter_test'); final String flutterTestDirectory = fs.path.join(automatedTestsDirectory, 'flutter_test');
testUsingContext('not have extraneous error messages', () async {
Cache.flutterRoot = '../..';
return _testFile('trivial_widget', automatedTestsDirectory, flutterTestDirectory, exitCode: isZero);
}, skip: io.Platform.isLinux); // Flutter on Linux sometimes has problems with font resolution (#7224)
testUsingContext('report nice errors for exceptions thrown within testWidgets()', () async { testUsingContext('report nice errors for exceptions thrown within testWidgets()', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
return _testFile('exception_handling', automatedTestsDirectory, flutterTestDirectory); return _testFile('exception_handling', automatedTestsDirectory, flutterTestDirectory);
...@@ -85,7 +90,8 @@ void main() { ...@@ -85,7 +90,8 @@ void main() {
}); });
} }
Future<Null> _testFile(String testName, String workingDirectory, String testDirectory) async { Future<Null> _testFile(String testName, String workingDirectory, String testDirectory, {Matcher exitCode}) async {
exitCode ??= isNonZero;
final String fullTestExpectation = fs.path.join(testDirectory, '${testName}_expectation.txt'); final String fullTestExpectation = fs.path.join(testDirectory, '${testName}_expectation.txt');
final File expectationFile = fs.file(fullTestExpectation); final File expectationFile = fs.file(fullTestExpectation);
if (!expectationFile.existsSync()) if (!expectationFile.existsSync())
...@@ -96,7 +102,7 @@ Future<Null> _testFile(String testName, String workingDirectory, String testDire ...@@ -96,7 +102,7 @@ Future<Null> _testFile(String testName, String workingDirectory, String testDire
final ProcessResult exec = await _runFlutterTest(testName, workingDirectory, testDirectory); final ProcessResult exec = await _runFlutterTest(testName, workingDirectory, testDirectory);
expect(exec.exitCode, isNonZero); expect(exec.exitCode, exitCode);
final List<String> output = exec.stdout.split('\n'); final List<String> output = exec.stdout.split('\n');
if (output.first == 'Waiting for another flutter command to release the startup lock...') if (output.first == 'Waiting for another flutter command to release the startup lock...')
output.removeAt(0); output.removeAt(0);
......
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