maui icon indicating copy to clipboard operation
maui copied to clipboard

[Testing] Need reliable validation support to ensure the KeyboardType in Appium

Open anandhan-rajagopal opened this issue 10 months ago • 4 comments
trafficstars

Description

Tests for TableViewEntryCellShowsDefaultKeyboardThenNumericKeyboardAfterScrolling (Bugzilla33578) were failing on Android and iOS. Due to cursor blinking for entry, some time the image generated with cursor and without cursor sometimes. so need a proper validation helper method for verify the keyboard type in Appium as like XamarinUITest. Eg. Need a helper extension like detect the virtual keyboard type.

Steps to Reproduce

No response

Link to public reproduction project repository

https://dev.azure.com/xamarin/public/_build/results?buildId=131498&view=ms.vss-test-web.build-test-results-tab&runId=3545447&resultId=100043&paneView=debug

Version with bug

9.0.21 SR2.1

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms

Last version that worked well

Unknown/Other

Affected platforms

Android, iOS

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

VisualTestUtils.VisualTestFailedException :
Snapshot different than baseline: TableViewEntryCellShowsNumberKeyboard.png (1.16% difference)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.


More info: https://aka.ms/visual-test-workflow

anandhan-rajagopal avatar Jan 06 '25 11:01 anandhan-rajagopal

Could you share more details? Which Xamarin.UITest option are you referring to? A link to the Xamarin.UITest documentation or similar for example would be sufficient.

There are different approaches that can be taken:

  • Use Mapper to remove Entry/Editor etc cursor in the UITests sample, which is not always wanted, so I would rule this option out.
  • Pass parameters when trigger the LaunchApp method and only remove the cursor when the parameter is passed.
  • Create a NoCursorEntry etc, inside a Controls folder available in the UITests project. This way, when you want to take screenshots you can use these controls.
  • Using Appium might be possible, although not in all situations. Two methods can be created, a pre-verifysnapshot where the element with focus is accessed, and from there the focus is moved to the next control (if there is only one Entry, for example, it would not be possible and moving the focus to the parent element would have no effect. While in XF tapping on a Layout removed the focus, this does not happen in .NET MAUI). And a post-verifysnapshot to restore the focus state. So I would rule out this option.

jsuarezruiz avatar Jan 13 '25 14:01 jsuarezruiz

@PureWeen Thoughts?

jsuarezruiz avatar Jan 13 '25 14:01 jsuarezruiz

We already added a control in the tests to manage the cursor visibility.

jsuarezruiz avatar May 30 '25 10:05 jsuarezruiz

@jsuarezruiz The actual requirement was to validate the keyboard type of the Entry control without relying on UI test screenshots, as the displayed keys and suggestions vary randomly, resulting in flaky tests. Although the mentioned test case was enabled by cropping the keyboard portion in the screenshot, it still does not fulfill the original purpose of the issue. Therefore, I have reopened the issue for further investigation.

ghost avatar Jun 17 '25 13:06 ghost