Add Android device build/OS/API Level information to logs. (#58747)

This adds some information about the chosen device to the output log so that we can tell what type of device/OS Level/API Level the test is running on when doing a postmortem on a failed test.
This commit is contained in:
Greg Spencer
2020-06-05 14:02:07 -07:00
committed by GitHub
parent 5722adf11d
commit ab68721a5d
3 changed files with 103 additions and 32 deletions

View File

@@ -42,6 +42,7 @@ void main() {
test('sends power event', () async {
await device.togglePower();
expectLog(<CommandArgs>[
cmd(command: 'getprop', arguments: <String>['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null),
cmd(command: 'input', arguments: <String>['keyevent', '26']),
]);
});
@@ -52,6 +53,7 @@ void main() {
FakeDevice.pretendAwake();
await device.wakeUp();
expectLog(<CommandArgs>[
cmd(command: 'getprop', arguments: <String>['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null),
cmd(command: 'dumpsys', arguments: <String>['power']),
]);
});
@@ -60,6 +62,7 @@ void main() {
FakeDevice.pretendAsleep();
await device.wakeUp();
expectLog(<CommandArgs>[
cmd(command: 'getprop', arguments: <String>['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null),
cmd(command: 'dumpsys', arguments: <String>['power']),
cmd(command: 'input', arguments: <String>['keyevent', '26']),
]);
@@ -71,6 +74,7 @@ void main() {
FakeDevice.pretendAsleep();
await device.sendToSleep();
expectLog(<CommandArgs>[
cmd(command: 'getprop', arguments: <String>['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null),
cmd(command: 'dumpsys', arguments: <String>['power']),
]);
});
@@ -79,6 +83,7 @@ void main() {
FakeDevice.pretendAwake();
await device.sendToSleep();
expectLog(<CommandArgs>[
cmd(command: 'getprop', arguments: <String>['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null),
cmd(command: 'dumpsys', arguments: <String>['power']),
cmd(command: 'input', arguments: <String>['keyevent', '26']),
]);
@@ -90,6 +95,7 @@ void main() {
FakeDevice.pretendAwake();
await device.unlock();
expectLog(<CommandArgs>[
cmd(command: 'getprop', arguments: <String>['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null),
cmd(command: 'dumpsys', arguments: <String>['power']),
cmd(command: 'input', arguments: <String>['keyevent', '82']),
]);
@@ -100,6 +106,7 @@ void main() {
test('tap', () async {
await device.tap(100, 200);
expectLog(<CommandArgs>[
cmd(command: 'getprop', arguments: <String>['ro.bootimage.build.fingerprint', ';', 'getprop', 'ro.build.version.release', ';', 'getprop', 'ro.build.version.sdk'], environment: null),
cmd(command: 'input', arguments: <String>['tap', '100', '200']),
]);
});
@@ -183,7 +190,7 @@ class FakeDevice extends AndroidDevice {
}
@override
Future<String> shellEval(String command, List<String> arguments, { Map<String, String> environment }) async {
Future<String> shellEval(String command, List<String> arguments, { Map<String, String> environment, bool silent = false }) async {
commandLog.add(CommandArgs(
command: command,
arguments: arguments,
@@ -193,7 +200,7 @@ class FakeDevice extends AndroidDevice {
}
@override
Future<void> shellExec(String command, List<String> arguments, { Map<String, String> environment }) async {
Future<void> shellExec(String command, List<String> arguments, { Map<String, String> environment, bool silent = false }) async {
commandLog.add(CommandArgs(
command: command,
arguments: arguments,