-
Notifications
You must be signed in to change notification settings - Fork 904
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
fix: update logic to check for available ios devices for log-ios
to work
#1675
fix: update logic to check for available ios devices for log-ios
to work
#1675
Conversation
Two things that we might want to follow-up on:
(please lmk if these are needed before merging or anything else) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
It looks like we have some overlapping implementations, and this is properly resolved in run-ios, but it haven't propagated to log-ios: cli/packages/cli-platform-ios/src/commands/runIOS/findMatchingSimulator.ts Lines 70 to 73 in b3812ea
Would you be so kind and refactor this so more code is being shared, to avoid such discrepancies in the future? |
(device.availability === '(available)' || | ||
device.isAvailable === true) && | ||
device.state === 'Booted' | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @esthor thanks for the fix! 💪
Question - is there a chance that device is "Booted" and not available? 🤔
If not then I think this logic could be simplified a bit and we won't care anymore about availability
v isAvailable
mismatch :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're probably right in this case. Will have to double-check, but it doesn't really make sense to be unavailable but Booted for a simulator, but similar logic was there before. Maybe there is an edge case 🤷
Yes, 💯 . I wanted to propose this, but didn't want to risk rocking the boat too much. Happy to hop on it! |
Go for it! 💪 |
Will do! |
@esthor is there anything we can help you with to push this through? |
I'm adding it to my TODO in a week 🙏 |
There hasn't been any activity on this pull request in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. |
My bad, I thought this was handled in other changes, but it's not. I'll find some time to try and wrap up this PR. |
Hey @esthor, recently @adamTrz fixed error with getting devices and simulators in CLI #1823 and basically there was a change from |
Summary:
Hey, just ran into this while working on a new feature.
When pulling the devices via
xcrun simctl list devices --json
now, I don't actually get theavailability
key, I just get theisAvailable
key. They are both already listed as optional keys in theDevice
type in the repo. My guess is that theavailability
key was on an older version ofsimctl
.Anyway, if I run the
log-ios
as-is, without this change, it always fails to find an available iOS device becausedevice.availability
simply never exists. Changing it to also check fordevice.isAvailable
works.Test Plan:
environment:
macOS 12.5 (latest stable)
xcrun version 61 / xcode 13.4.1 (latest stable)
log-ios
command as is in the currentmain
cli branch. (Result: FAILS witherror: No active iOS device found
)log-ios
command with this PR's code. (Result: Successfully finds the active simulator and starts a log session)