Skip to content

Commit 48c2301

Browse files
authored
Add a simple golden-file test to package:integration_test. (#159233)
Closes flutter/flutter#72045. Let's see if I wired this correctly and if `Flutter Gold` knows to check based on the files changed.
1 parent dc58093 commit 48c2301

File tree

5 files changed

+52
-0
lines changed

5 files changed

+52
-0
lines changed

packages/integration_test/pubspec.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ dependencies:
3838
vector_math: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
3939
webdriver: 3.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
4040

41+
dev_dependencies:
42+
flutter_goldens:
43+
sdk: flutter
44+
4145
flutter:
4246
plugin:
4347
platforms:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
export 'package:flutter_goldens/flutter_goldens.dart' show testExecutable;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:async';
6+
7+
// package:flutter_goldens is not used as part of the test process for web.
8+
Future<void> testExecutable(FutureOr<void> Function() testMain, {String? namePrefix}) async => testMain();
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'dart:async';
6+
7+
import '_goldens_io.dart' if (dart.library.js_interop) '_goldens_web.dart' as flutter_goldens;
8+
9+
Future<void> testExecutable(FutureOr<void> Function() testMain) {
10+
// Enable golden file testing using Skia Gold.
11+
return flutter_goldens.testExecutable(testMain, namePrefix: 'integration');
12+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
@Tags(<String>['reduced-test-set'])
6+
library;
7+
8+
import 'package:flutter/material.dart';
9+
import 'package:flutter_test/flutter_test.dart';
10+
import 'package:integration_test/integration_test.dart';
11+
12+
void main() {
13+
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
14+
15+
testWidgets('a screenshot of a Placeholder', (WidgetTester tester) async {
16+
await tester.pumpWidget(const Placeholder());
17+
18+
await expectLater(
19+
find.byType(Placeholder),
20+
matchesGoldenFile('placeholder.png'),
21+
);
22+
});
23+
}

0 commit comments

Comments
 (0)