Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NewArch/windows/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ Ankh.NoLoad
*.binlog
*.err
*.wrn

# Accessibility scan results
AccessibilityUnitTest/ScanResults/
231 changes: 231 additions & 0 deletions NewArch/windows/AccessibilityUnitTest/AccessibilitySnapshot.json

Large diffs are not rendered by default.

189 changes: 189 additions & 0 deletions NewArch/windows/AccessibilityUnitTest/AccessibilityTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
using AccessibilityUnitTest;
using Axe.Windows.Automation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Windows.Automation;

namespace AccessibilityUnitTest
{
[TestClass]
public class AccessibilityTests : GallerySession
{
private static AutomationElement GalleryWindow;
private static int processId;

public TestContext TestContext { get; set; }

/// <summary>
/// Creates a scanner whose output file is named after the current test.
/// </summary>
private IScanner GetTestScanner()
{
return CreateScannerForTest(processId, TestContext.TestName);
}

[TestMethod]
public void TestZNavigation()
{
// Navigate home first to reset UI state when running after other tests
FindAndInvokeElement(GalleryWindow, "Navigation menu", waitMs: 2000);
FindAndInvokeElement(GalleryWindow, "Home", waitMs: 1000);
FindAndInvokeElement(GalleryWindow, "Navigation menu", waitMs: 2000);
var navMenu = FindElement(GalleryWindow, "Navigation menu");
var parent = GetParentElement(navMenu);
FindAndExpandElement(GalleryWindow, "Basic Input");
FindAndExpandElement(GalleryWindow, "Collections");
FindAndExpandElement(GalleryWindow, "Dialogs & flyouts");
FindAndExpandElement(GalleryWindow, "Layout");
FindAndExpandElement(GalleryWindow, "Media");
FindAndExpandElement(GalleryWindow, "Scrolling");
FindAndExpandElement(GalleryWindow, "Text");
FindAndExpandElement(GalleryWindow, "System");
FindAndExpandElement(GalleryWindow, "Legacy");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner(), parent));
}

[TestMethod]
public void TestNavigateToHomeAndValidate()
{
FindAndInvokeElement(GalleryWindow, "Navigation menu", waitMs: 2000);
FindAndInvokeElement(GalleryWindow, "Home");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToSettingsAndValidate()
{
FindAndInvokeElement(GalleryWindow, "Navigation menu", waitMs: 2000);
FindAndInvokeElement(GalleryWindow, "Settings");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToButtonAndValidate()
{
NavigateToComponent(GalleryWindow, "Button1 control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToPressableAndValidate()
{
NavigateToComponent(GalleryWindow, "Pressable control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToSwitchAndValidate()
{
NavigateToComponent(GalleryWindow, "Switch control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToFlatListAndValidate()
{
NavigateToComponent(GalleryWindow, "FlatList control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

// [TestMethod]
// public void TestNavigateToVirtualizedListAndValidate()
// {
// NavigateToComponent(GalleryWindow, "VirtualizedList control");
// AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
// }

[TestMethod]
public void TestNavigateToModalAndValidate()
{
NavigateToComponent(GalleryWindow, "Modal control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToViewAndValidate()
{
NavigateToComponent(GalleryWindow, "View control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToImageAndValidate()
{
NavigateToComponent(GalleryWindow, "Image control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToScrollViewAndValidate()
{
NavigateToComponent(GalleryWindow, "ScrollView control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToTextAndValidate()
{
NavigateToComponent(GalleryWindow, "Text control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToTextInputAndValidate()
{
NavigateToComponent(GalleryWindow, "TextInput control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToClipboardAndValidate()
{
NavigateToComponent(GalleryWindow, "Clipboard control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToTouchableHighlightAndValidate()
{
NavigateToComponent(GalleryWindow, "TouchableHighlight control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToTouchableOpacityAndValidate()
{
NavigateToComponent(GalleryWindow, "TouchableOpacity control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[TestMethod]
public void TestNavigateToTouchableWithoutFeedbackAndValidate()
{
NavigateToComponent(GalleryWindow, "TouchableWithoutFeedback control");
AddTestSnapshot(TestContext.TestName, GetScanResults(GetTestScanner()));
}

[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
try
{
processId = GetProcessId();
GalleryWindow = InitializeGalleryWindow();
}
catch (Exception ex)
{
Console.WriteLine($"Error during initialization: {ex.Message}");
throw;
}
}

[ClassCleanup]
public static void ClassCleanup()
{
string snapshotPath = WriteSnapshotFile();
Console.WriteLine($"Snapshot saved to: {snapshotPath}");
}
}
}
124 changes: 124 additions & 0 deletions NewArch/windows/AccessibilityUnitTest/AccessibilityUnitTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4494014E-461B-45A6-BAC5-91FCD1936FDC}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AccessibilityUnitTest</RootNamespace>
<AssemblyName>AccessibilityUnitTest</AssemblyName>
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Axe.Windows.Actions, Version=2.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Axe.Windows.2.4.2\lib\netstandard20\Axe.Windows.Actions.dll</HintPath>
</Reference>
<Reference Include="Axe.Windows.Automation, Version=2.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Axe.Windows.2.4.2\lib\netstandard20\Axe.Windows.Automation.dll</HintPath>
</Reference>
<Reference Include="Axe.Windows.Core, Version=2.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Axe.Windows.2.4.2\lib\netstandard20\Axe.Windows.Core.dll</HintPath>
</Reference>
<Reference Include="Axe.Windows.Desktop, Version=2.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Axe.Windows.2.4.2\lib\netstandard20\Axe.Windows.Desktop.dll</HintPath>
</Reference>
<Reference Include="Axe.Windows.Rules, Version=2.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Axe.Windows.2.4.2\lib\netstandard20\Axe.Windows.Rules.dll</HintPath>
</Reference>
<Reference Include="Axe.Windows.RuleSelection, Version=2.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Axe.Windows.2.4.2\lib\netstandard20\Axe.Windows.RuleSelection.dll</HintPath>
</Reference>
<Reference Include="Axe.Windows.SystemAbstractions, Version=2.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Axe.Windows.2.4.2\lib\netstandard20\Axe.Windows.SystemAbstractions.dll</HintPath>
</Reference>
<Reference Include="Axe.Windows.Telemetry, Version=2.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Axe.Windows.2.4.2\lib\netstandard20\Axe.Windows.Telemetry.dll</HintPath>
</Reference>
<Reference Include="Axe.Windows.Win32, Version=2.4.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Axe.Windows.2.4.2\lib\netstandard20\Axe.Windows.Win32.dll</HintPath>
</Reference>
<Reference Include="Interop.UIAutomationClient, Version=10.0.19041.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Interop.UIAutomationClient.10.19041.0\lib\net45\Interop.UIAutomationClient.dll</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MSTest.TestFramework.2.2.10\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Win32.Registry, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Win32.Registry.5.0.0\lib\net461\Microsoft.Win32.Registry.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Drawing.Common.8.0.10\lib\net462\System.Drawing.Common.dll</HintPath>
</Reference>
<Reference Include="System.IO.Packaging, Version=8.0.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Packaging.8.0.1\lib\net462\System.IO.Packaging.dll</HintPath>
</Reference>
<Reference Include="System.Security.AccessControl, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.AccessControl.5.0.0\lib\net461\System.Security.AccessControl.dll</HintPath>
</Reference>
<Reference Include="System.Security.Principal.Windows, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Principal.Windows.5.0.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="UIAutomationClient" />
<Reference Include="UIAutomationTypes" />
</ItemGroup>
<ItemGroup>
<Compile Include="AccessibilityTests.cs" />
<Compile Include="GallerySession.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets'))" />
<Error Condition="!Exists('..\packages\Interop.UIAutomationClient.10.19041.0\build\Interop.UIAutomationClient.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Interop.UIAutomationClient.10.19041.0\build\Interop.UIAutomationClient.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.2.10\build\net46\MSTest.TestAdapter.targets')" />
<Import Project="..\packages\Interop.UIAutomationClient.10.19041.0\build\Interop.UIAutomationClient.targets" Condition="Exists('..\packages\Interop.UIAutomationClient.10.19041.0\build\Interop.UIAutomationClient.targets')" />
</Project>
Loading