Fill the blank
Fill the blank so the test waits up to 5 seconds for the confirmation.
let app = XCUIApplication()
app.launchArguments = ["-uiTesting"]
app.launch()
app.buttons["checkoutButton"].tap()
XCTAssertTrue(app.staticTexts["orderConfirmation"].____(timeout: 5))Hint 1 of 1
Which API waits?
Choose an answer, then open Show answer below to check it.
Show answer
Answer: A waitForExistence
Correct. It polls until the element appears or the timeout passes.
Why not the others?
- B
exists. exists is a property that checks once and takes no timeout. - C
isHittable. It's a property that checks once whether the element can be tapped. - D
sleep. sleep isn't an element method, and fixed sleeps make tests flaky.