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

UI Automation

8 Answers 92 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
p-h
Top achievements
Rank 1
p-h asked on 24 Jul 2018, 02:40 PM
Recently I contacted Telerik regarding the ability of End2End tests over the WPF app which uses Telerik controls.
I used to work with TestStack.White framework previously but encountered some issues while trying to automate
Telerik controls.
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

Sort by
0
Peshito
Telerik team
answered on 27 Jul 2018, 07:13 AM
Hello,

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?
 
Please give this approach a try. In case this does not work, please attach the sample runnable project you are working on, or one that reproduces the issue. As this is a support thread, you might use a third party web site for files sharing.

Regards,
Peshito
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
p-h
Top achievements
Rank 1
answered on 01 Aug 2018, 01:41 PM

Hello,

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.

Thank you!

0
p-h
Top achievements
Rank 1
answered on 01 Aug 2018, 02:34 PM

Sorry, this is the right link:

https://github.com/horowitzp/Project_Telerik.git

0
Peshito
Telerik team
answered on 02 Aug 2018, 12:49 PM
Hi,

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?

Regards,
Peshito
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
p-h
Top achievements
Rank 1
answered on 08 Aug 2018, 07:01 AM

Hello,

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. 

<Setter Property="ContentTemplate">
   <Setter.Value>
      <DataTemplate>
         <Border>
            <local:CustomElementView DataContext="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:CustomDiagramShape}}, Path=DataContext}"/>
         </Border>
      </DataTemplate>
   </Setter.Value>
</Setter>

Do you have another solution to my problem?

0
Dmitry
Top achievements
Rank 1
answered on 12 Aug 2018, 03:55 AM

@Peshito

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.

 

 

0
Peshito
Telerik team
answered on 13 Aug 2018, 06:46 AM
Hi Dmitry,

I forwarded this to our developers for further investigation. I will write you back with more information on the matter not later then tomorrow.

Regards,
Peshito
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Peshito
Telerik team
answered on 13 Aug 2018, 09:44 AM
Hello Dmitry,

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).

Regards,
Peshito
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
p-h
Top achievements
Rank 1
Answers by
Peshito
Telerik team
p-h
Top achievements
Rank 1
Dmitry
Top achievements
Rank 1
Share this question
or