-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create uitest for keyboardmanager and api for element clicking by hel… (
#37007) Create uitest for keyboardmanager and api for element clicking by helpText Co-authored-by: Xiaofeng Wang (from Dev Box) <[email protected]>
- Loading branch information
Showing
4 changed files
with
165 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/modules/keyboardmanager/KeyboardManagerUITests/KeyboardManagerUITests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<!-- Look at Directory.Build.props in root for common stuff as well --> | ||
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" /> | ||
|
||
<PropertyGroup> | ||
<ProjectGuid>{6F8C7C5A-130A-48C2-A245-3132A4121E24}</ProjectGuid> | ||
<RootNamespace>Microsoft.KeyboardManager.UITests</RootNamespace> | ||
<IsPackable>false</IsPackable> | ||
<Nullable>enable</Nullable> | ||
<OutputType>Library</OutputType> | ||
|
||
<!-- This is a UI test, so don't run as part of MSBuild --> | ||
<RunVSTest>false</RunVSTest> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<OutputPath>..\..\..\..\$(Platform)\$(Configuration)\tests\KeyboardManagerUITests\</OutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="MSTest" /> | ||
<PackageReference Include="System.IO.Abstractions" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Folder Include="Properties\" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\UITestAPI\UITestAPI.csproj" /> | ||
</ItemGroup> | ||
</Project> |
73 changes: 73 additions & 0 deletions
73
src/modules/keyboardmanager/KeyboardManagerUITests/RunKeyboardManagerUITests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright (c) Microsoft Corporation | ||
// The Microsoft Corporation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using Microsoft.UITests.API; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace UITests_KeyboardManager | ||
{ | ||
[TestClass] | ||
public class RunKeyboardManagerUITests | ||
{ | ||
private const string PowerToysSettingsPath = @"\..\..\..\WinUI3Apps\PowerToys.Settings.exe"; | ||
private static UITestAPI? _uITestAPI; | ||
|
||
private static TestContext? _context; | ||
|
||
[AssemblyInitialize] | ||
public static void SetupAll(TestContext context) | ||
{ | ||
Debug.WriteLine("AssemblyInitialize executed"); | ||
} | ||
|
||
[AssemblyCleanup] | ||
public static void CleanupAll() | ||
{ | ||
Debug.WriteLine("AssemblyCleanup executed"); | ||
} | ||
|
||
[ClassInitialize] | ||
public static void ClassInitialize(TestContext testContext) | ||
{ | ||
_uITestAPI = new UITestAPI(); | ||
_uITestAPI.Init(PowerToysSettingsPath); | ||
Debug.WriteLine("ClassInitialize executed"); | ||
} | ||
|
||
[ClassCleanup] | ||
public static void ClassCleanup() | ||
{ | ||
if (_uITestAPI != null && _context != null) | ||
{ | ||
_uITestAPI.Close(_context); | ||
} | ||
|
||
_context = null; | ||
Debug.WriteLine("ClassCleanup executed"); | ||
} | ||
|
||
[TestInitialize] | ||
public void TestInitialize() | ||
{ | ||
Debug.WriteLine("TestInitialize executed"); | ||
} | ||
|
||
[TestCleanup] | ||
public void TestCleanup() | ||
{ | ||
Debug.WriteLine("TestCleanup executed"); | ||
} | ||
|
||
[TestMethod] | ||
public void EnableKeyboardManager() // verify the session is initialized | ||
{ | ||
Debug.WriteLine("Test method executed"); | ||
Assert.IsNotNull(_uITestAPI); | ||
_uITestAPI.Click_Element("Enable module", "Keyboard Manager"); | ||
} | ||
} | ||
} |
e801ca2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@check-spelling-bot Report
🔴 Please review
See the 📜action log or 📝 job summary for details.
Unrecognized words (1)
ITest
These words are not needed and should be removed
accctrl aclapi AMPROPERTY AMPROPSETID appdata Appium appmodel atlbase atlcom atlfile atlstr bootstrapper caniuse CDEF ceq cguid Cmds cne codicon comdef commandline commctrl commdlg comutil consts contentdialog cppwinrt CRSEL crx dcommon dcomp DCs ddf desktopwindowxamlsource devenum DEVMON devpkey DEVSOURCE DIIRFLAG dshow DVH DVHD DVSD DVSL dxgidebug dxgiformat EData emmintrin Emoji endpointvolume ERole evntrace exdisp fdw FILEINFOSIG Filtergraph Filterx Functiondiscoverykeys guiddef HCERTSTORE hinstance hstring IKs iljxck Intelli ipreviewhandlervisualssetfont IYUV junja Knownfolders KSPROPERTY lcb ldx lld lmcons LONGLONG lpt LTRB majortype makecab MEDIASUBTYPE mediatype mfapi mfidl mfobjects mfplat mftransform mic Minimatch mjpg mmdeviceapi mmsystem msedge Msimg msiquery newdev nodoc notlike ntfs Objbase objidl ORAW outpin outputtype overlaywindow pathcch PAUDIO PINDIR Pnp ppmt Preinstalled previouscamera processthreadsapi PROPBAG propkey propvarutil redistributable reencode reencoded REFGUID REGFILTER REGFILTERPINS REGPINTYPES regsvr Renamer reparse restrictederrorinfo roadmap ruleset runtimes shellapi shellscalingapi shldisp shlobj shmem sizeread stl strsafe strutil subquery SWC SYNCMFT tailwindcss tapp thumbcache tlhelp TMPVAR Toolset touchpad Tsd uninstantiated uniquifier Unknwn unregistering urlmon USERDATA vcdl vdi verrsrc vid VIDCAP VIDEOINFOHEADER vih wcautil webcam wincodec Wincodecsdk windef windowsapp windowsx winerror winevt winexe winforms winsdkver winternl wistd wsl wtsapi WVCTo accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands
... in a clone of the [email protected]:microsoft/PowerToys.git repository
on the
zhaopengwang/UITestAPI
branch (ℹ️ how do I use this?):If the flagged items are 🤯 false positives
If items relate to a ...
binary file (or some other file you wouldn't want to check at all).
Please add a file path to the
excludes.txt
file matching the containing file.File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.
^
refers to the file's path from the root of the repository, so^README\.md$
would exclude README.md (on whichever branch you're using).well-formed pattern.
If you can write a pattern that would match it,
try adding it to the
patterns.txt
file.Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.
Note that patterns can't match multiline strings.