I am trying to test VOIP calling in our app. I simulate a call and I try to assert if the correct caller ID is present. However, I can't access the caller name label "Bob" using the following:
let springBoard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
XCTAssert(springBoard.staticTexts["Bob"].waitForExistence(timeout: 10)) // Assertion fails
However, if I try to access the label just below it "*** Audio…" using the same call the assertion passes:
XCTAssert(springBoard.staticTexts["*** Audio…"].waitForExistence(timeout: 10))
When I print out springBoard.debugDescription
I find both "Bob" and "*** Audio…" in the accessibility hierarchy and they both are staticTexts:
The screen being tested:
How do I go about accessing "Bob" label and asserting that it's the correct caller ID?