Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit eaaca80

Browse files
authored
Merge pull request #853 from editor-tools/fixes/812-automation-ids
Add Automation ID properties to controls
2 parents ee4b18d + 5bda0bb commit eaaca80

21 files changed

+220
-107
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,6 @@
1616
[submodule "script"]
1717
path = script
1818
url = [email protected]:github/VisualStudioBuildScripts
19+
[submodule "submodules/GitHubVSAutomationIDs"]
20+
path = submodules/GitHubVSAutomationIDs
21+
url = https://github.com/editor-tools/GitHubVSAutomationIDs.git

GitHubVS.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.VisualStudio.UI", "s
104104
EndProject
105105
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHub.StartPage", "src\GitHub.StartPage\GitHub.StartPage.csproj", "{50E277B8-8580-487A-8F8E-5C3B9FBF0F77}"
106106
EndProject
107+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GitHubVSAutomationIDs", "GitHubVSAutomationIDs", "{4405C20E-A72A-4807-9480-14E9BB558347}"
108+
EndProject
109+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GithubVSTestAutomationIDs", "submodules\GitHubVSAutomationIDs\GithubVSAutomationIDs\GithubVSTestAutomationIDs.csproj", "{665078F4-5875-431D-A2CC-421849B43328}"
110+
EndProject
107111
Global
108112
GlobalSection(SolutionConfigurationPlatforms) = preSolution
109113
Debug|Any CPU = Debug|Any CPU
@@ -542,6 +546,22 @@ Global
542546
{50E277B8-8580-487A-8F8E-5C3B9FBF0F77}.XamlDesign|Any CPU.Build.0 = Release|Any CPU
543547
{50E277B8-8580-487A-8F8E-5C3B9FBF0F77}.XamlDesign|x86.ActiveCfg = Release|Any CPU
544548
{50E277B8-8580-487A-8F8E-5C3B9FBF0F77}.XamlDesign|x86.Build.0 = Release|Any CPU
549+
{665078F4-5875-431D-A2CC-421849B43328}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
550+
{665078F4-5875-431D-A2CC-421849B43328}.Debug|Any CPU.Build.0 = Debug|Any CPU
551+
{665078F4-5875-431D-A2CC-421849B43328}.Debug|x86.ActiveCfg = Debug|Any CPU
552+
{665078F4-5875-431D-A2CC-421849B43328}.Debug|x86.Build.0 = Debug|Any CPU
553+
{665078F4-5875-431D-A2CC-421849B43328}.Publish|Any CPU.ActiveCfg = Release|Any CPU
554+
{665078F4-5875-431D-A2CC-421849B43328}.Publish|Any CPU.Build.0 = Release|Any CPU
555+
{665078F4-5875-431D-A2CC-421849B43328}.Publish|x86.ActiveCfg = Release|Any CPU
556+
{665078F4-5875-431D-A2CC-421849B43328}.Publish|x86.Build.0 = Release|Any CPU
557+
{665078F4-5875-431D-A2CC-421849B43328}.Release|Any CPU.ActiveCfg = Release|Any CPU
558+
{665078F4-5875-431D-A2CC-421849B43328}.Release|Any CPU.Build.0 = Release|Any CPU
559+
{665078F4-5875-431D-A2CC-421849B43328}.Release|x86.ActiveCfg = Release|Any CPU
560+
{665078F4-5875-431D-A2CC-421849B43328}.Release|x86.Build.0 = Release|Any CPU
561+
{665078F4-5875-431D-A2CC-421849B43328}.XamlDesign|Any CPU.ActiveCfg = Release|Any CPU
562+
{665078F4-5875-431D-A2CC-421849B43328}.XamlDesign|Any CPU.Build.0 = Release|Any CPU
563+
{665078F4-5875-431D-A2CC-421849B43328}.XamlDesign|x86.ActiveCfg = Release|Any CPU
564+
{665078F4-5875-431D-A2CC-421849B43328}.XamlDesign|x86.Build.0 = Release|Any CPU
545565
EndGlobalSection
546566
GlobalSection(SolutionProperties) = preSolution
547567
HideSolutionNode = FALSE
@@ -565,5 +585,7 @@ Global
565585
{0EC8DBA1-D745-4EE5-993A-6026440EC3BF} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AF9}
566586
{DD99FD0F-82F6-4C30-930E-4A1D0DF01D65} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AB9}
567587
{7B835A7D-CF94-45E8-B191-96F5A4FE26A8} = {8A7DA2E7-262B-4581-807A-1C45CE79CDFD}
588+
{4405C20E-A72A-4807-9480-14E9BB558347} = {1E7F7253-A6AF-43C4-A955-37BEDDA01AB8}
589+
{665078F4-5875-431D-A2CC-421849B43328} = {4405C20E-A72A-4807-9480-14E9BB558347}
568590
EndGlobalSection
569591
EndGlobal

src/GitHub.UI.Reactive/Controls/TwoFactorInput.xaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:automation="clr-namespace:GitHub.VisualStudio.TestAutomation;assembly=GitHub.VisualStudio.TestAutomation.AutomationIDs"
78
mc:Ignorable="d"
89
Width="256"
910
d:DesignHeight="47"
10-
d:DesignWidth="262">
11+
d:DesignWidth="262"
12+
AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.TwoFactorAuthenticatonInputCustom}">
1113
<UserControl.Resources>
1214
<Style TargetType="{x:Type TextBox}">
1315
<Setter Property="Width" Value="36"/>
@@ -18,12 +20,12 @@
1820
<Setter Property="FontSize" Value="20px" />
1921
</Style>
2022
</UserControl.Resources>
21-
<StackPanel Orientation="Horizontal" UseLayoutRounding="True" SnapsToDevicePixels="True">
22-
<TextBox x:Name="one" />
23-
<TextBox x:Name="two" />
24-
<TextBox x:Name="three" />
25-
<TextBox x:Name="four" />
26-
<TextBox x:Name="five" />
27-
<TextBox x:Name="six" Margin="0" />
23+
<StackPanel Orientation="Horizontal" UseLayoutRounding="True" SnapsToDevicePixels="True" AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.TwoFactorAuthenticationInputStackPanel}">
24+
<TextBox x:Name="one" />
25+
<TextBox x:Name="two" />
26+
<TextBox x:Name="three" />
27+
<TextBox x:Name="four" />
28+
<TextBox x:Name="five" />
29+
<TextBox x:Name="six" Margin="0" />
2830
</StackPanel>
2931
</UserControl>

src/GitHub.UI.Reactive/Controls/TwoFactorInput.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using GitHub.Extensions;
77
using NullGuard;
88
using System.Globalization;
9+
using GitHub.VisualStudio.TestAutomation;
910

1011
namespace GitHub.UI
1112
{

src/GitHub.UI.Reactive/GitHub.UI.Reactive.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@
173173
<None Include="packages.config" />
174174
</ItemGroup>
175175
<ItemGroup>
176+
<ProjectReference Include="..\..\submodules\GitHubVSAutomationIDs\GithubVSAutomationIDs\GithubVSTestAutomationIDs.csproj">
177+
<Project>{665078f4-5875-431d-a2cc-421849b43328}</Project>
178+
<Name>GithubVSTestAutomationIDs</Name>
179+
</ProjectReference>
176180
<ProjectReference Include="..\..\submodules\reactiveui\ReactiveUI.Events\ReactiveUI.Events_Net45.csproj">
177181
<Project>{600998c4-54dd-4755-bfa8-6f44544d8e2e}</Project>
178182
<Name>ReactiveUI.Events_Net45</Name>

src/GitHub.VisualStudio.UI/GitHub.VisualStudio.UI.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@
200200
</Page>
201201
</ItemGroup>
202202
<ItemGroup>
203+
<ProjectReference Include="..\..\submodules\GitHubVSAutomationIDs\GithubVSAutomationIDs\GithubVSTestAutomationIDs.csproj">
204+
<Project>{665078f4-5875-431d-a2cc-421849b43328}</Project>
205+
<Name>GithubVSTestAutomationIDs</Name>
206+
</ProjectReference>
203207
<ProjectReference Include="..\..\submodules\octokit.net\Octokit\Octokit.csproj">
204208
<Project>{08dd4305-7787-4823-a53f-4d0f725a07f3}</Project>
205209
<Name>Octokit</Name>

src/GitHub.VisualStudio.UI/UI/Controls/InfoPanel.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
88
xmlns:sampleData="clr-namespace:GitHub.SampleData;assembly=GitHub.App"
99
xmlns:ui="clr-namespace:GitHub.UI;assembly=GitHub.UI"
10+
xmlns:automation="clr-namespace:GitHub.VisualStudio.TestAutomation;assembly=GitHub.VisualStudio.TestAutomation.AutomationIDs"
1011
Background="Beige"
1112
d:DataContext="{d:DesignInstance Type=sampleData:InfoPanelDesigner, IsDesignTimeCreatable=True}"
1213
d:DesignHeight="300"
1314
d:DesignWidth="300"
14-
mc:Ignorable="d">
15+
mc:Ignorable="d"
16+
AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.GitHubInfoPanel}">
1517

1618
<UserControl.Resources>
1719
<ResourceDictionary>

src/GitHub.VisualStudio.UI/UI/Views/GitHubConnectContent.xaml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
xmlns:cache="clr-namespace:GitHub.VisualStudio.UI.Helpers"
99
xmlns:sampleData="clr-namespace:GitHub.SampleData;assembly=GitHub.App"
1010
xmlns:prop="clr-namespace:GitHub.VisualStudio.UI"
11+
xmlns:automation="clr-namespace:GitHub.VisualStudio.TestAutomation;assembly=GitHub.VisualStudio.TestAutomation.AutomationIDs"
1112
mc:Ignorable="d"
1213
d:DesignHeight="300" d:DesignWidth="300" d:DesignBackground="White"
1314
KeyboardNavigation.TabNavigation="Local"
1415
DataContext="{Binding ViewModel}"
15-
Background="{DynamicResource GitHubVsToolWindowBackground}"
16-
>
16+
Background="{DynamicResource GitHubVsToolWindowBackground}" >
17+
1718
<d:DesignProperties.DataContext>
1819
<Binding>
1920
<Binding.Source>
@@ -146,14 +147,18 @@
146147

147148
<DockPanel>
148149
<WrapPanel Orientation="Horizontal" Margin="6,0,0,6" DockPanel.Dock="Top">
149-
<Button Style="{StaticResource ActionLinkButton}" KeyboardNavigation.TabIndex="0" x:Name="cloneLink" Command="{Binding Clone}" Content="{x:Static prop:Resources.CloneLink}"/>
150+
<Button Style="{StaticResource ActionLinkButton}" KeyboardNavigation.TabIndex="0" x:Name="cloneLink" Content="{x:Static prop:Resources.CloneLink}"
151+
AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.CloneHyperlink}"/>
150152
<Separator Margin="3,0,3,0" Style="{StaticResource VerticalSeparator}" />
151-
<Button Style="{StaticResource ActionLinkButton}" KeyboardNavigation.TabIndex="1" x:Name="createLink" Click="createLink_Click" Content="{x:Static prop:Resources.CreateLink}"/>
153+
<Button Style="{StaticResource ActionLinkButton}" KeyboardNavigation.TabIndex="1" x:Name="createLink" Click="createLink_Click" Content="{x:Static prop:Resources.CreateLink}"
154+
AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.CreateHyperlink}"/>
152155
<Separator Margin="3,0,3,0" Style="{StaticResource VerticalSeparator}" />
153156
<Button Style="{StaticResource ActionLinkButton}" KeyboardNavigation.TabIndex="2" x:Name="signOut" Click="signOut_Click" Content="{x:Static prop:Resources.SignOutLink}"
154-
Visibility="{Binding ShowLogout, Converter={StaticResource BooleanToVisibilityConverter}}"/>
157+
Visibility="{Binding ShowLogout, Converter={StaticResource BooleanToVisibilityConverter}}"
158+
AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.SignOutHyperlink}"/>
155159
<Button Style="{StaticResource ActionLinkButton}" KeyboardNavigation.TabIndex="2" x:Name="login" Click="login_Click" Content="{x:Static prop:Resources.LoginLink}"
156-
Visibility="{Binding ShowLogin, Converter={StaticResource BooleanToVisibilityConverter}}"/>
160+
Visibility="{Binding ShowLogin, Converter={StaticResource BooleanToVisibilityConverter}}"
161+
AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.SignInHyperlink}"/>
157162
</WrapPanel>
158163

159164
<ListView x:Name="repositories"
@@ -172,7 +177,7 @@
172177
VirtualizingPanel.ScrollUnit="Pixel"
173178
VirtualizingPanel.IsVirtualizingWhenGrouping="True"
174179
Visibility="{Binding Repositories, Converter={StaticResource HasItemsVisibilityConverter}}"
175-
>
180+
AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.TeamExplorerRepositoryListView}" >
176181
<ListView.ItemTemplate>
177182
<DataTemplate>
178183
<Grid>

src/GitHub.VisualStudio/GitHub.VisualStudio.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,10 @@
568568
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup;GetCopyToOutputDirectoryItems;DebugSymbolsProjectOutputGroup;</IncludeOutputGroupsInVSIX>
569569
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup;</IncludeOutputGroupsInVSIXLocalOnly>
570570
</ProjectReference>
571+
<ProjectReference Include="..\..\submodules\GitHubVSAutomationIDs\GithubVSAutomationIDs\GithubVSTestAutomationIDs.csproj">
572+
<Project>{665078f4-5875-431d-a2cc-421849b43328}</Project>
573+
<Name>GithubVSTestAutomationIDs</Name>
574+
</ProjectReference>
571575
<ProjectReference Include="..\..\submodules\octokit.net\Octokit.Reactive\Octokit.Reactive.csproj">
572576
<Project>{674b69b8-0780-4d54-ae2b-c15821fa51cb}</Project>
573577
<Name>Octokit.Reactive</Name>
@@ -728,4 +732,4 @@
728732
<Target Name="AfterBuild">
729733
</Target>
730734
-->
731-
</Project>
735+
</Project>

src/GitHub.VisualStudio/UI/Views/Controls/GistCreationControl.xaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@
88
xmlns:cache="clr-namespace:GitHub.VisualStudio.Helpers"
99
xmlns:prop="clr-namespace:GitHub.VisualStudio.UI;assembly=GitHub.VisualStudio.UI"
1010
xmlns:uirx="clr-namespace:GitHub.UI;assembly=GitHub.UI.Reactive"
11+
xmlns:automation="clr-namespace:GitHub.VisualStudio.TestAutomation;assembly=GitHub.VisualStudio.TestAutomation.AutomationIDs"
1112
mc:Ignorable="d"
1213
d:DesignWidth="414"
13-
d:DesignHeight="440">
14+
d:DesignHeight="440"
15+
AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.GistCreationControlCustom}">
1416
<UserControl.Resources>
1517
<ResourceDictionary>
1618
<ResourceDictionary.MergedDictionaries>
@@ -72,10 +74,10 @@
7274
<RowDefinition Height="Auto" />
7375
</Grid.RowDefinitions>
7476
<Label Grid.Column="0" Grid.Row="0" Target="{Binding ElementName=nameTextBox}" Content="{x:Static prop:Resources.fileNameText}"/>
75-
<ui:PromptTextBox x:Name="fileNameTextBox" Grid.Column="1" Grid.Row="0" />
77+
<ui:PromptTextBox x:Name="fileNameTextBox" Grid.Column="1" Grid.Row="0" AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.GistFileNameTextBox}" />
7678

7779
<Label Grid.Column="0" Grid.Row="1" Target="{Binding ElementName=descriptionTextBox}" Content="{x:Static prop:Resources.Description}"/>
78-
<ui:PromptTextBox x:Name="descriptionTextBox" Grid.Column="1" Grid.Row="1"/>
80+
<ui:PromptTextBox x:Name="descriptionTextBox" Grid.Column="1" Grid.Row="1" AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.GistDescriptionTextBlock}"/>
7981

8082
<StackPanel x:Name="accountStackPanel" Grid.Column="1" Grid.Row="2" Orientation="Horizontal">
8183
<Image
@@ -93,7 +95,8 @@
9395
Grid.Row="3"
9496
Content="{x:Static prop:Resources.makePrivateGist}"
9597
Style="{DynamicResource BlueRoundedCheckBox}"
96-
Padding="8,4,0,4" />
98+
Padding="8,4,0,4"
99+
AutomationProperties.AutomationId="{x:Static automation:AutomationIDs.PrivateGistCheckBox}" />
97100

98101
<uirx:ErrorMessageDisplay
99102
x:Name="errorMessage"

0 commit comments

Comments
 (0)