How to take a screenshot in XCUITest during press&hold?

280 Views Asked by At

I need to take a screenshot in the middle of zoom/pan/rotate, i.e. I expect some code like this:

element.startPressAndHold(.twoTouches)
// at this point my app renders differently, so I capture a screenshot
// for snapshot testing
let shot = element.screenshot()
element.stopPressAndHold()

XCUIElement in fact has something similar for keys:

XCUIElement.perform(withKeyModifiers: .command) {
    let shot = element.screenshot()
}

but I can not find something similar for mouse/touches/gestures.

Is there a trick to achieve this?

0

There are 0 best solutions below