UI Tests: Simulate a shake gesture with Swift
Asked Answered
H

1

9

Using UI tests, I'd like the app to respond to shake gestures, and I would like to programmatically trigger a shake gesture in my swift UI tests.

Triggering the shake gesture while recording during a UI test session yields no added code.

Is there a way to do this? Thanks in advance!

Hexapla answered 25/7, 2015 at 22:0 Comment(4)
It looks like you can... Have you tried this: #24434263 ? Specifically the code the question provides and modifying it as suggested by an answer?Tameratamerlane
I'm completely unfamiliar with Objective C, but I'll try to convert it over and seeHexapla
I'm not good enough with Objective C to figure out how that converts to swift. I don't even know if the classes are the same.Hexapla
This isn't possible in Swift; radar 29368021 was filed and feel free to duplicate it.Blistery
A
1

As far as I know, currently you cannot do it directly from XCUITest. So instead, maybe programmatically call it using launch arguments that then call the relevant section of the code to simulate the gesture. Not perfect, but the best way I know of currently (Apr 2019)

Analiese answered 5/4, 2019 at 10:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.