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

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

问题描述

我有一个 UIView 的子类,假设它是包含 UILabel 和 UIButton 的 class DemoView: UIView { }.我需要对它进行分组并添加 UIAccessibilityCustomAction 所以我覆盖了 var accessibilityElements: [Any]? 并使用 union 来连接两个元素.我还为 accessibilityLabel 分配了Users"字符串.

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.

我建议使用 Feedback Assistant 提出建议.

I recommend making a suggestion using Feedback Assistant.

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

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