简体   繁体   中英

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. This will then automatically focus on an Xamarin.Forms Entry field on an Android device.

Now, I would like to write a UI test to confirm that the field has been auto focused.

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.

So, going to Calabash API for Android http://calabashapi.xamarin.com/android/ , I see TextHelpers contains keyboard_visible? which can be called from ruby definitions to check for keyboard visibility.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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