You need a simulator for your Xcode UI tests that is not available on the stack that you are using. For example, you wish to run a simulator for an older iOS version.
Add the following code in a Script Step (replace 'iOS 13' with the version you need):
gem install xcode-install xcversion simulators --install='iOS 13'
Note: this does not work for Xcode 14 onwards, as Apple changed how simulators get installed (previous version can still use this).
For Xcode 14 (and newer versions), you can download the installer of the runtime (or simulator) with custom script and install it it as a normal pkg file (this can be found on the Apple developer portal).