Hey guys,
We are currently
automating our Xamarin Forms App with Appium. Xamarin Forms allows us to use Automation ID’s to find elements
in our test-cases.
For the Telerik
Calendar there is just the possibility to set an automation ID on the calendar
itself, but not on the DayCells.
To test our app, we need
to set the automation ID for the DayCells to identify the dates in the
calendar. At the moment, the ID for every cells seems to be the day of the
month. So it can happen that Id’s are available twice in the MonthView. So we can’t
use the current approach for our case.
Is there a way to set
the automation ID of the DayCells to something like: “Day.Month.Year”?
Best regards
Julian
5 Answers, 1 is accepted
Thank you for contacting us.
Currently there is no straightforward/easy way to set automation ID for the DayCells.
However in your particular scenario (automating day cells for a calendar) this can be achieved by some custom logic in your tests handling such scenario (two objects with the same automation ID). The idea is when requesting a particular day first to check the count of objects returned with some particular ID (1 from the attached image). If there is only one - you can safely use it, in case that there are 2 such objects, you can just get the first or the second, depending exact day that you want to get.
I hope that this suggestion is applicable to your scenario.
Regards,
Vladislav
Telerik

What about Events? We cannot see the dots at all in the iOS or Android "DOM" in Appium's UI Browser.
We can see a list of UIViews that correspond to the DayNumber, but there are no children in the UIView for that Day, for any Events that may be visible on the CalendarUI.
Thanks.
I am afraid that currently there is no way to set automation ids or see the events in the "DOM". The reason behind this comes from the fact that they are not visual elements in the tree, but rather drawn on the screen.
If you have any other questions or concerns, please don't hesitate to write us.
Regards,
Georgi
Progress Telerik

Thanks.
Another wrinkle QA has informed me of:
On Android we cannot see DayCells at all, only the Weeks. Thus we cannot click on them in Android tests:
Details:
XamarinForms 2.50.280555
Telerik Common / Input 2018.2.620.2
We test with Appium Studio (v11.8) & have tried looking at the tree on an Android 6.0 device. We have even added "AutomationProperties.IsInAccessibleTree=true" to the CalendarControl. It has helped us in the past with <Listview/> elements being invisible.
Any suggestions?
Thanks.
Indeed the DayCells cannot be located and the case here is similar to the one with the events on iOS. In order to boost the performance, the content of the control is a Canvas and all of the elements of the Calendar are just drawings (for example using the drawTextmethod) inside of it.
So as the only visual element here is the Canvas, all of the drawings inside of it (the Calendar elements) cannot be located.
Nevertheless, as we struggle with automation of the calendar internally, the only thing we found useful is to use image comparing verification in order to validate the control state, and as the image would be different every day, we set the Emulator current date to a specific date.
Hope this would help.
Regards,
Georgi
Progress Telerik