Certain elements are not "visible" in XCUITest, can't assert for them, their never found. Even when I print XCUIApplication() from debugging the elements won't show.

1 Answers

Bence Pattogato On

I found out that if you set the

isAccessbilityElement = true

property (which I did to support voice over) then all of the marked view's subviews will be hidden in XCUITest world. My solution was to check if I'm running UITests, if so then set false to this flag if not, then true.

let application = XCUIApplication()
application.launchArguments = ["UITest"]

public var isRunningUITests: Bool {
    return arguments.contains("UITest")