Unverified Commit 3396ec7b authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Device discovery output cleanup (#131223)

Fixes https://github.com/flutter/flutter/issues/6538
parent 096b7c3c
...@@ -168,48 +168,43 @@ class DevicesCommandOutput { ...@@ -168,48 +168,43 @@ class DevicesCommandOutput {
} }
if (allDevices.isEmpty) { if (allDevices.isEmpty) {
_printNoDevicesDetected(); _logger.printStatus('No authorized devices detected.');
} else { } else {
if (attachedDevices.isNotEmpty) { if (attachedDevices.isNotEmpty) {
_logger.printStatus('${attachedDevices.length} connected ${pluralize('device', attachedDevices.length)}:\n'); _logger.printStatus('Found ${attachedDevices.length} connected ${pluralize('device', attachedDevices.length)}:');
await Device.printDevices(attachedDevices, _logger); await Device.printDevices(attachedDevices, _logger, prefix: ' ');
} }
if (wirelessDevices.isNotEmpty) { if (wirelessDevices.isNotEmpty) {
if (attachedDevices.isNotEmpty) { if (attachedDevices.isNotEmpty) {
_logger.printStatus(''); _logger.printStatus('');
} }
_logger.printStatus('${wirelessDevices.length} wirelessly connected ${pluralize('device', wirelessDevices.length)}:\n'); _logger.printStatus('Found ${wirelessDevices.length} wirelessly connected ${pluralize('device', wirelessDevices.length)}:');
await Device.printDevices(wirelessDevices, _logger); await Device.printDevices(wirelessDevices, _logger, prefix: ' ');
} }
} }
await _printDiagnostics(); await _printDiagnostics(foundAny: allDevices.isNotEmpty);
} }
void _printNoDevicesDetected() { Future<void> _printDiagnostics({ required bool foundAny }) async {
final StringBuffer status = StringBuffer('No devices detected.'); final StringBuffer status = StringBuffer();
status.writeln();
status.writeln(); status.writeln();
final List<String> diagnostics = await _deviceManager?.getDeviceDiagnostics() ?? <String>[];
if (diagnostics.isNotEmpty) {
for (final String diagnostic in diagnostics) {
status.writeln(diagnostic);
status.writeln();
}
}
status.writeln('Run "flutter emulators" to list and start any available device emulators.'); status.writeln('Run "flutter emulators" to list and start any available device emulators.');
status.writeln(); status.writeln();
status.write('If you expected your device to be detected, please run "flutter doctor" to diagnose potential issues. '); status.write('If you expected ${ foundAny ? 'another' : 'a' } device to be detected, please run "flutter doctor" to diagnose potential issues. ');
if (deviceDiscoveryTimeout == null) { if (deviceDiscoveryTimeout == null) {
status.write('You may also try increasing the time to wait for connected devices with the --${FlutterOptions.kDeviceTimeout} flag. '); status.write('You may also try increasing the time to wait for connected devices with the "--${FlutterOptions.kDeviceTimeout}" flag. ');
} }
status.write('Visit https://flutter.dev/setup/ for troubleshooting tips.'); status.write('Visit https://flutter.dev/setup/ for troubleshooting tips.');
_logger.printStatus(status.toString()); _logger.printStatus(status.toString());
} }
Future<void> _printDiagnostics() async {
final List<String> diagnostics = await _deviceManager?.getDeviceDiagnostics() ?? <String>[];
if (diagnostics.isNotEmpty) {
_logger.printStatus('');
for (final String diagnostic in diagnostics) {
_logger.printStatus('• $diagnostic', hangingIndent: 2);
}
}
}
Future<void> printDevicesAsJson(List<Device> devices) async { Future<void> printDevicesAsJson(List<Device> devices) async {
_logger.printStatus( _logger.printStatus(
const JsonEncoder.withIndent(' ').convert( const JsonEncoder.withIndent(' ').convert(
...@@ -266,8 +261,8 @@ class DevicesCommandOutputWithExtendedWirelessDeviceDiscovery extends DevicesCom ...@@ -266,8 +261,8 @@ class DevicesCommandOutputWithExtendedWirelessDeviceDiscovery extends DevicesCom
// Display list of attached devices. // Display list of attached devices.
if (attachedDevices.isNotEmpty) { if (attachedDevices.isNotEmpty) {
_logger.printStatus('${attachedDevices.length} connected ${pluralize('device', attachedDevices.length)}:\n'); _logger.printStatus('Found ${attachedDevices.length} connected ${pluralize('device', attachedDevices.length)}:');
await Device.printDevices(attachedDevices, _logger); await Device.printDevices(attachedDevices, _logger, prefix: ' ');
_logger.printStatus(''); _logger.printStatus('');
numLinesToClear += 1; numLinesToClear += 1;
} }
...@@ -292,8 +287,8 @@ class DevicesCommandOutputWithExtendedWirelessDeviceDiscovery extends DevicesCom ...@@ -292,8 +287,8 @@ class DevicesCommandOutputWithExtendedWirelessDeviceDiscovery extends DevicesCom
if (_logger.isVerbose && _includeAttachedDevices) { if (_logger.isVerbose && _includeAttachedDevices) {
// Reprint the attach devices. // Reprint the attach devices.
if (attachedDevices.isNotEmpty) { if (attachedDevices.isNotEmpty) {
_logger.printStatus('\n${attachedDevices.length} connected ${pluralize('device', attachedDevices.length)}:\n'); _logger.printStatus('\nFound ${attachedDevices.length} connected ${pluralize('device', attachedDevices.length)}:');
await Device.printDevices(attachedDevices, _logger); await Device.printDevices(attachedDevices, _logger, prefix: ' ');
} }
} else if (terminal.supportsColor && terminal is AnsiTerminal) { } else if (terminal.supportsColor && terminal is AnsiTerminal) {
_logger.printStatus( _logger.printStatus(
...@@ -309,16 +304,16 @@ class DevicesCommandOutputWithExtendedWirelessDeviceDiscovery extends DevicesCom ...@@ -309,16 +304,16 @@ class DevicesCommandOutputWithExtendedWirelessDeviceDiscovery extends DevicesCom
if (wirelessDevices.isEmpty) { if (wirelessDevices.isEmpty) {
if (attachedDevices.isEmpty) { if (attachedDevices.isEmpty) {
// No wireless or attached devices were found. // No wireless or attached devices were found.
_printNoDevicesDetected(); _logger.printStatus('No authorized devices detected.');
} else { } else {
// Attached devices found, wireless devices not found. // Attached devices found, wireless devices not found.
_logger.printStatus(_noWirelessDevicesFoundMessage); _logger.printStatus(_noWirelessDevicesFoundMessage);
} }
} else { } else {
// Display list of wireless devices. // Display list of wireless devices.
_logger.printStatus('${wirelessDevices.length} wirelessly connected ${pluralize('device', wirelessDevices.length)}:\n'); _logger.printStatus('Found ${wirelessDevices.length} wirelessly connected ${pluralize('device', wirelessDevices.length)}:');
await Device.printDevices(wirelessDevices, _logger); await Device.printDevices(wirelessDevices, _logger, prefix: ' ');
} }
await _printDiagnostics(); await _printDiagnostics(foundAny: wirelessDevices.isNotEmpty || attachedDevices.isNotEmpty);
} }
} }
...@@ -849,8 +849,10 @@ abstract class Device { ...@@ -849,8 +849,10 @@ abstract class Device {
]; ];
} }
static Future<void> printDevices(List<Device> devices, Logger logger) async { static Future<void> printDevices(List<Device> devices, Logger logger, { String prefix = '' }) async {
(await descriptions(devices)).forEach(logger.printStatus); for (final String line in await descriptions(devices)) {
logger.printStatus('$prefix$line');
}
} }
static List<String> devicesPlatformTypes(List<Device> devices) { static List<String> devicesPlatformTypes(List<Device> devices) {
......
...@@ -77,11 +77,11 @@ void main() { ...@@ -77,11 +77,11 @@ void main() {
expect( expect(
testLogger.statusText, testLogger.statusText,
equals(''' equals('''
No devices detected. No authorized devices detected.
Run "flutter emulators" to list and start any available device emulators. Run "flutter emulators" to list and start any available device emulators.
If you expected your device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the --device-timeout flag. Visit https://flutter.dev/setup/ for troubleshooting tips. If you expected a device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''), '''),
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
...@@ -178,16 +178,18 @@ If you expected your device to be detected, please run "flutter doctor" to diagn ...@@ -178,16 +178,18 @@ If you expected your device to be detected, please run "flutter doctor" to diagn
final DevicesCommand command = DevicesCommand(); final DevicesCommand command = DevicesCommand();
await createTestCommandRunner(command).run(<String>['devices']); await createTestCommandRunner(command).run(<String>['devices']);
expect(testLogger.statusText, ''' expect(testLogger.statusText, '''
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) Found 1 wirelessly connected device:
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator) wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator)
1 wirelessly connected device: Cannot connect to device ABC
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator) Run "flutter emulators" to list and start any available device emulators.
• Cannot connect to device ABC If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager(devices: deviceList), DeviceManager: () => _FakeDeviceManager(devices: deviceList),
...@@ -200,12 +202,15 @@ wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2 ...@@ -200,12 +202,15 @@ wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2
final DevicesCommand command = DevicesCommand(); final DevicesCommand command = DevicesCommand();
await createTestCommandRunner(command).run(<String>['devices', '--device-connection', 'attached']); await createTestCommandRunner(command).run(<String>['devices', '--device-connection', 'attached']);
expect(testLogger.statusText, ''' expect(testLogger.statusText, '''
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
Cannot connect to device ABC
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) Run "flutter emulators" to list and start any available device emulators.
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
• Cannot connect to device ABC If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager(devices: deviceList), DeviceManager: () => _FakeDeviceManager(devices: deviceList),
...@@ -217,11 +222,14 @@ webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulato ...@@ -217,11 +222,14 @@ webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulato
final DevicesCommand command = DevicesCommand(); final DevicesCommand command = DevicesCommand();
await createTestCommandRunner(command).run(<String>['devices', '--device-connection', 'wireless']); await createTestCommandRunner(command).run(<String>['devices', '--device-connection', 'wireless']);
expect(testLogger.statusText, ''' expect(testLogger.statusText, '''
1 wirelessly connected device: Found 1 wirelessly connected device:
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator)
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator) Cannot connect to device ABC
Run "flutter emulators" to list and start any available device emulators.
• Cannot connect to device ABC If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager(devices: deviceList), DeviceManager: () => _FakeDeviceManager(devices: deviceList),
...@@ -244,12 +252,15 @@ wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2 ...@@ -244,12 +252,15 @@ wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2
final DevicesCommand command = DevicesCommand(); final DevicesCommand command = DevicesCommand();
await createTestCommandRunner(command).run(<String>['devices']); await createTestCommandRunner(command).run(<String>['devices']);
expect(testLogger.statusText, ''' expect(testLogger.statusText, '''
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) Cannot connect to device ABC
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
• Cannot connect to device ABC Run "flutter emulators" to list and start any available device emulators.
If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager(devices: deviceList), DeviceManager: () => _FakeDeviceManager(devices: deviceList),
...@@ -270,11 +281,14 @@ webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulato ...@@ -270,11 +281,14 @@ webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulato
final DevicesCommand command = DevicesCommand(); final DevicesCommand command = DevicesCommand();
await createTestCommandRunner(command).run(<String>['devices']); await createTestCommandRunner(command).run(<String>['devices']);
expect(testLogger.statusText, ''' expect(testLogger.statusText, '''
1 wirelessly connected device: Found 1 wirelessly connected device:
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator)
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator) Cannot connect to device ABC
• Cannot connect to device ABC Run "flutter emulators" to list and start any available device emulators.
If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager(devices: deviceList), DeviceManager: () => _FakeDeviceManager(devices: deviceList),
...@@ -308,11 +322,11 @@ wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2 ...@@ -308,11 +322,11 @@ wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2
equals(''' equals('''
No devices found yet. Checking for wireless devices... No devices found yet. Checking for wireless devices...
No devices detected. No authorized devices detected.
Run "flutter emulators" to list and start any available device emulators. Run "flutter emulators" to list and start any available device emulators.
If you expected your device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the --device-timeout flag. Visit https://flutter.dev/setup/ for troubleshooting tips. If you expected a device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''), '''),
); );
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
...@@ -329,11 +343,11 @@ If you expected your device to be detected, please run "flutter doctor" to diagn ...@@ -329,11 +343,11 @@ If you expected your device to be detected, please run "flutter doctor" to diagn
final DevicesCommand command = DevicesCommand(); final DevicesCommand command = DevicesCommand();
await createTestCommandRunner(command).run(<String>['devices', '--device-connection', 'attached']); await createTestCommandRunner(command).run(<String>['devices', '--device-connection', 'attached']);
expect(testLogger.statusText, ''' expect(testLogger.statusText, '''
No devices detected. No authorized devices detected.
Run "flutter emulators" to list and start any available device emulators. Run "flutter emulators" to list and start any available device emulators.
If you expected your device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the --device-timeout flag. Visit https://flutter.dev/setup/ for troubleshooting tips. If you expected a device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => NoDevicesManager(), DeviceManager: () => NoDevicesManager(),
...@@ -347,11 +361,11 @@ If you expected your device to be detected, please run "flutter doctor" to diagn ...@@ -347,11 +361,11 @@ If you expected your device to be detected, please run "flutter doctor" to diagn
expect(testLogger.statusText, ''' expect(testLogger.statusText, '''
Checking for wireless devices... Checking for wireless devices...
No devices detected. No authorized devices detected.
Run "flutter emulators" to list and start any available device emulators. Run "flutter emulators" to list and start any available device emulators.
If you expected your device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the --device-timeout flag. Visit https://flutter.dev/setup/ for troubleshooting tips. If you expected a device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => NoDevicesManager(), DeviceManager: () => NoDevicesManager(),
...@@ -449,19 +463,21 @@ If you expected your device to be detected, please run "flutter doctor" to diagn ...@@ -449,19 +463,21 @@ If you expected your device to be detected, please run "flutter doctor" to diagn
final DevicesCommand command = DevicesCommand(); final DevicesCommand command = DevicesCommand();
await createTestCommandRunner(command).run(<String>['devices']); await createTestCommandRunner(command).run(<String>['devices']);
expect(testLogger.statusText, ''' expect(testLogger.statusText, '''
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
Checking for wireless devices... Checking for wireless devices...
2 wirelessly connected devices: Found 2 wirelessly connected devices:
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator)
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator) Cannot connect to device ABC
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
• Cannot connect to device ABC Run "flutter emulators" to list and start any available device emulators.
If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager(devices: deviceList), DeviceManager: () => _FakeDeviceManager(devices: deviceList),
...@@ -477,10 +493,9 @@ wireless ios (mobile) • wireless-ios • ios • iOS 16 (simul ...@@ -477,10 +493,9 @@ wireless ios (mobile) • wireless-ios • ios • iOS 16 (simul
terminal = FakeTerminal(supportsColor: true); terminal = FakeTerminal(supportsColor: true);
fakeLogger = FakeBufferLogger(terminal: terminal); fakeLogger = FakeBufferLogger(terminal: terminal);
fakeLogger.originalStatusText = ''' fakeLogger.originalStatusText = '''
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
Checking for wireless devices... Checking for wireless devices...
'''; ''';
...@@ -491,17 +506,19 @@ Checking for wireless devices... ...@@ -491,17 +506,19 @@ Checking for wireless devices...
await createTestCommandRunner(command).run(<String>['devices']); await createTestCommandRunner(command).run(<String>['devices']);
expect(fakeLogger.statusText, ''' expect(fakeLogger.statusText, '''
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) Found 2 wirelessly connected devices:
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator) wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator)
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
2 wirelessly connected devices: Cannot connect to device ABC
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator) Run "flutter emulators" to list and start any available device emulators.
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
• Cannot connect to device ABC If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => DeviceManager: () =>
...@@ -525,24 +542,25 @@ wireless ios (mobile) • wireless-ios • ios • iOS 16 (simul ...@@ -525,24 +542,25 @@ wireless ios (mobile) • wireless-ios • ios • iOS 16 (simul
await createTestCommandRunner(command).run(<String>['devices']); await createTestCommandRunner(command).run(<String>['devices']);
expect(fakeLogger.statusText, ''' expect(fakeLogger.statusText, '''
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
Checking for wireless devices... Checking for wireless devices...
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) Found 2 wirelessly connected devices:
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator) wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator)
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
2 wirelessly connected devices: Cannot connect to device ABC
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator) Run "flutter emulators" to list and start any available device emulators.
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
• Cannot connect to device ABC If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager( DeviceManager: () => _FakeDeviceManager(
...@@ -560,12 +578,15 @@ wireless ios (mobile) • wireless-ios • ios • iOS 16 (simul ...@@ -560,12 +578,15 @@ wireless ios (mobile) • wireless-ios • ios • iOS 16 (simul
expect(testLogger.statusText, ''' expect(testLogger.statusText, '''
Checking for wireless devices... Checking for wireless devices...
2 wirelessly connected devices: Found 2 wirelessly connected devices:
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator)
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
Cannot connect to device ABC
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator) Run "flutter emulators" to list and start any available device emulators.
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
• Cannot connect to device ABC If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager(devices: deviceList), DeviceManager: () => _FakeDeviceManager(devices: deviceList),
...@@ -588,16 +609,19 @@ wireless ios (mobile) • wireless-ios • ios • iOS 16 (simul ...@@ -588,16 +609,19 @@ wireless ios (mobile) • wireless-ios • ios • iOS 16 (simul
final DevicesCommand command = DevicesCommand(); final DevicesCommand command = DevicesCommand();
await createTestCommandRunner(command).run(<String>['devices']); await createTestCommandRunner(command).run(<String>['devices']);
expect(testLogger.statusText, ''' expect(testLogger.statusText, '''
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
Checking for wireless devices... Checking for wireless devices...
No wireless devices were found. No wireless devices were found.
• Cannot connect to device ABC Cannot connect to device ABC
Run "flutter emulators" to list and start any available device emulators.
If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager(devices: deviceList), DeviceManager: () => _FakeDeviceManager(devices: deviceList),
...@@ -613,10 +637,9 @@ No wireless devices were found. ...@@ -613,10 +637,9 @@ No wireless devices were found.
terminal = FakeTerminal(supportsColor: true); terminal = FakeTerminal(supportsColor: true);
fakeLogger = FakeBufferLogger(terminal: terminal); fakeLogger = FakeBufferLogger(terminal: terminal);
fakeLogger.originalStatusText = ''' fakeLogger.originalStatusText = '''
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
Checking for wireless devices... Checking for wireless devices...
'''; ''';
...@@ -627,14 +650,17 @@ Checking for wireless devices... ...@@ -627,14 +650,17 @@ Checking for wireless devices...
await createTestCommandRunner(command).run(<String>['devices']); await createTestCommandRunner(command).run(<String>['devices']);
expect(fakeLogger.statusText, ''' expect(fakeLogger.statusText, '''
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
No wireless devices were found. No wireless devices were found.
• Cannot connect to device ABC Cannot connect to device ABC
Run "flutter emulators" to list and start any available device emulators.
If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager( DeviceManager: () => _FakeDeviceManager(
...@@ -660,21 +686,23 @@ No wireless devices were found. ...@@ -660,21 +686,23 @@ No wireless devices were found.
await createTestCommandRunner(command).run(<String>['devices']); await createTestCommandRunner(command).run(<String>['devices']);
expect(fakeLogger.statusText, ''' expect(fakeLogger.statusText, '''
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
Checking for wireless devices... Checking for wireless devices...
2 connected devices: Found 2 connected devices:
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator)
ephemeral (mobile) • ephemeral • android-arm • Test SDK (1.2.3) (emulator) webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
webby (mobile) • webby • web-javascript • Web SDK (1.2.4) (emulator)
No wireless devices were found. No wireless devices were found.
• Cannot connect to device ABC Cannot connect to device ABC
Run "flutter emulators" to list and start any available device emulators.
If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager( DeviceManager: () => _FakeDeviceManager(
...@@ -703,12 +731,15 @@ No wireless devices were found. ...@@ -703,12 +731,15 @@ No wireless devices were found.
expect(testLogger.statusText, ''' expect(testLogger.statusText, '''
No devices found yet. Checking for wireless devices... No devices found yet. Checking for wireless devices...
2 wirelessly connected devices: Found 2 wirelessly connected devices:
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator)
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator) Cannot connect to device ABC
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
Run "flutter emulators" to list and start any available device emulators.
• Cannot connect to device ABC If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager(devices: deviceList), DeviceManager: () => _FakeDeviceManager(devices: deviceList),
...@@ -733,12 +764,15 @@ No devices found yet. Checking for wireless devices... ...@@ -733,12 +764,15 @@ No devices found yet. Checking for wireless devices...
await createTestCommandRunner(command).run(<String>['devices']); await createTestCommandRunner(command).run(<String>['devices']);
expect(fakeLogger.statusText, ''' expect(fakeLogger.statusText, '''
2 wirelessly connected devices: Found 2 wirelessly connected devices:
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator)
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator) Cannot connect to device ABC
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
• Cannot connect to device ABC Run "flutter emulators" to list and start any available device emulators.
If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager( DeviceManager: () => _FakeDeviceManager(
...@@ -766,12 +800,15 @@ wireless ios (mobile) • wireless-ios • ios • iOS 16 (simul ...@@ -766,12 +800,15 @@ wireless ios (mobile) • wireless-ios • ios • iOS 16 (simul
expect(fakeLogger.statusText, ''' expect(fakeLogger.statusText, '''
No devices found yet. Checking for wireless devices... No devices found yet. Checking for wireless devices...
2 wirelessly connected devices: Found 2 wirelessly connected devices:
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator)
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
wireless android (mobile) • wireless-android • android-arm • Test SDK (1.2.3) (emulator) Cannot connect to device ABC
wireless ios (mobile) • wireless-ios • ios • iOS 16 (simulator)
Run "flutter emulators" to list and start any available device emulators.
• Cannot connect to device ABC If you expected another device to be detected, please run "flutter doctor" to diagnose potential issues. You may also try increasing the time to wait for connected devices with the "--device-timeout" flag. Visit https://flutter.dev/setup/ for troubleshooting tips.
'''); ''');
}, overrides: <Type, Generator>{ }, overrides: <Type, Generator>{
DeviceManager: () => _FakeDeviceManager( DeviceManager: () => _FakeDeviceManager(
......
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