1
내 응용 프로그램 용으로 내 XCUITest를 쓰고 있습니다. 내 테스트 비동기를 만들기 위해 waitForExpectationsWithTimeout
를 사용하기 위해 나는 그러나이 줄에 alert
의 선언에 오류 Variable used within its own initial value
을 던지고있다 .... 경고를 선언하고 5Swift Error "자체 초기 값 내에서 사용되는 변수"
let timeout = NSTimeInterval()
let app = XCUIApplication()
let exists = NSPredicate(format: "exists == 1")
let alert = alert.buttons["OK"]
testCase.addUIInterruptionMonitorWithDescription("Enable Notifications") { (alert) -> Bool in
alert.buttons["OK"].tap()
return true
}
self.buttons["Enable notifications"].tap()
testCase.expectationForPredicate(exists, evaluatedWithObject: alert, handler: nil)
testCase.waitForExpectationsWithTimeout(timeout, handler: nil)
app.tap()
이 왜 누군가가 말해 줄 수 이 오류가 발생하고이를 해결하기 위해 할 수있는 일이 있습니다. 미리 감사드립니다.
좋아요, 알기 전에 어떻게 경고해야합니까? –
Xcode Tests에 익숙하지 않아서 질문에 답했습니다. 비트 검색 후 인터넷에서이 문제를 발견했습니다. alert = app.alerts.elementBoundByIndex (0) .buttons [ "OK"] - 한번 시도하십시오 – Aakash
도움이되지 않으면이 링크를 사용해보십시오 http://stackoverflow.com/questions/32148965/ xcode-7-ui-testing-how-to-dismiss-a-series-of-system-alerts를 코드로 사용하거나 지식이있는 사람이 응답하도록 기다립니다. – Aakash