从UITests执行UIAccessibilityCustomAction [英] Performing UIAccessibilityCustomAction from UITests

查看:210
本文介绍了从UITests执行UIAccessibilityCustomAction的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIView的子类,假设它是类DemoView:UIView {} ,其中包含UILabel和UIButton。我需要对其进行分组并添加UIAccessibilityCustomAction,因此我已经覆盖了 var accessibilityElements:[Any]?,并使用并集连接了这两个元素。我还为 accessibilityLabel 分配了用户字符串。

I've got a subclass of UIView, let's say it's class DemoView: UIView { } which contains UILabel and UIButton. I needed to group it and add UIAccessibilityCustomAction so I've overriden the var accessibilityElements: [Any]? and used union to connect both elements. I've also assigned "Users" string to accessibilityLabel.

从用户的角度来看,VoiceOver应该可以正常工作读取 Users ,然后用户可以选择名为 Edit 的自定义操作。

From user perspective this works as it should, VoiceOver reads Users and then user can select custom action which is named Edit.

问题是我不知道如何从UITests触发此自定义操作。我知道 XCUIElement 包含 UICustomActions 的数组,我可以得到它的选择器,但是那又是什么呢?

Problem is that I don't know how can I fire this custom action from UITests. I know that XCUIElement contains array of UICustomActions and I can get its selector but then what?

推荐答案

在WWDC19辅助功能和测试实验室期间,我与Apple工程师进行了交谈,他们说现在不可能。在测试期间无法访问的原因是出于安全考虑。他们还说,他们不使用UITests测试UIAccessibility,并且在创建可访问性元素时支持两种情况-当运行UITests而没有运行时。

I talked to Apple Engineers during WWDC19 Accessibility and Testing Labs and they said it is not possible right now. The reason why accessibility is not available during testing are security concerns. What they also said is that they don't use UITests for testing UIAccessibility and when creating accessibility elements support two cases - when there are UITests running and not.

使用反馈助手的建议。

这篇关于从UITests执行UIAccessibilityCustomAction的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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