매우 간단한 테스트를 구현하려고하지만, XCUIElementQuery.matching(identifier:) 메서드가 붙어 있습니다. 나는 UIImageView
을 쿼리하는 것이 예상대로 작동하지 않는다고 생각하지만 확실하지 않습니다.XCUIElementQuery.matching (identifier :)이 UIImageView에서 작동하지 않습니다.
내가보기 설정이 두 설정이 :
그리고이 시험이 : 나는 '
func testRecording() {
XCTAssertEqual(app.staticTexts.matching(identifier: "label").count, 2)
XCTAssertEqual(app.images.matching(identifier: "accept").count, 1)
}
을 이 두보기에 대해 질문합니다 (ID가인 라벨). ID가 accept
인및 UIImageView). 여기에서 : app
은 다음과 같이 클래스 속성으로 정의됩니다. let app = XCUIApplication()
.
이 ID label
두 staticText
의 화면에 ID를 accept
하나 image
이 있기 때문에이 테스트를 통과해야한다는 것을 의미 :
그래서,이 화면 모습입니다. staticText
의 성공적 조회되고 있지만 matching(identifier:)
시도는 ID accept
와 image
를 조회 할 때 실패 :
app.images.
app.tables.
: 내가 좋아하는 많은 것들로 조회하려고
app.tables.images.
app.tables.cells.images.
01 23,516,
app.buttons.
은 (또한 접근성 설정의 특색 부분에Button
로 표시)
![Test failing on image with id 'accept'](https://i.stack.imgur.com/FR0Lu.png)
하지만 행운 (또한 접근성 설정의 특색 부분에 Static Text
로 표시)
app.staticTexts.