Unverified Commit edf26e75 authored by Anna Gringauze's avatar Anna Gringauze Committed by GitHub

Move web integration tool tests to web.shard (#70226)

* Move web integration tool tests to web.shard

Web integration tool tests depend on DDC changes in SDK. This change
moves them to a separate shard and subshard so CI bot configurations
can run them separately.

In particular, with will allow running those tests on dart CI flutter
HHH web bot instead of a non-web one, allowing early detection and easy
classification of issues caused by SDK changes as VM- or Web related.

* Enabled verbose mode for flaky web_tool_tests

* Split out the test changes to be commited first
parent 153f3d23
...@@ -125,6 +125,7 @@ Future<void> main(List<String> args) async { ...@@ -125,6 +125,7 @@ Future<void> main(List<String> args) async {
'framework_tests': _runFrameworkTests, 'framework_tests': _runFrameworkTests,
'tool_coverage': _runToolCoverage, 'tool_coverage': _runToolCoverage,
'tool_tests': _runToolTests, 'tool_tests': _runToolTests,
'web_tool_tests': _runWebToolTests,
'web_tests': _runWebUnitTests, 'web_tests': _runWebUnitTests,
'web_integration_tests': _runWebIntegrationTests, 'web_integration_tests': _runWebIntegrationTests,
'web_long_running_tests': _runWebLongRunningTests, 'web_long_running_tests': _runWebLongRunningTests,
...@@ -313,6 +314,7 @@ Future<void> _runToolCoverage() async { ...@@ -313,6 +314,7 @@ Future<void> _runToolCoverage() async {
Future<void> _runToolTests() async { Future<void> _runToolTests() async {
const String kDotShard = '.shard'; const String kDotShard = '.shard';
const String kWeb = 'web';
const String kTest = 'test'; const String kTest = 'test';
final String toolsPath = path.join(flutterRoot, 'packages', 'flutter_tools'); final String toolsPath = path.join(flutterRoot, 'packages', 'flutter_tools');
...@@ -321,6 +323,7 @@ Future<void> _runToolTests() async { ...@@ -321,6 +323,7 @@ Future<void> _runToolTests() async {
.listSync() .listSync()
.map<String>((FileSystemEntity entry) => entry.path) .map<String>((FileSystemEntity entry) => entry.path)
.where((String name) => name.endsWith(kDotShard)) .where((String name) => name.endsWith(kDotShard))
.where((String name) => path.basenameWithoutExtension(name) != kWeb)
.map<String>((String name) => path.basenameWithoutExtension(name)), .map<String>((String name) => path.basenameWithoutExtension(name)),
// The `dynamic` on the next line is because Map.fromIterable isn't generic. // The `dynamic` on the next line is because Map.fromIterable isn't generic.
value: (dynamic subshard) => () async { value: (dynamic subshard) => () async {
...@@ -337,10 +340,27 @@ Future<void> _runToolTests() async { ...@@ -337,10 +340,27 @@ Future<void> _runToolTests() async {
); );
}, },
); );
// Prevent web tests from running if not explicitly requested.
if (Platform.environment[CIRRUS_TASK_NAME] == null) { await selectSubshard(subshards);
subshards.remove('web'); }
}
Future<void> _runWebToolTests() async {
const String kDotShard = '.shard';
const String kWeb = 'web';
const String kTest = 'test';
final String toolsPath = path.join(flutterRoot, 'packages', 'flutter_tools');
final Map<String, ShardRunner> subshards = <String, ShardRunner>{
kWeb:
() async {
await _pubRunTest(
toolsPath,
forceSingleCore: true,
testPaths: <String>[path.join(kTest, '$kWeb$kDotShard', '')],
enableFlutterToolAsserts: true,
);
}
};
await selectSubshard(subshards); await selectSubshard(subshards);
} }
......
# Web integration tests
These tests are not hermetic, and use the actual Flutter SDK. While
they don't require actual devices, they run `flutter_tester` to test
Dart web debug services (dwds) and Flutter integration.
Use this command to run (from the `flutter_tools` directory):
```shell
../../bin/cache/dart-sdk/bin/pub run test test/web.shard
```
These tests are expensive to run and do not give meaningful coverage
information for the flutter tool (since they are black-box tests that
run the tool as a subprocess, rather than being unit tests). For this
reason, they are in a separate shard when running on continuous
integration and are not run when calculating coverage.
...@@ -6,10 +6,10 @@ import 'dart:io'; ...@@ -6,10 +6,10 @@ import 'dart:io';
import 'package:file/file.dart'; import 'package:file/file.dart';
import '../integration.shard/test_data/stepping_project.dart';
import '../integration.shard/test_driver.dart';
import '../integration.shard/test_utils.dart';
import '../src/common.dart'; import '../src/common.dart';
import 'test_data/stepping_project.dart';
import 'test_driver.dart';
import 'test_utils.dart';
void main() { void main() {
Directory tempDirectory; Directory tempDirectory;
...@@ -25,7 +25,9 @@ void main() { ...@@ -25,7 +25,9 @@ void main() {
flutter = FlutterRunTestDriver(tempDirectory); flutter = FlutterRunTestDriver(tempDirectory);
await flutter.run(withDebugger: true, startPaused: true, chrome: true); await flutter.run(
withDebugger: true, startPaused: true, chrome: true,
additionalCommandArgs: <String>['--verbose']);
await flutter.addBreakpoint(_project.breakpointUri, _project.breakpointLine); await flutter.addBreakpoint(_project.breakpointUri, _project.breakpointLine);
await flutter.resume(); await flutter.resume();
await flutter.waitForPause(); // Now we should be on the breakpoint. await flutter.waitForPause(); // Now we should be on the breakpoint.
......
...@@ -33,7 +33,8 @@ void batch1() { ...@@ -33,7 +33,8 @@ void batch1() {
// No need to start paused as all breakpoint would be eventually reached. // No need to start paused as all breakpoint would be eventually reached.
return _flutter.run( return _flutter.run(
withDebugger: true, chrome: true, withDebugger: true, chrome: true,
expressionEvaluation: expressionEvaluation); expressionEvaluation: expressionEvaluation,
additionalCommandArgs: <String>['--verbose']);
} }
Future<void> breakInBuildMethod(FlutterTestDriver flutter) async { Future<void> breakInBuildMethod(FlutterTestDriver flutter) async {
...@@ -139,7 +140,8 @@ void batch2() { ...@@ -139,7 +140,8 @@ void batch2() {
return _flutter.run( return _flutter.run(
withDebugger: true, chrome: true, withDebugger: true, chrome: true,
expressionEvaluation: expressionEvaluation, expressionEvaluation: expressionEvaluation,
startPaused: true, script: _project.testFilePath); startPaused: true, script: _project.testFilePath,
additionalCommandArgs: <String>['--verbose']);
} }
testWithoutContext('flutter test expression evaluation - error if expression evaluation disabled', () async { testWithoutContext('flutter test expression evaluation - error if expression evaluation disabled', () async {
......
...@@ -24,11 +24,12 @@ void main() { ...@@ -24,11 +24,12 @@ void main() {
tearDown(() async { tearDown(() async {
await flutter?.stop(); await flutter?.stop();
await flutter?.done;
tryToDelete(tempDir); tryToDelete(tempDir);
}); });
testWithoutContext('hot restart works without error', () async { testWithoutContext('hot restart works without error', () async {
await flutter.run(chrome: true); await flutter.run(chrome: true, additionalCommandArgs: <String>['--verbose']);
await flutter.hotRestart(); await flutter.hotRestart();
}); });
...@@ -40,7 +41,7 @@ void main() { ...@@ -40,7 +41,7 @@ void main() {
completer.complete(); completer.complete();
} }
}); });
await flutter.run(chrome: true); await flutter.run(chrome: true, additionalCommandArgs: <String>['--verbose']);
project.uncommentHotReloadPrint(); project.uncommentHotReloadPrint();
try { try {
await flutter.hotRestart(); await flutter.hotRestart();
...@@ -58,7 +59,8 @@ void main() { ...@@ -58,7 +59,8 @@ void main() {
completer.complete(); completer.complete();
} }
}); });
await flutter.run(chrome: true, additionalCommandArgs: <String>['--dart-define=FLUTTER_WEB_USE_SKIA=true']); await flutter.run(chrome: true,
additionalCommandArgs: <String>['--dart-define=FLUTTER_WEB_USE_SKIA=true', '--verbose']);
project.uncommentHotReloadPrint(); project.uncommentHotReloadPrint();
try { try {
await flutter.hotRestart(); await flutter.hotRestart();
......
...@@ -4,10 +4,11 @@ ...@@ -4,10 +4,11 @@
import 'package:file/file.dart'; import 'package:file/file.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import '../integration.shard/test_data/basic_project.dart';
import '../integration.shard/test_driver.dart';
import '../integration.shard/test_utils.dart';
import '../src/common.dart'; import '../src/common.dart';
import 'test_data/basic_project.dart';
import 'test_driver.dart';
import 'test_utils.dart';
void main() { void main() {
Directory tempDir; Directory tempDir;
...@@ -26,6 +27,6 @@ void main() { ...@@ -26,6 +27,6 @@ void main() {
}); });
testWithoutContext('flutter run works on web devices with a unary main function', () async { testWithoutContext('flutter run works on web devices with a unary main function', () async {
await flutter.run(chrome: true); await flutter.run(chrome: true, additionalCommandArgs: <String>['--verbose']);
}, skip: platform.isMacOS); }, skip: platform.isMacOS);
} }
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