Unverified Commit 48287750 authored by Ming Lyu (CareF)'s avatar Ming Lyu (CareF) Committed by GitHub

remove duplicate e2e driver (#64015)

parent d504437d
......@@ -3,55 +3,15 @@
// found in the LICENSE file.
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:e2e/common.dart' as e2e;
import 'package:flutter_driver/flutter_driver.dart';
import 'package:e2e/e2e_driver.dart' as driver;
import 'package:path/path.dart' as path;
const JsonEncoder _prettyEncoder = JsonEncoder.withIndent(' ');
/// Flutter Driver test output directory.
///
/// Tests should write any output files to this directory. Defaults to the path
/// set in the FLUTTER_TEST_OUTPUTS_DIR environment variable, or `build` if
/// unset.
String testOutputsDirectory = Platform.environment['FLUTTER_TEST_OUTPUTS_DIR'] ?? 'build';
String testOutputFilename = 'e2e_perf_summary';
Future<void> main() async {
final FlutterDriver driver = await FlutterDriver.connect();
final String jsonResult =
await driver.requestData(null, timeout: const Duration(minutes: 1));
final e2e.Response response = e2e.Response.fromJson(jsonResult);
await driver.close();
if (response.allTestsPassed) {
print('All tests passed.');
await fs.directory(testOutputsDirectory).create(recursive: true);
final File file = fs.file(path.join(
testOutputsDirectory,
'$testOutputFilename.json'
));
final String resultString = _encodeJson(
response.data['performance'] as Map<String, dynamic>,
true,
Future<void> main() => driver.e2eDriver(
timeout: const Duration(minutes: 5),
responseDataCallback: (Map<String, dynamic> data) async {
await driver.writeResponseData(
data['performance'] as Map<String, dynamic>,
testOutputFilename: 'e2e_perf_summary',
);
await file.writeAsString(resultString);
exit(0);
} else {
print('Failure Details:\n${response.formattedFailureDetails}');
exit(1);
}
}
String _encodeJson(Map<String, dynamic> jsonObject, bool pretty) {
return pretty
? _prettyEncoder.convert(jsonObject)
: json.encode(jsonObject);
}
);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment