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

Selecting each element of a combo box until the end

2 Answers 73 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Benjamin
Top achievements
Rank 1
Benjamin asked on 15 Apr 2014, 02:18 PM
Hello,

I'm trying to run a test on a combo box containing variable items in a silverlight application. I need to select each item from the list and verify that a chart appears. The lists can be quite long, and sometimes a slider bar is needed to scroll to the bottom 

I was hoping to use a while loop somehow, but when i try to create validations for the combo box item, I can only base it on the property, visibility, location or tooltip, nothing about the position in the list.  The combobox itself also has a combobox verification "Selected item is index '0'", however I cant see a way relate this to the number of entries in the list either as it only changes between 0 and -1 for the list entries.

Another issue is that as there is also a slider bar when the list is long, i need to be able to scroll down once i reach the bottom of the visible list.

What is the best way to go about testing this? I've attached a photo which will hopefully help describe what i mean.

Thanks in advance

2 Answers, 1 is accepted

Sort by
0
Benjamin
Top achievements
Rank 1
answered on 15 Apr 2014, 02:23 PM
Edit : I've just realised the  "Selected item is index '0'" is updated after the item is selected from the list (and is -1 for the unselected entries), but i'm still not sure how to compare it to the total number of items, or incorporate the slide bar.
0
Daniel Djambov
Telerik team
answered on 18 Apr 2014, 10:17 AM
Hi Benjamin,

What you are trying can be done through coded step in your test, however the application you are using is specific to you and I can only provide you some guidelines how to implement it yourself.

I have used this Telerik Silverlight Demo page:
http://demos.telerik.com/silverlight/#ComboBox/FirstLook
then I have created a coded step, that opens the combobox, gets all the combobox items and iterates through each of the item and selects it:
Pages.TelerikComboBoxFor.SilverlightApp.CategorySelectionRadcombobox.ToggleDropDown();
            Telerik.WebAii.Controls.Xaml.RadComboBox cb = this.Pages.TelerikComboBoxFor.SilverlightApp.CategorySelectionRadcombobox;
            //Log.WriteLine(cb.Items.Count.ToString());
            cb.ToggleDropDown();
            foreach(Telerik.WebAii.Controls.Xaml.RadComboBoxItem ch in cb.Items)
            {
                Pages.TelerikComboBoxFor.SilverlightApp.CategorySelectionRadcombobox.ToggleDropDown();
                if(ch.IsVisible)
                {
                    Log.WriteLine(ch.TextBlockContent);
                    ch.Select();
                    //Here you place your additional verification code for the Chart
                }
                else
                {
                    Log.WriteLine(ch.TextBlockContent+" scolled");
                    ch.ScrollToVisible(ScrollToVisibleType.ElementTopAtWindowTop);
                    ch.Select();
                    //Here you place your additional verification code for the Chart
                }
            }

You will not be able to use it as it is for your case, but can get the idea. In the above example I have input verification if comboboxitem is visible and based on the condition scroll to it using Telerik Silverlight Controls and Test Studio for Silverlight Translators functionality. However in your case where scrolling is required you should implement some scrolling action (using the scrollbar or pressing scrolldown button) to ensure the element you work with is available. Note: be careful and check the different properties of the combobox items for the ones that are not currently seen by you, they still might be loaded in the combobox and reported as visible by your application.

Hopefully this can give you some directions how to solve your task.

Regards,
Daniel Djambov
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Benjamin
Top achievements
Rank 1
Answers by
Benjamin
Top achievements
Rank 1
Daniel Djambov
Telerik team
Share this question
or