func test_MyView_TextShouldHaveIsHeaderAccessibilityTrait() {
// Arrange
let sut = MyView()
// Act
let text = sut.inspect().text()
// Assert
XCTAssertTrue(text.accessibilityTraits.contains(.isHeader)) /// ERROR: Value of type 'InspectableView<ViewType.Text>' has no member 'accessibilityTraits'
}
}
This forum is meant for the Swift Testing library that is part of the Swift project, not for Swift testing questions in general. Since your question is about a specific third-party library (ViewInspector), you may have better luck opening an issue on their GitHub repository.
(EDIT: I've moved this post from Development > Swift Testing to Using Swift.)
Thanks for the link, mr Allevato. However, I am open to other frameworks or native solutions. Is there any other approach to assert that a view contains a specific accessibility trait ?