I'm using the following code to launch a UI test that forces a specific app language and moves a slider.
I noticed that when forcing right to left text direction (for Arabic or Hebrew), during the UI test the slider doesn't move.
The app content:
struct ContentView: View {
@State private var slider = 0.0
var body: some View {
Slider(value: $slider, in: 0.0...1.0)
}
}
The UI test:
final class problemUITests: XCTestCase {
func testExample() throws {
let app = XCUIApplication()
let locale = Locale(identifier: "ar")
app.launchArguments += ["-AppleLanguages", "(ar)", "-AppleLocale", "ar"]
if locale.language.characterDirection == .rightToLeft {
app.launchArguments += ["-NSForceRightToLeftWritingDirection", "YES", "-AppleTextDirection", "YES"]
}
app.launch()
app.sliders.element.adjust(toNormalizedSliderPosition: 0.3)
}
}
Am I missing something or is there a workaround?