UI 测试:使用 Swift 模拟摇晃手势 [英] UI Tests: Simulate a shake gesture with Swift

查看:25
本文介绍了UI 测试:使用 Swift 模拟摇晃手势的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用 UI 测试,我希望应用能够响应摇晃手势,并且我希望在我的 swift UI 测试中以编程方式触发摇晃手势.

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.

在 UI 测试会话期间录制时触发摇动手势不会产生任何添加代码.

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!

推荐答案

据我所知,目前您不能直接从 XCUITest 中完成.因此,也许可以使用启动参数以编程方式调用它,然后调用代码的相关部分来模拟手势.不完美,但我目前所知道的最好方法(2019 年 4 月)

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)

这篇关于UI 测试:使用 Swift 模拟摇晃手势的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆