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:
parent
dc5809309a
commit
48c2301f7a
@ -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:
|
||||
|
5
packages/integration_test/test/_goldens_io.dart
Normal file
5
packages/integration_test/test/_goldens_io.dart
Normal 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;
|
8
packages/integration_test/test/_goldens_web.dart
Normal file
8
packages/integration_test/test/_goldens_web.dart
Normal 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();
|
12
packages/integration_test/test/flutter_test_config.dart
Normal file
12
packages/integration_test/test/flutter_test_config.dart
Normal 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');
|
||||
}
|
23
packages/integration_test/test/golden_screenshot_test.dart
Normal file
23
packages/integration_test/test/golden_screenshot_test.dart
Normal 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'),
|
||||
);
|
||||
});
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user