Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[web] Fix screenshot tests running locally #31054

Merged
merged 1 commit into from
Jan 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions web_sdk/web_test_utils/lib/image_compare.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Future<String> compareImage(

final String screenshotPath = _getFullScreenshotPath(filename);
final File screenshotFile = File(screenshotPath);
await screenshotFile.create(recursive: true);
await screenshotFile.writeAsBytes(encodePng(screenshot), flush: true);

if (_isLuci) {
Expand All @@ -59,9 +60,12 @@ Future<String> compareImage(

if (golden == null) {
// This is a new screenshot that doesn't have an existing golden.
return 'No golden was found for "$filename". If this is a new screenshot'
'test, please take a look at the generated screenshot:\n\n'
'* file://$screenshotPath\n';

// At the moment, we don't support local screenshot testing because we use
// Skia Gold to handle our screenshots and diffing. In the future, we might
// implement local screenshot testing if there's a need.
print('Screenshot generated: file://$screenshotPath');
return 'OK';
}

// Compare screenshots.
Expand Down