maui
maui copied to clipboard
[Testing] Need reliable validation support to ensure the KeyboardType in Appium
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
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.
@PureWeen Thoughts?
We already added a control in the tests to manage the cursor visibility.
@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.