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

Content inside TabItem's ContentControl were not identified by Coded UI Test

4 Answers 68 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Sirisha
Top achievements
Rank 1
Sirisha asked on 23 Jan 2014, 01:04 PM
Hi Team,
I have RadTabItem with ContentControl inside it. Coded UI Test is not able to identify the controls placed inside. I am referencing the telerik assemblies from Binaries.NoXaml folder under 4.5 version.

Can anyone help in resolving it?

Following is the Xaml template: 
<telerik:RadTabControl Name="MainTabControl" Visibility="Visible" TabStripPlacement="Left" SelectionChanged="MainTabControl_SelectionChanged">
           <telerik:RadTabItem Header="Define Manual Columns" Visibility="Visible" DataContext="{Binding Customers}">
               <StackPanel>
                   <ContentControl Content="{Binding}"  Grid.Row="0" Grid.RowSpan="2"  Grid.Column="1"       Width="Auto"  HorizontalAlignment="Stretch"                                     
                                         >
                       <ContentControl.Style>
                           <Style TargetType="ContentControl">
                               <Style.Triggers>
                                   <DataTrigger Binding="{Binding ReceiveNewsletter}" Value="True">
                                       <Setter Property="ContentTemplate">
                                           <Setter.Value>
                                               <DataTemplate>
                                                   <StackPanel >
                                                       <TextBlock x:Name="TestPanel1" Text="Test Panel"  Height="50" Width="50" VerticalAlignment="Top"  Foreground="Black" Margin="5"  />
                                                       <TextBlock  x:Name="TestPanel2" Text="Test Panel2" Height="50" Width="50" Foreground="Black" Margin="5"  />
 
                                                       <StackPanel  x:Name="ButtonsStack"   Orientation="Horizontal" HorizontalAlignment="Right"  VerticalAlignment="Bottom" Margin="0,100,5,0">
 
                                                           <telerik:RadButton x:Name="EditStyle"  ToolTipService.ToolTip="Edit" Height="25" Width="25">
                                                           </telerik:RadButton>
                                                           <telerik:RadButton x:Name="CopyStyle"  ToolTipService.ToolTip="Copy" Height="25" Width="25" >
                                                           </telerik:RadButton>
                                                           <telerik:RadButton x:Name="CancelSave1"  ToolTipService.ToolTip="Delete" Height="25" Width="25" >
 
                                                           </telerik:RadButton>
                                                       </StackPanel>
                                                   </StackPanel>
                                               </DataTemplate>
                                           </Setter.Value>
                                       </Setter>
                                   </DataTrigger>
 
                                   <!-- EDIT TEMPLATE -->
                                   <DataTrigger Binding="{Binding Temp}" Value="True">
                                       <Setter Property="ContentTemplate">
                                           <Setter.Value>
                                               <DataTemplate >
                                                   <StackPanel HorizontalAlignment="Stretch" Orientation="Vertical">
                                                    </StackPanel>
                                               </DataTemplate>
                                           </Setter.Value>
                                       </Setter>
                                   </DataTrigger>
                               </Style.Triggers>
                           </Style>
                       </ContentControl.Style>
                   </ContentControl>
               </StackPanel>
           </telerik:RadTabItem>
       </telerik:RadTabControl>


4 Answers, 1 is accepted

Sort by
0
Sirisha
Top achievements
Rank 1
answered on 27 Jan 2014, 01:11 PM
Team,

Any update on this?

Regards,
Sirisha
0
Stefan
Telerik team
answered on 27 Jan 2014, 02:06 PM
Hello Sirisha,

Thank you for your report. I used your code snippet to reproduce the described issue and I was able to do so only partially - I was not able to get the TextBlocks from the ContentControl's DataTemplate. There were no problems identifying the RadButtons. However there is a way also to identify the TextBlocks and add assertion for them - when you run the TestBuilder and mark (using the Add Assertion option) any of the RadButtons you can navigate to the other controls in the application using the Coded UI Test Builder's navigation button. You can see the described approach in this screen cast.

I also attached the project I used to test your scenario so that you can examine it.

Please give this approach a try and let us know if it works for you.

Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Sirisha
Top achievements
Rank 1
answered on 28 Jan 2014, 05:21 AM
Stefan,

Whatever I have shared is a sample code. But in real time, there would be many buttons and the navigation to reach the edit would be difficult to act on each of the edit box. Isn't it possible to have the TextBlock recognize by the CUIT directly?

Regards,
Sirisha

0
Stefan
Telerik team
answered on 29 Jan 2014, 12:02 PM
Hi Sirisha,

The issue you are facing is not caused by the RadTabControl (your scenario also is reproducible with the native TabControl). My investigation shows that the problem is caused by a limitation of the CUIT.

Unfortunately you are not able to recognize the TextBlocks directly because WPF TextBlocks do not expose themselves to UI automation when they are inside a DataTemplate. I found a few discussions and blog posts focused on the same issue - in these two - link1 and link2, you can find more information about the topic and a possible workaround. Please take a look at these resources and don't hesitate to contact us if you need further assistance. 

Regards,
Stefan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
TabControl
Asked by
Sirisha
Top achievements
Rank 1
Answers by
Sirisha
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or