From 7d1a2f74323f18b9b09e14ed9642e0de59537e93 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Wed, 4 Sep 2024 08:27:14 -0700 Subject: [PATCH 01/18] Test branch for bots --- packages/devtools_app/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/devtools_app/README.md b/packages/devtools_app/README.md index d87507936cd..b15dbd3eb15 100644 --- a/packages/devtools_app/README.md +++ b/packages/devtools_app/README.md @@ -7,7 +7,7 @@ the devtools app is in package:devtools_app. ## Getting started For documentation on installing and trying out DevTools, please -visit the [DevTools docs](https://docs.flutter.dev/tools/devtools/). +visit the [DevTools documentation](https://docs.flutter.dev/tools/devtools/). ## Feedback From 627285b4468e19338633c581e2a0cf9277b313c3 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Wed, 4 Sep 2024 13:45:54 -0700 Subject: [PATCH 02/18] Enhance logging. --- .../test_infra/run/_utils.dart | 2 +- .../lib/src/test/integration_test_runner.dart | 35 ++++++++++--------- .../lib/src/test/io_utils.dart | 4 +-- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/packages/devtools_app/integration_test/test_infra/run/_utils.dart b/packages/devtools_app/integration_test/test_infra/run/_utils.dart index 012ed47e72f..1ec03224827 100644 --- a/packages/devtools_app/integration_test/test_infra/run/_utils.dart +++ b/packages/devtools_app/integration_test/test_infra/run/_utils.dart @@ -4,7 +4,7 @@ // ignore_for_file: avoid_print -bool debugTestScript = false; +bool debugTestScript = true; void debugLog(String log) { if (debugTestScript) { diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index 2e737a070ca..53f1ec6de05 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -36,22 +36,21 @@ class IntegrationTestRunner with IOMixin { Future runTest({required int attemptNumber}) async { debugLog('starting the flutter drive process'); - final process = await Process.start( - 'flutter', - [ - 'drive', - // Debug outputs from the test will not show up in profile mode. Since - // we rely on debug outputs for detecting errors and exceptions from the - // test, we cannot run this these tests in profile mode until this issue - // is resolved. See https://github.com/flutter/flutter/issues/69070. - // '--profile', - '--driver=$testDriver', - '--target=$testTarget', - '-d', - headless ? 'web-server' : 'chrome', - for (final arg in dartDefineArgs) '--dart-define=$arg', - ], - ); + final flutterDriveArgs = [ + 'drive', + // Debug outputs from the test will not show up in profile mode. Since + // we rely on debug outputs for detecting errors and exceptions from the + // test, we cannot run this these tests in profile mode until this issue + // is resolved. See https://github.com/flutter/flutter/issues/69070. + // '--profile', + '--driver=$testDriver', + '--target=$testTarget', + '-d', + headless ? 'web-server' : 'chrome', + for (final arg in dartDefineArgs) '--dart-define=$arg', + ]; + debugLog('> flutter ${flutterDriveArgs.join(' ')}'); + final process = await Process.start('flutter', flutterDriveArgs); bool stdOutWriteInProgress = false; bool stdErrWriteInProgress = false; @@ -112,6 +111,10 @@ class IntegrationTestRunner with IOMixin { timeout, ]); + debugLog( + 'shutting down processes because ' + '${testTimedOut ? 'test timed out' : 'test finished'}', + ); debugLog('attempting to kill the flutter drive process'); process.kill(); debugLog('flutter drive process has exited'); diff --git a/packages/devtools_shared/lib/src/test/io_utils.dart b/packages/devtools_shared/lib/src/test/io_utils.dart index a5ce8d7b020..bb65050d584 100644 --- a/packages/devtools_shared/lib/src/test/io_utils.dart +++ b/packages/devtools_shared/lib/src/test/io_utils.dart @@ -82,7 +82,7 @@ mixin IOMixin { }) async { final processId = process.pid; if (debugLogging) { - print('Sending SIGTERM to $processId..'); + print('Sending SIGTERM to $processId.'); } await cancelAllStreamSubscriptions(); Process.killPid(processId); @@ -100,7 +100,7 @@ mixin IOMixin { // Use sigint here instead of sigkill. See // https://github.com/flutter/flutter/issues/117415. if (debugLogging) { - print('Sending SIGINT to $processId..'); + print('Sending SIGINT to $processId.'); } Process.killPid(processId, ProcessSignal.sigint); return process.exitCode; From ae7920fff89159f320c6911b738cfd9b942342cb Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Wed, 4 Sep 2024 13:48:16 -0700 Subject: [PATCH 03/18] Undo initial commit --- packages/devtools_app/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/devtools_app/README.md b/packages/devtools_app/README.md index b15dbd3eb15..d87507936cd 100644 --- a/packages/devtools_app/README.md +++ b/packages/devtools_app/README.md @@ -7,7 +7,7 @@ the devtools app is in package:devtools_app. ## Getting started For documentation on installing and trying out DevTools, please -visit the [DevTools documentation](https://docs.flutter.dev/tools/devtools/). +visit the [DevTools docs](https://docs.flutter.dev/tools/devtools/). ## Feedback From b9c49f30b765467171fa224dad876c0fbfbd24a9 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Wed, 4 Sep 2024 15:52:12 -0700 Subject: [PATCH 04/18] try only running eval_and_inspect_test.dart --- packages/devtools_app/integration_test/run_tests.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/devtools_app/integration_test/run_tests.dart b/packages/devtools_app/integration_test/run_tests.dart index 1a35dbd238a..df88e9f4495 100644 --- a/packages/devtools_app/integration_test/run_tests.dart +++ b/packages/devtools_app/integration_test/run_tests.dart @@ -30,6 +30,13 @@ const _testDeviceAll = 'all'; /// Format: `'my_example_test.dart'`. final _skipTestsForDevice = >{ _testDeviceAll: { + 'app_test.dart', + 'debugger_panel_test.dart', + 'devtools_extensions_test.dart', + 'export_snapshot_test.dart', + 'performance_screen_event_recording_test.dart', + 'service_connection_test.dart', + 'service_extensions_test.dart', // https://github.com/flutter/devtools/issues/6592 'eval_and_browse_test.dart', // https://github.com/flutter/devtools/issues/7425 From 0cc3506421af811f837da37a97526af6db6ab769 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Wed, 4 Sep 2024 16:37:36 -0700 Subject: [PATCH 05/18] Add debug logging --- .../integration_test/run_tests.dart | 22 ++++++++++--------- .../test_infra/run/run_test.dart | 6 +++-- .../lib/src/test/integration_test_runner.dart | 11 ++++++++++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/packages/devtools_app/integration_test/run_tests.dart b/packages/devtools_app/integration_test/run_tests.dart index df88e9f4495..b129931555a 100644 --- a/packages/devtools_app/integration_test/run_tests.dart +++ b/packages/devtools_app/integration_test/run_tests.dart @@ -18,22 +18,21 @@ import 'test_infra/run/run_test.dart'; const _testDirectory = 'integration_test/test'; const _offlineIndicator = 'integration_test/test/offline'; -/// The key in [_skipTestsForDevice] that will hold a set of tests that should +/// The key in [_disabledTestsForDevice] that will hold a set of tests that should /// be skipped for all test devices. const _testDeviceAll = 'all'; -/// The set of tests that should be skipped for each type of test target. +/// The set of tests that are temporarily disabled for each type of test device. /// /// This list should be empty most of the time, but may contain a broken test /// while a fix being worked on. /// /// Format: `'my_example_test.dart'`. -final _skipTestsForDevice = >{ +final _disabledTestsForDevice = >{ _testDeviceAll: { 'app_test.dart', 'debugger_panel_test.dart', 'devtools_extensions_test.dart', - 'export_snapshot_test.dart', 'performance_screen_event_recording_test.dart', 'service_connection_test.dart', 'service_extensions_test.dart', @@ -74,14 +73,17 @@ Future _runTest( final testTarget = testRunnerArgs.testTarget!; final testDevice = testRunnerArgs.testAppDevice.name; - final skipAll = _skipTestsForDevice[_testDeviceAll]!; - final skipForDevice = _skipTestsForDevice[testDevice] ?? {}; - final shouldSkip = - {...skipAll, ...skipForDevice}.any((t) => testTarget.endsWith(t)); - if (shouldSkip) return; + final disabledForAllDevices = _disabledTestsForDevice[_testDeviceAll]!; + final disabledForDevice = _disabledTestsForDevice[testDevice] ?? {}; + final disabled = {...disabledForAllDevices, ...disabledForDevice} + .any((t) => testTarget.endsWith(t)); + if (disabled) { + debugLog('Disabled test - skipping $testTarget for $testDevice.'); + return; + } if (!testRunnerArgs.testAppDevice.supportsTest(testTarget)) { - // Skip test, since it is not supported for device. + debugLog('Unsupported test - skipping $testTarget for $testDevice.'); return; } diff --git a/packages/devtools_app/integration_test/test_infra/run/run_test.dart b/packages/devtools_app/integration_test/test_infra/run/run_test.dart index c0a62ab3a96..e8cad8ae97a 100644 --- a/packages/devtools_app/integration_test/test_infra/run/run_test.dart +++ b/packages/devtools_app/integration_test/test_infra/run/run_test.dart @@ -28,7 +28,6 @@ Future runFlutterIntegrationTest( if (!offline) { if (testRunnerArgs.testAppUri == null) { - debugLog('Starting a test application'); // Create the test app and start it. try { if (testRunnerArgs.testAppDevice == TestAppDevice.cli) { @@ -46,6 +45,7 @@ Future runFlutterIntegrationTest( appDevice: testRunnerArgs.testAppDevice, ); } + debugLog('testApp.start()'); await testApp.start(); } catch (e) { // ignore: avoid-throw-in-catch-block, by design @@ -63,8 +63,10 @@ Future runFlutterIntegrationTest( final testArgs = { if (!offline) 'service_uri': testAppUri, }; + final testTarget = testRunnerArgs.testTarget!; + debugLog('Starting test run [target: $testTarget]'); await testRunner.run( - testRunnerArgs.testTarget!, + testTarget, testDriver: 'test_driver/integration_test.dart', headless: testRunnerArgs.headless, dartDefineArgs: [ diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index 53f1ec6de05..3226bc91ab5 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -35,6 +35,7 @@ class IntegrationTestRunner with IOMixin { } Future runTest({required int attemptNumber}) async { + debugLog('starting attempt #$attemptNumber for $testTarget'); debugLog('starting the flutter drive process'); final flutterDriveArgs = [ 'drive', @@ -291,6 +292,10 @@ Future runOneOrManyTests({ return; } + void debugLog(String log) { + if (debugLogging) print(log); + } + final chromedriver = ChromeDriver(); try { @@ -300,6 +305,7 @@ Future runOneOrManyTests({ if (testRunnerArgs.testTarget != null) { // TODO(kenz): add support for specifying a directory as the target instead // of a single file. + debugLog('Running a single test: ${testRunnerArgs.testTarget}'); await runTest(testRunnerArgs); } else { // Run all supported tests since a specific target test was not provided. @@ -313,6 +319,10 @@ Future runOneOrManyTests({ ) .toList(); + debugLog( + 'Running all tests: ${testFiles.map((file) => file.path).toList().toString()}', + ); + final shard = testRunnerArgs.shard; if (shard != null) { final shardSize = testFiles.length ~/ shard.totalShards; @@ -330,6 +340,7 @@ Future runOneOrManyTests({ ...testRunnerArgs.rawArgs, '--${IntegrationTestRunnerArgs.testTargetArg}=$testTarget', ]); + debugLog('Running a single test of many: $testTarget'); await runTest(newArgsWithTarget); } } From ae7dd1ecb84b73565dd5e992f811d00b81a1afc7 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Wed, 4 Sep 2024 16:37:47 -0700 Subject: [PATCH 06/18] add stdout/stderr prints --- .../devtools_shared/lib/src/test/integration_test_runner.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index 3226bc91ab5..640e9dcc1ff 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -62,6 +62,7 @@ class IntegrationTestRunner with IOMixin { process, printTag: 'FlutterDriveProcess', onStdout: (line) { + debugLog('STDOUT LINE: $line'); if (line.endsWith(_allTestsPassed)) { testsPassed = true; } @@ -92,6 +93,7 @@ class IntegrationTestRunner with IOMixin { } }, onStderr: (line) { + debugLog('STDERR LINE: $line'); if (line.contains(_errorMarker) || line.contains(_unhandledExceptionMarker)) { stdErrWriteInProgress = true; From 43cf9b479fdbd6334dbb046b325fa7be98382ec7 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Thu, 5 Sep 2024 09:01:14 -0700 Subject: [PATCH 07/18] logs --- .../integration_test/test_infra/run/run_test.dart | 2 +- .../lib/src/test/integration_test_runner.dart | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/devtools_app/integration_test/test_infra/run/run_test.dart b/packages/devtools_app/integration_test/test_infra/run/run_test.dart index e8cad8ae97a..4d9a753016c 100644 --- a/packages/devtools_app/integration_test/test_infra/run/run_test.dart +++ b/packages/devtools_app/integration_test/test_infra/run/run_test.dart @@ -64,7 +64,7 @@ Future runFlutterIntegrationTest( if (!offline) 'service_uri': testAppUri, }; final testTarget = testRunnerArgs.testTarget!; - debugLog('Starting test run [target: $testTarget]'); + debugLog('starting test run for $testTarget'); await testRunner.run( testTarget, testDriver: 'test_driver/integration_test.dart', diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index 640e9dcc1ff..bfe032f0986 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -307,7 +307,7 @@ Future runOneOrManyTests({ if (testRunnerArgs.testTarget != null) { // TODO(kenz): add support for specifying a directory as the target instead // of a single file. - debugLog('Running a single test: ${testRunnerArgs.testTarget}'); + debugLog('Attempting to run a single test: ${testRunnerArgs.testTarget}'); await runTest(testRunnerArgs); } else { // Run all supported tests since a specific target test was not provided. @@ -321,10 +321,6 @@ Future runOneOrManyTests({ ) .toList(); - debugLog( - 'Running all tests: ${testFiles.map((file) => file.path).toList().toString()}', - ); - final shard = testRunnerArgs.shard; if (shard != null) { final shardSize = testFiles.length ~/ shard.totalShards; @@ -336,13 +332,18 @@ Future runOneOrManyTests({ testFiles = testFiles.sublist(shardStart, shardEnd); } + debugLog( + 'Attempting to run all tests: ' + '${testFiles.map((file) => file.path).toList().toString()}', + ); + for (final testFile in testFiles) { final testTarget = testFile.path; final newArgsWithTarget = newArgsGenerator([ ...testRunnerArgs.rawArgs, '--${IntegrationTestRunnerArgs.testTargetArg}=$testTarget', ]); - debugLog('Running a single test of many: $testTarget'); + debugLog('Attempting to run: $testTarget'); await runTest(newArgsWithTarget); } } From 7a9bde6923c557085b102c8508b5a56e0bd84178 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Thu, 5 Sep 2024 09:04:15 -0700 Subject: [PATCH 08/18] log case --- .../integration_test/test_infra/run/run_test.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/devtools_app/integration_test/test_infra/run/run_test.dart b/packages/devtools_app/integration_test/test_infra/run/run_test.dart index 4d9a753016c..653bcf8527b 100644 --- a/packages/devtools_app/integration_test/test_infra/run/run_test.dart +++ b/packages/devtools_app/integration_test/test_infra/run/run_test.dart @@ -32,12 +32,12 @@ Future runFlutterIntegrationTest( try { if (testRunnerArgs.testAppDevice == TestAppDevice.cli) { debugLog( - 'Creating a TestDartCliApp with path ${testFileArgs.appPath}', + 'creating a TestDartCliApp with path ${testFileArgs.appPath}', ); testApp = TestDartCliApp(appPath: testFileArgs.appPath); } else { debugLog( - 'Creating a TestFlutterApp with path ${testFileArgs.appPath} and ' + 'creating a TestFlutterApp with path ${testFileArgs.appPath} and ' 'device ${testRunnerArgs.testAppDevice}', ); testApp = TestFlutterApp( @@ -45,7 +45,7 @@ Future runFlutterIntegrationTest( appDevice: testRunnerArgs.testAppDevice, ); } - debugLog('testApp.start()'); + debugLog('starting the test app'); await testApp.start(); } catch (e) { // ignore: avoid-throw-in-catch-block, by design From 9e935018b743c6b77b158a85f0ed79d189122e45 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Thu, 5 Sep 2024 09:05:03 -0700 Subject: [PATCH 09/18] remove extra logs --- .../devtools_shared/lib/src/test/integration_test_runner.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index bfe032f0986..d809adbfa73 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -62,7 +62,6 @@ class IntegrationTestRunner with IOMixin { process, printTag: 'FlutterDriveProcess', onStdout: (line) { - debugLog('STDOUT LINE: $line'); if (line.endsWith(_allTestsPassed)) { testsPassed = true; } @@ -93,7 +92,6 @@ class IntegrationTestRunner with IOMixin { } }, onStderr: (line) { - debugLog('STDERR LINE: $line'); if (line.contains(_errorMarker) || line.contains(_unhandledExceptionMarker)) { stdErrWriteInProgress = true; From 152fb113be333aa3a4de2c8f7b3c4dc09c676211 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Thu, 5 Sep 2024 09:37:30 -0700 Subject: [PATCH 10/18] Try to remove --headless --- .../devtools_app/integration_test/run_tests.dart | 2 ++ .../devtools_shared/lib/src/test/chrome_driver.dart | 9 +++++---- tool/ci/bots.sh | 12 ++++++------ 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/devtools_app/integration_test/run_tests.dart b/packages/devtools_app/integration_test/run_tests.dart index b129931555a..df739a620b8 100644 --- a/packages/devtools_app/integration_test/run_tests.dart +++ b/packages/devtools_app/integration_test/run_tests.dart @@ -36,6 +36,8 @@ final _disabledTestsForDevice = >{ 'performance_screen_event_recording_test.dart', 'service_connection_test.dart', 'service_extensions_test.dart', + 'memory_offline_data_test.dart', + 'perfetto_test.dart', // https://github.com/flutter/devtools/issues/6592 'eval_and_browse_test.dart', // https://github.com/flutter/devtools/issues/7425 diff --git a/packages/devtools_shared/lib/src/test/chrome_driver.dart b/packages/devtools_shared/lib/src/test/chrome_driver.dart index 2e58fd3ed18..6769051573a 100644 --- a/packages/devtools_shared/lib/src/test/chrome_driver.dart +++ b/packages/devtools_shared/lib/src/test/chrome_driver.dart @@ -16,14 +16,15 @@ class ChromeDriver with IOMixin { // https://github.com/flutter/flutter/blob/master/docs/contributing/testing/Running-Flutter-Driver-tests-with-Web.md#web-installers-repo. Future start({bool debugLogging = false}) async { try { + const chromedriverExe = 'chromedriver'; + const chromedriverArgs = ['--port=4444']; if (debugLogging) { print('starting the chromedriver process'); + print('> $chromedriverExe ${chromedriverArgs.join(' ')}'); } final process = _process = await Process.start( - 'chromedriver', - [ - '--port=4444', - ], + chromedriverExe, + chromedriverArgs, ); listenToProcessOutput(process, printTag: 'ChromeDriver'); } catch (e) { diff --git a/tool/ci/bots.sh b/tool/ci/bots.sh index 453d9fd2bc9..3bca34485a2 100755 --- a/tool/ci/bots.sh +++ b/tool/ci/bots.sh @@ -77,16 +77,16 @@ elif [ "$BOT" = "integration_dart2js" ]; then echo "Preparing to run integration tests. Warning: if you see the exception \ 'Web Driver Command WebDriverCommandType.screenshot failed while waiting for driver side', \ this is a known issue and likely means that the golden image check failed (see \ -https://github.com/flutter/flutter/issues/118470). Run the test locally to see if new \ -images under a 'failures/' directory are created as a result of the test run: \ -$ dart run integration_test/run_tests.dart --headless" +https://github.com/flutter/flutter/issues/118470). Look at the summary of the Github Actions \ +run to see if golden image failures have been uploaded (this only happens once all checks have \ +completed). Download these goldens and update them in the codebase to apply the updates." if [ "$DEVICE" = "flutter" ]; then - dart run integration_test/run_tests.dart --headless --shard="$SHARD" + dart run integration_test/run_tests.dart --shard="$SHARD" elif [ "$DEVICE" = "flutter-web" ]; then - dart run integration_test/run_tests.dart --test-app-device=chrome --headless --shard="$SHARD" + dart run integration_test/run_tests.dart --test-app-device=chrome --shard="$SHARD" elif [ "$DEVICE" = "dart-cli" ]; then - dart run integration_test/run_tests.dart --test-app-device=cli --headless --shard="$SHARD" + dart run integration_test/run_tests.dart --test-app-device=cli --shard="$SHARD" fi elif [ "$DEVTOOLS_PACKAGE" = "devtools_extensions" ]; then pushd $DEVTOOLS_DIR/packages/devtools_extensions From dfb8df188cceccd85bc4fc6f4b10574eb481e36a Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Thu, 5 Sep 2024 10:06:00 -0700 Subject: [PATCH 11/18] cleanup --- packages/devtools_app/integration_test/run_tests.dart | 8 -------- .../integration_test/test_infra/run/_utils.dart | 2 +- tool/ci/bots.sh | 2 ++ 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/packages/devtools_app/integration_test/run_tests.dart b/packages/devtools_app/integration_test/run_tests.dart index df739a620b8..df7ec9aefe6 100644 --- a/packages/devtools_app/integration_test/run_tests.dart +++ b/packages/devtools_app/integration_test/run_tests.dart @@ -30,14 +30,6 @@ const _testDeviceAll = 'all'; /// Format: `'my_example_test.dart'`. final _disabledTestsForDevice = >{ _testDeviceAll: { - 'app_test.dart', - 'debugger_panel_test.dart', - 'devtools_extensions_test.dart', - 'performance_screen_event_recording_test.dart', - 'service_connection_test.dart', - 'service_extensions_test.dart', - 'memory_offline_data_test.dart', - 'perfetto_test.dart', // https://github.com/flutter/devtools/issues/6592 'eval_and_browse_test.dart', // https://github.com/flutter/devtools/issues/7425 diff --git a/packages/devtools_app/integration_test/test_infra/run/_utils.dart b/packages/devtools_app/integration_test/test_infra/run/_utils.dart index 1ec03224827..012ed47e72f 100644 --- a/packages/devtools_app/integration_test/test_infra/run/_utils.dart +++ b/packages/devtools_app/integration_test/test_infra/run/_utils.dart @@ -4,7 +4,7 @@ // ignore_for_file: avoid_print -bool debugTestScript = true; +bool debugTestScript = false; void debugLog(String log) { if (debugTestScript) { diff --git a/tool/ci/bots.sh b/tool/ci/bots.sh index 3bca34485a2..91003971659 100755 --- a/tool/ci/bots.sh +++ b/tool/ci/bots.sh @@ -81,6 +81,8 @@ https://github.com/flutter/flutter/issues/118470). Look at the summary of the Gi run to see if golden image failures have been uploaded (this only happens once all checks have \ completed). Download these goldens and update them in the codebase to apply the updates." + # TODO(https://github.com/flutter/devtools/issues/8301): run these tests with the + # --headless flag once the issue with Chrome and chromedriver is resolved. if [ "$DEVICE" = "flutter" ]; then dart run integration_test/run_tests.dart --shard="$SHARD" elif [ "$DEVICE" = "flutter-web" ]; then From 97af507a2f69690b951a21e2c714d2a7f4afa5a5 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Thu, 5 Sep 2024 11:28:53 -0700 Subject: [PATCH 12/18] add browser dimension --- .../devtools_shared/lib/src/test/integration_test_runner.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index d809adbfa73..f88bbdcd500 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -49,6 +49,7 @@ class IntegrationTestRunner with IOMixin { '-d', headless ? 'web-server' : 'chrome', for (final arg in dartDefineArgs) '--dart-define=$arg', + '--browser-dimension=4000,4000', ]; debugLog('> flutter ${flutterDriveArgs.join(' ')}'); final process = await Process.start('flutter', flutterDriveArgs); From 0e329aa73b35fe9135e783cb1a64cb907aa1f8ca Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Thu, 5 Sep 2024 12:21:29 -0700 Subject: [PATCH 13/18] Try disable GPU --- .../lib/src/test/integration_test_runner.dart | 4 +++- tool/ci/bots.sh | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index f88bbdcd500..67e3db01610 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -48,8 +48,10 @@ class IntegrationTestRunner with IOMixin { '--target=$testTarget', '-d', headless ? 'web-server' : 'chrome', + // --disable-gpu speeds up tests that use ChromeDriver when run on + // GitHub Actions. See https://github.com/flutter/devtools/issues/8301. + '--web-browser-flag=--disable-gpu', for (final arg in dartDefineArgs) '--dart-define=$arg', - '--browser-dimension=4000,4000', ]; debugLog('> flutter ${flutterDriveArgs.join(' ')}'); final process = await Process.start('flutter', flutterDriveArgs); diff --git a/tool/ci/bots.sh b/tool/ci/bots.sh index 91003971659..0bbbb1df6d7 100755 --- a/tool/ci/bots.sh +++ b/tool/ci/bots.sh @@ -84,11 +84,11 @@ completed). Download these goldens and update them in the codebase to apply the # TODO(https://github.com/flutter/devtools/issues/8301): run these tests with the # --headless flag once the issue with Chrome and chromedriver is resolved. if [ "$DEVICE" = "flutter" ]; then - dart run integration_test/run_tests.dart --shard="$SHARD" + dart run integration_test/run_tests.dart --headless --shard="$SHARD" elif [ "$DEVICE" = "flutter-web" ]; then - dart run integration_test/run_tests.dart --test-app-device=chrome --shard="$SHARD" + dart run integration_test/run_tests.dart --headless --test-app-device=chrome --shard="$SHARD" elif [ "$DEVICE" = "dart-cli" ]; then - dart run integration_test/run_tests.dart --test-app-device=cli --shard="$SHARD" + dart run integration_test/run_tests.dart --headless --test-app-device=cli --shard="$SHARD" fi elif [ "$DEVTOOLS_PACKAGE" = "devtools_extensions" ]; then pushd $DEVTOOLS_DIR/packages/devtools_extensions From 68fba1214aec9e6534b5b4a88bd92bd0252ae675 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Thu, 5 Sep 2024 16:02:21 -0700 Subject: [PATCH 14/18] Try new chrome flags. --- .../lib/src/test/integration_test_runner.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index 67e3db01610..d4dc1674d5a 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -51,6 +51,11 @@ class IntegrationTestRunner with IOMixin { // --disable-gpu speeds up tests that use ChromeDriver when run on // GitHub Actions. See https://github.com/flutter/devtools/issues/8301. '--web-browser-flag=--disable-gpu', + // Flags to avoid breakage with chromedriver 128. See + // https://github.com/flutter/devtools/issues/8301. + '--web-browser-flag=--headless=old', + '--web-browser-flag=--disable-search-engine-choice-screen', + '--browser-dimension=2400,1600', for (final arg in dartDefineArgs) '--dart-define=$arg', ]; debugLog('> flutter ${flutterDriveArgs.join(' ')}'); From b4c335e10b2138c78535e6c988932b554678e1a9 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Thu, 5 Sep 2024 16:47:17 -0700 Subject: [PATCH 15/18] remove browser size and stale todo --- .../lib/src/test/integration_test_runner.dart | 1 - tool/ci/bots.sh | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index d4dc1674d5a..d91aca5185f 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -55,7 +55,6 @@ class IntegrationTestRunner with IOMixin { // https://github.com/flutter/devtools/issues/8301. '--web-browser-flag=--headless=old', '--web-browser-flag=--disable-search-engine-choice-screen', - '--browser-dimension=2400,1600', for (final arg in dartDefineArgs) '--dart-define=$arg', ]; debugLog('> flutter ${flutterDriveArgs.join(' ')}'); diff --git a/tool/ci/bots.sh b/tool/ci/bots.sh index 0bbbb1df6d7..98b6d9e1b26 100755 --- a/tool/ci/bots.sh +++ b/tool/ci/bots.sh @@ -81,14 +81,12 @@ https://github.com/flutter/flutter/issues/118470). Look at the summary of the Gi run to see if golden image failures have been uploaded (this only happens once all checks have \ completed). Download these goldens and update them in the codebase to apply the updates." - # TODO(https://github.com/flutter/devtools/issues/8301): run these tests with the - # --headless flag once the issue with Chrome and chromedriver is resolved. if [ "$DEVICE" = "flutter" ]; then dart run integration_test/run_tests.dart --headless --shard="$SHARD" elif [ "$DEVICE" = "flutter-web" ]; then - dart run integration_test/run_tests.dart --headless --test-app-device=chrome --shard="$SHARD" + dart run integration_test/run_tests.dart --test-app-device=chrome --headless --shard="$SHARD" elif [ "$DEVICE" = "dart-cli" ]; then - dart run integration_test/run_tests.dart --headless --test-app-device=cli --shard="$SHARD" + dart run integration_test/run_tests.dart --test-app-device=cli --headless --shard="$SHARD" fi elif [ "$DEVTOOLS_PACKAGE" = "devtools_extensions" ]; then pushd $DEVTOOLS_DIR/packages/devtools_extensions From 483a17757f1557f16b3872080537deaef8a97be9 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Fri, 6 Sep 2024 08:30:37 -0700 Subject: [PATCH 16/18] only include extra flags for headless mode --- .../lib/src/test/integration_test_runner.dart | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index d91aca5185f..5eb0cb1c226 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -47,14 +47,17 @@ class IntegrationTestRunner with IOMixin { '--driver=$testDriver', '--target=$testTarget', '-d', - headless ? 'web-server' : 'chrome', + if (headless) ...[ + 'web-server', + // Flags to avoid breakage with chromedriver 128. See + // https://github.com/flutter/devtools/issues/8301. + '--web-browser-flag=--headless=old', + '--web-browser-flag=--disable-search-engine-choice-screen', + ] else + 'chrome', // --disable-gpu speeds up tests that use ChromeDriver when run on // GitHub Actions. See https://github.com/flutter/devtools/issues/8301. '--web-browser-flag=--disable-gpu', - // Flags to avoid breakage with chromedriver 128. See - // https://github.com/flutter/devtools/issues/8301. - '--web-browser-flag=--headless=old', - '--web-browser-flag=--disable-search-engine-choice-screen', for (final arg in dartDefineArgs) '--dart-define=$arg', ]; debugLog('> flutter ${flutterDriveArgs.join(' ')}'); From 802e448f41a22ec4723f3ab1270e638307ae2e0e Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Fri, 6 Sep 2024 08:39:11 -0700 Subject: [PATCH 17/18] simplify flags --- .../lib/src/test/integration_test_runner.dart | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index 5eb0cb1c226..8a6012d89ed 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -47,17 +47,16 @@ class IntegrationTestRunner with IOMixin { '--driver=$testDriver', '--target=$testTarget', '-d', + headless ? 'web-server' : 'chrome', + // --disable-gpu speeds up tests that use ChromeDriver when run on + // GitHub Actions. See https://github.com/flutter/devtools/issues/8301. + '--web-browser-flag=--disable-gpu', if (headless) ...[ - 'web-server', // Flags to avoid breakage with chromedriver 128. See // https://github.com/flutter/devtools/issues/8301. '--web-browser-flag=--headless=old', '--web-browser-flag=--disable-search-engine-choice-screen', - ] else - 'chrome', - // --disable-gpu speeds up tests that use ChromeDriver when run on - // GitHub Actions. See https://github.com/flutter/devtools/issues/8301. - '--web-browser-flag=--disable-gpu', + ], for (final arg in dartDefineArgs) '--dart-define=$arg', ]; debugLog('> flutter ${flutterDriveArgs.join(' ')}'); From fbf7746537b9623775bed2c62899d9a766181914 Mon Sep 17 00:00:00 2001 From: Kenzie Schmoll Date: Fri, 6 Sep 2024 08:40:59 -0700 Subject: [PATCH 18/18] changelog --- packages/devtools_shared/CHANGELOG.md | 1 + .../devtools_shared/lib/src/test/integration_test_runner.dart | 2 ++ 2 files changed, 3 insertions(+) diff --git a/packages/devtools_shared/CHANGELOG.md b/packages/devtools_shared/CHANGELOG.md index edf655e0731..c00251a423f 100644 --- a/packages/devtools_shared/CHANGELOG.md +++ b/packages/devtools_shared/CHANGELOG.md @@ -13,6 +13,7 @@ * Deprecate `surveyActionTakenPropertyName`. * Deprecate `apiGetSurveyShownCount` in favor of `SurveyApi.getSurveyShownCount`. * Deprecate `apiIncrementSurveyShownCount` in favor of `SurveyApi.incrementSurveyShownCount`. +* Support Chrome's new headless mode in the integration test runner. # 10.0.2 * Update dependency `web_socket_channel: '>=2.4.0 <4.0.0'`. diff --git a/packages/devtools_shared/lib/src/test/integration_test_runner.dart b/packages/devtools_shared/lib/src/test/integration_test_runner.dart index 8a6012d89ed..b2e2fdc3a46 100644 --- a/packages/devtools_shared/lib/src/test/integration_test_runner.dart +++ b/packages/devtools_shared/lib/src/test/integration_test_runner.dart @@ -37,6 +37,7 @@ class IntegrationTestRunner with IOMixin { Future runTest({required int attemptNumber}) async { debugLog('starting attempt #$attemptNumber for $testTarget'); debugLog('starting the flutter drive process'); + final flutterDriveArgs = [ 'drive', // Debug outputs from the test will not show up in profile mode. Since @@ -59,6 +60,7 @@ class IntegrationTestRunner with IOMixin { ], for (final arg in dartDefineArgs) '--dart-define=$arg', ]; + debugLog('> flutter ${flutterDriveArgs.join(' ')}'); final process = await Process.start('flutter', flutterDriveArgs);