flutter/packages/flutter_tools/test/web.shard/hot_reload_web_test.dart
Anna Gringauze edf26e756d
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
2020-11-11 15:42:15 -08:00

73 lines
2.3 KiB
Dart

// Copyright 2014 The Flutter 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 'dart:async';
import 'package:file/file.dart';
import '../integration.shard/test_data/hot_reload_project.dart';
import '../integration.shard/test_driver.dart';
import '../integration.shard/test_utils.dart';
import '../src/common.dart';
void main() {
Directory tempDir;
final HotReloadProject project = HotReloadProject();
FlutterRunTestDriver flutter;
setUp(() async {
tempDir = createResolvedTempDirectorySync('hot_reload_test.');
await project.setUpIn(tempDir);
flutter = FlutterRunTestDriver(tempDir);
});
tearDown(() async {
await flutter?.stop();
await flutter?.done;
tryToDelete(tempDir);
});
testWithoutContext('hot restart works without error', () async {
await flutter.run(chrome: true, additionalCommandArgs: <String>['--verbose']);
await flutter.hotRestart();
});
testWithoutContext('newly added code executes during hot restart', () async {
final Completer<void> completer = Completer<void>();
final StreamSubscription<String> subscription = flutter.stdout.listen((String line) {
print(line);
if (line.contains('(((((RELOAD WORKED)))))')) {
completer.complete();
}
});
await flutter.run(chrome: true, additionalCommandArgs: <String>['--verbose']);
project.uncommentHotReloadPrint();
try {
await flutter.hotRestart();
await completer.future.timeout(const Duration(seconds: 15));
} finally {
await subscription.cancel();
}
});
testWithoutContext('newly added code executes during hot restart - canvaskit', () async {
final Completer<void> completer = Completer<void>();
final StreamSubscription<String> subscription = flutter.stdout.listen((String line) {
print(line);
if (line.contains('(((((RELOAD WORKED)))))')) {
completer.complete();
}
});
await flutter.run(chrome: true,
additionalCommandArgs: <String>['--dart-define=FLUTTER_WEB_USE_SKIA=true', '--verbose']);
project.uncommentHotReloadPrint();
try {
await flutter.hotRestart();
await completer.future.timeout(const Duration(seconds: 15));
} finally {
await subscription.cancel();
}
});
}