Мое предложение было бы помочь вам использовать один из этих двух методов ниже. На экране появится первый элемент. Второй элемент ожидает hittable. Но в любом случае эти методы помогут вам, возможно, вы можете использовать метод sleep (param). Как sleep(5)
. Ждет в течение 5 секунд
import XCTest
class BaseTestCase: XCTestCase {
func waitForElementToAppear(element: XCUIElement, timeout: NSTimeInterval = 60, file: String = #file, line: UInt = #line) {
let existsPredicate = NSPredicate(format: "exists == true")
expectationForPredicate(existsPredicate,
evaluatedWithObject: element, handler: nil)
waitForExpectationsWithTimeout(timeout) { (error) -> Void in
if (error != nil) {
let message = "Failed to find \(element) after \(timeout) seconds."
self.recordFailureWithDescription(message, inFile: file, atLine: line, expected: true)
}
}
}
func waitForHittable(element: XCUIElement, timeout: NSTimeInterval = 70, file: String = #file, line: UInt = #line) {
let existsPredicate = NSPredicate(format: "hittable == 1")
expectationForPredicate(existsPredicate, evaluatedWithObject: element, handler: nil)
waitForExpectationsWithTimeout(timeout) { (error) -> Void in
if (error != nil) {
let message = "Failed to find \(element) after \(timeout) seconds."
self.recordFailureWithDescription(message,
inFile: file, atLine: line, expected: true)
}
}
}
}
Я надеюсь, что помог в некотором роде
Спасибо, что нашли время, чтобы помочь мне. Элемент по-прежнему остается гибким и существует, но снова он ждет долгое время с тем же сообщением «Ожидание приложения в режиме ожидания». Иногда я вижу это сообщение ---- «App анимации полное уведомление не получено, будет пытаться продолжить». – Manoj