【发布时间】:2020-07-14 18:30:52
【问题描述】:
我是 XCUITest 框架的新手。我需要调用 API https://restcountries.eu/rest/v2/all 获取国家列表并现在显示在 UITableView 中,因为用户将单击基于国家名称的任何单元格下一个屏幕将具有国家名称和国家标志,一切正常现在我想实现 XCUITest,因为我已经添加了功能
[![enter image description here][1]][1]
func testTheCountryListAndAllScreen() {
app.launch()
let countryListTableView = self.app.tables["CountryList"]
XCTAssertTrue(countryListTableView.exists, "Country list have data")
let countryListCell = countryListTableView.cells
if countryListCell.count > 0 {
for cell in 0..<countryListCell.count {
let countryCell = countryListCell.element(boundBy: cell)
countryCell.tap()
self.app.buttons.staticTexts["Move to info page"].tap()
self.app.navigationBars.buttons.element(boundBy: 0).tap()
self.app.navigationBars.buttons.element(boundBy: 0).tap()
}
}
}
在 app.launch() 应用程序正在崩溃
【问题讨论】:
标签: ios swift xcode-ui-testing xcuitest