I used to work with TestStack.White framework previously but encountered some issues while trying to automate
After that I asked Telerik about support for TestStack.White and Telerik replied that this framework is not guaranteed to be supported.
And recommended me to use either CodedUI or your own framework claiming that both are supported by your controls.
That’s why I switched to CodedUI.
I've been struggling to automate controls inside the diagrams on canvas (all being Telerik controls)
Our app contains RadDiagram and controls that inherit from RadDiagramShape.
I succeed to get the shapes and test them in the code, but can’t access to the nested items, under the shapes.
Itried to implement control automation both in code using WpfCustom API and via CodedUI Test Builder.
In both case Igot the same error of being unable to find the control by its automation id.
8 Answers, 1 is accepted
This seems like an issue related to the hierarchy of the control. Default hierarchy level is 2, which means that the look for 2 levels up from control’s immediate ancestor [parent of the control in Coded UI]. This can be solved by editing the CodedUITestBuilder.exe.config file and change the MaxLevelsForItemContainer property with a higher value. This issue and the fix are well described in the article below:
How to test deep hierarchy controls using Coded UI Test in WPF?
I changed the MaxLevelsForItemContainer property, I attached the config file. this helped for some times, and then the CodedUI again can't access to the nested items.
I wrote a sample project. Here's the link to it: https://github.com/horowitzp/SampleProject.git. I hope it's understandable.
I also added the CodedUITestBuilder.exe.config file to the project.
Sorry, this is the right link:
Thank you for sharing the sample project. It looks like the reason for the CodedUI not being able to locate the elements is caused by the way the custom diagram shapes are created. I checked the Elements' tree with Visual UI Automation Verify tool and no children elements are being found, but only the CustomElement. This is also reproducible if you have diagram shape inside a diagram shape. Could you try not creating the sub elements as direct siblings of the custom diagram shape but inside a border or stack panel?
Thanks for the response,
I tried to wrap the sub elements with border as you can see in the sample project that I had sent (the change is in file - MainWindow.xaml) but I still have the problem.
Do you have another solution to my problem?
I tried the proposed solution and the outcome is the same.
Moreover I switched to the regular RadDiagram and RadDiagramShape with only a button as ContentTemplate and the result is the same: The UIAVerify tool doesn't see the contents of the shapes.
Do you have a working sample of visual tree which uses RadDiagram/Custom Diagram and is visible by UIAVerify tool?
This is urgent as I'm stuck on this feature that was said to have out-of-the-box support.
Thanks in advance.
I forwarded this to our developers for further investigation. I will write you back with more information on the matter not later then tomorrow.
After further investigating the issue it turns out that this is a bug in RadDiagram's automation peers. The issue is now logged in our feedback portal - DiagramShape's child automation peers are not present in the automation tree when the shape's ContentTemplate is used. You can track its progress by subscribing to it. The fix will most likely be part of the next LIB (Latest Internal Build).