Detect Physical iOS device without Xcode

Summary:
This diff adds the support of detecting physical device in Flipper even if the xcode is not installed and there is no cli tool installed.

See the demo.

Reviewed By: timur-valiev

Differential Revision: D26816588

fbshipit-source-id: 5f052998fcbe5c51385222d16df0e1855177b552
This commit is contained in:
Pritesh Nandgaonkar
2021-03-05 11:34:34 -08:00
committed by Facebook GitHub Bot
parent 11879c127b
commit a2d559c8c0
8 changed files with 238 additions and 39 deletions

View File

@@ -7,7 +7,18 @@
* @format
*/
import {parseXcodeFromCoreSimPath} from '../iOSDevice';
import {
parseXcodeFromCoreSimPath,
getAllPromisesForQueryingDevices,
} from '../iOSDevice';
import configureStore from 'redux-mock-store';
import reducers, {State} from '../../reducers/index';
import {getInstance} from '../../fb-stubs/Logger';
const mockStore = configureStore<State, {}>([])(
reducers(undefined, {type: 'INIT'}),
);
const logger = getInstance();
const standardCoresimulatorLog =
'username 1264 0.0 0.1 5989740 41648 ?? Ss 2:23PM 0:12.92 /Applications/Xcode_12.4.0_fb.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/libexec/mobileassetd';
@@ -48,3 +59,23 @@ test('test parseXcodeFromCoreSimPath from standard locations', () => {
match[0],
).toEqual('/Applications/Xcode_12.4.0_fb.app/Contents/Developer');
});
test('test getAllPromisesForQueryingDevices when xcode detected', () => {
const promises = getAllPromisesForQueryingDevices(
mockStore,
logger,
{},
true,
);
expect(promises.length).toEqual(3);
});
test('test getAllPromisesForQueryingDevices when xcode is not detected', () => {
const promises = getAllPromisesForQueryingDevices(
mockStore,
logger,
{},
false,
);
expect(promises.length).toEqual(1);
});