Verified input test take 2 (#140836)

This is a reland of https://github.com/flutter/flutter/pull/140806 which had an issue with package versions.
This commit is contained in:
John McCutchan
2024-01-02 17:17:08 -08:00
committed by GitHub
parent b08fc60024
commit dcc2c91471
25 changed files with 784 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
// 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:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/tasks/android_verified_input_test.dart';
Future<void> main() async {
await task(androidVerifiedInputTest());
}

View File

@@ -0,0 +1,60 @@
// 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 '../framework/devices.dart';
import '../framework/framework.dart';
import '../framework/task_result.dart';
import '../framework/utils.dart';
TaskFunction androidVerifiedInputTest({Map<String, String>? environment}) {
return DriverTest(
'${flutterDirectory.path}/dev/integration_tests/android_verified_input',
'test_driver/main_test.dart',
environment: environment,
).call;
}
class DriverTest {
DriverTest(
this.testDirectory,
this.testTarget, {
this.extraOptions = const <String>[],
this.deviceIdOverride,
this.environment,
}
);
final String testDirectory;
final String testTarget;
final List<String> extraOptions;
final String? deviceIdOverride;
final Map<String, String>? environment;
Future<TaskResult> call() {
return inDirectory<TaskResult>(testDirectory, () async {
String deviceId;
if (deviceIdOverride != null) {
deviceId = deviceIdOverride!;
} else {
final Device device = await devices.workingDevice;
await device.unlock();
deviceId = device.deviceId;
}
await flutter('packages', options: <String>['get']);
final List<String> options = <String>[
'--no-android-gradle-daemon',
'-v',
'-t',
testTarget,
'-d',
deviceId,
...extraOptions,
];
await flutter('drive', options: options, environment: environment);
return TaskResult.success(null);
});
}
}