Make automated_tests mostly ignore extraneous error messages (#14170)
* Ignore extraneous error messages outside of one skipped test * Fix analysis error
This commit is contained in:
parent
f77826c5ee
commit
460dd00b72
@ -1,4 +1,4 @@
|
|||||||
[^═]*(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\?
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[^═]*(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\.
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
[^═]*(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\.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
[^═]*(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,0 +1,2 @@
|
|||||||
|
[0-9]+:[0-9]+ [+]0: - A trivial widget test
|
||||||
|
[0-9]+:[0-9]+ [+]1: All tests passed!
|
@ -0,0 +1,9 @@
|
|||||||
|
// 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() {
|
|||||||
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() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
|||||||
|
|
||||||
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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user