-
Notifications
You must be signed in to change notification settings - Fork 3.6k
WIP - Gold testing #10753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Piinks
wants to merge
4
commits into
flutter:main
Choose a base branch
from
Piinks:goldTesting
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
WIP - Gold testing #10753
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/two_dimensional_scrollables/test/flutter_test_config.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // 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. | ||
|
|
||
|
|
||
| // Initial testing of instance only, not for merging. | ||
| // Plenty to do next (if this works): | ||
| // - verify service accounts used by Luci in pre/post submit tests in flutter/packages, auth works | ||
| // - Get new Gold frontend up | ||
| // - document how to enable golden file testing for a package | ||
| // - update flutter/cocoon to add flutter-gold check for triage | ||
|
|
||
| import 'dart:async'; | ||
|
|
||
| import 'goldens_io.dart' | ||
| if (dart.library.js_interop) 'goldens_web.dart' | ||
| as flutter_goldens; | ||
|
|
||
| Future<void> testExecutable(FutureOr<void> Function() testMain) { | ||
| // Enable golden file testing using Skia Gold. | ||
| return flutter_goldens.testExecutable(testMain, namePrefix: 'two_dimensional_scrollables'); | ||
| } |
21 changes: 21 additions & 0 deletions
21
packages/two_dimensional_scrollables/test/goldens/goldens.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Copyright 2013 The Flutter Authors | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter/widgets.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
|
|
||
| void main() { | ||
| testWidgets('Inconsequential golden test', (WidgetTester tester) async { | ||
| // The test validates the Flutter Gold integration. Any changes to the | ||
| // golden file can be approved at any time. | ||
| await tester.pumpWidget(RepaintBoundary(child: Container(color: const Color(0xAFF61145)))); | ||
|
|
||
| await tester.pumpAndSettle(); | ||
| await expectLater( | ||
| find.byType(RepaintBoundary), | ||
| matchesGoldenFile('inconsequential_golden_file.png'), | ||
| ); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // 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. | ||
|
|
||
| export 'package:flutter_goldens/flutter_goldens.dart' show testExecutable; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| // 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'; | ||
|
|
||
| // package:flutter_goldens is not used as part of the test process for web. | ||
| Future<void> testExecutable(FutureOr<void> Function() testMain, {String? namePrefix}) async => | ||
| testMain(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| This package is an internal implementation detail for our testing | ||
| infrastructure. It enables the framework to use the Skia Gold | ||
| infrastructure for tracking golden image tests. | ||
|
|
||
| See also: | ||
|  | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| * https://skia.org/docs/dev/testing/skiagold/ | ||
| * https://flutter-packages-gold.skia.org/ | ||
| * [Writing a golden file test for package flutter] | ||
|
|
||
| [Writing a golden file test for package flutter]: /docs/contributing/testing/Writing-a-golden-file-test-for-package-flutter.md | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
dependenciesblock forgoldctlis duplicated across many targets in this file. To improve maintainability and make future updates to thegoldctlversion easier, consider using YAML anchors to define this block once and reuse it where needed. Note that this is contingent on the CI system's support for YAML anchors.Example: