Skip to content

[scan] fix: Properly select device if Xcode destination is provided - #29814

Open
mykola-mokhnach wants to merge 3 commits into
fastlane:masterfrom
mykola-mokhnach:dest-select
Open

[scan] fix: Properly select device if Xcode destination is provided#29814
mykola-mokhnach wants to merge 3 commits into
fastlane:masterfrom
mykola-mokhnach:dest-select

Conversation

@mykola-mokhnach

Copy link
Copy Markdown

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

Currently the test lane ignores device parameters provided in the destination argument and selects the first matched device instead. Check the https://github.com/appium/WebDriverAgent/actions/runs/20296663483/job/58291864199?pr=1086#step:7:79 CI log for more details. Even though we set the destination to platform\=iOS\ Simulator,name\=iPhone\ 17,OS\=26.1 Fastlane logs the following Simulator selected: [08:46:47]: Found simulator "iPhone 16 Pro (18.4)".

Description

Testing Steps

@iBotPeaches

Copy link
Copy Markdown
Member

Could you help me understand this avenue vs the device and devices parameters scan offers? The comment on destination states - "Only use if you're a pro" so a bit funny that it doesn't tell me exactly why someone would do this.

So to see destination have to rip off a device from that parameter from that seems like some extra features. Is there something I'm missing why its not part of the device parameter?

Apologies if these are dumb questions - honestly not used scan yet.

@mykola-mokhnach

Copy link
Copy Markdown
Author

Could you help me understand this avenue vs the device and devices parameters scan offers? The comment on destination states - "Only use if you're a pro" so a bit funny that it doesn't tell me exactly why someone would do this.

So to see destination have to rip off a device from that parameter from that seems like some extra features. Is there something I'm missing why its not part of the device parameter?

Apologies if these are dumb questions - honestly not used scan yet.

No problem @iBotPeaches, I'm happy to provide more details, and thanks for taking a look into the PR.

If you check the above CI log you could see that in the affected PR I was providing only the destination parameter to the lane hoping that it already has all the necessary device and OS info. Also, even the original fastlane sources contain the below comment:

    # No need to show below warnings message(s) for xcode13+, because
    # Apple recommended to have destination in all xcodebuild commands
    # otherwise, Apple will generate warnings in console logs
    # see: https://github.com/fastlane/fastlane/issues/19579

So, seeing that fastlane selects absolutely different simulator device and OS version was completely unexpected to me. In such case the mismatch was a major problem since it's important to select a correct device and platform to run integrations tests on. Now I have updated my code to use device explicitly to workaround the issue, although I still think it is a bug, and that it makes sense to fix it for other people.

If there are any major concerns about merging the PR itself then we could at least update the documentation to explain that fastlane deliberately ignores parameters provided in destination while scanning for devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants