From 02a3532442bf57c2e4a6697e3597872b0464c5a8 Mon Sep 17 00:00:00 2001 From: Matt Cooley Date: Mon, 24 Jun 2019 13:23:41 -0700 Subject: [PATCH] Remove deprecated internal-only tests (#565) --- .../Calculator.TestPackage.csproj | 131 ----- .../Calculator.TestPackage.wm.xml | 28 - internal/Calculator.TestPackage/project.json | 13 - .../Calculator.UIAutomationLibrary.csproj | 99 ---- .../CalculatorAppLauncher.cs | 63 --- .../Components/App/CalculatorAppLfm.cs | 43 -- .../Components/App/CalculatorAppPom.cs | 31 -- .../Components/ContentDialogLfm.cs | 35 -- .../Components/ContentDialogPom.cs | 62 --- .../Components/Pages/AboutFlyoutLfm.cs | 31 -- .../Components/Pages/AboutFlyoutPom.cs | 29 - .../Components/Pages/CalculatorBasePom.cs | 57 -- .../Components/Pages/DateCalculatorLfm.cs | 36 -- .../Components/Pages/DateCalculatorPom.cs | 25 - .../Components/Pages/MainPageLfm.cs | 255 --------- .../Components/Pages/MainPagePom.cs | 51 -- .../Components/Pages/NavBarLfm.cs | 144 ----- .../Components/Pages/NavBarPom.cs | 96 ---- .../Pages/ProgrammerCalculatorLfm.cs | 56 -- .../Pages/ProgrammerCalculatorPom.cs | 56 -- .../Pages/ScientificCalculatorLfm.cs | 138 ----- .../Pages/ScientificCalculatorPom.cs | 63 --- .../Components/Pages/StandardCalculatorLfm.cs | 94 ---- .../Components/Pages/StandardCalculatorPom.cs | 45 -- .../Components/Pages/UnitConverterLfm.cs | 24 - .../Components/Pages/UnitConverterPom.cs | 27 - .../Components/Shared/HistoryLfm.cs | 48 -- .../Components/Shared/HistoryPom.cs | 29 - .../Components/Shared/ICanFocusWithClicks.cs | 15 - .../Components/Shared/MemoryLfm.cs | 51 -- .../Components/Shared/MemoryPom.cs | 44 -- .../Components/Shared/NumberPadPom.cs | 49 -- .../Properties/AssemblyInfo.cs | 20 - .../Tests/BasicCalculationTest.cs | 31 -- .../Tests/ScientificCalculationTest.cs | 38 -- .../Utilities/Constants.cs | 100 ---- .../Utilities/EtwHelper.cs | 101 ---- .../Utilities/Impersonator.cs | 100 ---- .../Utilities/InstallHelper.cs | 84 --- .../Utilities/NativeMethods.cs | 139 ----- .../Utilities/PerfTestConstants.cs | 41 -- .../Utilities/ServiceHelper.cs | 156 ------ .../Utilities/UIObjectExtensions.cs | 66 --- .../Utilities/Utilities.cs | 31 -- .../Utilities/WindowHelper.cs | 18 - .../project.json | 12 - .../Calculator.UITests.csproj | 145 ----- .../Config/AppLifecycle.Iterations.xml | 40 -- .../Config/AppLifecycle.Profile.wprp | 526 ------------------ .../Config/AppLifecycle.Regions.tt | 364 ------------ .../Config/AppLifecycle.Regions.xml | 353 ------------ internal/Calculator.UITests/Initialization.cs | 54 -- .../Properties/AssemblyInfo.cs | 21 - .../Tests/AppLifecycleTests.cs | 51 -- .../Tests/CalculatorTests.cs | 49 -- .../Calculator.UITests/Tests/LaunchTests.cs | 43 -- internal/Calculator.UITests/project.json | 19 - internal/Calculator.UITests/testmd.definition | 73 --- internal/CalculatorInternal.sln | 77 --- internal/Readme.txt | 1 - internal/Settings.XamlStyler | 39 -- internal/nuget.config | 19 - 62 files changed, 4779 deletions(-) delete mode 100644 internal/Calculator.TestPackage/Calculator.TestPackage.csproj delete mode 100644 internal/Calculator.TestPackage/Calculator.TestPackage.wm.xml delete mode 100644 internal/Calculator.TestPackage/project.json delete mode 100644 internal/Calculator.UIAutomationLibrary/Calculator.UIAutomationLibrary.csproj delete mode 100644 internal/Calculator.UIAutomationLibrary/CalculatorAppLauncher.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/App/CalculatorAppLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/App/CalculatorAppPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/ContentDialogLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/ContentDialogPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/AboutFlyoutLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/AboutFlyoutPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/CalculatorBasePom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/DateCalculatorLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/DateCalculatorPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/MainPageLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/MainPagePom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/NavBarLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/NavBarPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/ProgrammerCalculatorLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/ProgrammerCalculatorPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/ScientificCalculatorLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/ScientificCalculatorPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/StandardCalculatorLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/StandardCalculatorPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/UnitConverterLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Pages/UnitConverterPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Shared/HistoryLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Shared/HistoryPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Shared/ICanFocusWithClicks.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Shared/MemoryLfm.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Shared/MemoryPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Components/Shared/NumberPadPom.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Properties/AssemblyInfo.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Tests/BasicCalculationTest.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Tests/ScientificCalculationTest.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Utilities/Constants.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Utilities/EtwHelper.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Utilities/Impersonator.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Utilities/InstallHelper.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Utilities/NativeMethods.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Utilities/PerfTestConstants.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Utilities/ServiceHelper.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Utilities/UIObjectExtensions.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Utilities/Utilities.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/Utilities/WindowHelper.cs delete mode 100644 internal/Calculator.UIAutomationLibrary/project.json delete mode 100644 internal/Calculator.UITests/Calculator.UITests.csproj delete mode 100644 internal/Calculator.UITests/Config/AppLifecycle.Iterations.xml delete mode 100644 internal/Calculator.UITests/Config/AppLifecycle.Profile.wprp delete mode 100644 internal/Calculator.UITests/Config/AppLifecycle.Regions.tt delete mode 100644 internal/Calculator.UITests/Config/AppLifecycle.Regions.xml delete mode 100644 internal/Calculator.UITests/Initialization.cs delete mode 100644 internal/Calculator.UITests/Properties/AssemblyInfo.cs delete mode 100644 internal/Calculator.UITests/Tests/AppLifecycleTests.cs delete mode 100644 internal/Calculator.UITests/Tests/CalculatorTests.cs delete mode 100644 internal/Calculator.UITests/Tests/LaunchTests.cs delete mode 100644 internal/Calculator.UITests/project.json delete mode 100644 internal/Calculator.UITests/testmd.definition delete mode 100644 internal/CalculatorInternal.sln delete mode 100644 internal/Readme.txt delete mode 100644 internal/Settings.XamlStyler delete mode 100644 internal/nuget.config diff --git a/internal/Calculator.TestPackage/Calculator.TestPackage.csproj b/internal/Calculator.TestPackage/Calculator.TestPackage.csproj deleted file mode 100644 index 8579128..0000000 --- a/internal/Calculator.TestPackage/Calculator.TestPackage.csproj +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Debug - AnyCPU - {24767C43-CD5A-4DC9-8D6B-429F255524E5} - Library - Properties - Calculator.TestPackage - Calculator.TestPackage - .NETPortable - v5.0 - .NETCore,Version=v5.0 - UAP - 10.0.17763.0 - 10.0.17134.0 - 512 - - true - True - - - true - full - false - bin\Debug\x86 - DEBUG;TRACE - prompt - 4 - x86 - - - pdbonly - true - bin\Release\x86 - TRACE - prompt - 4 - x86 - - - true - full - false - bin\Debug\x64 - DEBUG;TRACE - prompt - 4 - x64 - - - pdbonly - true - bin\Release\x64 - TRACE - prompt - 4 - x64 - - - true - full - false - bin\Debug\arm - DEBUG;TRACE - prompt - 4 - ARM - - - pdbonly - true - bin\Release\arm - TRACE - prompt - 4 - ARM - - - true - full - false - bin\Debug\ARM64\ - DEBUG;TRACE - prompt - 4 - ARM64 - - - pdbonly - true - bin\Release\ARM64\ - TRACE - prompt - 4 - ARM64 - - - - - - - - {9447424a-0e05-4911-beb8-e0354405f39a} - Calculator - - - - 15.0 - - - - - - - - - - - - - @(AppxBundleOutput->'%(RootDir)%(Directory)') - $(UniversalTestCustomMacros)AppxPackageVCLibsDependency=$(AppxPackageTestDir)Dependencies\$(PlatformTarget)\Microsoft.VCLibs.$(PlatformTarget).Debug.14.00.appx; - $(UniversalTestCustomMacros)AppxPackageVCLibsDependency=$(AppxPackageTestDir)Dependencies\$(PlatformTarget)\Microsoft.VCLibs.$(PlatformTarget).14.00.appx; - $(UniversalTestCustomMacros)AppxPackageWinUIDependency=$(AppxPackageTestDir)Dependencies\$(PlatformTarget)\Microsoft.UI.Xaml.2.1.appx; - $(UniversalTestCustomMacros)AppxPackagePublicKeyFile=@(AppxPackagePublicKeyFile->'%(FullPath)');AppxBundleOutput=@(AppxBundleOutput->'%(FullPath)'); - - - - diff --git a/internal/Calculator.TestPackage/Calculator.TestPackage.wm.xml b/internal/Calculator.TestPackage/Calculator.TestPackage.wm.xml deleted file mode 100644 index 1f3e6c2..0000000 --- a/internal/Calculator.TestPackage/Calculator.TestPackage.wm.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - diff --git a/internal/Calculator.TestPackage/project.json b/internal/Calculator.TestPackage/project.json deleted file mode 100644 index 3f3f1eb..0000000 --- a/internal/Calculator.TestPackage/project.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "dependencies": { - "Microsoft.TestInfrastructure.UniversalTest": "1.0.20181107.1" - }, - "frameworks": { - "netcore50": {} - }, - "runtimes": { - "win10-arm": {}, - "win10-x64": {}, - "win10-x86": {} - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Calculator.UIAutomationLibrary.csproj b/internal/Calculator.UIAutomationLibrary/Calculator.UIAutomationLibrary.csproj deleted file mode 100644 index f752c1a..0000000 --- a/internal/Calculator.UIAutomationLibrary/Calculator.UIAutomationLibrary.csproj +++ /dev/null @@ -1,99 +0,0 @@ - - - - Debug - AnyCPU - {A43517B5-8BE3-4312-913F-004978C34444} - Library - Properties - Calculator.UIAutomationLibrary - Calculator.UIAutomationLibrary - .NETPortable - v5.0 - .NETCore,Version=v5.0 - UAP - 10.0.17763.0 - 10.0.17134.0 - 512 - 15.0 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - true - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 15.0 - - - - - \ No newline at end of file diff --git a/internal/Calculator.UIAutomationLibrary/CalculatorAppLauncher.cs b/internal/Calculator.UIAutomationLibrary/CalculatorAppLauncher.cs deleted file mode 100644 index df2ad9c..0000000 --- a/internal/Calculator.UIAutomationLibrary/CalculatorAppLauncher.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Etw.Managed; -using Microsoft.OneCoreUap.Test.AppModel; -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using Calculator.UIAutomationLibrary.Components; -using WEX.Logging.Interop; - -namespace Calculator.UIAutomationLibrary -{ - /// - /// Class that can open and close the Calculator app. - /// - public static class CalculatorAppLauncher - { - public const string CoreWindowClassName = "Windows.UI.Core.CoreWindow"; - - // This doesn't actually work right now because popup will disappear - // Bug 13713223: ContentDialog/Popup does not show up in the UIA tree when Windows.Current.Content has an AutomationName set. - // public static readonly UICondition TopLevelWindowUICondition = UICondition.CreateFromId(Constants.TopLevelWindowAutomationId); - public static readonly UICondition CoreWindowUICondition = UICondition.CreateFromClassName(CoreWindowClassName) - .AndWith(UICondition.CreateFromName(Constants.AppWindowName)); - - /// - /// Launch the app - /// - public static CalculatorAppLfm Launch() - { - Log.Comment("Launching Calculator and waiting for first page load..."); - - // Need to set this for the MITALite Tap~ methods to work on high DPI screens. - UAPApp.SetTestDPIAwareness(); - - // We want to be able to see any element in the tree - Context.RawContext.Activate(); - - // Set default wait timeout. - MS.Internal.Mita.Foundation.Waiters.Waiter.DefaultTimeout = TimeSpan.FromSeconds(30); - - // Enable Mita internal logging. - MS.Internal.Mita.Foundation.Utilities.Log.OutImplementation = (s, a) => { Log.Comment($"- [MitaLite] { string.Format(s, a) }"); }; - - using (EtwWaiter appLaunchWaiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.AppLaunchEndETWEventName)) - { - var viewDescriptor = NavigationHelper.LaunchApplication(Constants.PackageAppUserModelId); - appLaunchWaiter.Wait(TimeSpan.FromSeconds(30)); - - Window calculatorWindow = new Window(UIObject.Root.Descendants.Find(CoreWindowUICondition)); - Debug.Assert(calculatorWindow.ClassName == CoreWindowClassName); - - // Move our window to the foreground. - WindowHelper.SetAsForeground(calculatorWindow.GetTopLevelWindow()); - - return new CalculatorAppLfm(new CalculatorAppPom(calculatorWindow), viewDescriptor); - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/App/CalculatorAppLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/App/CalculatorAppLfm.cs deleted file mode 100644 index 41c34be..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/App/CalculatorAppLfm.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Microsoft.OneCoreUap.Test.AppModel; -using MS.Internal.Mita.Foundation; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class CalculatorAppLfm - { - private readonly IViewDescriptor viewDescriptor; - - public CalculatorAppLfm(CalculatorAppPom objectModel, IViewDescriptor viewDescriptor) - { - this.ObjectModel = objectModel; - this.viewDescriptor = viewDescriptor; - } - - public CalculatorAppPom ObjectModel { get; } - - public MainPageLfm MainPageLfm - { - get - { - return new MainPageLfm(this.ObjectModel.MainPagePom); - } - } - - public void Close() - { - // ObjectModel is essentially the window ui object. - if (this.viewDescriptor != null) - { - NavigationHelper.CloseApplication(this.viewDescriptor.AUMID); - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/App/CalculatorAppPom.cs b/internal/Calculator.UIAutomationLibrary/Components/App/CalculatorAppPom.cs deleted file mode 100644 index dac82b2..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/App/CalculatorAppPom.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class CalculatorAppPom : UIObject - { - /// - /// Creates a new instance of the class. - /// - /// UIObject for the calculator app window. - public CalculatorAppPom(UIObject uiObject) - : base(uiObject) - { - } - public MainPagePom MainPagePom - { - get - { - return new MainPagePom(this); - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/ContentDialogLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/ContentDialogLfm.cs deleted file mode 100644 index 08888c9..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/ContentDialogLfm.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class ContentDialogLfm - { - public ContentDialogLfm(ContentDialogPom objectModel) - { - this.ObjectModel = objectModel; - } - - public ContentDialogPom ObjectModel { get; } - - public void InvokePrimary() - { - this.ObjectModel.PrimaryButton.Invoke(); - } - public void InvokeSecondary() - { - this.ObjectModel.SecondaryButton.Invoke(); - } - - public void InvokeClose() - { - this.ObjectModel.CloseButton.Invoke(); - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/ContentDialogPom.cs b/internal/Calculator.UIAutomationLibrary/Components/ContentDialogPom.cs deleted file mode 100644 index b52e97d..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/ContentDialogPom.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class ContentDialogPom : UIObject - { - private static readonly UICondition textScrollViewerCondition = UICondition.CreateFromId("ContentScrollViewer"); - private static readonly UICondition titleTextBlockCondition = UICondition.CreateFromClassName("TextBlock"); - - private static readonly UICondition primaryButtonCondition = - UICondition.CreateFromClassName("Button") - .AndWith(UICondition.CreateFromId("PrimaryButton")); - private static readonly UICondition secondaryButtonCondition = - UICondition.CreateFromClassName("Button") - .AndWith(UICondition.CreateFromId("SecondaryButton")); - private static readonly UICondition closeButtonCondition = - UICondition.CreateFromClassName("Button") - .AndWith(UICondition.CreateFromId("CloseButton")); - - public ContentDialogPom(UIObject uiObject) : base(uiObject) - { - } - - public Button PrimaryButton - { - get - { - return new Button(this.Children.Find(primaryButtonCondition)); - } - } - - public Button SecondaryButton - { - get - { - return new Button(this.Children.Find(secondaryButtonCondition)); - } - } - - public Button CloseButton - { - get - { - return new Button(this.Children.Find(closeButtonCondition)); - } - } - - public string Title - { - get - { - var scrollViewer = this.Children.Find(textScrollViewerCondition); - var textBlock = scrollViewer.Children.Find(titleTextBlockCondition); - return textBlock.Name; - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/AboutFlyoutLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/AboutFlyoutLfm.cs deleted file mode 100644 index d6b3e00..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/AboutFlyoutLfm.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Calculator.UIAutomationLibrary.Components -{ - public class AboutFlyoutLfm : ICanFocusWithClicks - { - private const string FlyoutId = "FlyoutNav"; - - /// - /// Initializes a new instance of the class. - /// - /// The AboutFlyoutPom that represents the About flyout panel. - public AboutFlyoutLfm(AboutFlyoutPom objectModel) - { - this.ObjectModel = objectModel; - } - - public AboutFlyoutPom ObjectModel { get; } - - public void FocusWithClicks() - { - this.ObjectModel.Title.DoubleClick(); - } - - public void Close() - { - this.ObjectModel.SendKeys("{ESC}"); - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/AboutFlyoutPom.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/AboutFlyoutPom.cs deleted file mode 100644 index 29fa28c..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/AboutFlyoutPom.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class AboutFlyoutPom : UIObject - { - private const string TitleId = "Header"; - - /// - /// Initializes a new instance of the class. - /// - /// The UIObject that is the root of the navigation menu. - public AboutFlyoutPom(UIObject uiObject) : base(uiObject) - { - } - - public UIObject Title - { - get - { - return new UIObject(this.Descendants.Find(TitleId)); - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/CalculatorBasePom.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/CalculatorBasePom.cs deleted file mode 100644 index c8cdd95..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/CalculatorBasePom.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; -using MS.Internal.Mita.Foundation.Waiters; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Calculator.UIAutomationLibrary.Components -{ - /// - /// Represents the Display section of the calculator modes. - /// - public class CalculatorBasePom : UIObject - { - private const string ExpressionContainerId = "CalculatorExpression"; - private const string NormalOutputId = "normalOutput"; - - /// - /// Initializes a new instance of the class. - /// - /// The UIObject that is the root of the standard calculator. - public CalculatorBasePom(UIObject uiObject) : base(uiObject) - { - } - - public TextBlock Expression - { - get - { - return new TextBlock(this.Descendants.Find(ExpressionContainerId)); - } - } - - public UIEventWaiter GetExpressionChangedWaiter() - { - return new PropertyChangedEventWaiter(this.Expression, UIProperty.Get("Name")); - } - - public TextBlock Display - { - get - { - return new TextBlock(this.Descendants.Find(NormalOutputId)); - } - } - - public UIEventWaiter GetDisplayChangedWaiter() - { - return new PropertyChangedEventWaiter(this.Display, UIProperty.Get("Name")); - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/DateCalculatorLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/DateCalculatorLfm.cs deleted file mode 100644 index 727b5dd..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/DateCalculatorLfm.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Calculator.UIAutomationLibrary.Components -{ - public class DateCalculatorLfm - { - public DateCalculatorLfm(DateCalculatorPom dateCalculatorPom) - { - this.ObjectModel = dateCalculatorPom; - } - - public DateCalculatorPom ObjectModel { get; } - - public void EnsureDateDifferenceMode() - { - this.OpenModeSelector(); - this.ObjectModel.ModeSelector.AllItems[0].Select(); - } - - public void EnsureAddSubtractMode() - { - this.OpenModeSelector(); - this.ObjectModel.ModeSelector.AllItems[1].Select(); - } - - private void OpenModeSelector() - { - using (var waiter = this.ObjectModel.ModeSelector.GetExpandedWaiter()) - { - this.ObjectModel.ModeSelector.Expand(); - waiter.TryWait(); - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/DateCalculatorPom.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/DateCalculatorPom.cs deleted file mode 100644 index 2c240f0..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/DateCalculatorPom.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class DateCalculatorPom : UIObject - { - private const string ModeSelectorId = "DateCalculationOption"; - - public DateCalculatorPom(UIObject uiObject) : base(uiObject) - { - } - - public ComboBox ModeSelector - { - get - { - return new ComboBox(this.Descendants.Find(ModeSelectorId)); - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/MainPageLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/MainPageLfm.cs deleted file mode 100644 index 41f12ea..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/MainPageLfm.cs +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Etw.Managed; -using MS.Internal.Mita.Foundation.Waiters; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class MainPageLfm : ICanFocusWithClicks - { - public MainPageLfm(MainPagePom objectModel) - { - this.ObjectModel = objectModel; - } - - public MainPagePom ObjectModel { get; } - - public NavBarLfm OpenNavBar() - { - using (EtwWaiter waiter = this.ObjectModel.GetNavBarOpenedWaiter()) - { - this.ObjectModel.NavButton.Invoke(); - waiter.Wait(); - } - - return new NavBarLfm(this.ObjectModel.NavBarPom); - } - - public void CloseNavBar() - { - this.ObjectModel.NavBarPom.CloseButton.Invoke(); - } - - public void FocusWithClicks() - { - this.ObjectModel.Header.DoubleClick(); - } - - public StandardCalculatorLfm NavigateToStandardCalculator() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectStandard(); - waiter.TryWait(); - } - - return new StandardCalculatorLfm(this.ObjectModel.StandardCalculatorPom); - } - - public ScientificCalculatorLfm NavigateToScientificCalculator() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectScientific(); - waiter.TryWait(); - } - - return new ScientificCalculatorLfm(this.ObjectModel.ScientificCalculatorPom); - } - - public ProgrammerCalculatorLfm NavigateToProgrammerCalculator() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectProgrammer(); - waiter.TryWait(); - } - - return new ProgrammerCalculatorLfm(this.ObjectModel.ProgrammerCalculatorPom); - } - - public DateCalculatorLfm NavigateToDateCalculator() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectDate(); - waiter.TryWait(); - } - - return new DateCalculatorLfm(this.ObjectModel.DateCalculatorPom); - } - - public UnitConverterLfm NavigateToCurrencyConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectCurrency(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToVolumeConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectVolume(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToLengthConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectLength(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToWeightConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectWeight(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToTemperatureConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectTemperature(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToEnergyConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectEnergy(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToAreaConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectArea(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToSpeedConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectSpeed(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToTimeConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectTime(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToPowerConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectPower(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToDataConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectData(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToPressureConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectPressure(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public UnitConverterLfm NavigateToAngleConverter() - { - var navBar = this.OpenNavBar(); - using (var waiter = this.ObjectModel.GetModeChangedWaiter()) - { - navBar.SelectAngle(); - waiter.TryWait(); - } - - return new UnitConverterLfm(this.ObjectModel.UnitConverterPom); - } - - public AboutFlyoutLfm OpenAboutFlyout() - { - var navBar = this.OpenNavBar(); - using (EtwWaiter waiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.AboutFlyoutOpenedETWEventName)) - { - navBar.SelectAbout(); - waiter.Wait(); - } - - return new AboutFlyoutLfm(this.ObjectModel.AboutFlyoutPom); - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/MainPagePom.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/MainPagePom.cs deleted file mode 100644 index 7fa70bb..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/MainPagePom.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Etw.Managed; -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; -using MS.Internal.Mita.Foundation.Waiters; - -namespace Calculator.UIAutomationLibrary.Components -{ - /// - /// Physical Object Model for the app window. - /// POM is the implementation model of the app. - /// See https://en.wikipedia.org/wiki/Model-based_testing for model-based testing. - /// - public class MainPagePom : UIObject - { - private const string NavButtonId = "TogglePaneButton"; - private const string SplitViewPaneRootId = "PaneRoot"; - private const string NavBarFlyoutId = "FlyoutNav"; - private const string HeaderId = "Header"; - private const string AboutPageFlyoutId = "AboutPageFlyout"; - - public MainPagePom(UIObject uiObject) - : base(uiObject) - { - } - - public Button NavButton => new Button(this.Descendants.Find(UICondition.CreateFromId(NavButtonId))); - - public UIObject Header => new UIObject(this.Descendants.Find(HeaderId)); - - public NavBarPom NavBarPom => new NavBarPom(this.Children.Find(SplitViewPaneRootId)); - - public EtwWaiter GetNavBarOpenedWaiter() => new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.NavBarOpenedETWEventName); - - public StandardCalculatorPom StandardCalculatorPom => new StandardCalculatorPom(this); - - public ScientificCalculatorPom ScientificCalculatorPom => new ScientificCalculatorPom(this); - - public ProgrammerCalculatorPom ProgrammerCalculatorPom => new ProgrammerCalculatorPom(this); - - public DateCalculatorPom DateCalculatorPom => new DateCalculatorPom(this); - - public UnitConverterPom UnitConverterPom => new UnitConverterPom(this); - - public AboutFlyoutPom AboutFlyoutPom => new AboutFlyoutPom(this.Descendants.Find(AboutPageFlyoutId)); - - public EtwWaiter GetModeChangedWaiter() => new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.AppModeChangeEndETWEventName); - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/NavBarLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/NavBarLfm.cs deleted file mode 100644 index 9201eb9..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/NavBarLfm.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Windows.Automation; -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; -using MS.Internal.Mita.Foundation.Patterns; - -namespace Calculator.UIAutomationLibrary.Components -{ - /// - /// Represents the NavBar of the Calculator app. - /// - public class NavBarLfm : ICanFocusWithClicks - { - /// - /// Initializes a new instance of the class. - /// - /// The NavBarPom that represents the NavBar. - public NavBarLfm(NavBarPom objectModel) - { - this.ObjectModel = objectModel; - } - - public NavBarPom ObjectModel { get; } - - public void SelectStandard() - { - SelectItem(this.ObjectModel.StandardMenuItem); - } - - public void SelectScientific() - { - SelectItem(this.ObjectModel.ScientificMenuItem); - } - - public void SelectProgrammer() - { - SelectItem(this.ObjectModel.ProgrammerMenuItem); - } - - public void SelectDate() - { - SelectItem(this.ObjectModel.DateMenuItem); - } - - public void SelectCurrency() - { - SelectItem(this.ObjectModel.CurrencyMenuItem); - } - - public void SelectVolume() - { - SelectItem(this.ObjectModel.VolumeMenuItem); - } - - public void SelectLength() - { - SelectItem(this.ObjectModel.LengthMenuItem); - } - - public void SelectWeight() - { - SelectItem(this.ObjectModel.WeightMenuItem); - } - - public void SelectTemperature() - { - SelectItem(this.ObjectModel.TemperatureMenuItem); - } - - public void SelectEnergy() - { - SelectItem(this.ObjectModel.EnergyMenuItem); - } - - public void SelectArea() - { - SelectItem(this.ObjectModel.AreaMenuItem); - } - - public void SelectSpeed() - { - SelectItem(this.ObjectModel.SpeedMenuItem); - } - - public void SelectTime() - { - SelectItem(this.ObjectModel.TimeMenuItem); - } - - public void SelectPower() - { - SelectItem(this.ObjectModel.PowerMenuItem); - } - - public void SelectData() - { - SelectItem(this.ObjectModel.DataMenuItem); - } - - public void SelectPressure() - { - SelectItem(this.ObjectModel.PressureMenuItem); - } - - public void SelectAngle() - { - SelectItem(this.ObjectModel.AngleMenuItem); - } - - public void SelectAbout() - { - this.ObjectModel.AboutButton.Invoke(); - } - - public void Close() - { - this.ObjectModel.CloseButton.Invoke(); - } - - public void FocusWithClicks() - { - // To focus (for AccSpot) without changing anything, click to the right of the close button. - Button button = this.ObjectModel.CloseButton; - int xPos = button.BoundingRectangle.Width + Constants.ClickMargin; - int yPos = button.BoundingRectangle.Height / 2; - button.DoubleClick(PointerButtons.Primary, xPos, yPos); - } - - private void SelectItem(ListViewItem item) - { - if (item.IsSelected) - { - this.Close(); - } - else - { - item.Select(); - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/NavBarPom.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/NavBarPom.cs deleted file mode 100644 index 0b8b47a..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/NavBarPom.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Linq; -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; - -namespace Calculator.UIAutomationLibrary.Components -{ - /// - /// Represents the navigation menu. - /// - public class NavBarPom : UIObject - { - private const string StandardId = "Standard"; - private const string ScientificId = "Scientific"; - private const string ProgrammerId = "Programmer"; - private const string DateId = "Date"; - private const string CurrencyId = "Currency"; - private const string VolumeId = "Volume"; - private const string LengthId = "Length"; - private const string WeightId = "Weight"; - private const string TemperatureId = "Temperature"; - private const string EnergyId = "Energy"; - private const string AreaId = "Area"; - private const string SpeedId = "Speed"; - private const string TimeId = "Time"; - private const string PowerId = "Power"; - private const string DataId = "Data"; - private const string PressureId = "Pressure"; - private const string AngleId = "Angle"; - private const string AboutId = "AboutButton"; - private const string CloseId = "TogglePaneButton"; - private const string FlyoutListViewId = "MenuItemsHost"; - private const string ConverterSectionId = "Converter"; - private const string ConverterTextKey = "ConverterModeText"; - - /// - /// Initializes a new instance of the class. - /// - /// The UIObject that is the root of the navigation menu. - public NavBarPom(UIObject uiObject) : base(uiObject) - { - } - - public ListViewItem StandardMenuItem => ScrollAndGetItem(StandardId); - - public ListViewItem ScientificMenuItem => ScrollAndGetItem(ScientificId); - - public ListViewItem ProgrammerMenuItem => ScrollAndGetItem(ProgrammerId); - - public ListViewItem DateMenuItem => ScrollAndGetItem(DateId); - - public ListViewItem CurrencyMenuItem => ScrollAndGetItem(CurrencyId); - - public ListViewItem VolumeMenuItem => ScrollAndGetItem(VolumeId); - - public ListViewItem LengthMenuItem => ScrollAndGetItem(LengthId); - - public ListViewItem WeightMenuItem => ScrollAndGetItem(WeightId); - - public ListViewItem TemperatureMenuItem => ScrollAndGetItem(TemperatureId); - - public ListViewItem EnergyMenuItem => ScrollAndGetItem(EnergyId); - - public ListViewItem AreaMenuItem => ScrollAndGetItem(AreaId); - - public ListViewItem SpeedMenuItem => ScrollAndGetItem(SpeedId); - - public ListViewItem TimeMenuItem => ScrollAndGetItem(TimeId); - - public ListViewItem PowerMenuItem => ScrollAndGetItem(PowerId); - - public ListViewItem DataMenuItem => ScrollAndGetItem(DataId); - - public ListViewItem PressureMenuItem => ScrollAndGetItem(PressureId); - - public ListViewItem AngleMenuItem => ScrollAndGetItem(AngleId); - - public Button AboutButton => new Button(this.Descendants.Find(AboutId)); - - public Button CloseButton => new Button(this.Parent.Children.Find(CloseId)); - - public ListView ModeListView => new ListView(this.Descendants.Find(FlyoutListViewId)); - - private ListViewItem ScrollAndGetItem(string id) - { - ListViewItem item; - var res = this.ModeListView.AllItems.TryFind(id, out item); - - item.ScrollIntoView(); - - return item; - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/ProgrammerCalculatorLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/ProgrammerCalculatorLfm.cs deleted file mode 100644 index 916ec0b..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/ProgrammerCalculatorLfm.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation.Waiters; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class ProgrammerCalculatorLfm - { - public ProgrammerCalculatorLfm(ProgrammerCalculatorPom programmerCalculatorPom) - { - this.ObjectModel = programmerCalculatorPom; - } - - public ProgrammerCalculatorPom ObjectModel { get; } - - public void EnsureFullKeypad() - { - if (!this.ObjectModel.FullKeypadButton.IsSelected) - { - this.ObjectModel.FullKeypadButton.Select(); - } - } - - public void EnsureBitTogglingKeypad() - { - if (!this.ObjectModel.BitFlipKeypadButton.IsSelected) - { - this.ObjectModel.BitFlipKeypadButton.Select(); - } - } - - public void ChangeBitLength() - { - this.ObjectModel.GetCurrentBitLengthButton().Invoke(); - } - - public MemoryLfm OpenMemory() - { - MemoryLfm lfm = new MemoryLfm(this.ObjectModel.MemoryControls); - lfm.OpenBody(); - return lfm; - } - - public void FiveMemorySet() - { - using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - this.ObjectModel.NumberPad.FiveButton.Invoke(); - waiter.TryWait(); - } - - this.ObjectModel.MemoryControls.SetButton.Invoke(); - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/ProgrammerCalculatorPom.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/ProgrammerCalculatorPom.cs deleted file mode 100644 index 90a0786..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/ProgrammerCalculatorPom.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; -using MS.Internal.Mita.Foundation.Waiters; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class ProgrammerCalculatorPom : UIObject - { - private const string FullKeypadButtonId = "fullKeypad"; - private const string BitFlipKeypadButtonId = "bitFlip"; - private const string CalculatorResultsId = "CalculatorResults"; - private const string NumberPadId = "NumberPad"; - - private readonly string[] BitLengthButtonIds = - { - "qwordButton", - "dwordButton", - "wordButton", - "byteButton" - }; - - public ProgrammerCalculatorPom(UIObject uiObject) : base(uiObject) - { - } - - public NumberPadPom NumberPad => new NumberPadPom(this.Descendants.Find(NumberPadId)); - - public MemoryPom MemoryControls => new MemoryPom(this); - - public RadioButton FullKeypadButton => new RadioButton(this.Descendants.Find(FullKeypadButtonId)); - - public RadioButton BitFlipKeypadButton => new RadioButton(this.Descendants.Find(BitFlipKeypadButtonId)); - - public TextBlock Display => new TextBlock(this.Descendants.Find(CalculatorResultsId)); - - public UIEventWaiter GetDisplayChangedWaiter() => this.Display.GetNameChangedWaiter(); - - public Button GetCurrentBitLengthButton() - { - // There are four bit length buttons, with only one visible at a time. - UIObject button = null; - foreach (var buttonId in this.BitLengthButtonIds) - { - if (this.Descendants.TryFind(buttonId, out button)) - { - break; - } - } - - return new Button(button); - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/ScientificCalculatorLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/ScientificCalculatorLfm.cs deleted file mode 100644 index 0320ee3..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/ScientificCalculatorLfm.cs +++ /dev/null @@ -1,138 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation.Waiters; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using WEX.Logging.Interop; - -namespace Calculator.UIAutomationLibrary.Components -{ - /// - /// Represents the Standard calculator view. - /// - public class ScientificCalculatorLfm - { - /// - /// Initializes a new instance of the class. - /// - /// The UIObject that is the root of the scientific Calculator. - public ScientificCalculatorLfm(ScientificCalculatorPom objectModel) - { - this.ObjectModel = objectModel; - } - - public ScientificCalculatorPom ObjectModel { get; } - - public void Press1() - { - using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - Log.Comment("Invoking 1"); - this.ObjectModel.OneButton.Invoke(); - waiter.TryWait(); - } - } - - public void Press2() - { - using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - Log.Comment("Invoking 2"); - this.ObjectModel.NumberPad.TwoButton.Invoke(); - waiter.TryWait(); - } - } - - public void Press3() - { - using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - Log.Comment("Invoking 3"); - this.ObjectModel.ThreeButton.Invoke(); - waiter.TryWait(); - } - } - - public void Press4() - { - using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - Log.Comment("Invoking 4"); - this.ObjectModel.FourButton.Invoke(); - waiter.TryWait(); - } - } - - public void PressSqrt() - { - // When invoking sqrt, both the expression changes. - using (UIEventWaiter waiter = this.ObjectModel.GetExpressionChangedWaiter()) - { - Log.Comment("Invoking sqrt"); - this.ObjectModel.SqrtButton.Invoke(); - waiter.TryWait(); - } - } - - public void PressMinus() - { - using (UIEventWaiter waiter = this.ObjectModel.GetExpressionChangedWaiter()) - { - Log.Comment("Invoking minus"); - this.ObjectModel.MinusButton.Invoke(); - waiter.TryWait(); - } - } - - public void PressPlus() - { - using (UIEventWaiter waiter = this.ObjectModel.GetExpressionChangedWaiter()) - { - Log.Comment("Invoking plus"); - this.ObjectModel.PlusButton.Invoke(); - waiter.TryWait(); - } - } - - public void PressEquals() - { - // When invoking equals, both the display and the expression change. - using (UIEventWaiter expressionWaiter = this.ObjectModel.GetExpressionChangedWaiter()) - using (UIEventWaiter displayWaiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - Log.Comment("Invoking equals"); - this.ObjectModel.EqualButton.Invoke(); - expressionWaiter.TryWait(); - displayWaiter.TryWait(); - } - } - - public void OnePlusTwoEnter() - { - Press1(); - PressPlus(); - Press2(); - PressEquals(); - } - - public void MemorySet() => this.ObjectModel.MemoryControls.SetButton.Invoke(); - - public MemoryLfm OpenMemory() - { - MemoryLfm lfm = new MemoryLfm(this.ObjectModel.MemoryControls); - lfm.OpenBody(); - return lfm; - } - - public HistoryLfm OpenHistory() - { - HistoryLfm lfm = new HistoryLfm(this.ObjectModel.HistoryControls); - lfm.OpenBody(); - return lfm; - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/ScientificCalculatorPom.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/ScientificCalculatorPom.cs deleted file mode 100644 index bb72961..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/ScientificCalculatorPom.cs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; - -namespace Calculator.UIAutomationLibrary.Components -{ - /// - /// Represents the Scientific Calculator - /// - public class ScientificCalculatorPom : CalculatorBasePom - { - private const string NumberPadId = "NumberPad"; - private const string StandardOperatorsId = "StandardOperators"; - private const string DisplayControlsId = "DisplayControls"; - private const string ScientificFunctionsId = "ScientificFunctions"; - private const string OneButtonId = "num1Button"; - private const string ThreeButtonId = "num3Button"; - private const string FourButtonId = "num4Button"; - private const string SqrtButtonId = "squareRootButton"; - private const string MinusButtonId = "minusButton"; - private const string PlusButtonId = "plusButton"; - private const string EqualButtonId = "equalButton"; - private const string ClearButtonId = "clearButton"; - - /// - /// Initializes a new instance of the class. - /// - /// The UIObject that is the root of the scientific calculator. - public ScientificCalculatorPom(UIObject uiObject) : base(uiObject) - { - } - - public UIObject StandardOperatorsGroup => this.Descendants.Find(StandardOperatorsId); - - public UIObject DisplayControlsGroup => this.Descendants.Find(DisplayControlsId); - - public UIObject ScientificFunctionsGroup => this.Descendants.Find(ScientificFunctionsId); - - public Button OneButton => this.NumberPad.OneButton; - - public Button ThreeButton => this.NumberPad.ThreeButton; - - public Button FourButton => this.NumberPad.FourButton; - - public Button SqrtButton => new Button(this.ScientificFunctionsGroup.Children.Find(SqrtButtonId)); - - public Button MinusButton => new Button(this.StandardOperatorsGroup.Children.Find(MinusButtonId)); - - public Button PlusButton => new Button(this.StandardOperatorsGroup.Children.Find(PlusButtonId)); - - public Button EqualButton => new Button(this.StandardOperatorsGroup.Children.Find(EqualButtonId)); - - public Button ClearButton => new Button(this.DisplayControlsGroup.Children.Find(ClearButtonId)); - - public NumberPadPom NumberPad => new NumberPadPom(this.Descendants.Find(NumberPadId)); - - public HistoryPom HistoryControls => new HistoryPom(this); - - public MemoryPom MemoryControls => new MemoryPom(this); - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/StandardCalculatorLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/StandardCalculatorLfm.cs deleted file mode 100644 index 503ece5..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/StandardCalculatorLfm.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation.Waiters; -using WEX.Logging.Interop; - -namespace Calculator.UIAutomationLibrary.Components -{ - /// - /// Represents the Standard calculator view. - /// - public class StandardCalculatorLfm - { - /// - /// Initializes a new instance of the class. - /// - /// The UIObject that is the root of the Standard Calculator. - public StandardCalculatorLfm(StandardCalculatorPom objectModel) - { - this.ObjectModel = objectModel; - } - - public StandardCalculatorPom ObjectModel { get; } - - public void OnePlusTwoEnter() - { - using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - Log.Comment("Invoking 1"); - this.ObjectModel.NumPad.OneButton.Invoke(); - waiter.TryWait(); - } - using (UIEventWaiter waiter = this.ObjectModel.GetExpressionChangedWaiter()) - { - Log.Comment("Pressing +"); - this.ObjectModel.SendKeys("{ADD}"); - // PropertyChangeWaiter is unreliable for the first name changed notification - // Bug 17624996: PropertyChanged event not fired when Name is updated for the first time for a control with custom automation peer. - waiter.TryWait(); - } - using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - Log.Comment("Pressing 2"); - this.ObjectModel.SendKeys("2"); - waiter.TryWait(); - } - // When pressing enter, both the display and the expression change. - using (UIEventWaiter expressionWaiter = this.ObjectModel.GetExpressionChangedWaiter()) - using (UIEventWaiter displayWaiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - Log.Comment("Invoking equals"); - this.ObjectModel.EqualButton.Invoke(); - expressionWaiter.TryWait(); - displayWaiter.TryWait(); - } - } - - public void Clear() - { - using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - Log.Comment("Pressing escape"); - this.ObjectModel.ClearButton.Invoke(); - waiter.TryWait(); - } - } - - public void ClearFiveMemorySet() - { - this.Clear(); - using (UIEventWaiter waiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - this.ObjectModel.NumPad.FiveButton.Invoke(); - waiter.TryWait(); - } - - this.ObjectModel.MemoryControls.SetButton.Invoke(); - } - - public MemoryLfm OpenMemory() - { - MemoryLfm lfm = new MemoryLfm(this.ObjectModel.MemoryControls); - lfm.OpenBody(); - return lfm; - } - - public HistoryLfm OpenHistory() - { - HistoryLfm lfm = new HistoryLfm(this.ObjectModel.HistoryControls); - lfm.OpenBody(); - return lfm; - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/StandardCalculatorPom.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/StandardCalculatorPom.cs deleted file mode 100644 index 8e8d5c4..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/StandardCalculatorPom.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; -using MS.Internal.Mita.Foundation.Waiters; - -namespace Calculator.UIAutomationLibrary.Components -{ - /// - /// Represents the Standard Calculator - /// - public class StandardCalculatorPom : CalculatorBasePom - { - private const string CalculatorResultsId = "CalculatorResults"; - private const string ExpressionContainerId = "CalculatorExpression"; - private const string NumberPadId = "NumberPad"; - private const string StandardOperatorsId = "StandardOperators"; - private const string DisplayControlsId = "DisplayControls"; - private const string EqualButtonId = "equalButton"; - private const string ClearButtonId = "clearButton"; - - /// - /// Initializes a new instance of the class. - /// - /// The UIObject that is the root of the standard calculator. - public StandardCalculatorPom(UIObject uiObject) : base(uiObject) - { - } - - public NumberPadPom NumPad => new NumberPadPom(this.Descendants.Find(NumberPadId)); - - public MemoryPom MemoryControls => new MemoryPom(this); - - public HistoryPom HistoryControls => new HistoryPom(this); - - public UIObject StandardOperatorsGroup => this.Descendants.Find(StandardOperatorsId); - - public UIObject DisplayControlsGroup => this.Descendants.Find(DisplayControlsId); - - public Button EqualButton => new Button(this.StandardOperatorsGroup.Children.Find(EqualButtonId)); - - public Button ClearButton => new Button(this.DisplayControlsGroup.Children.Find(ClearButtonId)); - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/UnitConverterLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/UnitConverterLfm.cs deleted file mode 100644 index 9a17c74..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/UnitConverterLfm.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Calculator.UIAutomationLibrary.Components -{ - public class UnitConverterLfm - { - public UnitConverterLfm(UnitConverterPom unitConverterPom) - { - this.ObjectModel = unitConverterPom; - } - - public UnitConverterPom ObjectModel { get; } - - public void Eight() - { - using (var waiter = this.ObjectModel.GetDisplayChangedWaiter()) - { - this.ObjectModel.NumberPad.EightButton.Invoke(); - waiter.TryWait(); - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Pages/UnitConverterPom.cs b/internal/Calculator.UIAutomationLibrary/Components/Pages/UnitConverterPom.cs deleted file mode 100644 index 23e6a80..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Pages/UnitConverterPom.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; -using MS.Internal.Mita.Foundation.Waiters; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class UnitConverterPom : UIObject - { - private const string DisplayId = "Value1"; - private const string NumberPadId = "numberPad"; - - public UnitConverterPom(UIObject uiObject) : base(uiObject) - { - } - - public NumberPadPom NumberPad => new NumberPadPom(this.Descendants.Find(NumberPadId)); - - public TextBlock Display => new TextBlock(this.Descendants.Find(DisplayId)); - - public PropertyChangedEventWaiter GetDisplayChangedWaiter() => this.Display.GetNameChangedWaiter(); - - public ElementAddedWaiter GetDisplayElementAddedWaiter() => new ElementAddedWaiter(this, Scope.Descendants, DisplayId); - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Shared/HistoryLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/Shared/HistoryLfm.cs deleted file mode 100644 index a186a35..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Shared/HistoryLfm.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Etw.Managed; -using MS.Internal.Mita.Foundation; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class HistoryLfm : ICanFocusWithClicks - { - public HistoryLfm(HistoryPom historyPom) - { - this.ObjectModel = historyPom; - } - - public HistoryPom ObjectModel { get; } - - public void FocusWithClicks() - { - // On the Programming calc, the default click location can land on the first memory item, dismissing the flyout. - // Instead, click just below, in the gutter to the left of the trash can. - var body = this.ObjectModel.Body; - int height = body.BoundingRectangle.Height; - body.DoubleClick(PointerButtons.Primary, Constants.ClickMargin, height + Constants.ClickMargin); - } - - public void OpenBody() - { - using (EtwWaiter waiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.HistoryBodyOpenedETWEventName)) - { - // Only one exists at a given time. - if (this.ObjectModel.IsHistoryButtonVisible) - { - if (!this.ObjectModel.IsBodyOpen) - { - this.ObjectModel.HistoryButton.Invoke(); - waiter.Wait(); - } - } - else if (!this.ObjectModel.HistoryPivot.IsSelected) - { - this.ObjectModel.HistoryPivot.Click(); - waiter.Wait(); - } - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Shared/HistoryPom.cs b/internal/Calculator.UIAutomationLibrary/Components/Shared/HistoryPom.cs deleted file mode 100644 index d5d8d80..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Shared/HistoryPom.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class HistoryPom : UIObject - { - private const string HistoryButtonId = "HistoryButton"; - private const string HistoryPivotId = "HistoryLabel"; - private const string BodyId = "HistoryListView"; - - public HistoryPom(UIObject uiObject) : base(uiObject) - { - } - - public Button HistoryButton => new Button(this.Descendants.Find(HistoryButtonId)); - - public bool IsHistoryButtonVisible => this.DoesDescendantExist(HistoryButtonId); - - public TabItem HistoryPivot => new TabItem(this.Descendants.Find(HistoryPivotId)); - - public UIObject Body => this.Descendants.Find(BodyId); - - public bool IsBodyOpen => this.DoesDescendantExist(BodyId); - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Shared/ICanFocusWithClicks.cs b/internal/Calculator.UIAutomationLibrary/Components/Shared/ICanFocusWithClicks.cs deleted file mode 100644 index bd27cc1..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Shared/ICanFocusWithClicks.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Calculator.UIAutomationLibrary.Components -{ - public interface ICanFocusWithClicks - { - /// - /// Sets focus on an object by clicking on it, without causing further action. - /// Supports AccSpot scans by raising click events. - /// - void FocusWithClicks(); - } -} - diff --git a/internal/Calculator.UIAutomationLibrary/Components/Shared/MemoryLfm.cs b/internal/Calculator.UIAutomationLibrary/Components/Shared/MemoryLfm.cs deleted file mode 100644 index 216acfb..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Shared/MemoryLfm.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using Etw.Managed; -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Waiters; -using WEX.Logging.Interop; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class MemoryLfm : ICanFocusWithClicks - { - public MemoryLfm(MemoryPom memoryPom) - { - this.ObjectModel = memoryPom; - } - - public MemoryPom ObjectModel { get; } - - public void FocusWithClicks() - { - // On the Programming calc, the default click location can land on the first memory item, dismissing the flyout. - // Instead, click just below, in the gutter to the left of the trash can. - var body = this.ObjectModel.Body; - int height = body.BoundingRectangle.Height; - body.DoubleClick(PointerButtons.Primary, Constants.ClickMargin, height + Constants.ClickMargin); - } - - public void OpenBody() - { - using (EtwWaiter waiter = new EtwWaiter(Constants.CalculatorETWProviderGUID, Constants.MemoryBodyOpenedETWEventName)) - { - // Only one exists at a given time - if (this.ObjectModel.IsMemoryButtonVisible) - { - if (!this.ObjectModel.IsBodyOpen) - { - this.ObjectModel.MemoryButton.Invoke(); - waiter.Wait(); - } - } - else if (!this.ObjectModel.MemoryPivot.IsSelected) - { - this.ObjectModel.MemoryPivot.Click(); - waiter.Wait(); - } - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Shared/MemoryPom.cs b/internal/Calculator.UIAutomationLibrary/Components/Shared/MemoryPom.cs deleted file mode 100644 index a235258..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Shared/MemoryPom.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class MemoryPom : UIObject - { - private const string ClearMemoryButtonId = "ClearMemoryButton"; - private const string RecallButtonId = "MemRecall"; - private const string PlusButtonId = "MemPlus"; - private const string MinusButtonId = "MemMinus"; - private const string SetButtonId = "memButton"; - private const string MemoryButtonId = "MemoryButton"; - private const string MemoryPivotId = "MemoryLabel"; - private const string BodyId = "MemoryListView"; - - public MemoryPom(UIObject uiObject) : base(uiObject) - { - } - - public Button ClearButton => new Button(this.Descendants.Find(ClearMemoryButtonId)); - - public Button RecallButton => new Button(this.Descendants.Find(RecallButtonId)); - - public Button PlusButton => new Button(this.Descendants.Find(PlusButtonId)); - - public Button MinusButton => new Button(this.Descendants.Find(MinusButtonId)); - - public Button SetButton => new Button(this.Descendants.Find(SetButtonId)); - - public Button MemoryButton => new Button(this.Descendants.Find(MemoryButtonId)); - - public bool IsMemoryButtonVisible => this.DoesDescendantExist(MemoryButtonId); - - public TabItem MemoryPivot => new TabItem(this.Descendants.Find(MemoryPivotId)); - - public UIObject Body => this.Descendants.Find(BodyId); - - public bool IsBodyOpen => this.DoesDescendantExist(BodyId); - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Components/Shared/NumberPadPom.cs b/internal/Calculator.UIAutomationLibrary/Components/Shared/NumberPadPom.cs deleted file mode 100644 index 6da757f..0000000 --- a/internal/Calculator.UIAutomationLibrary/Components/Shared/NumberPadPom.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; - -namespace Calculator.UIAutomationLibrary.Components -{ - public class NumberPadPom : UIObject - { - private const string OneButtonId = "num1Button"; - private const string TwoButtonId = "num2Button"; - private const string ThreeButtonId = "num3Button"; - private const string FourButtonId = "num4Button"; - private const string FiveButtonId = "num5Button"; - private const string SixButtonId = "num6Button"; - private const string SevenButtonId = "num7Button"; - private const string EightButtonId = "num8Button"; - private const string NineButtonId = "num9Button"; - private const string ZeroButtonId = "num0Button"; - private const string DecimalButtonId = "decimalSeparatorButton"; - - public NumberPadPom(UIObject uiObject) : base(uiObject) - { - } - - public Button ZeroButton => new Button(this.Children.Find(ZeroButtonId)); - - public Button OneButton => new Button(this.Children.Find(OneButtonId)); - - public Button TwoButton => new Button(this.Children.Find(TwoButtonId)); - - public Button ThreeButton => new Button(this.Children.Find(ThreeButtonId)); - - public Button FourButton => new Button(this.Children.Find(FourButtonId)); - - public Button FiveButton => new Button(this.Children.Find(FiveButtonId)); - - public Button SixButton => new Button(this.Children.Find(SixButtonId)); - - public Button SevenButton => new Button(this.Children.Find(SevenButtonId)); - - public Button EightButton => new Button(this.Children.Find(EightButtonId)); - - public Button NineButton => new Button(this.Children.Find(NineButtonId)); - - public Button DecimalButton => new Button(this.Children.Find(DecimalButtonId)); - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Properties/AssemblyInfo.cs b/internal/Calculator.UIAutomationLibrary/Properties/AssemblyInfo.cs deleted file mode 100644 index 89cda6f..0000000 --- a/internal/Calculator.UIAutomationLibrary/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Calculator.UIAutomationLibrary")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("D6913DAD-1C3B-4229-915F-8301A57970FC")] - diff --git a/internal/Calculator.UIAutomationLibrary/Tests/BasicCalculationTest.cs b/internal/Calculator.UIAutomationLibrary/Tests/BasicCalculationTest.cs deleted file mode 100644 index 737584e..0000000 --- a/internal/Calculator.UIAutomationLibrary/Tests/BasicCalculationTest.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Etw.Managed; -using Calculator.UIAutomationLibrary.Components; -using WEX.TestExecution; - -namespace Calculator.UIAutomationLibrary.Tests -{ - public static class BasicCalculationTest - { - /// - /// This test uses LFMs to add and then delete an alarm. - /// - /// The LFM for the alarms app window. - public static void CalculateOnePlusTwo(this CalculatorAppLfm calculatorAppLfm) - { - var mainPage = calculatorAppLfm.MainPageLfm; - - var standardCalculator = mainPage.NavigateToStandardCalculator(); - - standardCalculator.OnePlusTwoEnter(); - - Verify.AreEqual("\u202D3\u202C", standardCalculator.ObjectModel.Display.Name, "Ensure display value is 3"); - - standardCalculator.Clear(); - - Verify.AreEqual("\u202D0\u202C", standardCalculator.ObjectModel.Display.Name, "Ensure display value is 0"); - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Tests/ScientificCalculationTest.cs b/internal/Calculator.UIAutomationLibrary/Tests/ScientificCalculationTest.cs deleted file mode 100644 index 7a2b8e7..0000000 --- a/internal/Calculator.UIAutomationLibrary/Tests/ScientificCalculationTest.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Calculator.UIAutomationLibrary.Components; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using WEX.TestExecution; - -namespace Calculator.UIAutomationLibrary.Tests -{ - public static class ScientificCalculationTest - { - /// - /// This test uses LFMs to calculate the sqrt(4) - 2. - /// - /// The LFM for the calculator app window. - public static void CalculateSqrt4Minus2(this CalculatorAppLfm calculatorAppLfm) - { - var mainPage = calculatorAppLfm.MainPageLfm; - - var scientificCalculator = mainPage.NavigateToScientificCalculator(); - - scientificCalculator.Press4(); - scientificCalculator.PressSqrt(); - scientificCalculator.PressMinus(); - scientificCalculator.Press3(); - scientificCalculator.PressPlus(); - scientificCalculator.Press1(); - scientificCalculator.PressEquals(); - - Verify.AreEqual("\u202D0\u202C", scientificCalculator.ObjectModel.Display.Name); - } - } -} - diff --git a/internal/Calculator.UIAutomationLibrary/Utilities/Constants.cs b/internal/Calculator.UIAutomationLibrary/Utilities/Constants.cs deleted file mode 100644 index 4a8957d..0000000 --- a/internal/Calculator.UIAutomationLibrary/Utilities/Constants.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; - -namespace Calculator.UIAutomationLibrary -{ - public class Constants - { - /// - /// The path to the certificate file. - /// - public const string CertificateFileName = @"Calculator.cer"; - - /// - /// The path to the appxbundle file. - /// - public const string PackageFileName = @"Calculator.appxbundle"; - - /// - /// The path to the appxbundle file. - /// - public const string VCLibsPackageFileName = @"Microsoft.VCLibs.appx"; - - /// - /// The path to the appxbundle file. - /// - public const string WinUIPackageFileName = @"Microsoft.UI.Xaml.appx"; - - /// - /// Name of the CoreWindow. - /// - public const string AppWindowName = "Calculator"; - - /// - /// Name of the process executable. - /// - public const string ProcessName = "Calculator.exe"; - - /// - /// The package name. - /// - public const string PackageName = "Microsoft.WindowsCalculator"; - - /// - /// The package family name for the app to test. - /// - public const string PackageFamilyName = PackageName + "_8wekyb3d8bbwe"; - - /// - /// The package App User Model Id. - /// - public const string PackageAppUserModelId = PackageFamilyName + "!App"; - - /// - /// AutomationId for the top level UI element. - /// - public const string TopLevelWindowAutomationId = "CalculatorWindow"; - - /// - /// Event fired when the first page is loaded. - /// - public const string AppLaunchEndETWEventName = "AppLaunchEnd"; - - /// - /// App Provider GUID for ETW Events - /// - public static readonly Guid CalculatorETWProviderGUID = new Guid("0905CA09-610E-401E-B650-2F212980B9E0"); - - /// - /// Event fired when a calculator mode change is complete. - /// - public const string AppModeChangeEndETWEventName = "ModeChangeEnd"; - - /// - /// Event fired when the History panel is opened by flyout or by changing pivot tabs. - /// - public const string HistoryBodyOpenedETWEventName = "HistoryBodyOpened"; - - /// - /// Event fired when the Memory panel is opened by flyout or by changing pivot tabs. - /// - public const string MemoryBodyOpenedETWEventName = "MemoryBodyOpened"; - - /// - /// Event fired when the About flyout control is loaded. - /// - public const string AboutFlyoutOpenedETWEventName = "AboutFlyoutOpened"; - - /// - /// Event fired when the Nav Bar control is opened. - /// - public const string NavBarOpenedETWEventName = "NavBarOpened"; - - /// - /// Margin used to click in the gutter beneath the History and Memory lists - /// - public const int ClickMargin = 10; - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Utilities/EtwHelper.cs b/internal/Calculator.UIAutomationLibrary/Utilities/EtwHelper.cs deleted file mode 100644 index d1615ee..0000000 --- a/internal/Calculator.UIAutomationLibrary/Utilities/EtwHelper.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.OneCoreUap.Test.AppModel; -using WEX.Logging.Interop; - -namespace Calculator.UIAutomationLibrary -{ - public class EtwHelper - { - private static bool etwServiceWasInstalled = false; - - /// - /// Installs and starts the Etw.Service so that Tests may utilize Etw Waiters. - /// Wex.Services.exe is part of TAEF. - /// - public static void InstallAndStartETWService() - { - etwServiceWasInstalled = ServiceHelper.IsInstalled("Etw.Service"); - if (!etwServiceWasInstalled) - { - string wexServices = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), "Wex.Services.exe"); - if (!File.Exists(wexServices)) - { - throw new FileNotFoundException(wexServices); - } - - Log.Comment("Attempting to install Etw.Service..."); - var startInfo = new ProcessStartInfo(); - startInfo.FileName = wexServices; - startInfo.Arguments = "/install:Etw.Service"; - - var process = new Process(); - process.StartInfo = startInfo; - if (process.Start()) - { - process.WaitForExit(); - Log.Comment("Completed installation of Etw.Service"); - } - else - { - throw new Exception("ETW service was not able to be installed. Process didn't start."); - } - } - - Log.Comment("Attempting to start Etw.Service..."); - ServiceHelper.Start("Etw.Service"); - Log.Comment("Etw.Service started"); - } - - /// - /// Stops the Etw.Service. - /// - public static void StopAndRemoveETWService() - { - if (ServiceHelper.IsInstalled("Etw.Service")) - { - Log.Comment("Attempting to stop Etw.Service..."); - ServiceHelper.Stop("Etw.Service"); - Log.Comment("Etw.Service stopped"); - - // if we installed the Etw.Service as part of this test we should also remove it. - // This prevents cases where TDP is upgraded but the service tregistration is referencing the old - // location that no longer exists. - if (!etwServiceWasInstalled) - { - - string wexServices = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), "Wex.Services.exe"); - if (!File.Exists(wexServices)) - { - throw new FileNotFoundException(wexServices); - } - - Log.Comment("Attempting to remove Etw.Service..."); - var startInfo = new ProcessStartInfo(); - startInfo.FileName = wexServices; - startInfo.Arguments = "/remove:Etw.Service"; - - var process = new Process(); - process.StartInfo = startInfo; - if (process.Start()) - { - process.WaitForExit(); - Log.Comment("Completed removal of Etw.Service"); - } - else - { - throw new Exception("ETW service could not be removed. Process didn't start."); - } - } - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Utilities/Impersonator.cs b/internal/Calculator.UIAutomationLibrary/Utilities/Impersonator.cs deleted file mode 100644 index 1b31b38..0000000 --- a/internal/Calculator.UIAutomationLibrary/Utilities/Impersonator.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Microsoft.Win32.SafeHandles; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Security.Principal; -using System.Text; -using System.Threading.Tasks; - -namespace Calculator.UIAutomationLibrary -{ - public static class Impersonater - { - public static void RunAs(RunAsUser user, Action action) - { - IntPtr errorInfo; - SafeAccessTokenHandle restrictedToken; - GetRunAsUserToken getRunAsUserToken = ResolveGetRunAsUserTokenMethod(); - Marshal.ThrowExceptionForHR(getRunAsUserToken(user, out restrictedToken, out errorInfo), errorInfo); - - WindowsIdentity.RunImpersonated(restrictedToken, action); - } - - public static void RunAs(RunAsUser user, Func function) - { - IntPtr errorInfo; - SafeAccessTokenHandle restrictedToken; - GetRunAsUserToken getRunAsUserToken = ResolveGetRunAsUserTokenMethod(); - Marshal.ThrowExceptionForHR(getRunAsUserToken(user, out restrictedToken, out errorInfo), errorInfo); - - WindowsIdentity.RunImpersonated(restrictedToken, function); - } - - // From: https://microsoft.visualstudio.com/EngSys/_git/validation.taef?path=%2Fsrc%2FTAEF%2FCommon%2FPublished%2FRunAsFromSystem.h&version=GBdevelop - public enum RunAsUser - { - ElevatedUser, - User, - RestrictedUser, - LowIL, - InteractiveUser, - }; - - [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - private delegate int GetRunAsUserToken(RunAsUser user, out SafeAccessTokenHandle token, out IntPtr errorInfo); - - // GetRunAsUserToken is defined in a namespace so we have to do some tricks to use P/Invoke. - // We got the actual exported method name by running dumpbin /exports TE.Common.dll - private static GetRunAsUserToken ResolveGetRunAsUserTokenMethod() - { - IntPtr teCommonDll = IntPtr.Zero; - try - { - teCommonDll = LoadLibrary(@"TE.Common.dll"); - - IntPtr x64GetRunAsUserToken = GetProcAddress(teCommonDll, "?GetRunAsUserToken@TestExecution@WEX@@YAJW4RunAsUser@12@PEAPEAXPEAPEAUIErrorInfo@@@Z"); - if (x64GetRunAsUserToken != IntPtr.Zero) - { - return Marshal.GetDelegateForFunctionPointer(x64GetRunAsUserToken); - } - IntPtr x86GetRunAsUserToken = GetProcAddress(teCommonDll, "?GetRunAsUserToken@TestExecution@WEX@@YGJW4RunAsUser@12@PAPAXPAPAUIErrorInfo@@@Z"); - if (x86GetRunAsUserToken != IntPtr.Zero) - { - return Marshal.GetDelegateForFunctionPointer(x86GetRunAsUserToken); - } - IntPtr armGetRunAsUserToken = GetProcAddress(teCommonDll, "?GetRunAsUserToken@TestExecution@WEX@@YAJW4RunAsUser@12@PAPAXPAPAUIErrorInfo@@@Z"); - if (armGetRunAsUserToken != IntPtr.Zero) - { - return Marshal.GetDelegateForFunctionPointer(armGetRunAsUserToken); - } - IntPtr arm64GetRunAsUserToken = GetProcAddress(teCommonDll, "?GetRunAsUserToken@TestExecution@WEX@@YAJW4RunAsUser@12@PEAPEAXPEAPEAUIErrorInfo@@@Z"); - if (arm64GetRunAsUserToken != IntPtr.Zero) - { - return Marshal.GetDelegateForFunctionPointer(arm64GetRunAsUserToken); - } - - throw new Exception("Unable to find the GetRunAsUserToken function in DLL 'TE.Common.dll'"); - } - finally - { - if (teCommonDll != IntPtr.Zero) - { - FreeLibrary(teCommonDll); - } - } - } - - [DllImport("kernel32.dll")] - public static extern IntPtr LoadLibrary(string dllToLoad); - - [DllImport("kernel32.dll")] - public static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName); - - [DllImport("kernel32.dll")] - public static extern bool FreeLibrary(IntPtr hModule); - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Utilities/InstallHelper.cs b/internal/Calculator.UIAutomationLibrary/Utilities/InstallHelper.cs deleted file mode 100644 index d9760be..0000000 --- a/internal/Calculator.UIAutomationLibrary/Utilities/InstallHelper.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.IO; -using System.Linq; -using System.Security.Cryptography.X509Certificates; -using System.Threading; -using Microsoft.OneCoreUap.Test.AppModel; -using WEX.Logging.Interop; -using Windows.Foundation; -using Windows.Management.Deployment; - -namespace Calculator.UIAutomationLibrary -{ - public class InstallHelper - { - public static void InstallCertFile(string certFilePath) - { - // Ensure cert exists. - if (!File.Exists(certFilePath)) - { - throw new FileNotFoundException(certFilePath); - } - - // For some reason, attempting to use CertificateHelper.InstallFromSignedPackage() to install - // the certificate associated with the appx package fails with the error: - // "A certificate chain could not be built to a trusted root authority." - // The reason is that the cert needs to be installed in 'StoreName.TrustedPeople', - // but DeploymentHelper.AddPackage() attempts to install it in 'StoreName.Root'. - // Therefore, the cert has been installed manually beforehand. - Log.Comment($"Starting install of certificate at {certFilePath}"); - - X509Certificate2 certificate = new X509Certificate2(certFilePath); - X509Store trustedPeopleStore = new X509Store(StoreName.TrustedPeople, StoreLocation.LocalMachine); - trustedPeopleStore.Open(OpenFlags.MaxAllowed); - trustedPeopleStore.Add(certificate); - - Log.Comment($"Completed install of certificate"); - } - - /// - /// Upgrades the appx/appxbundle from the path if needed. - /// - public static void InstallPackage(string appxFilePath, params string[] dependencyAppxFilePaths) - { - // Ensure the files exist. - if (!File.Exists(appxFilePath)) - { - throw new FileNotFoundException(appxFilePath); - } - foreach (var path in dependencyAppxFilePaths.Where(p => !File.Exists(p))) - { - throw new FileNotFoundException(path); - } - - Log.Comment($"Starting install of app package at {appxFilePath}"); - - PackageManager packageManager = new PackageManager(); - var deploymentOperation = packageManager.AddPackageAsync( - new Uri(appxFilePath), - dependencyAppxFilePaths.Select(d => new Uri(d)), - DeploymentOptions.ForceApplicationShutdown | DeploymentOptions.ForceTargetApplicationShutdown | DeploymentOptions.ForceUpdateFromAnyVersion); - - WaitForDeploymentOperation(deploymentOperation); - - Log.Comment("Completed install of app package"); - } - - /// - /// Waits for a deployment operation to complete - /// - private static void WaitForDeploymentOperation(IAsyncOperationWithProgress operation) - { - ManualResetEvent isCompletedEvent = new ManualResetEvent(false); - operation.Completed = (IAsyncOperationWithProgress asyncInfo, AsyncStatus asyncStatus) => - { - isCompletedEvent.Set(); - }; - - isCompletedEvent.WaitOne(); - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Utilities/NativeMethods.cs b/internal/Calculator.UIAutomationLibrary/Utilities/NativeMethods.cs deleted file mode 100644 index 39d50bb..0000000 --- a/internal/Calculator.UIAutomationLibrary/Utilities/NativeMethods.cs +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Runtime.InteropServices; -using System.Text; - -namespace Calculator.UIAutomationLibrary -{ - internal static class NativeMethods - { - internal const int GW_OWNER = 4; - - internal delegate bool EnumThreadWindowsCallback(IntPtr hWnd, IntPtr lParam); - - [DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)] - internal static extern bool EnumWindows(EnumThreadWindowsCallback callback, IntPtr extraData); - - [DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)] - internal static extern int GetWindowThreadProcessId(IntPtr handle, out int processId); - - [DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)] - internal static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int nMaxCount); - - [DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)] - internal static extern int GetWindowTextLength(IntPtr hWnd); - - [DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)] - internal static extern bool IsWindowVisible(IntPtr hWnd); - - [DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)] - internal static extern int GetWindowLong(IntPtr hWnd, int nIndex); - - [DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)] - internal static extern IntPtr GetWindow(IntPtr hWnd, int uCmd); - - [DllImport("api-ms-win-ntuser-ie-window-l1-1-0.dll", SetLastError = true)] - internal static extern bool SetForegroundWindow(IntPtr hWnd); - - [DllImport("api-ms-win-service-management-l1-1-0.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool StartService(IntPtr hService, int dwNumServiceArgs, string[] lpServiceArgVectors); - - [DllImport("api-ms-win-service-management-l1-1-0.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool ControlService(IntPtr hService, SERVICE_CONTROL dwControl, ref SERVICE_STATUS lpServiceStatus); - - [DllImport("api-ms-win-service-management-l1-1-0.dll")] - internal static extern IntPtr OpenSCManager(string machineName, string databaseName, uint dwAccess); - - [DllImport("api-ms-win-service-management-l1-1-0.dll", SetLastError = true)] - [return: MarshalAs(UnmanagedType.Bool)] - internal static extern bool CloseServiceHandle(IntPtr hSCObject); - - [DllImport("api-ms-win-service-management-l1-1-0.dll", SetLastError = true, CharSet = CharSet.Unicode)] - internal static extern IntPtr OpenService(IntPtr hSCManager, string lpServiceName, uint dwDesiredAccess); - - [DllImport("api-ms-win-service-management-l1-1-0.dll", SetLastError = true)] - internal static extern bool QueryServiceStatus(IntPtr hService, ref SERVICE_STATUS dwServiceStatus); - - [StructLayout(LayoutKind.Sequential, Pack = 1)] - internal struct SERVICE_STATUS - { - public int dwServiceType; - public int dwCurrentState; - public int dwControlsAccepted; - public int dwWin32ExitCode; - public int dwServiceSpecificExitCode; - public int dwCheckPoint; - public int dwWaitHint; - } - - internal static uint STANDARD_RIGHTS_REQUIRED = 0xF0000; - - internal static uint SC_MANAGER_CONNECT = 0x0001; - internal static uint SC_MANAGER_CREATE_SERVICE = 0x0002; - internal static uint SC_MANAGER_ENUMERATE_SERVICE = 0x0004; - internal static uint SC_MANAGER_LOCK = 0x0008; - internal static uint SC_MANAGER_QUERY_LOCK_STATUS = 0x0010; - internal static uint SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020; - internal static uint SC_MANAGER_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | - SC_MANAGER_CONNECT | - SC_MANAGER_CREATE_SERVICE | - SC_MANAGER_ENUMERATE_SERVICE | - SC_MANAGER_LOCK | - SC_MANAGER_QUERY_LOCK_STATUS | - SC_MANAGER_MODIFY_BOOT_CONFIG); - - internal static uint SERVICE_QUERY_CONFIG = 0x0001; - internal static uint SERVICE_CHANGE_CONFIG = 0x0002; - internal static uint SERVICE_QUERY_STATUS = 0x0004; - internal static uint SERVICE_ENUMERATE_DEPENDENTS = 0x0008; - internal static uint SERVICE_START = 0x0010; - internal static uint SERVICE_STOP = 0x0020; - internal static uint SERVICE_PAUSE_CONTINUE = 0x0040; - internal static uint SERVICE_INTERROGATE = 0x0080; - internal static uint SERVICE_USER_DEFINED_CONTROL = 0x0100; - internal static uint SERVICE_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | - SERVICE_QUERY_CONFIG | - SERVICE_CHANGE_CONFIG | - SERVICE_QUERY_STATUS | - SERVICE_ENUMERATE_DEPENDENTS | - SERVICE_START | - SERVICE_STOP | - SERVICE_PAUSE_CONTINUE | - SERVICE_INTERROGATE | - SERVICE_USER_DEFINED_CONTROL); - - [Flags] - internal enum SERVICE_CONTROL : uint - { - STOP = 0x00000001, - PAUSE = 0x00000002, - CONTINUE = 0x00000003, - INTERROGATE = 0x00000004, - SHUTDOWN = 0x00000005, - PARAMCHANGE = 0x00000006, - NETBINDADD = 0x00000007, - NETBINDREMOVE = 0x00000008, - NETBINDENABLE = 0x00000009, - NETBINDDISABLE = 0x0000000A, - DEVICEEVENT = 0x0000000B, - HARDWAREPROFILECHANGE = 0x0000000C, - POWEREVENT = 0x0000000D, - SESSIONCHANGE = 0x0000000E - } - - internal enum SERVICE_STATE : int - { - SERVICE_STOPPED = 0x00000001, - SERVICE_START_PENDING = 0x00000002, - SERVICE_STOP_PENDING = 0x00000003, - SERVICE_RUNNING = 0x00000004, - SERVICE_CONTINUE_PENDING = 0x00000005, - SERVICE_PAUSE_PENDING = 0x00000006, - SERVICE_PAUSED = 0x00000007 - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Utilities/PerfTestConstants.cs b/internal/Calculator.UIAutomationLibrary/Utilities/PerfTestConstants.cs deleted file mode 100644 index 02c0206..0000000 --- a/internal/Calculator.UIAutomationLibrary/Utilities/PerfTestConstants.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; - -namespace Calculator.UIAutomationLibrary -{ - public class PerfConstants - { - /// - /// Path where the regions, wprprofiles and wpaprofiles will be deployed to by the spkg. - /// - public const string ConfigDirectory = @"Config\"; - - /// - /// Our FunGates source, where we can view test results. - /// - public const string FunGatesSource = -#if DEBUG - "TestSite"; -#else - "Utility Apps Performance Tests"; -#endif - - /// - /// The Windows Performance Recorder profile. These strings must have the config directory prefix. - /// For use with the WPRProfileFile test attribute. - /// - public const string AppLifecycleWPRProfile = ConfigDirectory + "AppLifecycle.Profile.wprp"; - - /// - /// The regions of interest file that contains the events we are interested in measuring. - /// - public const string AppLifecycleRegions = ConfigDirectory + "AppLifecycle.regions.xml"; - - /// - /// These are uses with the DataSource test property to specify iteration info. - /// - public const string AppLifecycleIterationsSource = "Table:" + ConfigDirectory + "AppLifecycle.Iterations.xml#PerformanceConfigurations"; - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Utilities/ServiceHelper.cs b/internal/Calculator.UIAutomationLibrary/Utilities/ServiceHelper.cs deleted file mode 100644 index 4cae772..0000000 --- a/internal/Calculator.UIAutomationLibrary/Utilities/ServiceHelper.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -namespace Calculator.UIAutomationLibrary -{ - public class ServiceHelper - { - public static void Start(string serviceName, int timeoutInMilliSeconds = 30000) - { - IntPtr hService = IntPtr.Zero; - IntPtr hSCManager = IntPtr.Zero; - try - { - hSCManager = NativeMethods.OpenSCManager(null, null, NativeMethods.SC_MANAGER_ALL_ACCESS); - if (IntPtr.Zero == hSCManager) - { - throw new Exception($"Start: Cannot Open OpenSCManager, {Marshal.GetLastWin32Error()}"); - } - - hService = NativeMethods.OpenService(hSCManager, serviceName, NativeMethods.SERVICE_ALL_ACCESS); - if (IntPtr.Zero == hService) - { - throw new Exception($"Start: Cannot Open Service, {Marshal.GetLastWin32Error()}"); - } - - NativeMethods.SERVICE_STATUS serviceStatus = new NativeMethods.SERVICE_STATUS(); - if (!NativeMethods.QueryServiceStatus(hService, ref serviceStatus)) - { - throw new Exception($"Start: Unable to query status of Service, {Marshal.GetLastWin32Error()}"); - } - - if (serviceStatus.dwCurrentState != (int)NativeMethods.SERVICE_STATE.SERVICE_RUNNING && - serviceStatus.dwCurrentState != (int)NativeMethods.SERVICE_STATE.SERVICE_START_PENDING) - { - if (!NativeMethods.StartService(hService, 0, null)) - { - throw new Exception($"Start: Service cannot be started, {Marshal.GetLastWin32Error()}"); - } - } - - WaitForStatus(hService, NativeMethods.SERVICE_STATE.SERVICE_RUNNING, TimeSpan.FromMilliseconds(timeoutInMilliSeconds)); - } - finally - { - if (IntPtr.Zero != hService) - { - NativeMethods.CloseServiceHandle(hService); - } - if (IntPtr.Zero != hSCManager) - { - NativeMethods.CloseServiceHandle(hSCManager); - } - } - } - - public static void Stop(string serviceName, int timeoutInMilliSeconds = 30000) - { - IntPtr hSCManager = IntPtr.Zero; - IntPtr hService = IntPtr.Zero; - try - { - hSCManager = NativeMethods.OpenSCManager(null, null, NativeMethods.SC_MANAGER_ALL_ACCESS); - if (IntPtr.Zero == hSCManager) - { - throw new Exception($"Stop: Cannot Open OpenSCManager, {Marshal.GetLastWin32Error()}"); - } - - hService = NativeMethods.OpenService(hSCManager, serviceName, NativeMethods.SERVICE_ALL_ACCESS); - if (IntPtr.Zero == hService) - { - throw new Exception($"Stop: Cannot Open Service, {Marshal.GetLastWin32Error()}"); - } - - NativeMethods.SERVICE_STATUS serviceStatus = new NativeMethods.SERVICE_STATUS(); - if (!NativeMethods.QueryServiceStatus(hService, ref serviceStatus)) - { - throw new Exception($"Stop: Unable to query status of Service, {Marshal.GetLastWin32Error()}"); - } - - if (serviceStatus.dwCurrentState != (int)NativeMethods.SERVICE_STATE.SERVICE_STOPPED && - serviceStatus.dwCurrentState != (int)NativeMethods.SERVICE_STATE.SERVICE_STOP_PENDING) - { - if (!NativeMethods.ControlService(hService, NativeMethods.SERVICE_CONTROL.STOP, ref serviceStatus)) - { - throw new Exception($"Stop: Service cannot be stopped, {Marshal.GetLastWin32Error()}"); - } - } - - WaitForStatus(hService, NativeMethods.SERVICE_STATE.SERVICE_STOPPED, TimeSpan.FromMilliseconds(timeoutInMilliSeconds)); - } - finally - { - if (IntPtr.Zero != hService) - { - NativeMethods.CloseServiceHandle(hService); - } - - if (IntPtr.Zero != hSCManager) - { - NativeMethods.CloseServiceHandle(hSCManager); - } - } - } - - public static bool IsInstalled(string svcName) - { - IntPtr sc_handle = NativeMethods.OpenSCManager(null, null, NativeMethods.SC_MANAGER_ALL_ACCESS); - if (sc_handle == IntPtr.Zero) - { - throw new Exception($"IsInstalled: Cannot open service manager, {Marshal.GetLastWin32Error()}"); - } - - bool bResult = false; - IntPtr sv_handle = NativeMethods.OpenService(sc_handle, svcName, NativeMethods.SERVICE_QUERY_CONFIG); - if (sv_handle.ToInt64() != 0) - { - bResult = true; - NativeMethods.CloseServiceHandle(sv_handle); - } - NativeMethods.CloseServiceHandle(sc_handle); - return bResult; - } - - private static void WaitForStatus(IntPtr hService, NativeMethods.SERVICE_STATE desiredStatus, TimeSpan timeout) - { - Stopwatch swLoop = new Stopwatch(); - swLoop.Start(); - - NativeMethods.SERVICE_STATUS serviceStatus = new NativeMethods.SERVICE_STATUS(); - - do - { - Thread.Sleep(500); - if (!NativeMethods.QueryServiceStatus(hService, ref serviceStatus)) - { - throw new Exception($"WaitForStatus: Unable to query status of service, {Marshal.GetLastWin32Error()}"); - } - } - while (serviceStatus.dwCurrentState != (int)desiredStatus && (swLoop.ElapsedMilliseconds <= timeout.TotalMilliseconds)); - - if (serviceStatus.dwCurrentState != (int)desiredStatus) - { - throw new Exception($"WaitForStatus: Service failed to reach desired state: {desiredStatus}, current state: {serviceStatus.dwCurrentState}"); - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Utilities/UIObjectExtensions.cs b/internal/Calculator.UIAutomationLibrary/Utilities/UIObjectExtensions.cs deleted file mode 100644 index c77f4d6..0000000 --- a/internal/Calculator.UIAutomationLibrary/Utilities/UIObjectExtensions.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Linq; -using System.Windows.Automation; -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; -using MS.Internal.Mita.Foundation.Waiters; -using WEX.Logging.Interop; - -namespace Calculator.UIAutomationLibrary -{ - public static class UIObjectExtensions - { - private const string NamePropertyName = "Name"; - private static UICondition CoreWindowCondition = UICondition.CreateFromClassName("Windows.UI.Core.CoreWindow"); - - public static Window GetParentCoreWindow(this UIObject uiObject) - { - if (uiObject.Matches(CoreWindowCondition)) - { - return new Window(uiObject); - } - - return new Window(uiObject.Ancestors.Find(CoreWindowCondition)); - } - - public static Window GetTopLevelWindow(this Window window) - { - var node = window; - while (node != null && node.Parent != null && node.Parent.ControlType == ControlType.Window) - { - node = new Window(node.Parent); - } - return node; - } - - public static void VerifyParentTreeStructure(this UIObject uiObject) - { - var node = uiObject; - while (node != null && node.Parent != null) - { - if (!node.Parent.Children.Contains(node)) - { - Log.Comment($"- [VerifyingTree] {node} specifies {node.Parent} as parent but is not part of its children."); - } - if (!node.Parent.Descendants.Contains(node)) - { - Log.Comment($"- [VerifyingTree] {node} specifies {node.Parent} as parent but is not part of its descendants."); - } - node = node.Parent; - } - } - - public static bool DoesDescendantExist(this UIObject uiObject, string automationId) - { - UIObject temp; - return uiObject.Descendants.TryFind(automationId, out temp); - } - - public static PropertyChangedEventWaiter GetNameChangedWaiter(this TextBlock textBlock) - { - return new PropertyChangedEventWaiter(textBlock, UIProperty.Get(NamePropertyName)); - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Utilities/Utilities.cs b/internal/Calculator.UIAutomationLibrary/Utilities/Utilities.cs deleted file mode 100644 index c8dd58d..0000000 --- a/internal/Calculator.UIAutomationLibrary/Utilities/Utilities.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Diagnostics; -using System.IO; -using WEX.Logging.Interop; - -namespace Calculator.UIAutomationLibrary -{ - public class Utilities - { - public static void KillExistingCalculatorProcesses() - { - Log.Comment("Killing any existing Calculator processes"); - - foreach (var process in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(Constants.ProcessName))) - { - try - { - process.Kill(); - Log.Comment($"Killed {process.ProcessName}, Id: {process.Id}"); - } - catch (Exception) when (process.HasExited) - { - Log.Comment($"{process.ProcessName}, Id: {process.Id} already exited."); - } - } - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/Utilities/WindowHelper.cs b/internal/Calculator.UIAutomationLibrary/Utilities/WindowHelper.cs deleted file mode 100644 index bf19700..0000000 --- a/internal/Calculator.UIAutomationLibrary/Utilities/WindowHelper.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation.Controls; -using WEX.Logging.Interop; - -namespace Calculator.UIAutomationLibrary -{ - public class WindowHelper - { - public static void SetAsForeground(Window window) - { - Log.Comment($"Set window {window.NativeWindowHandle} as the foreground window."); - - NativeMethods.SetForegroundWindow(window.NativeWindowHandle); - } - } -} diff --git a/internal/Calculator.UIAutomationLibrary/project.json b/internal/Calculator.UIAutomationLibrary/project.json deleted file mode 100644 index 71f67e1..0000000 --- a/internal/Calculator.UIAutomationLibrary/project.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "dependencies": { - "AppModel.TestHelper": "2018.3.22", - "EtwProcessor.Managed": "10.34.181220007", - "MITALite": "1.0.180128001", - "Taef.Managed": "10.34.181220007", - "Test.Net.Redist": "2.0.1" - }, - "frameworks": { - "netcore50": {} - } -} \ No newline at end of file diff --git a/internal/Calculator.UITests/Calculator.UITests.csproj b/internal/Calculator.UITests/Calculator.UITests.csproj deleted file mode 100644 index 70da6c2..0000000 --- a/internal/Calculator.UITests/Calculator.UITests.csproj +++ /dev/null @@ -1,145 +0,0 @@ - - - - - Debug - x86 - {0224A709-0C48-4C4F-BA17-843A49842C15} - Library - Properties - Calculator.UITests - Calculator.UITests - .NETPortable - v5.0 - .NETCore,Version=v5.0 - UAP - 10.0.17763.0 - 10.0.17134.0 - 512 - true - - - true - full - false - bin\Debug\x86 - DEBUG;TRACE - prompt - 4 - x86 - - - pdbonly - true - bin\Release\x86 - TRACE - prompt - 4 - x86 - - - true - full - false - bin\Debug\x64 - DEBUG;TRACE - prompt - 4 - x64 - - - pdbonly - true - bin\Release\x64 - TRACE - prompt - 4 - x64 - - - true - full - false - bin\Debug\arm - DEBUG;TRACE - prompt - 4 - ARM - - - pdbonly - true - bin\Release\arm - TRACE - prompt - 4 - ARM - - - true - full - false - bin\Debug\ARM64\ - DEBUG;TRACE - prompt - 4 - ARM64 - - - pdbonly - true - bin\Release\ARM64\ - TRACE - prompt - 4 - ARM64 - - - - - - - - - - - PreserveNewest - - - TextTemplatingFileGenerator - AppLifecycle.Regions.xml - Designer - - - AppLifecycle.Regions.tt - True - PreserveNewest - True - - - - - - - {a43517b5-8be3-4312-913f-004978c34444} - Calculator.UIAutomationLibrary - - - - - Designer - PreserveNewest - - - - 15.0 - - - - \ No newline at end of file diff --git a/internal/Calculator.UITests/Config/AppLifecycle.Iterations.xml b/internal/Calculator.UITests/Config/AppLifecycle.Iterations.xml deleted file mode 100644 index 65cec85..0000000 --- a/internal/Calculator.UITests/Config/AppLifecycle.Iterations.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - -
-
diff --git a/internal/Calculator.UITests/Config/AppLifecycle.Profile.wprp b/internal/Calculator.UITests/Config/AppLifecycle.Profile.wprp deleted file mode 100644 index 6fe8afd..0000000 --- a/internal/Calculator.UITests/Config/AppLifecycle.Profile.wprp +++ /dev/null @@ -1,526 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/internal/Calculator.UITests/Config/AppLifecycle.Regions.tt b/internal/Calculator.UITests/Config/AppLifecycle.Regions.tt deleted file mode 100644 index acd8ead..0000000 --- a/internal/Calculator.UITests/Config/AppLifecycle.Regions.tt +++ /dev/null @@ -1,364 +0,0 @@ -<# // Copyright (c) Microsoft Corporation. All rights reserved. #> -<#@ template language="C#" hostspecific="True" #> -<#@ output extension=".xml" #> -<# // Set options specific to your app here -var options = new { - RegionPrefix = "Calculator", - ImageFileName = "Calculator.exe", - PackageFamilyName = "Microsoft.WindowsCalculator", - FirstView = "ms-resource:///Files/Views/MainPage.xbf" -}; -#> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - - - - - - - - - - - - CPU - <#= options.ImageFileName #> - Commit - <#= options.ImageFileName #> - - - - - - - diff --git a/internal/Calculator.UITests/Config/AppLifecycle.Regions.xml b/internal/Calculator.UITests/Config/AppLifecycle.Regions.xml deleted file mode 100644 index e9ee8ae..0000000 --- a/internal/Calculator.UITests/Config/AppLifecycle.Regions.xml +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - - - - - - - - - - - - CPU - Calculator.exe - Commit - Calculator.exe - - - - - - - diff --git a/internal/Calculator.UITests/Initialization.cs b/internal/Calculator.UITests/Initialization.cs deleted file mode 100644 index bb254fb..0000000 --- a/internal/Calculator.UITests/Initialization.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.IO; -using System.Runtime.InteropServices; -using Calculator.UIAutomationLibrary; -using Microsoft.OneCoreUap.Test.AppModel; -using WEX.TestExecution; -using WEX.TestExecution.Markup; - -namespace Calculator.UITests -{ - [TestClass] - public class Initialization - { - [DllImport("AppModel.TestHelper.dll")] - private static extern Int32 WinRTHelper_Register(); - - [AssemblyInitialize] - [TestProperty("CoreClrProfile", "TestNetv2.0")] - [TestProperty("RunFixtureAs:Assembly", "System")] - public static void AssemblySetup(TestContext context) - { - Verify.AreEqual(0, WinRTHelper_Register()); - TestHelper.Initialize(); - - // Install and Start the Etw.Service service to enable the use of EtwWaiter. - EtwHelper.InstallAndStartETWService(); - - bool installApp = false; - if (context.Properties.Contains("InstallApp") && (bool.TryParse(context.Properties["InstallApp"].ToString(), out installApp)) && installApp) - { - string certToDeploy = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), Constants.CertificateFileName); - InstallHelper.InstallCertFile(certToDeploy); - - string vcLibsToDeploy = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), Constants.VCLibsPackageFileName); - string winUIToDeploy = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), Constants.WinUIPackageFileName); - string appxToDeploy = Path.Combine(TAEFHelper.GetTestDeploymentDirectory(), Constants.PackageFileName); - Impersonater.RunAs(Impersonater.RunAsUser.RestrictedUser, () => InstallHelper.InstallPackage(appxToDeploy, vcLibsToDeploy, winUIToDeploy)); - } - } - - [AssemblyCleanup] - [TestProperty("RunFixtureAs:Assembly", "System")] - public static void AssemblyCleanup() - { - // Stop and remove the Etw.Service service. - EtwHelper.StopAndRemoveETWService(); - - TestHelper.Uninitialize(); - } - } -} diff --git a/internal/Calculator.UITests/Properties/AssemblyInfo.cs b/internal/Calculator.UITests/Properties/AssemblyInfo.cs deleted file mode 100644 index c644176..0000000 --- a/internal/Calculator.UITests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("UIAutomationTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] - -[assembly: AssemblyCulture("")] - - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("f5e8f9b8-f7f1-4300-a5cb-35bfab83f51e")] -// The following was autogenerated by UpdateVersion.ps1 -[assembly: AssemblyProduct(@"10.16.1128.1252")] diff --git a/internal/Calculator.UITests/Tests/AppLifecycleTests.cs b/internal/Calculator.UITests/Tests/AppLifecycleTests.cs deleted file mode 100644 index 2b34625..0000000 --- a/internal/Calculator.UITests/Tests/AppLifecycleTests.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Linq; -using Etw.Managed; -using Microsoft.Windows.Apps.Performance; -using WEX.Logging.Interop; -using WEX.TestExecution; -using WEX.TestExecution.Markup; -using Calculator.UIAutomationLibrary; - -namespace Calculator.PerfTests -{ - [TestClass] - public class AppLifecycleTests - { - [TestInitialize] - [TestProperty("RunAs", "ElevatedUserOrSystem")] - public void MethodSetup() - { - Utilities.KillExistingCalculatorProcesses(); - } - - [TestCleanup] - [TestProperty("RunAs", "ElevatedUserOrSystem")] - public void MethodCleanup() - { - Utilities.KillExistingCalculatorProcesses(); - } - - /// - /// This method executes the AppLifecycle performance test. - /// The test launches the application, suspend and resumes it and then terminates the app. - /// - /// A TAEF data source is used to specify the Windows Performance Recorder profile and - /// regions of interest file to use and defines three different configurations to execute this test with. - /// Cold: The initial run to get dlls loaded into memory and to execute any first-run app logic. - /// Warm: The run that will produce consistent results and that would be used for measures. - /// Memory: A run that is focused on collecting more info on allocations. - /// - [TestMethod] - [TestProperty("RunAs", "User")] - [TestProperty("Category", "Performance")] - [TestProperty(WinperfConstants.DataSource, PerfConstants.AppLifecycleIterationsSource)] - public void AppLifecycleTest() - { - AppLifecycle.Run(Constants.PackageAppUserModelId); - } - } -} diff --git a/internal/Calculator.UITests/Tests/CalculatorTests.cs b/internal/Calculator.UITests/Tests/CalculatorTests.cs deleted file mode 100644 index 718830e..0000000 --- a/internal/Calculator.UITests/Tests/CalculatorTests.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Calculator.UIAutomationLibrary; -using Calculator.UIAutomationLibrary.Tests; -using WEX.TestExecution.Markup; - -namespace Calculator.UITests -{ - [TestClass] - public class CalculatorTests - { - [TestInitialize] - [TestProperty("RunAs", "ElevatedUserOrSystem")] - public void MethodSetup() - { - Utilities.KillExistingCalculatorProcesses(); - } - - [TestCleanup] - [TestProperty("RunAs", "ElevatedUserOrSystem")] - public void MethodCleanup() - { - Utilities.KillExistingCalculatorProcesses(); - } - - [TestMethod] - [TestProperty("RunAs", "User")] - public void OnePlusTwoTest() - { - var calculatorLfm = CalculatorAppLauncher.Launch(); - - calculatorLfm.CalculateOnePlusTwo(); - - calculatorLfm.Close(); - } - - [TestMethod] - [TestProperty("RunAs", "User")] - public void Sqrt4Minus2Test() - { - var calculatorLfm = CalculatorAppLauncher.Launch(); - - calculatorLfm.CalculateSqrt4Minus2(); - - calculatorLfm.Close(); - } - } -} diff --git a/internal/Calculator.UITests/Tests/LaunchTests.cs b/internal/Calculator.UITests/Tests/LaunchTests.cs deleted file mode 100644 index 9af376a..0000000 --- a/internal/Calculator.UITests/Tests/LaunchTests.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using MS.Internal.Mita.Foundation; -using MS.Internal.Mita.Foundation.Controls; -using MS.Internal.Mita.Foundation.Waiters; -using System; -using WEX.TestExecution; -using WEX.TestExecution.Markup; -using System.Runtime.InteropServices; -using Microsoft.OneCoreUap.Test.AppModel; -using System.IO; -using Calculator.UITests; -using Calculator.UIAutomationLibrary; - -namespace Calculator.UITests -{ - [TestClass] - public class LaunchTests - { - [TestInitialize] - [TestProperty("RunAs", "ElevatedUserOrSystem")] - public void MethodSetup() - { - Utilities.KillExistingCalculatorProcesses(); - } - - [TestCleanup] - [TestProperty("RunAs", "ElevatedUserOrSystem")] - public void MethodCleanup() - { - Utilities.KillExistingCalculatorProcesses(); - } - - [TestMethod] - [TestProperty("RunAs", "User")] - public void NormalLaunchTest() - { - var calculatorLfm = CalculatorAppLauncher.Launch(); - calculatorLfm.Close(); - } - } -} diff --git a/internal/Calculator.UITests/project.json b/internal/Calculator.UITests/project.json deleted file mode 100644 index 790fc2a..0000000 --- a/internal/Calculator.UITests/project.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "dependencies": { - "AppModel.TestHelper": "2018.3.22", - "EtwProcessor.Managed": "10.34.181220007", - "Microsoft.TestInfrastructure.UniversalTest": "1.0.20181107.1", - "Microsoft.Windows.Apps.Performance": "1.0.7", - "MITALite": "1.0.180128001", - "Taef.Managed": "10.34.181220007", - "Test.Net.Redist": "2.0.1" - }, - "frameworks": { - "netcore50": {} - }, - "runtimes": { - "win10-arm": {}, - "win10-x64": {}, - "win10-x86": {} - } -} \ No newline at end of file diff --git a/internal/Calculator.UITests/testmd.definition b/internal/Calculator.UITests/testmd.definition deleted file mode 100644 index c65b246..0000000 --- a/internal/Calculator.UITests/testmd.definition +++ /dev/null @@ -1,73 +0,0 @@ -{ - "$schema": "http://universaltest/schema/testmddefinition-4.json", - "Package": { - "ComponentName": "Calculator", - "SubComponentName": "UITests" - }, - "SupportedArchitectures": [ "All" ], - "Execution": { - "Type": "TAEF", - "Parameter": "/ScreenCaptureOnError /TestMode:EnsureLoggedOnUser", - "ExecutionTimeoutInMinutes": "30" - }, - "Dependencies": { - "Files": [ - { - "SourcePath": "$(OUT_DIR)Calculator.UIAutomationLibrary.dll", - "DestinationFolderPath": "$$(TEST_DEPLOY_BIN)" - }, - { - "SourcePath": "$(OUT_DIR)Microsoft.Windows.Apps.Performance.dll", - "DestinationFolderPath": "$$(TEST_DEPLOY_BIN)" - }, - { - "SourcePath": "$(OUT_DIR)Config\\AppLifecycle.Profile.wprp", - "DestinationFolderPath": "$$(TEST_DEPLOY_BIN)\\Config\\" - }, - { - "SourcePath": "$(OUT_DIR)Config\\AppLifecycle.Regions.xml", - "DestinationFolderPath": "$$(TEST_DEPLOY_BIN)\\Config\\" - }, - { - "SourcePath": "$(OUT_DIR)Config\\AppLifecycle.Iterations.xml", - "DestinationFolderPath": "$$(TEST_DEPLOY_BIN)\\Config\\" - } - ], - "Packages": [ - "Microsoft-Windows-Test-Taef", - "Microsoft-Windows-Test-EtwProcessor", - "Microsoft-Test-Taef-EnsureLoggedOnUserTestMode", - "Microsoft-Test-Taef-EtwLoggerTestMode", - "Microsoft-Windows-Test-MitaLite", - "Microsoft-Windows-Test-TestNetV2.0", - "Microsoft-OneCoreUap-Test-AppModel-AreaLibrary" - ] - }, - "Logs": [], - "Plugins": [], - "Profiles": [ - { - "Name": "All", - "Execution": { - "AdditionalParameter": "/TestMode:EtwLogger /p:InstallApp=true /select:not(@Category='Performance')" - }, - "Dependencies": { - "AdditionalPackages": [ - "Microsoft-Calculator-App" - ] - } - }, - { - "Name": "Performance", - "Execution": { - "AdditionalParameter": "/TestMode:WinPerf /WinPerf:Upload=Full /winperf:WinPerfSource=\"Utility Apps Performance Tests\" /winperf:VersionProcess=Calculator.exe /winperf:VersionImage=Calculator.exe /p:InstallApp=true /select:@Category='Performance'" - }, - "Dependencies": { - "AdditionalPackages": [ - "Microsoft-Windows-Performance-Winperf-Winperf", - "Microsoft-Calculator-App" - ] - } - } - ] -} diff --git a/internal/CalculatorInternal.sln b/internal/CalculatorInternal.sln deleted file mode 100644 index 98be0fb..0000000 --- a/internal/CalculatorInternal.sln +++ /dev/null @@ -1,77 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2036 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Calculator.UIAutomationLibrary", "Calculator.UIAutomationLibrary\Calculator.UIAutomationLibrary.csproj", "{A43517B5-8BE3-4312-913F-004978C34444}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Calculator.UITests", "Calculator.UITests\Calculator.UITests.csproj", "{0224A709-0C48-4C4F-BA17-843A49842C15}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{E73C8A6E-BB94-4258-ACED-7C837A6A587B}" - ProjectSection(SolutionItems) = preProject - nuget.config = nuget.config - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Calculator.TestPackage", "Calculator.TestPackage\Calculator.TestPackage.csproj", "{24767C43-CD5A-4DC9-8D6B-429F255524E5}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|ARM64 = Debug|ARM64 - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM - Release|ARM64 = Release|ARM64 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A43517B5-8BE3-4312-913F-004978C34444}.Debug|ARM.ActiveCfg = Debug|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Debug|ARM.Build.0 = Debug|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Debug|x64.ActiveCfg = Debug|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Debug|x64.Build.0 = Debug|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Debug|x86.ActiveCfg = Debug|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Debug|x86.Build.0 = Debug|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Release|ARM.ActiveCfg = Release|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Release|ARM.Build.0 = Release|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Release|ARM64.ActiveCfg = Release|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Release|x64.ActiveCfg = Release|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Release|x64.Build.0 = Release|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Release|x86.ActiveCfg = Release|Any CPU - {A43517B5-8BE3-4312-913F-004978C34444}.Release|x86.Build.0 = Release|Any CPU - {0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|ARM.ActiveCfg = Debug|ARM - {0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|ARM.Build.0 = Debug|ARM - {0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|x64.ActiveCfg = Debug|x64 - {0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|x64.Build.0 = Debug|x64 - {0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|x86.ActiveCfg = Debug|x86 - {0224A709-0C48-4C4F-BA17-843A49842C15}.Debug|x86.Build.0 = Debug|x86 - {0224A709-0C48-4C4F-BA17-843A49842C15}.Release|ARM.ActiveCfg = Release|ARM - {0224A709-0C48-4C4F-BA17-843A49842C15}.Release|ARM.Build.0 = Release|ARM - {0224A709-0C48-4C4F-BA17-843A49842C15}.Release|ARM64.ActiveCfg = Release|ARM64 - {0224A709-0C48-4C4F-BA17-843A49842C15}.Release|x64.ActiveCfg = Release|x64 - {0224A709-0C48-4C4F-BA17-843A49842C15}.Release|x64.Build.0 = Release|x64 - {0224A709-0C48-4C4F-BA17-843A49842C15}.Release|x86.ActiveCfg = Release|x86 - {0224A709-0C48-4C4F-BA17-843A49842C15}.Release|x86.Build.0 = Release|x86 - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|ARM.ActiveCfg = Debug|ARM - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|ARM.Build.0 = Debug|ARM - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|x64.ActiveCfg = Debug|x64 - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|x64.Build.0 = Debug|x64 - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|x86.ActiveCfg = Debug|x86 - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Debug|x86.Build.0 = Debug|x86 - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|ARM.ActiveCfg = Release|ARM - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|ARM.Build.0 = Release|ARM - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|ARM64.ActiveCfg = Release|ARM64 - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|x64.ActiveCfg = Release|x64 - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|x64.Build.0 = Release|x64 - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|x86.ActiveCfg = Release|x86 - {24767C43-CD5A-4DC9-8D6B-429F255524E5}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {97D9888A-CF9F-4147-8CCE-71093C057452} - EndGlobalSection -EndGlobal diff --git a/internal/Readme.txt b/internal/Readme.txt deleted file mode 100644 index b515432..0000000 --- a/internal/Readme.txt +++ /dev/null @@ -1 +0,0 @@ -This directory contains projects that have dependencies on internal Microsoft tools and that are not necessary to build Calculator. \ No newline at end of file diff --git a/internal/Settings.XamlStyler b/internal/Settings.XamlStyler deleted file mode 100644 index 6fc7c48..0000000 --- a/internal/Settings.XamlStyler +++ /dev/null @@ -1,39 +0,0 @@ -{ - "AttributesTolerance": 2, - "KeepFirstAttributeOnSameLine": true, - "MaxAttributeCharatersPerLine": 0, - "MaxAttributesPerLine": 1, - "NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransfom, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter", - "SeparateByGroups": false, - "EnableAttributeReordering": true, - "AttributeOrderingRuleGroups": [ - "x:Class*", - "xmlns, xmlns:x", - "xmlns:*", - "x:Key, Key, x:Name, Name, x:Uid, Uid, Title", - "Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, Canvas.Left, Canvas.Top, Canvas.Right, Canvas.Bottom", - "Width, Height, MinWidth, MinHeight, MaxWidth, MaxHeight", - "Margin, Padding, HorizontalAlignment, VerticalAlignment, HorizontalContentAlignment, VerticalContentAlignment, Panel.ZIndex", - "Style, Background, Foreground, Fill, BorderBrush, BorderThickness, Stroke, StrokeThickness, Opacity", - "FontFamily, FontSize, LineHeight, FontWeight, FontStyle, FontStretch", - "*:*, *", - "PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint", - "mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText" - ], - "OrderAttributesByName": true, - "PutEndingBracketOnNewLine": false, - "RemoveEndingTagOfEmptyElement": true, - "SpaceBeforeClosingSlash": false, - "RootElementLineBreakRule": 0, - "ReorderVSM": 1, - "ReorderGridChildren": false, - "ReorderCanvasChildren": false, - "ReorderSetters": 0, - "FormatMarkupExtension": true, - "NoNewLineMarkupExtensions": "x:Bind, Binding", - "ThicknessSeparator": 2, - "ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin", - "FormatOnSave": true, - "CommentPadding": 1, - "IndentSize": 4 -} \ No newline at end of file diff --git a/internal/nuget.config b/internal/nuget.config deleted file mode 100644 index 606b630..0000000 --- a/internal/nuget.config +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - -