diff --git a/lib/web_ui/dev/steps/run_tests_step.dart b/lib/web_ui/dev/steps/run_tests_step.dart index c755d6065e0e9..21295688d2c06 100644 --- a/lib/web_ui/dev/steps/run_tests_step.dart +++ b/lib/web_ui/dev/steps/run_tests_step.dart @@ -131,6 +131,10 @@ class RunTestsStep implements PipelineStep { _checkExitCode('Golden tests'); } + if (skiaClient != null && skiaClient.isInitialized) { + skiaClient.imgtestFinalize(); + } + if (!allShardsPassed) { throw ToolExit(_createFailedShardsMessage()); } diff --git a/web_sdk/web_test_utils/lib/skia_client.dart b/web_sdk/web_test_utils/lib/skia_client.dart index 4d3d5f2a5324d..9d37eeadc49cd 100644 --- a/web_sdk/web_test_utils/lib/skia_client.dart +++ b/web_sdk/web_test_utils/lib/skia_client.dart @@ -55,6 +55,7 @@ class SkiaGoldClient { /// Indicates whether the `goldctl` tool has been initialized for the current /// test context. + bool get isInitialized => _isInitialized; bool _isInitialized = false; /// Indicates whether the client has already been authorized to communicate @@ -203,6 +204,30 @@ class SkiaGoldClient { return true; } + /// Executes the `imgtest finalize` command in the `goldctl` tool. + /// + /// Since we removed `--passfail` from our post-submit commands, images aren't + /// being uploaded anymore. In order to make sure they are uploaded, we need + /// to manually call `imgtest finalize` after all tests are complete. + Future imgtestFinalize() async { + await _imgtestInit(); + + final List imgtestCommand = [ + _goldctl, + 'imgtest', 'finalize', + '--work-dir', _tempPath, + ]; + + final ProcessResult result = await _runCommand(imgtestCommand); + + if (result.exitCode != 0) { + print('goldctl imgtest finalize stdout: ${result.stdout}'); + print('goldctl imgtest finalize stderr: ${result.stderr}'); + } + + return true; + } + /// Executes the `imgtest init` command in the `goldctl` tool for tryjobs. /// /// The `imgtest` command collects and uploads test results to the Skia Gold