2017-03-22 11 views
1

로그인 버튼을 누른 후 로그인이 성공한 후 더 나은 업데이트 또는 홈 스크린이 표시되고 수행 할 작업을 결정할 때까지 기다려야합니다. 문서 말한다 , 그XCTest waitForExpectations (...) 여러 결과를 기다리는 중

하나 -waitForExpectationsWithTimeout : 핸들러 : 주어진 시간에 활성화 될 수 있지만, {기대 -> 대기}의 * 여러 개의 개별 시퀀스가 ​​서로 연결 할 수 있습니다.

조금만 돌아 다니고 싶지만 마침내 알아 냈습니다.

답변

0

조건부에 인수를 추가하고 조건 사이에 OR을 사용할 수 있습니다. 그런 다음

let skipUpdateButtonPredicate = NSPredicate(format: "%@.exists == 1 OR %@.exists == 1", skipUpdateButton, homeTabBar) 
self.expectation(for: skipUpdateButtonPredicate, evaluatedWith: [Any](), handler: nil) 
testCase.waitForExpectations(timeout: Constants.loginTimeout, 
           handler: nil) 

가정이나 업데이트가 제공됩니다 경우, 여기에서 분기 할 수 있습니다 :

if skipUpdateButton.exists { 
    skipUpdateButton.tap() 
}