in HostApp/HostAppUITests/AMLMapCompositeViewScreen.swift [52:76]
func testSearchField() -> Self {
let searchBar = app.textFields[Identifiers.searchBar]
let cancelButton = app.buttons[Identifiers.searchBarButtonCancel]
// Cancel button should not be shown until the search bar is in focus / contains text
XCTAssertFalse(cancelButton.isHittable)
searchBar.tap()
// Now the cancel button should be visible
XCTAssertTrue(cancelButton.isHittable)
let searchText = "coffee"
searchBar.typeText(searchText)
// Accessibility value should equal text in the search bar
XCTAssertEqual(searchBar.value as? String, searchText)
cancelButton.tap()
// Value should be default "Search" after tapping cancel button
XCTAssertEqual(searchBar.value as? String, "Search")
searchBar.tap()
searchBar.typeText(searchText)
let goButton = app.buttons["Go"]
goButton.tap()
return self
}