Add a simple golden-file test to package:integration_test. (#159233)

Closes https://github.com/flutter/flutter/issues/72045.

Let's see if I wired this correctly and if `Flutter Gold` knows to check
based on the files changed.
This commit is contained in:
Matan Lurey 2024-12-09 12:00:26 -08:00 committed by GitHub
parent dc5809309a
commit 48c2301f7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 52 additions and 0 deletions

View File

@ -38,6 +38,10 @@ dependencies:
vector_math: 2.1.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
webdriver: 3.0.4 # THIS LINE IS AUTOGENERATED - TO UPDATE USE "flutter update-packages --force-upgrade"
dev_dependencies:
flutter_goldens:
sdk: flutter
flutter:
plugin:
platforms:

View File

@ -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;

View File

@ -0,0 +1,8 @@
// 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();

View File

@ -0,0 +1,12 @@
// 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';
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: 'integration');
}

View File

@ -0,0 +1,23 @@
// 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.
@Tags(<String>['reduced-test-set'])
library;
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
testWidgets('a screenshot of a Placeholder', (WidgetTester tester) async {
await tester.pumpWidget(const Placeholder());
await expectLater(
find.byType(Placeholder),
matchesGoldenFile('placeholder.png'),
);
});
}