Skip to content

Commit

Permalink
test: Add x:Uid to TextBlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
eriklimakc committed Sep 11, 2024
1 parent 293c150 commit aafe632
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ public async Task When_NavigationView()

private void CheckProductsVisible()
{
var text = App.MarkedAnywhere("CurrentNavigationViewItemTextBlock").GetText();
text.Should().Be("Products");
App.WaitForText("CurrentNavigationViewItemTextBlock", "Products");
var isVisible = App.MarkedAnywhere("ProductsStackPanel").IsVisible();
isVisible.Should().Be(true);
isVisible = App.MarkedAnywhere("DealsStackPanel").IsVisible();
Expand All @@ -66,8 +65,7 @@ private void CheckProductsVisible()

private void CheckDealsVisible()
{
var text = App.MarkedAnywhere("CurrentNavigationViewItemTextBlock").GetText();
text.Should().Be("Deals");
App.WaitForText("CurrentNavigationViewItemTextBlock", "Deals");
var isVisible = App.MarkedAnywhere("ProductsStackPanel").IsVisible();
isVisible.Should().Be(false);
isVisible = App.MarkedAnywhere("DealsStackPanel").IsVisible();
Expand All @@ -80,8 +78,7 @@ private void CheckDealsVisible()

private void CheckProfileVisible()
{
var text = App.MarkedAnywhere("CurrentNavigationViewItemTextBlock").GetText();
text.Should().Be("Profile");
App.WaitForText("CurrentNavigationViewItemTextBlock", "Profile");
var isVisible = App.MarkedAnywhere("ProductsStackPanel").IsVisible();
isVisible.Should().Be(false);
isVisible = App.MarkedAnywhere("DealsStackPanel").IsVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ public async Task When_TabBar()
private void CheckProductsVisible()
{
App.WaitElement("ProductsDealsButton");
var text = App.MarkedAnywhere("CurrentTabBarItemTextBlock").GetText();
text.Should().Be("Products");
App.WaitForText("CurrentTabBarItemTextBlock", "Products");
var isVisible = App.MarkedAnywhere("ProductsStackPanel").IsVisible();
isVisible.Should().Be(true);
isVisible = App.MarkedAnywhere("DealsStackPanel").IsVisible();
Expand All @@ -68,8 +67,7 @@ private void CheckProductsVisible()
private void CheckDealsVisible()
{
App.WaitElement("DealsProductsButton");
var text = App.MarkedAnywhere("CurrentTabBarItemTextBlock").GetText();
text.Should().Be("Deals");
App.WaitForText("CurrentTabBarItemTextBlock", "Deals");
var isVisible = App.MarkedAnywhere("ProductsStackPanel").IsVisible();
isVisible.Should().Be(false);
isVisible = App.MarkedAnywhere("DealsStackPanel").IsVisible();
Expand All @@ -83,8 +81,7 @@ private void CheckDealsVisible()
private void CheckProfileVisible()
{
App.WaitElement("ProfileProductsButton");
var text = App.MarkedAnywhere("CurrentTabBarItemTextBlock").GetText();
text.Should().Be("Profile");
App.WaitForText("CurrentTabBarItemTextBlock", "Profile");
var isVisible = App.MarkedAnywhere("ProductsStackPanel").IsVisible();
isVisible.Should().Be(false);
isVisible = App.MarkedAnywhere("DealsStackPanel").IsVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,16 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<utu:NavigationBar Content="NavigationView DataBound"
AutomationProperties.AutomationId="NavigationViewDataBoundNavigationBar" />
<TextBlock Text="..."
Grid.Row="1"
<utu:NavigationBar Content="NavigationView DataBound" AutomationProperties.AutomationId="NavigationViewDataBoundNavigationBar" />
<TextBlock AutomationProperties.AutomationId="CurrentNavigationViewItemTextBlock"
x:Uid="CurrentNavigationViewItemTextBlock"
x:Name="CurrentNavigationViewItemText"
AutomationProperties.AutomationId="CurrentNavigationViewItemTextBlock" />
Text="..."
Grid.Row="1" />
<StackPanel Orientation="Horizontal">
<Button Content="Profile"
Click="{x:Bind ViewModel.SelectProfile}" />
<Button Content="Deals"
Click="{x:Bind ViewModel.SelectDeals}" />
<Button Content="Products"
Click="{x:Bind ViewModel.SelectProducts}" />
<Button Content="Profile" Click="{x:Bind ViewModel.SelectProfile}" />
<Button Content="Deals" Click="{x:Bind ViewModel.SelectDeals}" />
<Button Content="Products" Click="{x:Bind ViewModel.SelectProducts}" />
</StackPanel>
<muxc:NavigationView uen:Region.Attached="true"
Grid.Row="3"
Expand Down Expand Up @@ -61,8 +58,7 @@
Content="Profile"
uen:Region.Name="Profile" />
</muxc:NavigationView.MenuItems>-->
<Grid uen:Region.Attached="True"
uen:Region.Navigator="Visibility">
<Grid uen:Region.Attached="True" uen:Region.Navigator="Visibility">
<StackPanel uen:Region.Name="Products"
AutomationProperties.AutomationId="ProductsStackPanel"
Visibility="Collapsed">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,32 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<utu:NavigationBar Content="NavigationView Home"
AutomationProperties.AutomationId="NavigationViewHomeNavigationBar" />
<TextBlock Text="..."
Grid.Row="1"
<utu:NavigationBar Content="NavigationView Home" AutomationProperties.AutomationId="NavigationViewHomeNavigationBar" />
<TextBlock AutomationProperties.AutomationId="CurrentNavigationViewItemTextBlock"
Text="..."
x:Uid="CurrentNavigationViewItemTextBlock"
x:Name="CurrentNavigationViewItemText"
AutomationProperties.AutomationId="CurrentNavigationViewItemTextBlock" />
Grid.Row="1" />
<muxc:NavigationView uen:Region.Attached="true"
Grid.Row="2"
SelectionChanged="NavigationViewItemChanged"
ItemInvoked="NavigationItemInvoked"
IsSettingsVisible="True">
<muxc:NavigationView.MenuItems>
<muxc:NavigationViewItem AutomationProperties.AutomationId="ProductsNavigationViewItem"
Content="Products"
uen:Region.Name="Products" />
<muxc:NavigationViewItem AutomationProperties.AutomationId="ProductsNavigationViewItem"
Content="Products"
uen:Region.Name="Products" />
<muxc:NavigationViewItem AutomationProperties.AutomationId="DealsNavigationViewItem"
Content="Deals"
uen:Region.Name="Deals" />
</muxc:NavigationView.MenuItems>
</muxc:NavigationView.MenuItems>
<muxc:NavigationView.FooterMenuItems>

<muxc:NavigationViewItem AutomationProperties.AutomationId="ProfileNavigationViewItem"
Content="Profile"
uen:Region.Name="Profile" />
</muxc:NavigationView.FooterMenuItems>
<Grid uen:Region.Attached="True"
uen:Region.Navigator="Visibility">
<Grid uen:Region.Attached="True" uen:Region.Navigator="Visibility">
<StackPanel uen:Region.Name="Products"
AutomationProperties.AutomationId="ProductsStackPanel"
Visibility="Collapsed">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@
<Button AutomationProperties.AutomationId="RapidSettingsWriteTestButton"
Click="{x:Bind ViewModel.SettingsWriteTest}"
Content="Settings Write Test" />
<TextBlock AutomationProperties.AutomationId="OnePageTxtDataContext"
x:Uid="OnePageTxtDataContext"
x:Name="TxtDataContext"
Text="DataContext is ok" />
<TextBlock x:Name="TxtUrl" AutomationProperties.AutomationId="OnePageTxtUrlFromBrowser" />
<TextBlock x:Name="TxtDataContext"
Text="DataContext is ok"
AutomationProperties.AutomationId="OnePageTxtDataContext" />
<Button AutomationProperties.AutomationId="OnePageGetUrlFromBrowser"
Click="GetUrlFromBrowser"
Content="Get URL" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<utu:NavigationBar Content="TabBar Home"
AutomationProperties.AutomationId="TabBarHomeNavigationBar" />
<TextBlock Text="..."
Grid.Row="1"
<utu:NavigationBar Content="TabBar Home" AutomationProperties.AutomationId="TabBarHomeNavigationBar" />
<TextBlock AutomationProperties.AutomationId="CurrentTabBarItemTextBlock"
x:Uid="CurrentTabBarItemTextBlock"
x:Name="CurrentTabBarItemText"
AutomationProperties.AutomationId="CurrentTabBarItemTextBlock" />
<ToggleButton Grid.Row="2" Content="ImplicitMapping" IsChecked="{Binding ImplicitMappingEnabled}" Command="{Binding ToggleIsCheckedCommand}" />
<Grid uen:Region.Attached="true"
Grid.Row="3" >
Text="..."
Grid.Row="1" />
<ToggleButton Grid.Row="2"
Content="ImplicitMapping"
IsChecked="{Binding ImplicitMappingEnabled}"
Command="{Binding ToggleIsCheckedCommand}" />
<Grid uen:Region.Attached="true" Grid.Row="3">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid uen:Region.Attached="True"
uen:Region.Navigator="Visibility">
<Grid uen:Region.Attached="True" uen:Region.Navigator="Visibility">
<StackPanel uen:Region.Name="Products"
AutomationProperties.AutomationId="ProductsStackPanel"
Visibility="Collapsed">
Expand Down

0 comments on commit aafe632

Please # to comment.