код:
Код: Выделить всё
var body: some View {
NavigationStack {
List {
// some elements
}
}
.searchable(text: $searchText)
.accessibilityIdentifier("SearchField")
}
< /code>
и для моих тестов пользовательского интерфейса, < /p>
override func setUpWithError() throws {
continueAfterFailure = false
app = XCUIApplication() // Initializes the XCTest app
app.launch() // Launches the app
let searchField = app.searchFields["SearchField"]
XCTAssertTrue(searchField.exists, "Search field should exist")
}
Спасибо все < /p>
Подробнее здесь: https://stackoverflow.com/questions/794 ... or-ui-test