Skip to content

Instantly share code, notes, and snippets.

private func loadMoreListings() {
if listingViewModelsLegacy.value == nil {
loadingEvents.on(.next(.loadingList))
}
guard let searchQuery = SearchQuery.deepCopy(model: searchQuery) else {
return
}
currentListRequest?.cancel()
let query = SearchQuery()
query.geography = "nyc"
query.nePoint = CommonUtilsGeoLocation(location: Location(latitude: 40.9176, longitude: -73.7))
query.swPoint = CommonUtilsGeoLocation(location: Location(latitude: 40.4774, longitude: -74.2591))
query.rentalStatuses = RentalListingStatus.consumer
query.saleStatuses = SaleListingStatus.consumer
query.geohashLength = 4
query.zoomLevel = 13
query.maxResultsForGranularClustering = 69
query.listingTypes = [.sales]
func suggest(query: String, currentLocation: Location? = nil) {
lastQuery = query
currentRequest?.cancel()
currentRequest = nil
let request = SearchSuggestRequestV2()
request.q = query
request.limit = 10
request.listingTypes = [.sales]
public class MapBot: Robot, RobotItem {
public enum Item: UIElementable {
case map
case cluster(withText: String)
case pricePin(withText: String)
case clearAll
case schoolPin
public func UIElement(on app: XCUIApplication) -> XCUIElement {
func testShowPinsAtMaxZoomLevel() {
XCTContext.runActivity(named: "Always show pins at the max zoom level") { _ in
CompassLauncher().account(.nycAgent).launch().verifyMore()
TabBarBot()
.search()
.tap(.searchBarTextField)
.enterText("East Village")
SearchSuggestBot()
.tap(.neighborhood)
MapBot()
public class MapBot: Robot, RobotItem {
...
@discardableResult
public func tapAnyCluster() -> MapBot {
app.otherElements[mapViewAccessibilityIdentifier]
.descendants(matching: .any)
.allElementsBoundByIndex
.first(where: { $0.label.contains(clusterIdentifier) })?
.tap()
return self
public class MapMarker: GMSMarker {
...
case .cluster:
let cluster = MapClusterView(count: viewModel.count)
cluster.text = viewModel.title
iconView = cluster
accessibilityIdentifier = clusterIdentifier + "_\(cluster.text ?? "")"
}
app.otherElements[mapAccessibilityIdentifier]
.descendants(matching: .any)[mapMarkerAccessibilityIdentifier]
.firstMatch
public class MapMarker: GMSMarker {
...
accessibilityIdentifier = mapMarkerAccessibilityIdentifier
...
}
public class MapView: UIView {
...
public let map = GMSMapView()
self.accessibilityIdentifier = mapAccessibilityIdentifier
map.accessibilityElementsHidden = false
public var pins: [MapMarker]?
...
}