mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

The goal here is to have a great standalone `android_engine_test` suite that [replaces `scenario_app/android`](https://github.com/flutter/flutter/pull/160992). No test is _functionally_ changed in this PR, but overview of changes: - Finished renaming the suite `android_engine_tests` instead of `flutter_driver_android` - Added instructions and an environment variable for local generation of golden-files (`UPDATE_GOLDENS=1`) - Added explanations of the individual tests, where they live, and how to run them locally - Added a hybrid-composition (HC, not TLHC, which is already tested) test - Renamed "other_smiley" to "surface_texture_smiley" (and renamed the original to "surface_producer_smiley") - Removed unnecessary ".android" suffix (we will not run this on anything but Android) - Added a `tool/deflake.dart` to run a test suite 10x (or custom) times locally to try and determine flakiness After this PR, I'll add flags to let you control variants and name the screenshots accordingly, i.e.: - API v34 or v35 - OpenGLES or Vulkan (will require an `AndroidManifest.xml` edit during the test instrumentation)
53 lines
2.0 KiB
Dart
53 lines
2.0 KiB
Dart
// 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 'package:file/file.dart';
|
|
import 'package:glob/glob.dart';
|
|
import 'package:glob/list_local_fs.dart';
|
|
import 'package:path/path.dart' as path;
|
|
|
|
import '../run_command.dart';
|
|
import '../utils.dart';
|
|
|
|
/// To run this test locally:
|
|
///
|
|
/// 1. Connect an Android device or emulator.
|
|
/// 2. Run `dart pub get` in dev/bots
|
|
/// 3. Run the following command from the root of the Flutter repository:
|
|
///
|
|
/// ```sh
|
|
/// # Generate a baseline of local golden files.
|
|
/// SHARD=android_engine_tests UPDATE_GOLDENS=1 bin/cache/dart-sdk/bin/dart dev/bots/test.dart
|
|
/// ```
|
|
///
|
|
/// 4. Then, re-run the command against the baseline images:
|
|
///
|
|
/// ```sh
|
|
/// SHARD=android_engine_tests bin/cache/dart-sdk/bin/dart dev/bots/test.dart
|
|
/// ```
|
|
///
|
|
/// If you are trying to debug a commit, you will want to run step (3) first,
|
|
/// then apply the commit (or flag), and then run step (4). If you are trying
|
|
/// to determine flakiness in the *same* state, or want better debugging, see
|
|
/// `dev/integration_tests/android_engine_test/README.md`.
|
|
Future<void> runAndroidEngineTests() async {
|
|
print('Running Flutter Driver Android tests...');
|
|
|
|
final String androidEngineTestPath = path.join('dev', 'integration_tests', 'android_engine_test');
|
|
final List<FileSystemEntity> mains = Glob('$androidEngineTestPath/lib/**_main.dart').listSync();
|
|
for (final FileSystemEntity file in mains) {
|
|
await runCommand('flutter', <String>[
|
|
'drive',
|
|
path.relative(file.path, from: androidEngineTestPath),
|
|
// There are no reason to enable development flags for this test.
|
|
// Disable them to work around flakiness issues, and in general just
|
|
// make less things start up unnecessarily.
|
|
'--no-dds',
|
|
'--no-enable-dart-profiling',
|
|
'--test-arguments=test',
|
|
'--test-arguments=--reporter=expanded',
|
|
], workingDirectory: androidEngineTestPath);
|
|
}
|
|
}
|