Open onmyway133 opened 4 years ago
Add accessibilityIdentifier to the parent view of GMSMapView. Setting directly onto GMSMapView has no effect
accessibilityIdentifier
GMSMapView
accessibilityIdentifier = "MapView"
let map = app.otherElements.matching(identifier: "MapView").element(boundBy: 0) map.pinch(withScale: 2, velocity: 1) map.rotate(CGFloat.pi/3, withVelocity: 1.0) map.swipeLeft() map.swipeRight() map.swipeDown() map.swipeDown()
Need to enable accessibility
mapView.accessibilityElementsHidden = false
Can't use pinch to zoom out with UITests, so need to mock location !!!
map().pinch(withScale: 0.05, velocity: -1)
Need to use gpx to mock to preferred location
let map = app.otherElements[Constant.AccessibilityId.mapView.rawValue] let pin = app.otherElements .matching(identifier: Constant.AccessibilityId.pin.rawValue) .element(boundBy: 0)
Try isAccessibilityElement = true for PinView, can't touch!! Use coordinate, can't touch !!
isAccessibilityElement = true
PinView
let coordinate = pin.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)) coordinate.tap()
Try traversing all the pins, can't touch
Array(0..<pins.count).forEach { let pin = pins.element(boundBy: $0) if pin.isHittable { pin.tap() } }
When po app.otherElements, coordinates are outside screen
po app.otherElements
Other, {{1624.0, 1624.0}, {30.0, 30.0}}, identifier: 'pin', label: 'Hello world'
My PinView has isHittable being false, no matter how I use coordinate or enable it. It can't be touched.
isHittable
Go to Xcode -> Open Developer Tool -> Accessibility Inspector to inspect our app in iOS simulator
It turns out that if I do
po app.buttons
It shows all the GMSMarker, but with identifier having class name MyApp.MyStopMarker, so just need to use buttons
identifier
MyApp.MyStopMarker
buttons
extension NSPredicate { static func contains(identifier: String) -> NSPredicate { return NSPredicate(format: "identifier CONTAINS[c] '\(text)'") } } let pin = map() .buttons.matching(NSPredicate.contains("MyStopMarker")) .element(boundBy: 0) pin.tap()
@onmyway133 for me it works only if I tap twice. Do you have any idea why?
Interact with GMSMapView
Add
accessibilityIdentifier
to the parent view ofGMSMapView
. Setting directly ontoGMSMapView
has no effectInteract with GMSMarker (1st try)
Need to enable accessibility
Can't use pinch to zoom out with UITests, so need to mock location !!!
Need to use gpx to mock to preferred location
Try
isAccessibilityElement = true
forPinView
, can't touch!! Use coordinate, can't touch !!Try traversing all the pins, can't touch
When
po app.otherElements
, coordinates are outside screenInteract with GMSMarker (works)
My
PinView
hasisHittable
being false, no matter how I use coordinate or enable it. It can't be touched.Go to Xcode -> Open Developer Tool -> Accessibility Inspector to inspect our app in iOS simulator
It turns out that if I do
It shows all the GMSMarker, but with
identifier
having class nameMyApp.MyStopMarker
, so just need to usebuttons