pixel
pixel

Reputation: 10587

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?

Upvotes: 0

Views: 186

Answers (1)

pixel
pixel

Reputation: 10587

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.

Upvotes: 0

Related Questions