diff --git a/build/CopyFilesToStagingDir.ps1 b/build/CopyFilesToStagingDir.ps1 index 50ef1cc0fe..d2c4f3f975 100644 --- a/build/CopyFilesToStagingDir.ps1 +++ b/build/CopyFilesToStagingDir.ps1 @@ -39,6 +39,19 @@ PublishFile -IfExists $FullBuildOutput\Microsoft.UI.Xaml.Design\Microsoft.UI.Xam PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\Microsoft.UI.Xaml.FrameworkPackagePRI\Microsoft.UI.Xaml.pri $FullPublishDir\Microsoft.UI.Xaml.FrameworkPackagePRI\ PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\MUXControls.Test.dll $FullPublishDir\Test\ PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\MUXTestInfra.TAEF.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\Microsoft.Win32.Registry.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\Axe.Windows.Actions.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\Axe.Windows.Automation.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\Axe.Windows.Core.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\Axe.Windows.Desktop.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\Axe.Windows.Rules.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\Axe.Windows.RuleSelection.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\Axe.Windows.SystemAbstractions.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\Axe.Windows.Telemetry.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\Axe.Windows.Win32.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\Newtonsoft.Json.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\System.Drawing.Common.dll $FullPublishDir\Test\ +PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.Test.TAEF\System.IO.Packaging.dll $FullPublishDir\Test\ PublishFile -IfExists $FullBuildOutput\Microsoft.UI.Xaml\WebView2Loader.dll $FullPublishDir\Test\ PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.ReleaseTest.TAEF\MUXControls.ReleaseTest.dll $FullPublishDir\Test\ PublishFile -IfExists $BuildOutputDir\$Configuration\AnyCPU\MUXControls.ReleaseTest.TAEF\WebView2Loader.dll $FullPublishDir\Test\ diff --git a/build/Helix/PrepareHelixPayload.ps1 b/build/Helix/PrepareHelixPayload.ps1 index 7e5bbecfaf..de6d3b4974 100644 --- a/build/Helix/PrepareHelixPayload.ps1 +++ b/build/Helix/PrepareHelixPayload.ps1 @@ -82,6 +82,19 @@ function Copy-Recursively-If-Exists # Copy files from the 'drop' artifact dir Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\MUXControls.Test.dll" $payloadDir +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\Microsoft.Win32.Registry.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\Axe.Windows.Actions.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\Axe.Windows.Automation.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\Axe.Windows.Core.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\Axe.Windows.Desktop.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\Axe.Windows.Rules.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\Axe.Windows.RuleSelection.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\Axe.Windows.SystemAbstractions.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\Axe.Windows.Telemetry.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\Axe.Windows.Win32.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\Newtonsoft.Json.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\System.Drawing.Common.dll" "$payloadDir\.NETCoreApp2.1\" +Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\System.IO.Packaging.dll" "$payloadDir\.NETCoreApp2.1\" Copy-Item "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\MUXTestInfra.TAEF.dll" $payloadDir Copy-If-Exists "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\MUXExperimental.Test.dll" $payloadDir Copy-If-Exists "$repoDirectory\Artifacts\$ArtifactName\$Configuration\$Platform\Test\WebView2Loader.dll" $payloadDir diff --git a/dev/AutoSuggestBox/InteractionTests/AutoSuggestBoxTests.cs b/dev/AutoSuggestBox/InteractionTests/AutoSuggestBoxTests.cs index 7a44119f00..f28d4a0929 100644 --- a/dev/AutoSuggestBox/InteractionTests/AutoSuggestBoxTests.cs +++ b/dev/AutoSuggestBox/InteractionTests/AutoSuggestBoxTests.cs @@ -18,6 +18,7 @@ using Microsoft.Windows.Apps.Test.Foundation.Controls; using Microsoft.Windows.Apps.Test.Foundation.Patterns; +using MUXTestInfra.Shared.Infra; namespace Windows.UI.Xaml.Tests.MUXControls.InteractionTests { @@ -58,5 +59,14 @@ public void CanSelectSuggestion() Verify.AreEqual("dolor", autoSuggestBoxTextBox.Value); } } + + [TestMethod] + public void VerifyAxeScanPasses() + { + using (var setup = new TestSetupHelper("AutoSuggestBox-Axe")) + { + AxeTestHelper.TestForAxeIssues(); + } + } } } diff --git a/dev/AutoSuggestBox/TestUI/AutoSuggestBoxPage.xaml b/dev/AutoSuggestBox/TestUI/AutoSuggestBoxPage.xaml index 2cdd5bc714..12931aa927 100644 --- a/dev/AutoSuggestBox/TestUI/AutoSuggestBoxPage.xaml +++ b/dev/AutoSuggestBox/TestUI/AutoSuggestBoxPage.xaml @@ -13,7 +13,9 @@ - + + + @@ -24,12 +26,13 @@ + + Header="Search Stuff" QueryIcon="Find" /> diff --git a/dev/AutoSuggestBox/TestUI/AutoSuggestBoxPage.xaml.cs b/dev/AutoSuggestBox/TestUI/AutoSuggestBoxPage.xaml.cs index 9f44310a1d..b7f6021151 100644 --- a/dev/AutoSuggestBox/TestUI/AutoSuggestBoxPage.xaml.cs +++ b/dev/AutoSuggestBox/TestUI/AutoSuggestBoxPage.xaml.cs @@ -4,6 +4,7 @@ namespace MUXControlsTestApp { [TopLevelTestPage(Name = "AutoSuggestBox", Icon = "AutoSuggestBox.png")] + [AxeScanTestPage(Name = "AutoSuggestBox-Axe")] public sealed partial class AutoSuggestBoxPage : TestPage { string[] suggestions = diff --git a/dev/Expander/InteractionTests/ExpanderTests.cs b/dev/Expander/InteractionTests/ExpanderTests.cs index 4955e98676..164639ff92 100644 --- a/dev/Expander/InteractionTests/ExpanderTests.cs +++ b/dev/Expander/InteractionTests/ExpanderTests.cs @@ -22,6 +22,7 @@ using Microsoft.Windows.Apps.Test.Foundation.Controls; using Microsoft.Windows.Apps.Test.Foundation.Patterns; using Microsoft.Windows.Apps.Test.Foundation.Waiters; +using MUXTestInfra.Shared.Infra; namespace Windows.UI.Xaml.Tests.MUXControls.InteractionTests { @@ -126,6 +127,15 @@ public void TestCleanup() TestCleanupHelper.Cleanup(); } + [TestMethod] + public void VerifyAxeScanPasses() + { + using (var setup = new TestSetupHelper("Expander-Axe")) + { + AxeTestHelper.TestForAxeIssues(); + } + } + [TestMethod] public void ExpandCollapseAutomationTests() { diff --git a/dev/Expander/TestUI/ExpanderPage.xaml b/dev/Expander/TestUI/ExpanderPage.xaml index febc08c624..2bde482dd8 100644 --- a/dev/Expander/TestUI/ExpanderPage.xaml +++ b/dev/Expander/TestUI/ExpanderPage.xaml @@ -38,7 +38,7 @@ - This is a toggle button in the header + This is a Togglebutton in the header diff --git a/dev/Expander/TestUI/ExpanderPage.xaml.cs b/dev/Expander/TestUI/ExpanderPage.xaml.cs index c718780845..bb00be1526 100644 --- a/dev/Expander/TestUI/ExpanderPage.xaml.cs +++ b/dev/Expander/TestUI/ExpanderPage.xaml.cs @@ -23,6 +23,7 @@ protected override AutomationPeer OnCreateAutomationPeer() { return new TestControlAutomationPeer(this); } + } public sealed class TestControlAutomationPeer : FrameworkElementAutomationPeer @@ -32,9 +33,15 @@ protected override AutomationControlType GetAutomationControlTypeCore() { return AutomationControlType.Custom; } + + protected override string GetLocalizedControlTypeCore() + { + return "TestControl"; + } } [TopLevelTestPage(Name = "Expander")] + [AxeScanTestPage(Name = "Expander-Axe")] public sealed partial class ExpanderPage : TestPage { public ExpanderPage() diff --git a/dev/MenuBar/MenuBar_InteractionTests/MenuBarTests.cs b/dev/MenuBar/MenuBar_InteractionTests/MenuBarTests.cs index 14cbe96f30..89e5e33b44 100644 --- a/dev/MenuBar/MenuBar_InteractionTests/MenuBarTests.cs +++ b/dev/MenuBar/MenuBar_InteractionTests/MenuBarTests.cs @@ -21,12 +21,13 @@ using Microsoft.Windows.Apps.Test.Foundation.Controls; using Microsoft.Windows.Apps.Test.Foundation.Patterns; using Microsoft.Windows.Apps.Test.Foundation.Waiters; +using MUXTestInfra.Shared.Infra; namespace Windows.UI.Xaml.Tests.MUXControls.InteractionTests { [TestClass] public class MenuBarTests - { + { [ClassInitialize] [TestProperty("RunAs", "User")] [TestProperty("Classification", "Integration")] @@ -36,6 +37,15 @@ public static void ClassInitialize(TestContext testContext) TestEnvironment.Initialize(testContext); } + [TestMethod] + public void VerifyAxeScanPasses() + { + using (var setup = new TestSetupHelper("MenuBar-Axe")) + { + AxeTestHelper.TestForAxeIssues(); + } + } + [TestCleanup] public void TestCleanup() { diff --git a/dev/MenuBar/MenuBar_TestUI/MenuBarPage.xaml.cs b/dev/MenuBar/MenuBar_TestUI/MenuBarPage.xaml.cs index cfeda8ff98..9dde8c918a 100644 --- a/dev/MenuBar/MenuBar_TestUI/MenuBarPage.xaml.cs +++ b/dev/MenuBar/MenuBar_TestUI/MenuBarPage.xaml.cs @@ -12,6 +12,7 @@ namespace MUXControlsTestApp { [TopLevelTestPage(Name = "MenuBar", Icon = "MenuBar.png")] + [AxeScanTestPage(Name = "MenuBar-Axe")] public sealed partial class MenuBarPage : TestPage { public MenuBarPage() diff --git a/dev/NavigationView/NavigationView_InteractionTests/CommonTests.cs b/dev/NavigationView/NavigationView_InteractionTests/CommonTests.cs index 88699bdc96..b8aa9338c5 100644 --- a/dev/NavigationView/NavigationView_InteractionTests/CommonTests.cs +++ b/dev/NavigationView/NavigationView_InteractionTests/CommonTests.cs @@ -22,6 +22,7 @@ using Microsoft.Windows.Apps.Test.Foundation; using Microsoft.Windows.Apps.Test.Foundation.Controls; using Microsoft.Windows.Apps.Test.Foundation.Waiters; +using MUXTestInfra.Shared.Infra; namespace Windows.UI.Xaml.Tests.MUXControls.InteractionTests.NavigationViewTests { @@ -38,6 +39,15 @@ public static void ClassInitialize(TestContext testContext) TestEnvironment.Initialize(testContext); } + [TestMethod] + public void VerifyAxeScanPasses() + { + using (var setup = new TestSetupHelper("NavigationView-Axe")) + { + AxeTestHelper.TestForAxeIssues(); + } + } + [TestMethod] public void DisplayModeTest() { diff --git a/dev/NavigationView/TestUI/NavigationViewAxeTestPage.xaml b/dev/NavigationView/TestUI/NavigationViewAxeTestPage.xaml new file mode 100644 index 0000000000..6b6aa09425 --- /dev/null +++ b/dev/NavigationView/TestUI/NavigationViewAxeTestPage.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dev/NavigationView/TestUI/NavigationViewAxeTestPage.xaml.cs b/dev/NavigationView/TestUI/NavigationViewAxeTestPage.xaml.cs new file mode 100644 index 0000000000..a2161705af --- /dev/null +++ b/dev/NavigationView/TestUI/NavigationViewAxeTestPage.xaml.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices.WindowsRuntime; +using Windows.Foundation; +using Windows.Foundation.Collections; +using Windows.UI.Xaml; +using Windows.UI.Xaml.Controls; +using Windows.UI.Xaml.Controls.Primitives; +using Windows.UI.Xaml.Data; +using Windows.UI.Xaml.Input; +using Windows.UI.Xaml.Media; +using Windows.UI.Xaml.Navigation; + +namespace MUXControlsTestApp +{ + [AxeScanTestPage(Name = "NavigationView-Axe")] + public sealed partial class NavigationViewAxeTestPage : TestPage + { + public NavigationViewAxeTestPage() + { + this.InitializeComponent(); + } + } +} diff --git a/dev/NavigationView/TestUI/NavigationView_TestUI.projitems b/dev/NavigationView/TestUI/NavigationView_TestUI.projitems index ff1166ac29..9f18d50d3e 100644 --- a/dev/NavigationView/TestUI/NavigationView_TestUI.projitems +++ b/dev/NavigationView/TestUI/NavigationView_TestUI.projitems @@ -82,6 +82,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -168,7 +172,10 @@ NavigationViewItemTemplatePage.xaml - NavigationViewPage.xaml + NavigationViewPage.xaml + + + NavigationViewAxeTestPage.xaml NavigationViewCustomThemeResourcesPage.xaml diff --git a/dev/NumberBox/InteractionTests/NumberBoxTests.cs b/dev/NumberBox/InteractionTests/NumberBoxTests.cs index c8aef27f38..4f39d70a08 100644 --- a/dev/NumberBox/InteractionTests/NumberBoxTests.cs +++ b/dev/NumberBox/InteractionTests/NumberBoxTests.cs @@ -20,6 +20,7 @@ using Microsoft.Windows.Apps.Test.Foundation.Controls; using Microsoft.Windows.Apps.Test.Foundation.Patterns; using Microsoft.Windows.Apps.Test.Foundation.Waiters; +using MUXTestInfra.Shared.Infra; namespace Windows.UI.Xaml.Tests.MUXControls.InteractionTests { @@ -605,6 +606,14 @@ public void VerifyRightClickForContextMenuDoesNotDeselectText() } } + [TestMethod] + public void VerifyAxeScanPasses() + { + using (var setup = new TestSetupHelper("NumberBox-Axe")) + { + AxeTestHelper.TestForAxeIssues(); + } + } Button FindButton(UIObject parent, string buttonName) { diff --git a/dev/NumberBox/TestUI/NumberBoxAxeTestPage.xaml b/dev/NumberBox/TestUI/NumberBoxAxeTestPage.xaml new file mode 100644 index 0000000000..c0a0586d27 --- /dev/null +++ b/dev/NumberBox/TestUI/NumberBoxAxeTestPage.xaml @@ -0,0 +1,16 @@ + + + + + + + diff --git a/dev/NumberBox/TestUI/NumberBoxAxeTestPage.xaml.cs b/dev/NumberBox/TestUI/NumberBoxAxeTestPage.xaml.cs new file mode 100644 index 0000000000..482cce2304 --- /dev/null +++ b/dev/NumberBox/TestUI/NumberBoxAxeTestPage.xaml.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. +namespace MUXControlsTestApp +{ + [AxeScanTestPage(Name = "NumberBox-Axe")] + public sealed partial class NumberBoxAxeTestPage : TestPage + { + public NumberBoxAxeTestPage() + { + this.InitializeComponent(); + } + } +} diff --git a/dev/NumberBox/TestUI/NumberBox_TestUI.projitems b/dev/NumberBox/TestUI/NumberBox_TestUI.projitems index fd1a3b14a8..038b698530 100644 --- a/dev/NumberBox/TestUI/NumberBox_TestUI.projitems +++ b/dev/NumberBox/TestUI/NumberBox_TestUI.projitems @@ -10,12 +10,19 @@ NumberBox_TestUI + + Designer + MSBuild:Compile + Designer MSBuild:Compile + + NumberBoxAxeTestPage.xaml + NumberBoxPage.xaml diff --git a/dev/TabView/InteractionTests/TabViewTests.cs b/dev/TabView/InteractionTests/TabViewTests.cs index ff5840c12e..db9c9a43e3 100755 --- a/dev/TabView/InteractionTests/TabViewTests.cs +++ b/dev/TabView/InteractionTests/TabViewTests.cs @@ -23,6 +23,7 @@ using Microsoft.Windows.Apps.Test.Foundation.Waiters; using Windows.UI.Xaml.Media; using Windows.Devices.Input; +using MUXTestInfra.Shared.Infra; namespace Windows.UI.Xaml.Tests.MUXControls.InteractionTests { @@ -43,6 +44,15 @@ public void TestCleanup() TestCleanupHelper.Cleanup(); } + [TestMethod] + public void VerifyAxeScanPasses() + { + using (var setup = new TestSetupHelper("TabView-Axe")) + { + AxeTestHelper.TestForAxeIssues(); + } + } + [TestMethod] public void SelectionTest() { diff --git a/dev/TabView/TestUI/TabViewAxeTestPage.xaml b/dev/TabView/TestUI/TabViewAxeTestPage.xaml new file mode 100644 index 0000000000..53da4efa5d --- /dev/null +++ b/dev/TabView/TestUI/TabViewAxeTestPage.xaml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + diff --git a/dev/TabView/TestUI/TabViewAxeTestPage.xaml.cs b/dev/TabView/TestUI/TabViewAxeTestPage.xaml.cs new file mode 100644 index 0000000000..df4423f8b9 --- /dev/null +++ b/dev/TabView/TestUI/TabViewAxeTestPage.xaml.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +namespace MUXControlsTestApp +{ + [AxeScanTestPage(Name = "TabView-Axe")] + public sealed partial class TabViewAxeTestPage : TestPage + { + public TabViewAxeTestPage() + { + this.InitializeComponent(); + } + } +} diff --git a/dev/TabView/TestUI/TabView_TestUI.projitems b/dev/TabView/TestUI/TabView_TestUI.projitems index 929f3db08d..9c3261ab5b 100644 --- a/dev/TabView/TestUI/TabView_TestUI.projitems +++ b/dev/TabView/TestUI/TabView_TestUI.projitems @@ -10,6 +10,10 @@ TabView_TestUI + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -28,6 +32,9 @@ + + TabViewAxeTestPage.xaml + TabViewTabItemsSourcePage.xaml diff --git a/docs/developer_guide.md b/docs/developer_guide.md index 18a6310050..6e7ed4249d 100644 --- a/docs/developer_guide.md +++ b/docs/developer_guide.md @@ -196,6 +196,12 @@ Windows, not just the most recent version. Your tests may need version or [IsApiPresent](https://docs.microsoft.com/uwp/api/windows.foundation.metadata.apiinformation.istypepresent) checks in order to pass on all versions. +#### Axe testing +Axe tests are part of the interaction tests. [Axe.Windows](https://github.com/microsoft/axe-windows) is a library to run automated app scans and allows to detect accessibility issues. +To add a new test page to use for Axe scanning, you can use the AxeTestPageAttribute which will add the test page to the list of test pages for Axe scanning. That way, other tests are not affected by the new test page. + +Running the Axe.Windows scan can be done using the `AxeTestHelper.TestForAxeIssues` method. If accessibility issues have been found, the method will throw an exception. + #### Visual tree verification tests ##### Update visual tree verification files diff --git a/test/MUXControls.Test/AxeTestHelper.cs b/test/MUXControls.Test/AxeTestHelper.cs new file mode 100644 index 0000000000..2fb5d8b7c6 --- /dev/null +++ b/test/MUXControls.Test/AxeTestHelper.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. +using Common; + +#if USING_TAEF +using WEX.TestExecution; +using WEX.TestExecution.Markup; +using WEX.Logging.Interop; +#else +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting.Logging; +#endif +using Axe.Windows.Automation; +using System.Diagnostics; +using Axe.Windows.Desktop.UIAutomation; +using System; + +namespace MUXTestInfra.Shared.Infra +{ + public class AxeTestHelper + { + private static IScanner scanner = null; + public static IScanner AxeScanner + { + get + { + if (scanner == null) + { + LoadScanner(); + } + return scanner; + } + } + + private static void LoadScanner() + { + var processes = Process.GetProcessesByName("MUXControlsTestApp"); + Verify.IsTrue(processes.Length > 0); + + string directory = Environment.GetEnvironmentVariable("TEMP") + @"\"; // For instance C:\Users\TDPUser\AppData\Local\Temp\ + var config = Config.Builder.ForProcessId(processes[0].Id).WithOutputFileFormat(OutputFileFormat.A11yTest).WithOutputDirectory(directory).Build(); + scanner = ScannerFactory.CreateScanner(config); + } + + public static void TestForAxeIssues() + { + var result = AxeScanner.Scan(); + + foreach(var error in result.Errors) + { + Log.Error($"{error.ToString()} - {error.Element.ToString()} - {error.Rule.ToString()} - {error.Rule.HowToFix}"); + } + + Verify.AreEqual(0, result.ErrorCount, "Found " + result.ErrorCount + " Axe errors."); + } + } +} diff --git a/test/MUXControls.Test/MSTest/MUXControls.Test.csproj b/test/MUXControls.Test/MSTest/MUXControls.Test.csproj index c01e720e22..385012fece 100644 --- a/test/MUXControls.Test/MSTest/MUXControls.Test.csproj +++ b/test/MUXControls.Test/MSTest/MUXControls.Test.csproj @@ -10,12 +10,13 @@ + - + - + diff --git a/test/MUXControls.Test/MUXControls.Test.Shared.projitems b/test/MUXControls.Test/MUXControls.Test.Shared.projitems index 77c2cbde88..119d02dbb6 100644 --- a/test/MUXControls.Test/MUXControls.Test.Shared.projitems +++ b/test/MUXControls.Test/MUXControls.Test.Shared.projitems @@ -141,6 +141,7 @@ + \ No newline at end of file diff --git a/test/MUXControls.Test/TAEF/MUXControls.Test.TAEF.csproj b/test/MUXControls.Test/TAEF/MUXControls.Test.TAEF.csproj index c7978d3615..a4590f77a3 100644 --- a/test/MUXControls.Test/TAEF/MUXControls.Test.TAEF.csproj +++ b/test/MUXControls.Test/TAEF/MUXControls.Test.TAEF.csproj @@ -11,12 +11,14 @@ netcoreapp2.1 .NETCoreApp v2.1 + true win-x86;win-x64;win-arm;win-arm64 $(NuGetPackageRoot)taef.redist.wlk\10.31.180822002\build\Binaries\x86\CoreClr\ + @@ -48,4 +50,31 @@ + + + + + + + + + + + + + + + + + + $(OutDir) + + + + + \ No newline at end of file diff --git a/test/MUXControls.Test/TAEF/NonRazzleIncludes.props b/test/MUXControls.Test/TAEF/NonRazzleIncludes.props index d77807ec27..7164855c52 100644 --- a/test/MUXControls.Test/TAEF/NonRazzleIncludes.props +++ b/test/MUXControls.Test/TAEF/NonRazzleIncludes.props @@ -2,7 +2,7 @@ - + diff --git a/test/MUXControlsReleaseTest/MUXControls.ReleaseTest/MSTest/MUXControls.ReleaseTest.csproj b/test/MUXControlsReleaseTest/MUXControls.ReleaseTest/MSTest/MUXControls.ReleaseTest.csproj index c3a241fbe8..b24c473595 100644 --- a/test/MUXControlsReleaseTest/MUXControls.ReleaseTest/MSTest/MUXControls.ReleaseTest.csproj +++ b/test/MUXControlsReleaseTest/MUXControls.ReleaseTest/MSTest/MUXControls.ReleaseTest.csproj @@ -9,7 +9,7 @@ - + diff --git a/test/MUXControlsReleaseTest/MUXControls.ReleaseTest/TAEF/MUXControls.ReleaseTest.TAEF.csproj b/test/MUXControlsReleaseTest/MUXControls.ReleaseTest/TAEF/MUXControls.ReleaseTest.TAEF.csproj index 66692ad10b..3c11244621 100644 --- a/test/MUXControlsReleaseTest/MUXControls.ReleaseTest/TAEF/MUXControls.ReleaseTest.TAEF.csproj +++ b/test/MUXControlsReleaseTest/MUXControls.ReleaseTest/TAEF/MUXControls.ReleaseTest.TAEF.csproj @@ -27,7 +27,7 @@ - + diff --git a/test/MUXControlsTestApp/MUXControlsTestApp.Shared.projitems b/test/MUXControlsTestApp/MUXControlsTestApp.Shared.projitems index 877175f00b..2bfdcee738 100644 --- a/test/MUXControlsTestApp/MUXControlsTestApp.Shared.projitems +++ b/test/MUXControlsTestApp/MUXControlsTestApp.Shared.projitems @@ -153,6 +153,7 @@ + diff --git a/test/MUXControlsTestApp/MainPage.xaml b/test/MUXControlsTestApp/MainPage.xaml index 27172fd515..feb27cea64 100644 --- a/test/MUXControlsTestApp/MainPage.xaml +++ b/test/MUXControlsTestApp/MainPage.xaml @@ -6,6 +6,7 @@ xmlns:local="using:MUXControlsTestApp" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:muxc="using:Microsoft.UI.Xaml.Controls" mc:Ignorable="d" AutomationProperties.AutomationId="MainPage"> @@ -80,6 +81,17 @@ Header="ApplicationHighContrastAdjustment" SelectionChanged="AppHighContrastAdjustmentChooser_SelectionChanged" /> + + + + +