From 7a0b4669fc4a294296403584c79d0e289c0b01ed Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Mon, 12 Jul 2021 09:01:04 -0700 Subject: [PATCH] [flutter_tools] switch web integration tests to use html (#85325) --- .../test_data/hot_reload_project.dart | 11 ++++++++++- .../test/web.shard/debugger_stepping_web_test.dart | 5 ++--- .../web.shard/expression_evaluation_web_test.dart | 10 ++++------ .../test/web.shard/hot_reload_web_test.dart | 4 ++-- .../test/web.shard/vm_service_web_test.dart | 8 ++++---- .../flutter_tools/test/web.shard/web_run_test.dart | 2 +- 6 files changed, 23 insertions(+), 17 deletions(-) diff --git a/packages/flutter_tools/test/integration.shard/test_data/hot_reload_project.dart b/packages/flutter_tools/test/integration.shard/test_data/hot_reload_project.dart index 406abfa5e5..9c3cb56b54 100644 --- a/packages/flutter_tools/test/integration.shard/test_data/hot_reload_project.dart +++ b/packages/flutter_tools/test/integration.shard/test_data/hot_reload_project.dart @@ -25,12 +25,21 @@ class HotReloadProject extends Project { import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; + import 'package:flutter/foundation.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); final ByteData message = const StringCodec().encodeMessage('AppLifecycleState.resumed')!; await ServicesBinding.instance!.defaultBinaryMessenger.handlePlatformMessage('flutter/lifecycle', message, (_) { }); - runApp(MyApp()); + // See https://github.com/flutter/flutter/issues/86202 + if (kIsWeb) { + while (true) { + runApp(MyApp()); + await Future.delayed(const Duration(seconds: 1)); + } + } else { + runApp(MyApp()); + } } int count = 1; diff --git a/packages/flutter_tools/test/web.shard/debugger_stepping_web_test.dart b/packages/flutter_tools/test/web.shard/debugger_stepping_web_test.dart index 9e38e55d15..508064a42e 100644 --- a/packages/flutter_tools/test/web.shard/debugger_stepping_web_test.dart +++ b/packages/flutter_tools/test/web.shard/debugger_stepping_web_test.dart @@ -27,7 +27,7 @@ void main() { await flutter.run( withDebugger: true, startPaused: true, chrome: true, - additionalCommandArgs: ['--verbose']); + additionalCommandArgs: ['--verbose', '--web-renderer=html']); await flutter.addBreakpoint(_project.breakpointUri, _project.breakpointLine); await flutter.resume(); await flutter.waitForPause(); // Now we should be on the breakpoint. @@ -48,8 +48,7 @@ void main() { reason: 'After $i steps, debugger should stop at $expectedLine but stopped at $actualLine' ); } - }, skip: true, // Flaky: https://github.com/flutter/flutter/issues/83260 - ); + }); tearDown(() async { await flutter.stop(); diff --git a/packages/flutter_tools/test/web.shard/expression_evaluation_web_test.dart b/packages/flutter_tools/test/web.shard/expression_evaluation_web_test.dart index 72dafd588f..65724f4d6f 100644 --- a/packages/flutter_tools/test/web.shard/expression_evaluation_web_test.dart +++ b/packages/flutter_tools/test/web.shard/expression_evaluation_web_test.dart @@ -36,7 +36,7 @@ void main() { await flutter.run( withDebugger: true, chrome: true, expressionEvaluation: expressionEvaluation, - additionalCommandArgs: ['--verbose']); + additionalCommandArgs: ['--verbose', '--web-renderer=html']); } Future breakInBuildMethod(FlutterTestDriver flutter) async { @@ -104,8 +104,7 @@ void main() { await start(expressionEvaluation: true); await evaluateComplexExpressionsInLibrary(flutter); }); - }, skip: true, // Flaky tests: https://github.com/flutter/flutter/issues/84012 - ); + }); group('Flutter test for web', () { final TestsProject project = TestsProject(); @@ -140,7 +139,7 @@ void main() { withDebugger: true, chrome: true, expressionEvaluation: expressionEvaluation, startPaused: true, script: project.testFilePath, - additionalCommandArgs: ['--verbose']); + additionalCommandArgs: ['--verbose', '--web-renderer=html']); } testWithoutContext('cannot evaluate expressions if feature is disabled', () async { @@ -170,8 +169,7 @@ void main() { await startPaused(expressionEvaluation: true); await evaluateComplexExpressionsInLibrary(flutter); }); - }, skip: true, // Flaky tests: https://github.com/flutter/flutter/issues/84012 - ); + }); } Future failToEvaluateExpression(FlutterTestDriver flutter) async { diff --git a/packages/flutter_tools/test/web.shard/hot_reload_web_test.dart b/packages/flutter_tools/test/web.shard/hot_reload_web_test.dart index 143b7e8af4..7f03bafa3f 100644 --- a/packages/flutter_tools/test/web.shard/hot_reload_web_test.dart +++ b/packages/flutter_tools/test/web.shard/hot_reload_web_test.dart @@ -31,7 +31,7 @@ void main() { }); testWithoutContext('hot restart works without error', () async { - await flutter.run(chrome: true, additionalCommandArgs: ['--verbose']); + await flutter.run(chrome: true, additionalCommandArgs: ['--verbose', '--web-renderer=html']); await flutter.hotRestart(); }); @@ -43,7 +43,7 @@ void main() { completer.complete(); } }); - await flutter.run(chrome: true, additionalCommandArgs: ['--verbose']); + await flutter.run(chrome: true, additionalCommandArgs: ['--verbose', '--web-renderer=html']); project.uncommentHotReloadPrint(); try { await flutter.hotRestart(); diff --git a/packages/flutter_tools/test/web.shard/vm_service_web_test.dart b/packages/flutter_tools/test/web.shard/vm_service_web_test.dart index 4bf95b30c0..51e282e491 100644 --- a/packages/flutter_tools/test/web.shard/vm_service_web_test.dart +++ b/packages/flutter_tools/test/web.shard/vm_service_web_test.dart @@ -36,7 +36,7 @@ void main() { testWithoutContext('can validate flutter version', () async { await flutter.run( withDebugger: true, chrome: true, - additionalCommandArgs: ['--verbose']); + additionalCommandArgs: ['--verbose', '--web-renderer=html']); expect(flutter.vmServiceWsUri, isNotNull); @@ -48,7 +48,7 @@ void main() { testWithoutContext('can validate flutter version in parallel', () async { await flutter.run( withDebugger: true, chrome: true, - additionalCommandArgs: ['--verbose']); + additionalCommandArgs: ['--verbose', '--web-renderer=html']); expect(flutter.vmServiceWsUri, isNotNull); @@ -80,7 +80,7 @@ void main() { testWithoutContext('can validate flutter version', () async { await flutter.run( withDebugger: true, chrome: true, - additionalCommandArgs: ['--verbose']); + additionalCommandArgs: ['--verbose', '--web-renderer=html']); expect(flutter.vmServiceWsUri, isNotNull); @@ -93,7 +93,7 @@ void main() { testWithoutContext('can validate flutter version in parallel', () async { await flutter.run( withDebugger: true, chrome: true, - additionalCommandArgs: ['--verbose']); + additionalCommandArgs: ['--verbose', '--web-renderer=html']); expect(flutter.vmServiceWsUri, isNotNull); diff --git a/packages/flutter_tools/test/web.shard/web_run_test.dart b/packages/flutter_tools/test/web.shard/web_run_test.dart index 8c760cd12f..32f6e1e913 100644 --- a/packages/flutter_tools/test/web.shard/web_run_test.dart +++ b/packages/flutter_tools/test/web.shard/web_run_test.dart @@ -29,6 +29,6 @@ void main() { }); testWithoutContext('flutter run works on web devices with a unary main function', () async { - await flutter.run(chrome: true, additionalCommandArgs: ['--verbose']); + await flutter.run(chrome: true, additionalCommandArgs: ['--verbose', '--web-renderer=html']); }); }