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

TreeListViewTests bugs

2 Answers 71 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Andrei
Top achievements
Rank 2
Andrei asked on 27 Apr 2012, 09:05 AM
Hi,

I need to select some items from RadTreeListView from test.

But I see that TreeListView tests from TelerikTestingFramework don't work.

For example the test: TreeListViewStructureTest  done error on line 
"Assert.AreEqual<int>(5, treeListView.Columns.Count, "Initial tree list view column count verification failed!");"

that "Element not found", same problem when I try to get TreeListItems.

Is there other solutions to get TreeListItem and select it?

2 Answers, 1 is accepted

Sort by
0
Accepted
Plamen
Telerik team
answered on 01 May 2012, 01:36 PM
Hello Andrei,

I'm sorry you are running into this problem. This is a known issue with our RadTreeListView translator. You can track its progress here: Public URL.

In the meantime, here's a sample code you can use to workaround the issue:
Settings.Current.Web.EnableSilverlight = true;
ActiveBrowser.NavigateTo("http://demos.telerik.com/silverlight/#TreeListView/TreeListViewDragAndDrop");
RadTreeListView tree = ActiveBrowser.SilverlightApps()[0].FindName<RadTreeListView>("treeListView");

//Get Header Cells Count
IList<GridViewHeaderCell> headers = tree.Find.AllByType<GridViewHeaderCell>();
Log.WriteLine("TreeView Header Cells Count : " + headers.Count);

//Get Header Rows Count
IList<GridViewHeaderRow> headerrow = tree.Find.AllByType<GridViewHeaderRow>();
Log.WriteLine("TreeView Header Rows Count : " + headerrow.Count);

//Get TreeListView Items Count
IList<FrameworkElement> TreeListItems = tree.Find.AllByType("TreeListViewRow");
Log.WriteLine("TreeView Items Count: " + TreeListItems.Count());

//Find a RadTreeListItem cell with text content 'My Files' and click on the item
foreach (FrameworkElement item in TreeListItems)
{
    IList<GridViewCell> cells = item.Find.AllByType<GridViewCell>();
    foreach (GridViewCell cell in cells)
    {
        if (cell.TextBlockContent == "My Files")
        {
            item.User.Click();
        }
    }
}

The code above demonstrates how to get the count of all Header Cells, Header Rows and the count of all items. Also, how to find a cell by its text content and click on the parent RadTreeListViewItem.

If you require further assistance, please let me know.

Kind regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Andrei
Top achievements
Rank 2
answered on 03 May 2012, 06:11 AM
Ok, thank you, today I'll try this code :)
Tags
General Discussions
Asked by
Andrei
Top achievements
Rank 2
Answers by
Plamen
Telerik team
Andrei
Top achievements
Rank 2
Share this question
or