This is a migrated thread and some comments may be shown as answers.

How to verify if columns of a RadGridView are filtered

3 Answers 163 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Keith
Top achievements
Rank 1
Keith asked on 24 Apr 2012, 03:24 PM
Hi

In my Silverlight application, I have a RadGridView, where two of the columns have a filter applied. They both show a yellow funnel icon next to their header names. I need a way of being able to verify whether a column has its filter applied or not. Visually, if a column has a filter applied, the funnel icon appears yellow, otherwise white. How would I verify this in a coded step? I don't really want to venture into the realms of image verification, as I've heard this can be quite brittle. There must be another, more robust way.

I have attached a screen shot of the DOM Explorer, showing the elements that make up a column filter on a RadGridView column. Originally, I assumed a column had a filter applied if the ToggleButton (AutomationId="PART_DropDownButton") was on e.g. IsChecked = true, but this is not the case. Can anyone suggest how I can verify if a column has a filter applied from the elements in the attachment?

Many thanks!

3 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 24 Apr 2012, 05:33 PM
Hello Keith,

First I'd like to suggest approaching your automation scenario in a different way. The most thorough way to verify a column is correctly filtered is to iterate through that column and verifying a specified condition is met in each cell along the way. See here for a code sample that verifies a DataGrid column is correctly alphabetized.

If you wish to continue verifying color, that must be done in a coded step as well. See here for an example.

Ideally there's some other reliable property on that element that changes when filtered. You can investigate its existence with the Available Verifications tab in the 3D Viewer. That way you avoid code have a test that's more easily maintained. Without testing the app directly I can't direct you towards which property to specifically look for, however.

Greetings,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Keith
Top achievements
Rank 1
answered on 25 Apr 2012, 09:45 AM
Thanks for your reply.

I'm not wanting to check if a column is correctly filtered. I'm wanting to check if it IS filtered at all (e.g. showing a yellow funnel icon). Like I said, I don't want to go down the path of verifying the colour, but there must be some Telerik property of the column or column header (e.g. IsFiltered = true) that I could use. Your 3rd paragraph is most relevant here. Having looked at the available verifications on all the associated elements, I cannot immediately see a property that I could use. I will continue to look and will post up on here if I find a solution.

Thanks
0
Keith
Top achievements
Rank 1
answered on 25 Apr 2012, 11:40 AM
Hello

I've discovered a property that I think I can use to verify if a column has its filter applied. There's a control called a FilteringDropDown (shown in my original attachment of the DOM explorer), which derives from Control. It has a property called FunnelFillVisibility. When filtered, this property is Visible, otherwise Collapsed. It is fairly straightforward from here to add a verification step based on this property from the elements menu.

Thanks for your help!

Tags
General Discussions
Asked by
Keith
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Keith
Top achievements
Rank 1
Share this question
or