Skip to content
Draft
Show file tree
Hide file tree
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
48 changes: 48 additions & 0 deletions .ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
Comment on lines +143 to +146

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The dependencies block for goldctl is duplicated across many targets in this file. To improve maintainability and make future updates to the goldctl version 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:

x-gold-dependency: &gold-dependency
  dependencies: >-
    [
      {"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
    ]

targets:
  - name: Linux analyze
    # ...
    properties:
      <<: *gold-dependency
      # ...

add_recipes_cq: "true"
target_file: dart_unit_tests.yaml
channel: master
Expand All @@ -155,6 +159,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
target_file: dart_unit_tests.yaml
channel: master
version_file: flutter_master.version
Expand All @@ -169,6 +177,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
target_file: dart_unit_tests.yaml
channel: stable
version_file: flutter_stable.version
Expand All @@ -183,6 +195,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
target_file: dart_unit_tests.yaml
channel: stable
version_file: flutter_stable.version
Expand All @@ -197,6 +213,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
add_recipes_cq: "true"
target_file: web_dart_unit_tests.yaml
channel: master
Expand All @@ -212,6 +232,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
target_file: web_dart_unit_tests.yaml
channel: master
version_file: flutter_master.version
Expand All @@ -226,6 +250,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
target_file: web_dart_unit_tests.yaml
channel: stable
version_file: flutter_stable.version
Expand All @@ -240,6 +268,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
target_file: web_dart_unit_tests.yaml
channel: stable
version_file: flutter_stable.version
Expand All @@ -255,6 +287,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
add_recipes_cq: "true"
target_file: web_dart_unit_tests_wasm.yaml
channel: master
Expand All @@ -270,6 +306,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
target_file: web_dart_unit_tests_wasm.yaml
channel: master
version_file: flutter_master.version
Expand Down Expand Up @@ -1316,6 +1356,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
target_file: windows_dart_unit_tests.yaml
channel: master
version_file: flutter_master.version
Expand All @@ -1330,6 +1374,10 @@ targets:
recipe: packages/packages
timeout: 60
properties:
dependencies: >-
[
{"dependency": "goldctl", "version": "git_revision:2387d6fff449587eecbb7e45b2692ca0710b63b9"}
]
target_file: windows_dart_unit_tests.yaml
channel: master
version_file: flutter_master.version
Expand Down
2 changes: 2 additions & 0 deletions packages/two_dimensional_scrollables/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ dependencies:
sdk: flutter

dev_dependencies:
flutter_goldens:
path: ../../script/flutter_goldens
flutter_test:
sdk: flutter

Expand Down
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 packages/two_dimensional_scrollables/test/goldens/goldens.dart
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'),
);
});
}
5 changes: 5 additions & 0 deletions packages/two_dimensional_scrollables/test/goldens_io.dart
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;
9 changes: 9 additions & 0 deletions packages/two_dimensional_scrollables/test/goldens_web.dart
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();
11 changes: 11 additions & 0 deletions script/flutter_goldens/README.md
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:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This line contains an unexpected character which appears to be a broken link or artifact. Please remove it.

* 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
Loading
Loading