i'm creating automate uitest test case i'd test scenario when users make 3d touch interaction element, shows them peek , pop view.
i can't seem find possible ways simulate 3d touch on element , continue.
anyone has idea this, or 3d touch still unavailable test?
thanks
i able execute force press / 3d touch on app icon on iphone 7 running ios 10.3. not possible on 10.2.
objective-c
first have declare following or import this header
typedef void (^cdunknownblocktype)(void); @interface xceventgenerator : nsobject + (id)sharedgenerator; // ios 10.3 specific - (double)forcepressatpoint:(struct cgpoint)arg1 orientation:(long long)arg2 handler:(cdunknownblocktype)arg3; @end
and execute force press
xcuielement *element = ...; // element xcuicoordinate *coord = [mapsicon coordinatewithnormalizedoffset:cgvectormake(0.5, 0.5)]; [[xceventgenerator sharedgenerator] forcepressatpoint:coord.screenpoint orientation:0 handler:^{}]; // handler cannot nil
here execute force press on maps icons.
swift (not tested)
for swift have declare/import same interface/header above , execute force press this
let el = ...; // element let coord = el.coordinate(withnormalizedoffset: cgvector(dx: 0.5, dy: 0.5) ) let eventgenerator: xceventgenerator = xceventgenerator.sharedgenerator() as! xceventgenerator eventgenerator.forcepress(at: coord.screenpoint, orientation: 0) { }
Comments
Post a Comment