Let's say I've an app with an UI which looks kind of like the image below:
Let's also say the blue view behaves like a map and the other colors are other interactable views.
I need to do a XCTest where I need to "zoom out" on that blue view which I tired with pinchWithScale:
[blueView pinchWithScale:0.5 velocity:-1];
Unfortunately that doesn't work because one of the red views or the violet view (which overlaps the blue view a tiny bit for shadow and corner reasons) gets triggered instead of a pinch
gesture on the blue view.
I saw that I can get coordinateWithNormalizedOffset (similar like here) of a view by using the method:
- (XCUICoordinate *)coordinateWithNormalizedOffset:(CGVector)normalizedOffset;
which would allow me to use not the whole blue view to perform a "zoom out" gesture by:
XCUICoordinate* blueViewInset = [blueView coordinateWithNormalizedOffset:
CGVectorMake(0.2f, 0.2f)];
but the XCUICoordinate object blueViewInset
doesn't support pinch gestures.
Hence how can I perform a pinch gesture to "zoom out" on a XCUIElement with coordinates not at the border of the view?
I'm also wondering if there is a way to create an extension to XCUIElement with a custom pinch gesture? I would appreciate any hints on that too.