Commit 14145a4e authored by Ian Hickson's avatar Ian Hickson Committed by Flutter GitHub Bot

Try re-enabling all these tests. (#46615)

parent eb7a4a5e
...@@ -5,8 +5,8 @@ Who lives, who dies, who tells your story\? ...@@ -5,8 +5,8 @@ Who lives, who dies, who tells your story\?
When the exception was thrown, this was the stack: When the exception was thrown, this was the stack:
#0 main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:10:5\) #0 main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:10:5\)
<asynchronous suspension>
#1 .+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\) #1 .+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
<asynchronous suspension>
<<skip until matching line>> <<skip until matching line>>
^\(elided [0-9]+ frames.+$ ^\(elided [0-9]+ frames.+$
<<skip until matching line>> <<skip until matching line>>
...@@ -24,8 +24,8 @@ Who lives, who dies, who tells your story\? ...@@ -24,8 +24,8 @@ Who lives, who dies, who tells your story\?
When the exception was thrown, this was the stack: When the exception was thrown, this was the stack:
#0 main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:13:5\) #0 main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:13:5\)
<asynchronous suspension>
#1 .+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\) #1 .+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
<asynchronous suspension>
<<skip until matching line>> <<skip until matching line>>
^\(elided [0-9]+ .+$ ^\(elided [0-9]+ .+$
<<skip until matching line>> <<skip until matching line>>
...@@ -43,6 +43,8 @@ Who lives, who dies, who tells your story\? ...@@ -43,6 +43,8 @@ Who lives, who dies, who tells your story\?
When the exception was thrown, this was the stack: When the exception was thrown, this was the stack:
#[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:15:105\) #[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:15:105\)
#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]binding.dart:[0-9]+:[0-9]+\)
#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]binding.dart:[0-9]+:[0-9]+\) #[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]binding.dart:[0-9]+:[0-9]+\)
#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]binding.dart:[0-9]+:[0-9]+\) #[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]binding.dart:[0-9]+:[0-9]+\)
#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]binding.dart:[0-9]+:[0-9]+\) #[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]binding.dart:[0-9]+:[0-9]+\)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// found in the LICENSE file. // found in the LICENSE file.
import 'dart:async'; import 'dart:async';
import 'dart:io' as io; import 'dart:convert';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
...@@ -18,124 +18,117 @@ import '../../src/context.dart'; ...@@ -18,124 +18,117 @@ import '../../src/context.dart';
Future<void> _testExclusionLock; Future<void> _testExclusionLock;
void main() { void main() {
group('flutter test should', () { final String automatedTestsDirectory = fs.path.join('..', '..', 'dev', 'automated_tests');
final String flutterTestDirectory = fs.path.join(automatedTestsDirectory, 'flutter_test');
final String automatedTestsDirectory = fs.path.join('..', '..', 'dev', 'automated_tests'); testUsingContext('flutter test should not have extraneous error messages', () async {
final String flutterTestDirectory = fs.path.join(automatedTestsDirectory, 'flutter_test'); Cache.flutterRoot = '../..';
return _testFile('trivial_widget', automatedTestsDirectory, flutterTestDirectory, exitCode: isZero);
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 {
Cache.flutterRoot = '../..';
return _testFile('exception_handling', automatedTestsDirectory, flutterTestDirectory);
}, skip: true); // https://github.com/flutter/flutter/issues/46142
// Note: was skip: skip: io.Platform.isWindows
// TODO(chunhtai): Remove Skip https://github.com/flutter/flutter/issues/35425.
testUsingContext('report a nice error when a guarded function was called without await', () async {
Cache.flutterRoot = '../..';
return _testFile('test_async_utils_guarded', automatedTestsDirectory, flutterTestDirectory);
}, skip: io.Platform.isWindows); // TODO(chunhtai): Remove Skip https://github.com/flutter/flutter/issues/35425.
testUsingContext('report a nice error when an async function was called without await', () async { testUsingContext('flutter test should report nice errors for exceptions thrown within testWidgets()', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
return _testFile('test_async_utils_unguarded', automatedTestsDirectory, flutterTestDirectory); return _testFile('exception_handling', automatedTestsDirectory, flutterTestDirectory);
}, skip: io.Platform.isWindows); // TODO(chunhtai): Remove Skip https://github.com/flutter/flutter/issues/35425. });
testUsingContext('report a nice error when a Ticker is left running', () async { testUsingContext('flutter test should report a nice error when a guarded function was called without await', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
return _testFile('ticker', automatedTestsDirectory, flutterTestDirectory); return _testFile('test_async_utils_guarded', automatedTestsDirectory, flutterTestDirectory);
}, skip: io.Platform.isWindows); // TODO(chunhtai): Remove Skip https://github.com/flutter/flutter/issues/35425. });
testUsingContext('report a nice error when a pubspec.yaml is missing a flutter_test dependency', () async { testUsingContext('flutter test should report a nice error when an async function was called without await', () async {
final String missingDependencyTests = fs.path.join('..', '..', 'dev', 'missing_dependency_tests'); Cache.flutterRoot = '../..';
Cache.flutterRoot = '../..'; return _testFile('test_async_utils_unguarded', automatedTestsDirectory, flutterTestDirectory);
return _testFile('trivial', missingDependencyTests, missingDependencyTests); });
}, skip: io.Platform.isWindows); // TODO(chunhtai): Remove Skip https://github.com/flutter/flutter/issues/35425.
testUsingContext('report which user created widget caused the error', () async { testUsingContext('flutter test should report a nice error when a Ticker is left running', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
return _testFile('print_user_created_ancestor', automatedTestsDirectory, flutterTestDirectory, return _testFile('ticker', automatedTestsDirectory, flutterTestDirectory);
extraArguments: const <String>['--track-widget-creation']); });
}, skip: io.Platform.isWindows); // TODO(chunhtai): Remove Skip https://github.com/flutter/flutter/issues/35425.
testUsingContext('report which user created widget caused the error - no flag', () async { testUsingContext('flutter test should report a nice error when a pubspec.yaml is missing a flutter_test dependency', () async {
Cache.flutterRoot = '../..'; final String missingDependencyTests = fs.path.join('..', '..', 'dev', 'missing_dependency_tests');
return _testFile('print_user_created_ancestor_no_flag', automatedTestsDirectory, flutterTestDirectory, Cache.flutterRoot = '../..';
extraArguments: const <String>['--no-track-widget-creation']); return _testFile('trivial', missingDependencyTests, missingDependencyTests);
}, skip: io.Platform.isWindows); // TODO(chunhtai): Remove Skip https://github.com/flutter/flutter/issues/35425. });
testUsingContext('report correct created widget caused the error', () async { testUsingContext('flutter test should report which user created widget caused the error', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
return _testFile('print_correct_local_widget', automatedTestsDirectory, flutterTestDirectory, return _testFile('print_user_created_ancestor', automatedTestsDirectory, flutterTestDirectory,
extraArguments: const <String>['--track-widget-creation']); extraArguments: const <String>['--track-widget-creation']);
}, skip: io.Platform.isWindows); // TODO(chunhtai): Remove Skip https://github.com/flutter/flutter/issues/35425. });
testUsingContext('can load assets within its own package', () async { testUsingContext('flutter test should report which user created widget caused the error - no flag', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
return _testFile('package_assets', automatedTestsDirectory, flutterTestDirectory, exitCode: isZero); return _testFile('print_user_created_ancestor_no_flag', automatedTestsDirectory, flutterTestDirectory,
}, skip: true); // https://github.com/flutter/flutter/issues/46142 extraArguments: const <String>['--no-track-widget-creation']);
// Note, was skip: io.Platform.isWindows });
testUsingContext('run a test when its name matches a regexp', () async { testUsingContext('flutter test should report correct created widget caused the error', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final ProcessResult result = await _runFlutterTest('filtering', automatedTestsDirectory, flutterTestDirectory, return _testFile('print_correct_local_widget', automatedTestsDirectory, flutterTestDirectory,
extraArguments: const <String>['--name', 'inc.*de']); extraArguments: const <String>['--track-widget-creation']);
if (!(result.stdout as String).contains('+1: All tests passed')) { });
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
}
expect(result.exitCode, 0);
});
testUsingContext('run a test when its name contains a string', () async { testUsingContext('flutter test should can load assets within its own package', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final ProcessResult result = await _runFlutterTest('filtering', automatedTestsDirectory, flutterTestDirectory, return _testFile('package_assets', automatedTestsDirectory, flutterTestDirectory, exitCode: isZero);
extraArguments: const <String>['--plain-name', 'include']); });
if (!(result.stdout as String).contains('+1: All tests passed')) {
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
}
expect(result.exitCode, 0);
});
testUsingContext('test runs to completion', () async { testUsingContext('flutter test should run a test when its name matches a regexp', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final ProcessResult result = await _runFlutterTest('trivial', automatedTestsDirectory, flutterTestDirectory, final ProcessResult result = await _runFlutterTest('filtering', automatedTestsDirectory, flutterTestDirectory,
extraArguments: const <String>['--verbose']); extraArguments: const <String>['--name', 'inc.*de']);
final String stdout = result.stdout as String; if (!(result.stdout as String).contains('+1: All tests passed')) {
if ((!stdout.contains('+1: All tests passed')) || fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
(!stdout.contains('test 0: starting shell process')) || }
(!stdout.contains('test 0: deleting temporary directory')) || expect(result.exitCode, 0);
(!stdout.contains('test 0: finished')) || });
(!stdout.contains('test package returned with exit code 0'))) {
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
}
if ((result.stderr as String).isNotEmpty) {
fail('unexpected error output from test:\n\n${result.stderr}\n-- end stderr --\n\n');
}
expect(result.exitCode, 0);
});
testUsingContext('run all tests inside of a directory with no trailing slash', () async { testUsingContext('flutter test should run a test when its name contains a string', () async {
Cache.flutterRoot = '../..'; Cache.flutterRoot = '../..';
final ProcessResult result = await _runFlutterTest(null, automatedTestsDirectory, flutterTestDirectory + '/child_directory', final ProcessResult result = await _runFlutterTest('filtering', automatedTestsDirectory, flutterTestDirectory,
extraArguments: const <String>['--verbose']); extraArguments: const <String>['--plain-name', 'include']);
final String stdout = result.stdout as String; if (!(result.stdout as String).contains('+1: All tests passed')) {
if ((!stdout.contains('+2: All tests passed')) || fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
(!stdout.contains('test 0: starting shell process')) || }
(!stdout.contains('test 0: deleting temporary directory')) || expect(result.exitCode, 0);
(!stdout.contains('test 0: finished')) || });
(!stdout.contains('test package returned with exit code 0'))) {
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
}
if ((result.stderr as String).isNotEmpty) {
fail('unexpected error output from test:\n\n${result.stderr}\n-- end stderr --\n\n');
}
expect(result.exitCode, 0);
});
testUsingContext('flutter test should test runs to completion', () async {
Cache.flutterRoot = '../..';
final ProcessResult result = await _runFlutterTest('trivial', automatedTestsDirectory, flutterTestDirectory,
extraArguments: const <String>['--verbose']);
final String stdout = result.stdout as String;
if ((!stdout.contains('+1: All tests passed')) ||
(!stdout.contains('test 0: starting shell process')) ||
(!stdout.contains('test 0: deleting temporary directory')) ||
(!stdout.contains('test 0: finished')) ||
(!stdout.contains('test package returned with exit code 0'))) {
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
}
if ((result.stderr as String).isNotEmpty) {
fail('unexpected error output from test:\n\n${result.stderr}\n-- end stderr --\n\n');
}
expect(result.exitCode, 0);
});
testUsingContext('flutter test should run all tests inside of a directory with no trailing slash', () async {
Cache.flutterRoot = '../..';
final ProcessResult result = await _runFlutterTest(null, automatedTestsDirectory, flutterTestDirectory + '/child_directory',
extraArguments: const <String>['--verbose']);
final String stdout = result.stdout as String;
if ((!stdout.contains('+2: All tests passed')) ||
(!stdout.contains('test 0: starting shell process')) ||
(!stdout.contains('test 0: deleting temporary directory')) ||
(!stdout.contains('test 0: finished')) ||
(!stdout.contains('test package returned with exit code 0'))) {
fail('unexpected output from test:\n\n${result.stdout}\n-- end stdout --\n\n');
}
if ((result.stderr as String).isNotEmpty) {
fail('unexpected error output from test:\n\n${result.stderr}\n-- end stderr --\n\n');
}
expect(result.exitCode, 0);
}); });
} }
...@@ -269,6 +262,8 @@ Future<ProcessResult> _runFlutterTest( ...@@ -269,6 +262,8 @@ Future<ProcessResult> _runFlutterTest(
fs.path.join(dartSdkPath, 'bin', 'dart'), fs.path.join(dartSdkPath, 'bin', 'dart'),
args, args,
workingDirectory: workingDirectory, workingDirectory: workingDirectory,
stdoutEncoding: utf8,
stderrEncoding: utf8,
); );
} finally { } finally {
_testExclusionLock = null; _testExclusionLock = null;
......
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