Skip to content

XCTest simulator version of build_and_inject #122

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nflore
Copy link

@nflore nflore commented Nov 27, 2023

I was automating screenshots with XCTest and the normal version of the build_and_inject script didn't find the Clone simulator(s) that opens.

--set testing will show the simulators used there, added a separate file for it.

Copy link
Collaborator

@chrisvasselli chrisvasselli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for this update, this is great.

I actually use parallel testing, but took a different approach to solve this problem. I create a simulator, then run build_and_inject.sh on that simulator, then run my tests on that simulator using xcodebuild -parallel-testing-enabled YES. That way, the simulator is duplicated with the correct status bar already setup, and I have found that it maintains that across the duplication.

I'm not sure which approach is better, but in a way I wonder if that's simpler than needing to inject into each duplicated simulator individual? What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe instead of a separate script this could be a flag that is passed to build_and_inject.sh, so we don't have to maintain two largely duplicate scripts?

### 1) Injecting into Springboard (Required on iOS 17+)
**tl;dr** Running `build_and_inject.sh booted` will apply a default status bar to the running simulator. Replace "booted" with a simulator UDID to target a specific simulator. Retrieve them with `xcrun simctl list devices | grep 'Booted'`

**For XCTest simulators, use `build_and_inject_test.sh booted`** - Replace "booted" with a simulator UDID to target a specific simulator. Retrieve them with `xcrun simctl --set testing list devices | grep 'Booted'`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I think this is a great addition.

We should also clarify that this is only for duplicated simulators created by using the -parallel-testing-enabled flag on xcodebuild. If you are using XCTest but not using parallel testing, this line might be misleading.

@@ -11,15 +11,18 @@ Modify the iOS Simulator so that it has a perfect status bar, then run your app

Starting in Xcode 11, the `simctl` command line tool includes a `status_bar` option that allows you to override the appearance of the status bar in the simulator. Hopefully this will eventually supercede the need for SimulatorStatusMagic, but at the moment it still has holes that make this project continue to be relevant. In particular, `simctl status_bar` does not currently provide a way to add localized date and time strings in the status bar.

## 1) Injecting into Springboard (Required on iOS 17+)
**tl;dr** Running `build_and_inject.sh booted` will apply a default status bar to the running simulator. Replace "booted" with a simulator UDID to target a specific simulator.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

@JPWhiteza JPWhiteza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request had been changed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants