I'm trying to automate creating screenshots of my application using Snapshot, and all goes well, until I want to navigate through a UIImagePickerController
which has set allowsEditing
to true
.
The weird thing is that in the iPhone 4s, 5s and 6s simulators this goes just fine, but in the iPhone 6(s) Plus the test can't seem to tap the "Choose" ("Kies" in Dutch) button in the cropper view.
My first attempt didn't work in any version:
app.buttons.elementBoundByIndex(2).tap()
And resulted in the following error:
file:///%3Cunknown%3E: test failure: -[MyAppSnapshots testExample()] failed: UI Testing Failure - Failed to scroll to visible (by AX action) Button 0x7f82d450ae30: traits: 8589934593, {{327.0, 613.5}, {35.0, 34.0}}, label: 'Kies', error: Error -25204 performing AXAction 2003
Then from this answer I grabbed the solution of forceTapElement
, which does work on all but iPhone 6(s) Plus.
app.buttons.elementBoundByIndex(2).forceTapElement()
Then I tried tapping on a coordinate;
let window = app.windows.elementBoundByIndex(0)
let rightBottom = window.coordinateWithNormalizedOffset(CGVectorMake(
CGRectGetWidth(window.frame) - 20,
CGRectGetHeight(window.frame) - 20
))
rightBottom.tap()
But that again didn't work on any of the devices.
So how do I test these native interfaces? Or should I just add some kind of switch to my code so that the UIImagePickerController
is replaced by something non-interactive.