WinAppDriver tests (#1371)

* added test project
* added FancyZonesSettings tests
This commit is contained in:
Seraphima Zykova 2020-03-17 18:03:02 +03:00 committed by GitHub
parent 72eb76191f
commit 419fc15d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 1519 additions and 17 deletions

View File

@ -1,4 +1,4 @@


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28803.452
@ -138,6 +138,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "action_runner", "src\action
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "msi_to_msix_upgrade_lib", "src\common\msi_to_msix_upgrade_lib\msi_to_msix_upgrade_lib.vcxproj", "{17DA04DF-E393-4397-9CF0-84DABE11032E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E775CC2C-24CB-48D6-9C3A-BE4CCE0DB17A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "win-app-driver", "src\tests\win-app-driver\win-app-driver.csproj", "{880ED251-9E16-4713-9A70-D35FE0C01669}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "previewpane", "previewpane", "{2F305555-C296-497E-AC20-5FA1B237996A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PreviewHandlerCommon", "src\modules\previewpane\Common\PreviewHandlerCommon.csproj", "{AF2349B8-E5B6-4004-9502-687C1C7730B1}"
@ -154,136 +158,222 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "powerpreviewTest", "src\mod
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Debug|Any CPU.ActiveCfg = Debug|x64
{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Debug|x64.ActiveCfg = Debug|x64
{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Debug|x64.Build.0 = Debug|x64
{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Release|Any CPU.ActiveCfg = Release|x64
{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Release|x64.ActiveCfg = Release|x64
{9412D5C6-2CF2-4FC2-A601-B55508EA9B27}.Release|x64.Build.0 = Release|x64
{74485049-C722-400F-ABE5-86AC52D929B3}.Debug|Any CPU.ActiveCfg = Debug|x64
{74485049-C722-400F-ABE5-86AC52D929B3}.Debug|x64.ActiveCfg = Debug|x64
{74485049-C722-400F-ABE5-86AC52D929B3}.Debug|x64.Build.0 = Debug|x64
{74485049-C722-400F-ABE5-86AC52D929B3}.Release|Any CPU.ActiveCfg = Release|x64
{74485049-C722-400F-ABE5-86AC52D929B3}.Release|x64.ActiveCfg = Release|x64
{74485049-C722-400F-ABE5-86AC52D929B3}.Release|x64.Build.0 = Release|x64
{A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Debug|Any CPU.ActiveCfg = Debug|x64
{A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Debug|x64.ActiveCfg = Debug|x64
{A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Debug|x64.Build.0 = Debug|x64
{A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Release|Any CPU.ActiveCfg = Release|x64
{A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Release|x64.ActiveCfg = Release|x64
{A46629C4-1A6C-40FA-A8B6-10E5102BB0BA}.Release|x64.Build.0 = Release|x64
{44CC9375-3E6E-4D99-8913-7FB748807EBD}.Debug|Any CPU.ActiveCfg = Debug|x64
{44CC9375-3E6E-4D99-8913-7FB748807EBD}.Debug|x64.ActiveCfg = Debug|x64
{44CC9375-3E6E-4D99-8913-7FB748807EBD}.Debug|x64.Build.0 = Debug|x64
{44CC9375-3E6E-4D99-8913-7FB748807EBD}.Release|Any CPU.ActiveCfg = Release|x64
{44CC9375-3E6E-4D99-8913-7FB748807EBD}.Release|x64.ActiveCfg = Release|x64
{44CC9375-3E6E-4D99-8913-7FB748807EBD}.Release|x64.Build.0 = Release|x64
{07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|Any CPU.ActiveCfg = Debug|x64
{07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|x64.ActiveCfg = Debug|x64
{07C389E3-6BC8-41CF-923E-307B1265FA2D}.Debug|x64.Build.0 = Debug|x64
{07C389E3-6BC8-41CF-923E-307B1265FA2D}.Release|Any CPU.ActiveCfg = Release|x64
{07C389E3-6BC8-41CF-923E-307B1265FA2D}.Release|x64.ActiveCfg = Release|x64
{07C389E3-6BC8-41CF-923E-307B1265FA2D}.Release|x64.Build.0 = Release|x64
{F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Debug|Any CPU.ActiveCfg = Debug|x64
{F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Debug|x64.ActiveCfg = Debug|x64
{F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Debug|x64.Build.0 = Debug|x64
{F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Release|Any CPU.ActiveCfg = Release|x64
{F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Release|x64.ActiveCfg = Release|x64
{F9C68EDF-AC74-4B77-9AF1-005D9C9F6A99}.Release|x64.Build.0 = Release|x64
{48804216-2A0E-4168-A6D8-9CD068D14227}.Debug|Any CPU.ActiveCfg = Debug|x64
{48804216-2A0E-4168-A6D8-9CD068D14227}.Debug|x64.ActiveCfg = Debug|x64
{48804216-2A0E-4168-A6D8-9CD068D14227}.Debug|x64.Build.0 = Debug|x64
{48804216-2A0E-4168-A6D8-9CD068D14227}.Release|Any CPU.ActiveCfg = Release|x64
{48804216-2A0E-4168-A6D8-9CD068D14227}.Release|x64.ActiveCfg = Release|x64
{48804216-2A0E-4168-A6D8-9CD068D14227}.Release|x64.Build.0 = Release|x64
{9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Debug|Any CPU.ActiveCfg = Debug|x64
{9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Debug|x64.ActiveCfg = Debug|x64
{9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Debug|x64.Build.0 = Debug|x64
{9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Release|Any CPU.ActiveCfg = Release|x64
{9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Release|x64.ActiveCfg = Release|x64
{9C6A7905-72D4-4BF5-B256-ABFDAEF68AE9}.Release|x64.Build.0 = Release|x64
{1A066C63-64B3-45F8-92FE-664E1CCE8077}.Debug|Any CPU.ActiveCfg = Debug|x64
{1A066C63-64B3-45F8-92FE-664E1CCE8077}.Debug|x64.ActiveCfg = Debug|x64
{1A066C63-64B3-45F8-92FE-664E1CCE8077}.Debug|x64.Build.0 = Debug|x64
{1A066C63-64B3-45F8-92FE-664E1CCE8077}.Release|Any CPU.ActiveCfg = Release|x64
{1A066C63-64B3-45F8-92FE-664E1CCE8077}.Release|x64.ActiveCfg = Release|x64
{1A066C63-64B3-45F8-92FE-664E1CCE8077}.Release|x64.Build.0 = Release|x64
{5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Debug|Any CPU.ActiveCfg = Debug|x64
{5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Debug|x64.ActiveCfg = Debug|x64
{5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Debug|x64.Build.0 = Debug|x64
{5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Release|Any CPU.ActiveCfg = Release|x64
{5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Release|x64.ActiveCfg = Release|x64
{5CCC8468-DEC8-4D36-99D4-5C891BEBD481}.Release|x64.Build.0 = Release|x64
{B25AC7A5-FB9F-4789-B392-D5C85E948670}.Debug|Any CPU.ActiveCfg = Debug|Win32
{B25AC7A5-FB9F-4789-B392-D5C85E948670}.Debug|x64.ActiveCfg = Debug|x64
{B25AC7A5-FB9F-4789-B392-D5C85E948670}.Debug|x64.Build.0 = Debug|x64
{B25AC7A5-FB9F-4789-B392-D5C85E948670}.Release|Any CPU.ActiveCfg = Release|Win32
{B25AC7A5-FB9F-4789-B392-D5C85E948670}.Release|x64.ActiveCfg = Release|x64
{B25AC7A5-FB9F-4789-B392-D5C85E948670}.Release|x64.Build.0 = Release|x64
{51920F1F-C28C-4ADF-8660-4238766796C2}.Debug|Any CPU.ActiveCfg = Debug|Win32
{51920F1F-C28C-4ADF-8660-4238766796C2}.Debug|x64.ActiveCfg = Debug|x64
{51920F1F-C28C-4ADF-8660-4238766796C2}.Debug|x64.Build.0 = Debug|x64
{51920F1F-C28C-4ADF-8660-4238766796C2}.Release|Any CPU.ActiveCfg = Release|Win32
{51920F1F-C28C-4ADF-8660-4238766796C2}.Release|x64.ActiveCfg = Release|x64
{51920F1F-C28C-4ADF-8660-4238766796C2}.Release|x64.Build.0 = Release|x64
{0E072714-D127-460B-AFAD-B4C40B412798}.Debug|Any CPU.ActiveCfg = Debug|x64
{0E072714-D127-460B-AFAD-B4C40B412798}.Debug|x64.ActiveCfg = Debug|x64
{0E072714-D127-460B-AFAD-B4C40B412798}.Debug|x64.Build.0 = Debug|x64
{0E072714-D127-460B-AFAD-B4C40B412798}.Release|Any CPU.ActiveCfg = Release|x64
{0E072714-D127-460B-AFAD-B4C40B412798}.Release|x64.ActiveCfg = Release|x64
{0E072714-D127-460B-AFAD-B4C40B412798}.Release|x64.Build.0 = Release|x64
{A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Debug|Any CPU.ActiveCfg = Debug|Win32
{A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Debug|x64.ActiveCfg = Debug|x64
{A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Debug|x64.Build.0 = Debug|x64
{A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Release|Any CPU.ActiveCfg = Release|Win32
{A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Release|x64.ActiveCfg = Release|x64
{A3935CF4-46C5-4A88-84D3-6B12E16E6BA2}.Release|x64.Build.0 = Release|x64
{2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Debug|Any CPU.ActiveCfg = Debug|Win32
{2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Debug|x64.ActiveCfg = Debug|x64
{2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Debug|x64.Build.0 = Debug|x64
{2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Release|Any CPU.ActiveCfg = Release|Win32
{2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Release|x64.ActiveCfg = Release|x64
{2151F984-E006-4A9F-92EF-C6DDE3DC8413}.Release|x64.Build.0 = Release|x64
{64A80062-4D8B-4229-8A38-DFA1D7497749}.Debug|Any CPU.ActiveCfg = Debug|x64
{64A80062-4D8B-4229-8A38-DFA1D7497749}.Debug|x64.ActiveCfg = Debug|x64
{64A80062-4D8B-4229-8A38-DFA1D7497749}.Debug|x64.Build.0 = Debug|x64
{64A80062-4D8B-4229-8A38-DFA1D7497749}.Release|Any CPU.ActiveCfg = Release|x64
{64A80062-4D8B-4229-8A38-DFA1D7497749}.Release|x64.ActiveCfg = Release|x64
{64A80062-4D8B-4229-8A38-DFA1D7497749}.Release|x64.Build.0 = Release|x64
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Debug|Any CPU.ActiveCfg = Debug|x64
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Debug|x64.ActiveCfg = Debug|x64
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Debug|x64.Build.0 = Debug|x64
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|Any CPU.ActiveCfg = Release|x64
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|x64.ActiveCfg = Release|x64
{0485F45C-EA7A-4BB5-804B-3E8D14699387}.Release|x64.Build.0 = Release|x64
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}.Debug|x64.ActiveCfg = Debug|x64
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}.Debug|x64.Build.0 = Debug|x64
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}.Release|x64.ActiveCfg = Release|x64
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}.Release|x64.Build.0 = Release|x64
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B}.Debug|x64.ActiveCfg = Debug|x64
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B}.Debug|x64.Build.0 = Debug|x64
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B}.Release|x64.ActiveCfg = Release|x64
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B}.Release|x64.Build.0 = Release|x64
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8}.Debug|x64.ActiveCfg = Debug|x64
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8}.Debug|x64.Build.0 = Debug|x64
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8}.Release|x64.ActiveCfg = Release|x64
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8}.Release|x64.Build.0 = Release|x64
{0B593A6C-4143-4337-860E-DB5710FB87DB}.Debug|Any CPU.ActiveCfg = Debug|Win32
{0B593A6C-4143-4337-860E-DB5710FB87DB}.Debug|x64.ActiveCfg = Debug|x64
{0B593A6C-4143-4337-860E-DB5710FB87DB}.Debug|x64.Build.0 = Debug|x64
{0B593A6C-4143-4337-860E-DB5710FB87DB}.Release|Any CPU.ActiveCfg = Release|Win32
{0B593A6C-4143-4337-860E-DB5710FB87DB}.Release|x64.ActiveCfg = Release|x64
{0B593A6C-4143-4337-860E-DB5710FB87DB}.Release|x64.Build.0 = Release|x64
{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Debug|Any CPU.ActiveCfg = Debug|Win32
{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Debug|x64.ActiveCfg = Debug|x64
{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Debug|x64.Build.0 = Debug|x64
{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Release|Any CPU.ActiveCfg = Release|Win32
{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Release|x64.ActiveCfg = Release|x64
{031AC72E-FA28-4AB7-B690-6F7B9C28AA73}.Release|x64.Build.0 = Release|x64
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|Any CPU.ActiveCfg = Debug|x64
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|x64.ActiveCfg = Debug|x64
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Debug|x64.Build.0 = Debug|x64
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|Any CPU.ActiveCfg = Release|x64
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|x64.ActiveCfg = Release|x64
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB}.Release|x64.Build.0 = Release|x64
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Debug|Any CPU.ActiveCfg = Debug|x64
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Debug|x64.ActiveCfg = Debug|x64
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Debug|x64.Build.0 = Debug|x64
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Release|Any CPU.ActiveCfg = Release|x64
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Release|x64.ActiveCfg = Release|x64
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6}.Release|x64.Build.0 = Release|x64
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}.Debug|Any CPU.ActiveCfg = Debug|x64
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}.Debug|x64.ActiveCfg = Debug|x64
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}.Debug|x64.Build.0 = Debug|x64
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}.Release|Any CPU.ActiveCfg = Release|x64
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}.Release|x64.ActiveCfg = Release|x64
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34}.Release|x64.Build.0 = Release|x64
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B}.Debug|Any CPU.ActiveCfg = Debug|Win32
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B}.Debug|x64.ActiveCfg = Debug|x64
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B}.Debug|x64.Build.0 = Debug|x64
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B}.Release|Any CPU.ActiveCfg = Release|Win32
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B}.Release|x64.ActiveCfg = Release|x64
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B}.Release|x64.Build.0 = Release|x64
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8}.Debug|Any CPU.ActiveCfg = Debug|x64
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8}.Debug|x64.ActiveCfg = Debug|x64
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8}.Debug|x64.Build.0 = Debug|x64
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8}.Release|Any CPU.ActiveCfg = Release|x64
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8}.Release|x64.ActiveCfg = Release|x64
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8}.Release|x64.Build.0 = Release|x64
{D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Debug|Any CPU.ActiveCfg = Debug|Win32
{D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Debug|x64.ActiveCfg = Debug|x64
{D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Debug|x64.Build.0 = Debug|x64
{D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Release|Any CPU.ActiveCfg = Release|Win32
{D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Release|x64.ActiveCfg = Release|x64
{D29DDD63-E2CF-4657-9FD5-2AEDE4257E5D}.Release|x64.Build.0 = Release|x64
{17DA04DF-E393-4397-9CF0-84DABE11032E}.Debug|Any CPU.ActiveCfg = Debug|Win32
{17DA04DF-E393-4397-9CF0-84DABE11032E}.Debug|x64.ActiveCfg = Debug|x64
{17DA04DF-E393-4397-9CF0-84DABE11032E}.Debug|x64.Build.0 = Debug|x64
{17DA04DF-E393-4397-9CF0-84DABE11032E}.Release|Any CPU.ActiveCfg = Release|Win32
{17DA04DF-E393-4397-9CF0-84DABE11032E}.Release|x64.ActiveCfg = Release|x64
{17DA04DF-E393-4397-9CF0-84DABE11032E}.Release|x64.Build.0 = Release|x64
{880ED251-9E16-4713-9A70-D35FE0C01669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{880ED251-9E16-4713-9A70-D35FE0C01669}.Debug|Any CPU.Build.0 = Debug|Any CPU
{880ED251-9E16-4713-9A70-D35FE0C01669}.Debug|x64.ActiveCfg = Debug|Any CPU
{880ED251-9E16-4713-9A70-D35FE0C01669}.Debug|x64.Build.0 = Debug|Any CPU
{880ED251-9E16-4713-9A70-D35FE0C01669}.Release|Any CPU.ActiveCfg = Release|Any CPU
{880ED251-9E16-4713-9A70-D35FE0C01669}.Release|Any CPU.Build.0 = Release|Any CPU
{880ED251-9E16-4713-9A70-D35FE0C01669}.Release|x64.ActiveCfg = Release|Any CPU
{880ED251-9E16-4713-9A70-D35FE0C01669}.Release|x64.Build.0 = Release|Any CPU
{AF2349B8-E5B6-4004-9502-687C1C7730B1}.Debug|Any CPU.ActiveCfg = Debug|x64
{AF2349B8-E5B6-4004-9502-687C1C7730B1}.Debug|x64.ActiveCfg = Debug|x64
{AF2349B8-E5B6-4004-9502-687C1C7730B1}.Debug|x64.Build.0 = Debug|x64
{AF2349B8-E5B6-4004-9502-687C1C7730B1}.Release|Any CPU.ActiveCfg = Release|x64
{AF2349B8-E5B6-4004-9502-687C1C7730B1}.Release|x64.ActiveCfg = Release|x64
{AF2349B8-E5B6-4004-9502-687C1C7730B1}.Release|x64.Build.0 = Release|x64
{6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB}.Debug|Any CPU.ActiveCfg = Debug|x64
{6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB}.Debug|x64.ActiveCfg = Debug|x64
{6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB}.Debug|x64.Build.0 = Debug|x64
{6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB}.Release|Any CPU.ActiveCfg = Release|x64
{6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB}.Release|x64.ActiveCfg = Release|x64
{6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB}.Release|x64.Build.0 = Release|x64
{A2B51B8B-8F90-424E-BC97-F9AB7D76CA1A}.Debug|Any CPU.ActiveCfg = Debug|x64
{A2B51B8B-8F90-424E-BC97-F9AB7D76CA1A}.Debug|x64.ActiveCfg = Debug|x64
{A2B51B8B-8F90-424E-BC97-F9AB7D76CA1A}.Debug|x64.Build.0 = Debug|x64
{A2B51B8B-8F90-424E-BC97-F9AB7D76CA1A}.Release|Any CPU.ActiveCfg = Release|x64
{A2B51B8B-8F90-424E-BC97-F9AB7D76CA1A}.Release|x64.ActiveCfg = Release|x64
{A2B51B8B-8F90-424E-BC97-F9AB7D76CA1A}.Release|x64.Build.0 = Release|x64
{DA425894-6E13-404F-8DCB-78584EC0557A}.Debug|Any CPU.ActiveCfg = Debug|x64
{DA425894-6E13-404F-8DCB-78584EC0557A}.Debug|x64.ActiveCfg = Debug|x64
{DA425894-6E13-404F-8DCB-78584EC0557A}.Debug|x64.Build.0 = Debug|x64
{DA425894-6E13-404F-8DCB-78584EC0557A}.Release|Any CPU.ActiveCfg = Release|x64
{DA425894-6E13-404F-8DCB-78584EC0557A}.Release|x64.ActiveCfg = Release|x64
{DA425894-6E13-404F-8DCB-78584EC0557A}.Release|x64.Build.0 = Release|x64
{060D75DA-2D1C-48E6-A4A1-6F0718B64661}.Debug|Any CPU.ActiveCfg = Debug|x64
{060D75DA-2D1C-48E6-A4A1-6F0718B64661}.Debug|x64.ActiveCfg = Debug|x64
{060D75DA-2D1C-48E6-A4A1-6F0718B64661}.Debug|x64.Build.0 = Debug|x64
{060D75DA-2D1C-48E6-A4A1-6F0718B64661}.Release|Any CPU.ActiveCfg = Release|x64
{060D75DA-2D1C-48E6-A4A1-6F0718B64661}.Release|x64.ActiveCfg = Release|x64
{060D75DA-2D1C-48E6-A4A1-6F0718B64661}.Release|x64.Build.0 = Release|x64
{748417CA-F17E-487F-9411-CAFB6D3F4877}.Debug|Any CPU.ActiveCfg = Debug|x64
{748417CA-F17E-487F-9411-CAFB6D3F4877}.Debug|x64.ActiveCfg = Debug|x64
{748417CA-F17E-487F-9411-CAFB6D3F4877}.Debug|x64.Build.0 = Debug|x64
{748417CA-F17E-487F-9411-CAFB6D3F4877}.Release|Any CPU.ActiveCfg = Release|x64
{748417CA-F17E-487F-9411-CAFB6D3F4877}.Release|x64.ActiveCfg = Release|x64
{748417CA-F17E-487F-9411-CAFB6D3F4877}.Release|x64.Build.0 = Release|x64
{217DF501-135C-4E38-BFC8-99D4821032EA}.Debug|Any CPU.ActiveCfg = Debug|x64
{217DF501-135C-4E38-BFC8-99D4821032EA}.Debug|x64.ActiveCfg = Debug|x64
{217DF501-135C-4E38-BFC8-99D4821032EA}.Debug|x64.Build.0 = Debug|x64
{217DF501-135C-4E38-BFC8-99D4821032EA}.Release|Any CPU.ActiveCfg = Release|x64
{217DF501-135C-4E38-BFC8-99D4821032EA}.Release|x64.ActiveCfg = Release|x64
{217DF501-135C-4E38-BFC8-99D4821032EA}.Release|x64.Build.0 = Release|x64
{47310AB4-9034-4BD1-8D8B-E88AD21A171B}.Debug|Any CPU.ActiveCfg = Debug|Win32
{47310AB4-9034-4BD1-8D8B-E88AD21A171B}.Debug|x64.ActiveCfg = Debug|x64
{47310AB4-9034-4BD1-8D8B-E88AD21A171B}.Debug|x64.Build.0 = Debug|x64
{47310AB4-9034-4BD1-8D8B-E88AD21A171B}.Release|Any CPU.ActiveCfg = Release|Win32
{47310AB4-9034-4BD1-8D8B-E88AD21A171B}.Release|x64.ActiveCfg = Release|x64
{47310AB4-9034-4BD1-8D8B-E88AD21A171B}.Release|x64.Build.0 = Release|x64
EndGlobalSection
@ -309,16 +399,17 @@ Global
{2151F984-E006-4A9F-92EF-C6DDE3DC8413} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
{64A80062-4D8B-4229-8A38-DFA1D7497749} = {BEEAB7F2-FFF6-45AB-9CDB-B04CC0734B88}
{0485F45C-EA7A-4BB5-804B-3E8D14699387} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
{6C7F47CC-2151-44A3-A546-41C70025132C} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34} = {6C7F47CC-2151-44A3-A546-41C70025132C}
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B} = {6C7F47CC-2151-44A3-A546-41C70025132C}
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8} = {6C7F47CC-2151-44A3-A546-41C70025132C}
{0B593A6C-4143-4337-860E-DB5710FB87DB} = {1AFB6476-670D-4E80-A464-657E01DFF482}
{031AC72E-FA28-4AB7-B690-6F7B9C28AA73} = {1AFB6476-670D-4E80-A464-657E01DFF482}
{8DC78AF7-DC3E-4C57-A8FB-7E347DE74A03} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{B9BDF8BE-FED7-49B5-A7AE-DD4D1CA2D9EB} = {8DC78AF7-DC3E-4C57-A8FB-7E347DE74A03}
{51D3BD1F-07A8-48EB-B2A0-0A249CD4E1A6} = {8DC78AF7-DC3E-4C57-A8FB-7E347DE74A03}
{6C7F47CC-2151-44A3-A546-41C70025132C} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{2BE46397-4DFA-414C-9BD4-41E4BBF8CB34} = {6C7F47CC-2151-44A3-A546-41C70025132C}
{0B43679E-EDFA-4DA0-AD30-F4628B308B1B} = {6C7F47CC-2151-44A3-A546-41C70025132C}
{E0CC7526-D85E-43AC-844F-D5DF0D2F5AB8} = {6C7F47CC-2151-44A3-A546-41C70025132C}
{17DA04DF-E393-4397-9CF0-84DABE11032E} = {1AFB6476-670D-4E80-A464-657E01DFF482}
{880ED251-9E16-4713-9A70-D35FE0C01669} = {E775CC2C-24CB-48D6-9C3A-BE4CCE0DB17A}
{2F305555-C296-497E-AC20-5FA1B237996A} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{AF2349B8-E5B6-4004-9502-687C1C7730B1} = {2F305555-C296-497E-AC20-5FA1B237996A}
{6A71162E-FC4C-4A2C-B90F-3CF94F59A9BB} = {2F305555-C296-497E-AC20-5FA1B237996A}

View File

@ -0,0 +1,781 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json.Linq;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Windows;
using OpenQA.Selenium.Interactions;
namespace PowerToysTests
{
[TestClass]
public class FancyZonesSettingsTests : PowerToysSession
{
private static string _settingsPath = "";
private string _initialSettings = "";
private JObject _initialSettingsJson;
private static WindowsElement _saveButton;
private static Actions _scrollDown;
private static Actions _scrollUp;
private static void Init()
{
OpenSettings();
ShortWait();
OpenFancyZonesSettings();
_saveButton = session.FindElementByName("Save");
Assert.IsNotNull(_saveButton);
WindowsElement powerToysWindow = session.FindElementByXPath("//Window[@Name=\"PowerToys Settings\"]");
Assert.IsNotNull(powerToysWindow);
_scrollUp = new Actions(session).MoveToElement(_saveButton).MoveByOffset(0, _saveButton.Rect.Height).ContextClick()
.SendKeys(OpenQA.Selenium.Keys.PageUp + OpenQA.Selenium.Keys.PageUp);
Assert.IsNotNull(_scrollUp);
_scrollDown = new Actions(session).MoveToElement(_saveButton).MoveByOffset(0, _saveButton.Rect.Height).ContextClick()
.SendKeys(OpenQA.Selenium.Keys.PageDown + OpenQA.Selenium.Keys.PageDown);
Assert.IsNotNull(_scrollDown);
}
private static void OpenFancyZonesSettings()
{
WindowsElement fzNavigationButton = session.FindElementByXPath("//Button[@Name=\"FancyZones\"]");
Assert.IsNotNull(fzNavigationButton);
fzNavigationButton.Click();
fzNavigationButton.Click();
ShortWait();
}
private JObject getProperties()
{
JObject settings = JObject.Parse(File.ReadAllText(_settingsPath));
return settings["properties"].ToObject<JObject>();
}
private T getPropertyValue<T>(string propertyName)
{
JObject properties = getProperties();
return properties[propertyName].ToObject<JObject>()["value"].Value<T>();
}
private T getPropertyValue<T>(JObject properties, string propertyName)
{
return properties[propertyName].ToObject<JObject>()["value"].Value<T>();
}
private void ScrollDown()
{
_scrollDown.Perform();
}
private void ScrollUp()
{
_scrollUp.Perform();
}
private void SaveChanges()
{
string isEnabled = _saveButton.GetAttribute("IsEnabled");
Assert.AreEqual("True", isEnabled);
_saveButton.Click();
isEnabled = _saveButton.GetAttribute("IsEnabled");
Assert.AreEqual("False", isEnabled);
}
private void SaveAndCheckOpacitySettings(WindowsElement editor, int expected)
{
Assert.AreEqual(expected.ToString() + "\r\n", editor.Text);
SaveChanges();
ShortWait();
int value = getPropertyValue<int>("fancyzones_highlight_opacity");
Assert.AreEqual(expected, value);
}
private void SetOpacity(WindowsElement editor, string key)
{
editor.Click(); //activate
editor.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace); //clear previous value
editor.SendKeys(key);
editor.SendKeys(OpenQA.Selenium.Keys.Enter); //confirm changes
}
private void TestRgbInput(string name)
{
WindowsElement colorInput = session.FindElementByXPath("//Edit[@Name=\"" + name + "\"]");
Assert.IsNotNull(colorInput);
colorInput.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
colorInput.SendKeys("0");
colorInput.SendKeys(OpenQA.Selenium.Keys.Enter);
Assert.AreEqual("0\r\n", colorInput.Text);
string invalidSymbols = "qwertyuiopasdfghjklzxcvbnm,./';][{}:`~!@#$%^&*()_-+=\"\'\\";
foreach (char symbol in invalidSymbols)
{
colorInput.SendKeys(symbol.ToString() + OpenQA.Selenium.Keys.Enter);
Assert.AreEqual("0\r\n", colorInput.Text);
}
string validSymbols = "0123456789";
foreach (char symbol in validSymbols)
{
colorInput.SendKeys(symbol.ToString() + OpenQA.Selenium.Keys.Enter);
Assert.AreEqual(symbol.ToString() + "\r\n", colorInput.Text);
colorInput.SendKeys(OpenQA.Selenium.Keys.Backspace);
}
//print zero first
colorInput.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
colorInput.SendKeys("0");
colorInput.SendKeys("1");
Assert.AreEqual("1\r\n", colorInput.Text);
//too many symbols
colorInput.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
colorInput.SendKeys("1");
colorInput.SendKeys("2");
colorInput.SendKeys("3");
colorInput.SendKeys("4");
Assert.AreEqual("123\r\n", colorInput.Text);
//too big value
colorInput.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
colorInput.SendKeys("555");
Actions action = new Actions(session); //reset focus from input
action.MoveToElement(colorInput).MoveByOffset(0, colorInput.Rect.Height).Click().Perform();
Assert.AreEqual("255\r\n", colorInput.Text);
}
private void ClearInput(WindowsElement input)
{
input.Click();
input.SendKeys(OpenQA.Selenium.Keys.Control + "a");
input.SendKeys(OpenQA.Selenium.Keys.Backspace);
}
private void TestHotkey(WindowsElement input, int modifierKeysState, string key, string keyString)
{
BitArray b = new BitArray(new int[] { modifierKeysState });
int[] flags = b.Cast<bool>().Select(bit => bit ? 1 : 0).ToArray();
Actions action = new Actions(session).MoveToElement(input).Click();
string expectedText = "";
if (flags[0] == 1)
{
action.KeyDown(OpenQA.Selenium.Keys.Command);
expectedText += "Win + ";
}
if (flags[1] == 1)
{
action.KeyDown(OpenQA.Selenium.Keys.Control);
expectedText += "Ctrl + ";
}
if (flags[2] == 1)
{
action.KeyDown(OpenQA.Selenium.Keys.Alt);
expectedText += "Alt + ";
}
if (flags[3] == 1)
{
action.KeyDown(OpenQA.Selenium.Keys.Shift);
expectedText += "Shift + ";
}
expectedText += keyString + "\r\n";
action.SendKeys(key + key);
action.MoveByOffset(0, (input.Rect.Height / 2) + 10).ContextClick();
if (flags[0] == 1)
{
action.KeyUp(OpenQA.Selenium.Keys.Command);
}
if (flags[1] == 1)
{
action.KeyUp(OpenQA.Selenium.Keys.Control);
}
if (flags[2] == 1)
{
action.KeyUp(OpenQA.Selenium.Keys.Alt);
}
if (flags[3] == 1)
{
action.KeyUp(OpenQA.Selenium.Keys.Shift);
}
action.Perform();
SaveChanges();
ShortWait();
//Assert.AreEqual(expectedText, input.Text);
JObject props = getProperties();
JObject hotkey = props["fancyzones_editor_hotkey"].ToObject<JObject>()["value"].ToObject<JObject>();
Assert.AreEqual(flags[0] == 1, hotkey.Value<bool>("win"));
Assert.AreEqual(flags[1] == 1, hotkey.Value<bool>("ctrl"));
Assert.AreEqual(flags[2] == 1, hotkey.Value<bool>("alt"));
Assert.AreEqual(flags[3] == 1, hotkey.Value<bool>("shift"));
//Assert.AreEqual(keyString, hotkey.Value<string>("key"));
}
[TestMethod]
public void FancyZonesSettingsOpen()
{
WindowsElement fzTitle = session.FindElementByName("FancyZones Settings");
Assert.IsNotNull(fzTitle);
}
/*
[TestMethod]
public void EditorOpen()
{
session.FindElementByXPath("//Button[@Name=\"Edit zones\"]").Click();
ShortWait();
WindowsElement editorWindow = session.FindElementByName("FancyZones Editor");
Assert.IsNotNull(editorWindow);
editorWindow.SendKeys(OpenQA.Selenium.Keys.Alt + OpenQA.Selenium.Keys.F4);
}
*/
/*
* click each toggle,
* save changes,
* check if settings are changed after clicking save button
*/
[TestMethod]
public void TogglesSingleClickSaveButtonTest()
{
List<WindowsElement> toggles = session.FindElementsByXPath("//Pane[@Name=\"PowerToys Settings\"]/*[@LocalizedControlType=\"toggleswitch\"]").ToList();
Assert.AreEqual(8, toggles.Count);
List<bool> toggleValues = new List<bool>();
foreach (WindowsElement toggle in toggles)
{
Assert.IsNotNull(toggle);
bool isOn = toggle.GetAttribute("Toggle.ToggleState") == "1";
toggleValues.Add(isOn);
toggle.Click();
SaveChanges();
ShortWait();
}
//check saved settings
JObject savedProps = getProperties();
Assert.AreNotEqual(toggleValues[0], getPropertyValue<bool>(savedProps, "fancyzones_shiftDrag"));
Assert.AreNotEqual(toggleValues[1], getPropertyValue<bool>(savedProps, "fancyzones_overrideSnapHotkeys"));
Assert.AreNotEqual(toggleValues[2], getPropertyValue<bool>(savedProps, "fancyzones_zoneSetChange_flashZones"));
Assert.AreNotEqual(toggleValues[3], getPropertyValue<bool>(savedProps, "fancyzones_displayChange_moveWindows"));
Assert.AreNotEqual(toggleValues[4], getPropertyValue<bool>(savedProps, "fancyzones_zoneSetChange_moveWindows"));
Assert.AreNotEqual(toggleValues[5], getPropertyValue<bool>(savedProps, "fancyzones_virtualDesktopChange_moveWindows"));
Assert.AreNotEqual(toggleValues[6], getPropertyValue<bool>(savedProps, "fancyzones_appLastZone_moveWindows"));
Assert.AreNotEqual(toggleValues[7], getPropertyValue<bool>(savedProps, "use_cursorpos_editor_startupscreen"));
}
/*
* click each toggle twice,
* save changes,
* check if settings are unchanged after clicking save button
*/
[TestMethod]
public void TogglesDoubleClickSave()
{
List<WindowsElement> toggles = session.FindElementsByXPath("//Pane[@Name=\"PowerToys Settings\"]/*[@LocalizedControlType=\"toggleswitch\"]").ToList();
Assert.AreEqual(8, toggles.Count);
List<bool> toggleValues = new List<bool>();
foreach (WindowsElement toggle in toggles)
{
Assert.IsNotNull(toggle);
bool isOn = toggle.GetAttribute("Toggle.ToggleState") == "1";
toggleValues.Add(isOn);
toggle.Click();
toggle.Click();
}
SaveChanges();
ShortWait();
JObject savedProps = getProperties();
Assert.AreEqual(toggleValues[0], getPropertyValue<bool>(savedProps, "fancyzones_shiftDrag"));
Assert.AreEqual(toggleValues[1], getPropertyValue<bool>(savedProps, "fancyzones_overrideSnapHotkeys"));
Assert.AreEqual(toggleValues[2], getPropertyValue<bool>(savedProps, "fancyzones_zoneSetChange_flashZones"));
Assert.AreEqual(toggleValues[3], getPropertyValue<bool>(savedProps, "fancyzones_displayChange_moveWindows"));
Assert.AreEqual(toggleValues[4], getPropertyValue<bool>(savedProps, "fancyzones_zoneSetChange_moveWindows"));
Assert.AreEqual(toggleValues[5], getPropertyValue<bool>(savedProps, "fancyzones_virtualDesktopChange_moveWindows"));
Assert.AreEqual(toggleValues[6], getPropertyValue<bool>(savedProps, "fancyzones_appLastZone_moveWindows"));
Assert.AreEqual(toggleValues[7], getPropertyValue<bool>(savedProps, "use_cursorpos_editor_startupscreen"));
}
[TestMethod]
public void HighlightOpacitySetValue()
{
WindowsElement editor = session.FindElementByName("Zone Highlight Opacity (%)");
Assert.IsNotNull(editor);
SetOpacity(editor, "50");
SaveAndCheckOpacitySettings(editor, 50);
SetOpacity(editor, "-50");
SaveAndCheckOpacitySettings(editor, 0);
SetOpacity(editor, "200");
SaveAndCheckOpacitySettings(editor, 100);
//for invalid input values previously saved value expected
SetOpacity(editor, "asdf");
SaveAndCheckOpacitySettings(editor, 100);
SetOpacity(editor, "*");
SaveAndCheckOpacitySettings(editor, 100);
SetOpacity(editor, OpenQA.Selenium.Keys.Return);
SaveAndCheckOpacitySettings(editor, 100);
Clipboard.SetText("Hello, clipboard");
SetOpacity(editor, OpenQA.Selenium.Keys.Control + "v");
SaveAndCheckOpacitySettings(editor, 100);
}
[TestMethod]
public void HighlightOpacityIncreaseValue()
{
WindowsElement editor = session.FindElementByName("Zone Highlight Opacity (%)");
Assert.IsNotNull(editor);
SetOpacity(editor, "99");
SaveAndCheckOpacitySettings(editor, 99);
System.Drawing.Rectangle editorRect = editor.Rect;
Actions action = new Actions(session);
action.MoveToElement(editor).MoveByOffset(editorRect.Width / 2 + 10, -editorRect.Height / 4).Perform();
ShortWait();
action.Click().Perform();
Assert.AreEqual("100\r\n", editor.Text);
SaveAndCheckOpacitySettings(editor, 100);
action.Click().Perform();
Assert.AreEqual("100\r\n", editor.Text);
SaveAndCheckOpacitySettings(editor, 100);
}
[TestMethod]
public void HighlightOpacityDecreaseValue()
{
WindowsElement editor = session.FindElementByName("Zone Highlight Opacity (%)");
Assert.IsNotNull(editor);
SetOpacity(editor, "1");
SaveAndCheckOpacitySettings(editor, 1);
System.Drawing.Rectangle editorRect = editor.Rect;
Actions action = new Actions(session);
action.MoveToElement(editor).MoveByOffset(editorRect.Width / 2 + 10, editorRect.Height / 4).Perform();
ShortWait();
action.Click().Perform();
Assert.AreEqual("0\r\n", editor.Text);
SaveAndCheckOpacitySettings(editor, 0);
action.Click().Perform();
Assert.AreEqual("0\r\n", editor.Text);
SaveAndCheckOpacitySettings(editor, 0);
}
[TestMethod]
public void HighlightOpacityClearValueButton()
{
WindowsElement editor = session.FindElementByName("Zone Highlight Opacity (%)");
Assert.IsNotNull(editor);
editor.Click(); //activate
AppiumWebElement clearButton = editor.FindElementByName("Clear value");
Assert.IsNotNull(clearButton);
/*element is not pointer- or keyboard interactable.*/
Actions action = new Actions(session);
action.MoveToElement(clearButton).Click().Perform();
Assert.AreEqual("\r\n", editor.Text);
}
//in 0.15.2 sliders cannot be found by inspect.exe
/*
[TestMethod]
public void HighlightColorSlidersTest()
{
ScrollDown();
WindowsElement saturationAndBrightness = session.FindElementByName("Saturation and brightness");
WindowsElement hue = session.FindElementByName("Hue");
WindowsElement hex = session.FindElementByXPath("//Edit[@Name=\"Hex\"]");
WindowsElement red = session.FindElementByXPath("//Edit[@Name=\"Red\"]");
WindowsElement green = session.FindElementByXPath("//Edit[@Name=\"Green\"]");
WindowsElement blue = session.FindElementByXPath("//Edit[@Name=\"Blue\"]");
Assert.IsNotNull(saturationAndBrightness);
Assert.IsNotNull(hue);
Assert.IsNotNull(hex);
Assert.IsNotNull(red);
Assert.IsNotNull(green);
Assert.IsNotNull(blue);
System.Drawing.Rectangle satRect = saturationAndBrightness.Rect;
System.Drawing.Rectangle hueRect = hue.Rect;
//black on the bottom
new Actions(session).MoveToElement(saturationAndBrightness).ClickAndHold().MoveByOffset(0, satRect.Height / 2).Click().Perform();
ShortWait();
Assert.AreEqual("0\r\n", red.Text);
Assert.AreEqual("0\r\n", green.Text);
Assert.AreEqual("0\r\n", blue.Text);
Assert.AreEqual("000000\r\n", hex.Text);
SaveChanges();
ShortWait();
Assert.AreEqual("#000000", getPropertyValue<string>("fancyzones_zoneHighlightColor"));
//white in left corner
new Actions(session).MoveToElement(saturationAndBrightness).ClickAndHold().MoveByOffset(-(satRect.Width/2), -(satRect.Height / 2)).Click().Perform();
Assert.AreEqual("255\r\n", red.Text);
Assert.AreEqual("255\r\n", green.Text);
Assert.AreEqual("255\r\n", blue.Text);
Assert.AreEqual("ffffff\r\n", hex.Text);
SaveChanges();
ShortWait();
Assert.AreEqual("#ffffff", getPropertyValue<string>("fancyzones_zoneHighlightColor"));
//color in right corner
new Actions(session).MoveToElement(saturationAndBrightness).ClickAndHold().MoveByOffset((satRect.Width / 2), -(satRect.Height / 2)).Click()
.MoveToElement(hue).ClickAndHold().MoveByOffset(-(hueRect.Width / 2), 0).Click().Perform();
Assert.AreEqual("255\r\n", red.Text);
Assert.AreEqual("0\r\n", green.Text);
Assert.AreEqual("0\r\n", blue.Text);
Assert.AreEqual("ff0000\r\n", hex.Text);
SaveChanges();
ShortWait();
Assert.AreEqual("#ff0000", getPropertyValue<string>("fancyzones_zoneHighlightColor"));
}
[TestMethod]
public void HighlightColorTest()
{
ScrollDown();
WindowsElement saturationAndBrightness = session.FindElementByName("Saturation and brightness");
WindowsElement hue = session.FindElementByName("Hue");
WindowsElement hex = session.FindElementByXPath("//Edit[@Name=\"Hex\"]");
Assert.IsNotNull(saturationAndBrightness);
Assert.IsNotNull(hue);
Assert.IsNotNull(hex);
hex.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
hex.SendKeys("63c99a");
new Actions(session).MoveToElement(hex).MoveByOffset(0, hex.Rect.Height).Click().Perform();
Assert.AreEqual("Saturation 51 brightness 79", saturationAndBrightness.Text);
Assert.AreEqual("152", hue.Text);
SaveChanges();
ShortWait();
Assert.AreEqual("#63c99a", getPropertyValue<string>("fancyzones_zoneHighlightColor"));
}
*/
[TestMethod]
public void HighlightRGBInputsTest()
{
ScrollDown();
TestRgbInput("Red");
TestRgbInput("Green");
TestRgbInput("Blue");
}
[TestMethod]
public void HighlightHexInputTest()
{
ScrollDown();
WindowsElement hexInput = session.FindElementByXPath("//Edit[@Name=\"Hex\"]");
Assert.IsNotNull(hexInput);
hexInput.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
string invalidSymbols = "qwrtyuiopsghjklzxvnm,./';][{}:`~!#@$%^&*()_-+=\"\'\\";
foreach (char symbol in invalidSymbols)
{
hexInput.SendKeys(symbol.ToString());
Assert.AreEqual("", hexInput.Text.Trim());
}
string validSymbols = "0123456789abcdef";
foreach (char symbol in validSymbols)
{
hexInput.SendKeys(symbol.ToString());
Assert.AreEqual(symbol.ToString(), hexInput.Text.Trim());
hexInput.SendKeys(OpenQA.Selenium.Keys.Backspace);
}
//too many symbols
hexInput.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
hexInput.SendKeys("000000");
hexInput.SendKeys("1");
Assert.AreEqual("000000\r\n", hexInput.Text);
//short string
hexInput.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
hexInput.SendKeys("000");
new Actions(session).MoveToElement(hexInput).MoveByOffset(0, hexInput.Rect.Height).Click().Perform();
Assert.AreEqual("000000\r\n", hexInput.Text);
hexInput.SendKeys(OpenQA.Selenium.Keys.Control + OpenQA.Selenium.Keys.Backspace);
hexInput.SendKeys("1234");
new Actions(session).MoveToElement(hexInput).MoveByOffset(0, hexInput.Rect.Height).Click().Perform();
Assert.AreEqual("112233\r\n", hexInput.Text);
}
[TestMethod]
public void ExcludeApps()
{
WindowsElement input = session.FindElementByXPath("//Edit[contains(@Name, \"exclude\")]");
Assert.IsNotNull(input);
ClearInput(input);
string inputValue;
//valid
inputValue = "Notepad\nChrome";
input.SendKeys(inputValue);
SaveChanges();
ClearInput(input);
ShortWait();
Assert.AreEqual(inputValue, getPropertyValue<string>("fancyzones_excluded_apps"));
//invalid
inputValue = "Notepad Chrome";
input.SendKeys(inputValue);
SaveChanges();
ClearInput(input);
ShortWait();
Assert.AreEqual(inputValue, getPropertyValue<string>("fancyzones_excluded_apps"));
inputValue = "Notepad,Chrome";
input.SendKeys(inputValue);
SaveChanges();
ClearInput(input);
ShortWait();
Assert.AreEqual(inputValue, getPropertyValue<string>("fancyzones_excluded_apps"));
inputValue = "Note*";
input.SendKeys(inputValue);
SaveChanges();
ClearInput(input);
ShortWait();
Assert.AreEqual(inputValue, getPropertyValue<string>("fancyzones_excluded_apps"));
inputValue = "Кириллица";
input.SendKeys(inputValue);
SaveChanges();
ClearInput(input);
ShortWait();
Assert.AreEqual(inputValue, getPropertyValue<string>("fancyzones_excluded_apps"));
}
[TestMethod]
public void ExitDialogSave()
{
WindowsElement toggle = session.FindElementByXPath("//Pane[@Name=\"PowerToys Settings\"]/*[@LocalizedControlType=\"toggleswitch\"]");
Assert.IsNotNull(toggle);
bool initialToggleValue = toggle.GetAttribute("Toggle.ToggleState") == "1";
toggle.Click();
CloseSettings();
WindowsElement exitDialog = session.FindElementByName("Changes not saved");
Assert.IsNotNull(exitDialog);
exitDialog.FindElementByName("Save").Click();
//check if window still opened
WindowsElement powerToysWindow = session.FindElementByXPath("//Window[@Name=\"PowerToys Settings\"]");
Assert.IsNotNull(powerToysWindow);
//check settings change
JObject savedProps = getProperties();
Assert.AreNotEqual(initialToggleValue, getPropertyValue<bool>(savedProps, "fancyzones_shiftDrag"));
//return initial app state
toggle.Click();
}
[TestMethod]
public void ExitDialogExit()
{
WindowsElement toggle = session.FindElementByXPath("//Pane[@Name=\"PowerToys Settings\"]/*[@LocalizedControlType=\"toggleswitch\"]");
Assert.IsNotNull(toggle);
bool initialToggleValue = toggle.GetAttribute("Toggle.ToggleState") == "1";
toggle.Click();
CloseSettings();
WindowsElement exitDialog = session.FindElementByName("Changes not saved");
Assert.IsNotNull(exitDialog);
exitDialog.FindElementByName("Exit").Click();
//check if window still opened
try
{
WindowsElement powerToysWindow = session.FindElementByXPath("//Window[@Name=\"PowerToys Settings\"]");
Assert.IsNull(powerToysWindow);
}
catch(OpenQA.Selenium.WebDriverException)
{
//window is no longer available, which is expected
}
//return initial app state
Init();
//check settings change
JObject savedProps = getProperties();
Assert.AreEqual(initialToggleValue, getPropertyValue<bool>(savedProps, "fancyzones_shiftDrag"));
}
[TestMethod]
public void ExitDialogCancel()
{
WindowsElement toggle = session.FindElementByXPath("//Pane[@Name=\"PowerToys Settings\"]/*[@LocalizedControlType=\"toggleswitch\"]");
Assert.IsNotNull(toggle);
toggle.Click();
CloseSettings();
WindowsElement exitDialog = session.FindElementByName("Changes not saved");
Assert.IsNotNull(exitDialog);
exitDialog.FindElementByName("Cancel").Click();
//check if window still opened
WindowsElement powerToysWindow = session.FindElementByXPath("//Window[@Name=\"PowerToys Settings\"]");
Assert.IsNotNull(powerToysWindow);
//check settings change
JObject savedProps = getProperties();
JObject initialProps = _initialSettingsJson["properties"].ToObject<JObject>();
Assert.AreEqual(getPropertyValue<bool>(initialProps, "fancyzones_shiftDrag"), getPropertyValue<bool>(savedProps, "fancyzones_shiftDrag"));
//return initial app state
toggle.Click();
SaveChanges();
}
[TestMethod]
public void ConfigureHotkey()
{
WindowsElement input = session.FindElementByXPath("//Edit[contains(@Name, \"hotkey\")]");
Assert.IsNotNull(input);
for (int i = 0; i < 16; i++)
{
TestHotkey(input, i, OpenQA.Selenium.Keys.End, "End");
}
}
[TestMethod]
public void ConfigureLocalSymbolHotkey()
{
WindowsElement input = session.FindElementByXPath("//Edit[contains(@Name, \"hotkey\")]");
Assert.IsNotNull(input);
TestHotkey(input, 0, "ё", "Ё");
}
[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
Setup(context);
string settingsFolderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft/PowerToys/FancyZones");
if (!Directory.Exists(settingsFolderPath))
{
Directory.CreateDirectory(settingsFolderPath);
}
_settingsPath = settingsFolderPath + "/settings.json";
Init();
}
[ClassCleanup]
public static void ClassCleanup()
{
CloseSettings();
try
{
WindowsElement exitDialogButton = session.FindElementByName("Exit");
if (exitDialogButton != null)
{
exitDialogButton.Click();
}
}
catch(OpenQA.Selenium.WebDriverException)
{
//element couldn't be located
}
TearDown();
}
[TestInitialize]
public void TestInitialize()
{
try
{
_initialSettings = File.ReadAllText(_settingsPath);
_initialSettingsJson = JObject.Parse(_initialSettings);
}
catch (System.IO.FileNotFoundException)
{
_initialSettings = "";
}
}
[TestCleanup]
public void TestCleanup()
{
ScrollUp();
if (_initialSettings.Length > 0)
{
File.WriteAllText(_settingsPath, _initialSettings);
}
}
}
}

View File

@ -0,0 +1,39 @@
# FancyZones Test Plan
## Settings
- [x] Test if settings are saved in file properly
## Editor
- [] Open editor by clicking button from settings
- [] without settings file
- [] with valid settings file
- [] with invalid settings file
- [] Open editor by hotkey with opened settings window
- [] without settings file
- [] with valid settings file
- [] with invalid settings file
- [] Open editor by hotkey with closed settings window
- [] without settings file
- [] with valid settings file
- [] with invalid settings file
- [] Increase/decrease zone count, check min and max possible values
- [] Test if settings are saved in file properly
- [] `Show spacing` checked/unchecked
- [] `Space around zone` saved correctly
- [] `Space around zone` possible input values
- [] Edit templates, check settings files
- [] Create new custom layout
- [] empty
- [] one zone
- [] fullscreen
- [] not fullscreen
- [] many zones
- [] overlapping
- [] non-overlapping
- [] utf-16 layout name
- [] empty layout name
- [] special characters in layout name
- [] Remove custom layout
- [] Edit selected layout
### Usage

View File

@ -0,0 +1,103 @@
using System;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Windows;
using OpenQA.Selenium;
namespace PowerToysTests
{
public class PowerToysSession
{
protected const string WindowsApplicationDriverUrl = "http://127.0.0.1:4723";
protected static WindowsDriver<WindowsElement> session;
protected static bool isPowerToysLaunched = false;
protected static WindowsElement trayButton;
public static void Setup(TestContext context)
{
if (session == null)
{
// Create a new Desktop session to use PowerToys.
AppiumOptions appiumOptions = new AppiumOptions();
appiumOptions.PlatformName = "Windows";
appiumOptions.AddAdditionalCapability("app", "Root");
session = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), appiumOptions);
Assert.IsNotNull(session);
trayButton = session.FindElementByAccessibilityId("1502");
isPowerToysLaunched = CheckPowerToysLaunched();
if (!isPowerToysLaunched)
{
LaunchPowerToys();
}
}
}
public static void TearDown()
{
if (session!=null)
{
session.Quit();
session = null;
}
}
public static void ShortWait()
{
Thread.Sleep(TimeSpan.FromSeconds(0.5));
}
public static void OpenSettings()
{
trayButton.Click();
session.FindElementByName("PowerToys").Click();
trayButton.Click();
}
public static void CloseSettings()
{
WindowsElement settings = session.FindElementByName("PowerToys Settings");
settings.SendKeys(Keys.Alt + Keys.F4);
}
private static bool CheckPowerToysLaunched()
{
trayButton.Click();
bool isLaunched = false;
try
{
WindowsElement pt = session.FindElementByName("PowerToys");
isLaunched = (pt != null);
}
catch(OpenQA.Selenium.WebDriverException)
{
//PowerToys not found
}
trayButton.Click(); //close
return isLaunched;
}
public static void LaunchPowerToys()
{
try
{
AppiumOptions opts = new AppiumOptions();
opts.PlatformName = "Windows";
opts.AddAdditionalCapability("app", "Microsoft.PowerToys_8wekyb3d8bbwe!PowerToys");
WindowsDriver<WindowsElement> driver = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), opts);
Assert.IsNotNull(driver);
driver.LaunchApp();
}
catch (OpenQA.Selenium.WebDriverException)
{
//exception could be thrown even if app launched successfully
}
}
}
}

View File

@ -0,0 +1,118 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Appium.Windows;
using OpenQA.Selenium.Interactions;
namespace PowerToysTests
{
[TestClass]
public class PowerToysTrayTests : PowerToysSession
{
private bool isSettingsOpened;
private bool isTrayOpened;
[TestMethod]
public void SettingsOpen()
{
OpenSettings();
ShortWait();
//check settings window opened
WindowsElement settingsWindow = session.FindElementByName("PowerToys Settings");
Assert.IsNotNull(settingsWindow);
isSettingsOpened = true;
}
[TestMethod]
public void SettingsOpenWithContextMenu()
{
//open tray
trayButton.Click();
isTrayOpened = true;
//open PowerToys context menu
WindowsElement pt = session.FindElementByName("PowerToys");
Assert.IsNotNull(pt);
new Actions(session).MoveToElement(pt).ContextClick().Perform();
ShortWait();
//open settings
session.FindElementByXPath("//MenuItem[@Name=\"Settings\"]").Click();
ShortWait();
//check settings window opened
WindowsElement settingsWindow = session.FindElementByName("PowerToys Settings");
Assert.IsNotNull(settingsWindow);
isSettingsOpened = true;
}
[TestMethod]
public void PowerToysExit()
{
//open PowerToys context menu
trayButton.Click();
isTrayOpened = true;
WindowsElement pt = session.FindElementByName("PowerToys");
Assert.IsNotNull(pt);
new Actions(session).MoveToElement(pt).ContextClick().Perform();
ShortWait();
//exit
session.FindElementByXPath("//MenuItem[@Name=\"Exit\"]").Click();
ShortWait();
//check PowerToys exited
pt = null;
try
{
pt = session.FindElementByName("PowerToys");
}
catch (OpenQA.Selenium.WebDriverException)
{
//expected, PowerToys shouldn't be here
}
LaunchPowerToys();
ShortWait();
Assert.IsNull(pt);
}
[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
Setup(context);
}
[ClassCleanup]
public static void ClassCleanup()
{
TearDown();
}
[TestInitialize]
public void TestInitialize()
{
isSettingsOpened = false;
isTrayOpened = false;
}
[TestCleanup]
public void TestCleanup()
{
if (isSettingsOpened)
{
CloseSettings();
}
if (isTrayOpened)
{
trayButton.Click();
}
}
}
}

View File

@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("PowerToysTests")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PowerToysTests")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("880ed251-9e16-4713-9a70-d35fe0c01669")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,82 @@
# PowerToys Tests
The PowerToys tests are implemented using Appium and use the [Windows Application Driver](https://github.com/microsoft/WinAppDriver) as an Appium compatible server for Windows applications.
## Prerequisites
- Install the latest stable version of Windows Application Driver in the test machine: [v1.1 Release](https://github.com/microsoft/WinAppDriver/releases/tag/v1.1)
- Install the ".Net desktop development" components in Visual Studio 2019. It should have support for "C#" and ".Net Framework 4.7.2".
- Install [PowerToys v0.15.2](https://github.com/microsoft/PowerToys/releases/download/v0.15.2/PowerToysSetup-0.15.2-x64.msix)
- Set Windows to "Developer Mode", by selecting `Developer mode` in `Settings > For developers > Use developer features` in Windows 10.
If you have `PowerToys v0.15.2 (MSIX)` installed, it can be launched automatically. Otherwise you should start `PowerToys` before running tests.
### Preparing the test machine
- Start `PowerToys` if it is necessary.
- Run the "Windows Application Driver" in Administrator mode in the test machine. By default you can find it in `C:\Program Files (x86)\Windows Application Driver`
- Notice that notifications or other application windows that are shown above PowerToys settings window or tray can disrupt testing process.
When testing on a remote machine, Firewall exceptions must be added and the IP and port must be passed when starting "Windows Application Driver". Here's how to do it from the [Windows Application Driver FAQ](https://github.com/microsoft/WinAppDriver/wiki/Frequently-Asked-Questions#running-on-a-remote-machine):
#### Running on a Remote Machine
Windows Application Driver can run remotely on any Windows 10 machine with `WinAppDriver.exe` installed and running. This *test machine* can then serve any JSON wire protocol commands coming from the *test runner* remotely through the network. Below are the steps to the one-time setup for the *test machine* to receive inbound requests:
1. On the *test machine* you want to run the test application on, open up **Windows Firewall with Advanced Security**
- Select **Inbound Rules** -> **New Rule...**
- **Rule Type** -> **Port**
- Select **TCP**
- Choose specific local port (4723 is WinAppDriver standard)
- **Action** -> **Allow the connection**
- **Profile** -> select all
- **Name** -> optional, choose name for rule (e.g. WinAppDriver remote).
Below command when run in admin command prompt gives same result
```shell
netsh advfirewall firewall add rule name="WinAppDriver remote" dir=in action=allow protocol=TCP localport=4723
```
2. Run `ipconfig.exe` to determine your machine's local IP address
> **Note**: Setting `*` as the IP address command line option will cause it to bind to all bound IP addresses on the machine
3. Run `WinAppDriver.exe 10.X.X.10 4723/wd/hub` as **administrator** with command line arguments as seen above specifying local IP and port
4. On the *test runner* machine where the runner and scripts are, update the test script to point to the IP of the remote *test machine*
### Starting the tests in the Development Machine
- Open `powertoys.sln` in Visual Studio 2017.
- Build the `PowerToysTests` project.
- Select `Test > Windows > Test Explorer`.
- Select `Test > Run > All` tests in the menu bar.
> Once the project is successfully built, you can use the **TestExplorer** to pick and choose the test scenario(s) to run
> If Visual Studio fail to discover and run the test scenarios:
> 1. Select **Tools** > **Options...** > **Test**
> 2. Under *Active Solution*, uncheck *For improved performance, only use test adapters in test assembly folder or as specified in runsettings file*
If a remote test machine is being used, the IP of the test machine must be used to replace the `WindowsApplicationDriverUrl` value in [PowerToysSession.cs](PowerToysSession.cs).
### Extra tools and information
For tests creation you will need a tool that enables you select any UI element and view the element's accessibility data. For this purpose you could use [AccessibilityInsights](https://accessibilityinsights.io/docs/en/windows/overview) or [Inspect](https://docs.microsoft.com/ru-ru/windows/win32/winauto/inspect-objects?redirectedfrom=MSDN).
* `inspect.exe` you can find installed at `C:\Program Files (x86)\Windows Kits\10\bin\<version>\<platform>\inspect.exe`
* `AccessibilityInsights` you can download [here](https://aka.ms/accessibilityinsights-windows/download)
##### How to use Inspect
Open Inspect, find element you need to investigate (by clicking on element or finding it in a tree) and in the right part of inspector window you will see info about this element.
Examples for searching elements with values of `Name`, `AutomationId` and `ControlType`:
```
//use FindElementByAccessibilityId with AutomationId value
session.FindElementByAccessibilityId("40001");
session.FindElementByAccessibilityId("decrementZones");
session.FindElementByName("PowerToys Settings");
//with XPath you can search elements with more specific information
session.FindElementByXPath("//Pane[@Name=\"PowerToys Settings\"]");
session.FindElementByXPath("//Edit[contains(@Name, \"hotkey\")]");
session.FindElementByXPath("//Pane[@Name=\"PowerToys Settings\"]/*[@LocalizedControlType=\"toggleswitch\"]");
```
>One more thing to notice: close helper tools while running tests. Overlapping windows can affect test results.

View File

@ -0,0 +1,147 @@
using System;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Appium;
using OpenQA.Selenium.Appium.Windows;
using OpenQA.Selenium.Interactions;
namespace PowerToysTests
{
[TestClass]
public class TestShortcutHelper : PowerToysSession
{
// Try to manage Press/Release of Windows Key here,
// since Keyboard.PressKey seems to release the key if pressed
// and Keyboard.ReleaseKey seems to press the key if not pressed.
private bool isWinKeyPressed;
private void PressWinKey()
{
if(!isWinKeyPressed)
{
new Actions(session).KeyDown(OpenQA.Selenium.Keys.Command).Perform();
isWinKeyPressed = true;
}
}
private void ReleaseWinKey()
{
if(isWinKeyPressed)
{
new Actions(session).KeyUp(OpenQA.Selenium.Keys.Command).Perform();
isWinKeyPressed = false;
}
}
[TestMethod]
public void AppearsOnWinKeyPress()
{
PressWinKey();
Thread.Sleep(TimeSpan.FromSeconds(2));
WindowsElement shortcutHelperWindow = session.FindElementByXPath("/Pane[@ClassName=\"#32769\"]/Pane[@ClassName=\"PToyD2DPopup\"]");
Assert.IsNotNull(shortcutHelperWindow);
ReleaseWinKey();
Thread.Sleep(TimeSpan.FromSeconds(2));
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException),
"The Shortcut Guide UI was still found after releasing the key.")]
public void DisappearsOnWinKeyRelease()
{
PressWinKey();
Thread.Sleep(TimeSpan.FromSeconds(2));
WindowsElement shortcutHelperWindow;
try
{
shortcutHelperWindow = session.FindElementByXPath("/Pane[@ClassName=\"#32769\"]/Pane[@ClassName=\"PToyD2DPopup\"]");
Assert.IsNotNull(shortcutHelperWindow);
}
catch (InvalidOperationException)
{
// Not the exception we wanted to catch here.
Assert.Fail("Shortcut Guide not found");
}
ReleaseWinKey();
Thread.Sleep(TimeSpan.FromSeconds(0.5));
shortcutHelperWindow = session.FindElementByXPath("/Pane[@ClassName=\"#32769\"]/Pane[@ClassName=\"PToyD2DPopup\"]");
}
[TestMethod]
public void DoesNotBlockStartMenuOnShortPress()
{
PressWinKey();
Thread.Sleep(TimeSpan.FromSeconds(0.4));
// FindElementByClassName will be faster than using with XPath.
WindowsElement shortcutHelperWindow = session.FindElementByClassName("PToyD2DPopup");
Assert.IsNotNull(shortcutHelperWindow);
ReleaseWinKey();
Thread.Sleep(TimeSpan.FromSeconds(0.5));
WindowsElement startMenuWindow = session.FindElementByXPath("/Pane[@ClassName=\"#32769\"]/Window[@Name=\"Start\"]");
}
[TestMethod]
[ExpectedException(typeof(InvalidOperationException),
"The Start Menu was found after releasing the key on a long press.")]
public void DoesNotSpawnStartMenuOnLongPress()
{
PressWinKey();
Thread.Sleep(TimeSpan.FromSeconds(2));
try
{
// FindElementByClassName will be faster than using with XPath.
WindowsElement shortcutHelperWindow = session.FindElementByClassName("PToyD2DPopup");
Assert.IsNotNull(shortcutHelperWindow);
} catch (InvalidOperationException)
{
// Not the exception we wanted to catch here.
Assert.Fail("Shortcut Guide not found");
}
ReleaseWinKey();
Thread.Sleep(TimeSpan.FromSeconds(0.5));
WindowsElement startMenuWindow = session.FindElementByXPath("/Pane[@ClassName=\"#32769\"]/Window[@Name=\"Start\"]");
}
[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
Setup(context);
}
[ClassCleanup]
public static void ClassCleanup()
{
TearDown();
}
[TestInitialize]
public void TestInitialize()
{
isWinKeyPressed = false;
// If the start menu is open, close it.
WindowsElement startMenuWindow = null;
try
{
startMenuWindow = session.FindElementByXPath("/Pane[@ClassName=\"#32769\"]/Window[@Name=\"Start\"]");
} catch (Exception)
{
//Start menu not found, as expected.
}
if (startMenuWindow!=null)
{
string startMenuWindowHandle = (int.Parse(startMenuWindow.GetAttribute("NativeWindowHandle"))).ToString("x");
// Create session for controlling the Start Menu.
AppiumOptions appiumOptions = new AppiumOptions();
appiumOptions.PlatformName = "Windows";
appiumOptions.AddAdditionalCapability("appTopLevelWindow", startMenuWindowHandle);
WindowsDriver<WindowsElement> startMenuSession = new WindowsDriver<WindowsElement>(new Uri(WindowsApplicationDriverUrl), appiumOptions);
if (startMenuSession != null)
{
new Actions(session).SendKeys(OpenQA.Selenium.Keys.Escape + OpenQA.Selenium.Keys.Escape).Perform();
startMenuSession.Quit();
}
}
}
[TestCleanup]
public void TestCleanup()
{
// Release Windows Key in case it's being pressed by some of the tests
ReleaseWinKey();
}
}
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Appium.WebDriver" version="4.1.1" targetFramework="net461" />
<package id="Castle.Core" version="4.3.1" targetFramework="net461" />
<package id="DotNetSeleniumExtras.PageObjects" version="3.11.0" targetFramework="net461" />
<package id="MSTest.TestAdapter" version="2.1.0" targetFramework="net461" />
<package id="MSTest.TestFramework" version="2.1.0" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
<package id="Selenium.Support" version="3.141.0" targetFramework="net461" />
<package id="Selenium.WebDriver" version="3.141.0" targetFramework="net461" />
</packages>

View File

@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{880ED251-9E16-4713-9A70-D35FE0C01669}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PowerToysTests</RootNamespace>
<AssemblyName>PowerToysTests</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Appium.Net, Version=4.1.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Appium.WebDriver.4.1.1\lib\net45\Appium.Net.dll</HintPath>
</Reference>
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SeleniumExtras.PageObjects, Version=3.11.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\DotNetSeleniumExtras.PageObjects.3.11.0\lib\net45\SeleniumExtras.PageObjects.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System">
<HintPath>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll</HintPath>
</Reference>
<Reference Include="System.Configuration">
<HintPath>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll</HintPath>
</Reference>
<Reference Include="System.Core">
<HintPath>C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="WebDriver, Version=3.141.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Selenium.WebDriver.3.141.0\lib\net45\WebDriver.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="WebDriver.Support, Version=3.141.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Selenium.Support.3.141.0\lib\net45\WebDriver.Support.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="FancyZonesTests\FancyZonesSettingsTests.cs" />
<Compile Include="PowerToysSession.cs" />
<Compile Include="PowerToysTrayTests.cs" />
<Compile Include="TestShortcutHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
<Import Project="..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" />
</Project>