From 9e0fabdfe6553f2d952541b82bebb7d3ee3057a5 Mon Sep 17 00:00:00 2001 From: Maurice McCabe Date: Wed, 17 Jul 2019 13:15:28 -0700 Subject: [PATCH] Fixed finding device info from config --- lib/src/config.dart | 10 ++++++---- test/screenshots_test.dart | 2 ++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/src/config.dart b/lib/src/config.dart index 13210891..76669b97 100644 --- a/lib/src/config.dart +++ b/lib/src/config.dart @@ -253,10 +253,12 @@ bool isValidFrame(dynamic frame) { /// Find device info in config for device name. Map findDeviceInfo(Map configInfo, String deviceName) { Map deviceInfo; - configInfo['devices'].values.forEach((devices) { - devices.forEach((_deviceName, _deviceInfo) { - if (_deviceName == deviceName) deviceInfo = _deviceInfo; - }); + configInfo['devices'].forEach((deviceType, devices) { + if (devices != null) { + devices.forEach((_deviceName, _deviceInfo) { + if (_deviceName == deviceName) deviceInfo = _deviceInfo; + }); + } }); return deviceInfo; } diff --git a/test/screenshots_test.dart b/test/screenshots_test.dart index a691444d..0c111a6d 100644 --- a/test/screenshots_test.dart +++ b/test/screenshots_test.dart @@ -732,11 +732,13 @@ devices: android: android device 1: android device 2: + fuschia: '''; final configInfo = loadYaml(params); final deviceNames = utils.getAllConfiguredDeviceNames(configInfo); for (final devName in deviceNames) { final deviceInfo = findDeviceInfo(configInfo, devName); + print('devName=$devName'); print('deviceInfo=$deviceInfo'); if (deviceInfo != null) { expect(deviceInfo['orientation'], orientation);