This reverts commit e03f439145.
This commit is contained in:
@@ -10,5 +10,5 @@ import 'package:flutter_devicelab/tasks/integration_tests.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
deviceOperatingSystem = DeviceOperatingSystem.fuchsia;
|
||||
await task(createFlutterDriverScreenshotTest(useFlutterGold: true));
|
||||
await task(createFlutterDriverScreenshotTest());
|
||||
}
|
||||
|
||||
@@ -107,22 +107,15 @@ TaskFunction createAndroidSplashScreenKitchenSinkTest() {
|
||||
);
|
||||
}
|
||||
|
||||
/// Executes a driver test that takes a screenshot and compares it against a golden image.
|
||||
/// If [useFlutterGold] is true, the golden image is served by Flutter Gold
|
||||
/// (https://flutter-gold.skia.org/), otherwise the golden image is read from the disk.
|
||||
TaskFunction createFlutterDriverScreenshotTest({
|
||||
bool useFlutterGold = false,
|
||||
}) {
|
||||
TaskFunction createFlutterDriverScreenshotTest() {
|
||||
return DriverTest(
|
||||
'${flutterDirectory.path}/dev/integration_tests/flutter_driver_screenshot_test',
|
||||
'lib/main.dart',
|
||||
extraOptions: useFlutterGold ? const <String>[
|
||||
'--driver', 'test_driver/flutter_gold_main_test.dart'
|
||||
] : const <String>[]
|
||||
);
|
||||
}
|
||||
|
||||
class DriverTest {
|
||||
|
||||
DriverTest(
|
||||
this.testDirectory,
|
||||
this.testTarget, {
|
||||
|
||||
@@ -4,12 +4,7 @@ This tests contains an app with a main page and sub pages.
|
||||
The main page contains a list of buttons; each button leads to a designated sub page when tapped on.
|
||||
Each sub page should displays some simple UIs to screenshot tested.
|
||||
|
||||
The flutter driver test runs the app and opens each page to take a screenshot.
|
||||
|
||||
Use `test_driver/flutter_gold_main_test.dart` to test against golden files stored on Flutter Gold.
|
||||
Otherwise, use `main_test.dart` to test against golden files stored on `test_driver/goldens/<some_test_page_name>/<device_model>.png`.
|
||||
|
||||
Note that new binaries can't be checked in the Flutter repo, so use [Flutter Gold](https://github.com/flutter/flutter/wiki/Writing-a-golden-file-test-for-package:flutter) instead.
|
||||
The flutter driver test runs the app and opens each page to take a screenshot. Then it compares the screenshot against a golden image stored in `test_driver/goldens/<some_test_page_name>/<device_model>.png`.
|
||||
|
||||
# Add a new page to test
|
||||
|
||||
@@ -21,7 +16,6 @@ Note that new binaries can't be checked in the Flutter repo, so use [Flutter Gol
|
||||
|
||||
An example of a `Page` subclass can be found in `lib/image_page.dart`
|
||||
|
||||
# Environments
|
||||
# Experiments
|
||||
|
||||
* Device Lab which runs the app on iPhone 6s.
|
||||
* LUCI which runs the app on a Fuchsia NUC device.
|
||||
The test currently only runs on device lab ["mac/ios"] which runs the app on iPhone 6s.
|
||||
@@ -1,38 +0,0 @@
|
||||
// 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 'package:flutter_driver/flutter_driver.dart';
|
||||
import 'package:test/test.dart' hide TypeMatcher, isInstanceOf;
|
||||
import 'package:flutter_test/src/buffer_matcher.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
FlutterDriver driver;
|
||||
String deviceModel;
|
||||
|
||||
setUpAll(() async {
|
||||
driver = await FlutterDriver.connect();
|
||||
deviceModel = await driver.requestData('device_model');
|
||||
});
|
||||
|
||||
tearDownAll(() => driver.close());
|
||||
|
||||
test('A page with an image screenshot', () async {
|
||||
final SerializableFinder imagePageListTile =
|
||||
find.byValueKey('image_page');
|
||||
await driver.waitFor(imagePageListTile);
|
||||
await driver.tap(imagePageListTile);
|
||||
await driver.waitFor(find.byValueKey('red_square_image'));
|
||||
await driver.waitUntilNoTransientCallbacks();
|
||||
|
||||
// TODO(egarciad): This is currently a no-op on LUCI.
|
||||
// https://github.com/flutter/flutter/issues/49837
|
||||
await expectLater(
|
||||
driver.screenshot(),
|
||||
bufferMatchesGoldenFile('red_square_driver_screenshot__$deviceModel.png'),
|
||||
);
|
||||
|
||||
await driver.tap(find.byTooltip('Back'));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user