简体   繁体   English

Calabash-android UI测试-检测Xamarin.Forms Entry字段是否具有焦点

[英]Calabash-android UI test - Detect if Xamarin.Forms Entry field has focus

My code will focus on Xamarin.Forms Entry field when its ContentView is displayed. 显示ContentView时,我的代码将专注于Xamarin.Forms Entry字段。 This will then automatically focus on an Xamarin.Forms Entry field on an Android device. 然后,它将自动关注Android设备上的Xamarin.Forms Entry字段。

Now, I would like to write a UI test to confirm that the field has been auto focused. 现在,我想编写一个UI测试来确认该字段已自动聚焦。

How can I detect that an field has been autofocused in a Calabash/ruby test? 如何在葫芦/红宝石测试中检测到某个字段已自动聚焦?

Figured this out. 想通了。 Not exactly detecting field got focus but detecting that the keyboard is displayed which was my original question. 不是准确地检测到焦点,而是检测到显示了键盘,这是我最初的问题。

When field is focused, keyboard is displayed and that is what I wanted to test in my Calabash test. 重点关注字段时,将显示键盘,这就是我要在Calabash测试中测试的内容。

So, going to Calabash API for Android http://calabashapi.xamarin.com/android/ , I see TextHelpers contains keyboard_visible? 因此,转到适用于Android的Calabash API http://calabashapi.xamarin.com/android/ ,我看到TextHelpers包含keyboard_visible吗? which can be called from ruby definitions to check for keyboard visibility. 可以从ruby定义中调用它以检查键盘的可见性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM