-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
17
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
Show all changes
17 commits
Select commit
Hold shift + click to select a range
574b90b
Add goldctl dependency on unit tests
Piinks 1cafe86
WIP - add gold integration to flutter/packages
Piinks 20cdbb8
Logs for debug
Piinks 443868c
++
Piinks 81a5a2a
Reshuffle
Piinks 5c8489e
Fix commit logic
Piinks fb32271
++
Piinks 68f5590
++
Piinks 062dc55
Tweaking...
Piinks 95c3950
Debug tryjobInit
Piinks 2e2a5e2
Revert, what happened?
Piinks f891bc1
Update to use sdk path
Piinks 962ade6
Iterating
Piinks 0cb0e6f
++
Piinks cb1e5bc
Bump goldctl, format, fix headers
Piinks 3e9ea06
Set up CI support
Piinks 7af4d9e
Fix headers in flutter_goldens
Piinks 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| #!/bin/bash | ||
| # 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. | ||
| set -e | ||
|
|
||
| cd script/flutter_goldens | ||
| flutter analyze --fatal-infos |
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,8 @@ | ||
| #!/bin/bash | ||
| # 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. | ||
| set -e | ||
|
|
||
| cd script/flutter_goldens | ||
| dart format --set-exit-if-changed . |
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,8 @@ | ||
| #!/bin/bash | ||
| # 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. | ||
| set -e | ||
|
|
||
| cd script/flutter_goldens | ||
| flutter test |
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 |
|---|---|---|
|
|
@@ -10,3 +10,6 @@ git branch main origin/main | |
|
|
||
| cd script/tool | ||
| dart pub get | ||
|
|
||
| cd ../flutter_goldens | ||
| flutter pub get | ||
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
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
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,14 @@ | ||
| // 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 '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: 'cupertino_ui'); | ||
| } |
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,23 @@ | ||
| // 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/cupertino.dart'; | ||
| import 'package:flutter/foundation.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( | ||
| const CupertinoApp(home: Center(child: Text('Cupertino Goldens'))), | ||
| ); | ||
|
|
||
| await tester.pumpAndSettle(); | ||
| await expectLater( | ||
| find.byType(CupertinoApp), | ||
| matchesGoldenFile('inconsequential_golden_file.png'), | ||
| ); | ||
| }, skip: kIsWeb); | ||
| } |
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 2013 The Flutter Authors | ||
| // 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,11 @@ | ||
| // 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 '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
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,14 @@ | ||
| // 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 '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: 'material_ui'); | ||
| } |
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,24 @@ | ||
| // 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/cupertino.dart'; | ||
| import 'package:flutter/foundation.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:material_ui/material_ui.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'), | ||
| ); | ||
| }, skip: kIsWeb); | ||
| } |
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 2013 The Flutter Authors | ||
| // 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,11 @@ | ||
| // 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 '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 packages to use the Skia Gold | ||
| infrastructure for tracking golden image tests. | ||
|
|
||
| See also: | ||
|  | ||
|
Piinks marked this conversation as resolved.
|
||
| * 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]: https://github.com/flutter/flutter/blob/master/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.
Uh oh!
There was an error while loading. Please reload this page.