I'm trying to automate parts of my UI testing using XCUITest. I wan't the test do automatically do parts of the test, and then wait for me to do some stuff manually. Is there a good way to do this?
Right now I'm just doing this:
class QDBUITestHost: XCTestCase {
override func setUp() {
continueAfterFailure = false
XCUIApplication().launch()
}
override func tearDown() {}
func testHosting() {
let app = XCUIApplication()
app.buttons["Select Group"].tap()
app.sheets.buttons["com-mist-qdb-1"].tap()
app.buttons["Host"].tap()
sleep(600) // This is an ugly hack
}
}
So, is there a better way to do this, rather than to just sleep(600)
?
There is a xctwaiter framework.
You can use expectations to wait the results. They are very flexible.
let result = XCTWaiter().wait(for:[expectation], timeout: 10)
How to use an expectation you can see in the documentation. An example .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.