I'm implementing XCUI tests for an Apple Watch app and have trouble with text fields. I suspect it's a bug (FB9983700)
TextField("Hello, World!", text: $text)
.accessibilityIdentifier("hellotext")
XCTAssertTrue(app.textFields["hellotext"].exists) // Fails on watch but works on iPhone
I found a workaround by using otherElements
instead of textFields
, but then the test will have to be different between iOS and watchOS.
Does anyone know of a better way?