Stop Xcode UITests running for light/dark and orientation permutations

I'm trying to run UITests just once. However, Xcode by default seems to run every permutation of light/dark color theme and device orientation and localizations. This means all UITests run 8 times (with 1 additional localization besides English). With tests that can take a couple minutes, the time to run all these adds up.

Nothing in my UITest depends on the color theme, so I'd like to turn those permutations off always. The orientation and localization variations I might want sometimes but would generally also like to turn off.

Questions:

  1. Can I disable any/all of these permutations?
  2. How can I get the locale string for the current run? I've tried using Locale(identifier: Locale.preferredLanguages.first!) but this just gets the device language, not the language being used on that run of the UI Test.

Minimal reproducible example:

Make a new SwiftUI app project in Xcode 15. Add a UI Testing Bundle target Add a localization in the general app settings, then add a string catalog called Localizable and at least one string's translation in that string catalog. Run a UITest Observe that it runs 8 times.

Thanks for the help!

Stop Xcode UITests running for light/dark and orientation permutations
 
 
Q