Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check isAvailable key on simulator object #21557

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions local-cli/runIOS/__tests__/findMatchingSimulator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,58 @@ describe('findMatchingSimulator', () => {
});
});

it('should find simulator with new xcrun format', () => {
expect(
findMatchingSimulator(
{
devices: {
'iOS 12.1': [
{
state: 'Shutdown',
isAvailable: 'YES',
name: 'iPhone 6s',
udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508',
},
{
state: 'Shutdown',
isAvailable: 'YES',
name: 'iPhone 6',
udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C',
},
{
state: 'Shutdown',
isAvailable: 'YES',
name: 'iPhone XS Max',
udid: 'B9B5E161-416B-43C4-A78F-729CB96CC8C6',
availabilityError: '',
},
{
state: 'Shutdown',
isAvailable: 'YES',
name: 'iPad Air',
udid: '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB',
availabilityError: '',
},
{
state: 'Shutdown',
isAvailable: 'YES',
name: 'iPad (5th generation)',
udid: '9564ABEE-9EC2-4B4A-B443-D3710929A45A',
availabilityError: '',
},
],
},
},
'iPhone 6',
),
).toEqual({
udid: 'BA0D93BD-07E6-4182-9B0A-F60A2474139C',
name: 'iPhone 6',
booted: false,
version: 'iOS 12.1',
});
});

it('should return null if no simulators available', () => {
expect(
findMatchingSimulator(
Expand Down
5 changes: 4 additions & 1 deletion local-cli/runIOS/findMatchingSimulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ function findMatchingSimulator(simulators, simulatorName) {
for (let i in devices[version]) {
let simulator = devices[version][i];
// Skipping non-available simulator
if (simulator.availability !== '(available)') {
if (
simulator.availability !== '(available)' &&
simulator.isAvailable !== 'YES'
) {
continue;
}
let booted = simulator.state === 'Booted';
Expand Down