mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-06-07 17:42:45 +08:00
Add UI test for Peek
This commit is contained in:
parent
ff9aab3003
commit
c41d0773b5
@ -716,6 +716,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MouseUtils.UITests", "src\m
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkspacesEditorUITest", "src\modules\Workspaces\WorkspacesEditorUITest\WorkspacesEditorUITest.csproj", "{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Peek.UITests", "src\modules\peek\Peek.UITests\Peek.UITests.csproj", "{829C61AF-BDE6-4575-B13D-E66AB9628905}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|ARM64 = Debug|ARM64
|
||||
@ -2588,6 +2590,28 @@ Global
|
||||
{64B88F02-CD88-4ED8-9624-989A800230F9}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{64B88F02-CD88-4ED8-9624-989A800230F9}.Release|x64.ActiveCfg = Release|x64
|
||||
{64B88F02-CD88-4ED8-9624-989A800230F9}.Release|x64.Build.0 = Release|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.Build.0 = Debug|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.ActiveCfg = Release|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.Build.0 = Release|x64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|x64.Build.0 = Debug|x64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Release|x64.ActiveCfg = Release|x64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Release|x64.Build.0 = Release|x64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Debug|x64.Build.0 = Debug|x64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|x64.ActiveCfg = Release|x64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|x64.Build.0 = Release|x64
|
||||
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1}.Debug|x64.ActiveCfg = Debug|x64
|
||||
@ -2604,28 +2628,14 @@ Global
|
||||
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Release|x64.ActiveCfg = Release|x64
|
||||
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9}.Release|x64.Build.0 = Release|x64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Debug|x64.Build.0 = Debug|x64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Release|x64.ActiveCfg = Release|x64
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2}.Release|x64.Build.0 = Release|x64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Debug|x64.Build.0 = Debug|x64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|x64.ActiveCfg = Release|x64
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E}.Release|x64.Build.0 = Release|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Debug|x64.Build.0 = Debug|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.ActiveCfg = Release|x64
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A}.Release|x64.Build.0 = Release|x64
|
||||
{829C61AF-BDE6-4575-B13D-E66AB9628905}.Debug|ARM64.ActiveCfg = Debug|ARM64
|
||||
{829C61AF-BDE6-4575-B13D-E66AB9628905}.Debug|ARM64.Build.0 = Debug|ARM64
|
||||
{829C61AF-BDE6-4575-B13D-E66AB9628905}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{829C61AF-BDE6-4575-B13D-E66AB9628905}.Debug|x64.Build.0 = Debug|x64
|
||||
{829C61AF-BDE6-4575-B13D-E66AB9628905}.Release|ARM64.ActiveCfg = Release|ARM64
|
||||
{829C61AF-BDE6-4575-B13D-E66AB9628905}.Release|ARM64.Build.0 = Release|ARM64
|
||||
{829C61AF-BDE6-4575-B13D-E66AB9628905}.Release|x64.ActiveCfg = Release|x64
|
||||
{829C61AF-BDE6-4575-B13D-E66AB9628905}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -2896,11 +2906,12 @@ Global
|
||||
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A0} = {F05E590D-AD46-42BE-9C25-6A63ADD2E3EA}
|
||||
{5702B3CC-8575-48D5-83D8-15BB42269CD3} = {929C1324-22E8-4412-A9A8-80E85F3985A5}
|
||||
{64B88F02-CD88-4ED8-9624-989A800230F9} = {ECB8E0D1-7603-4E5C-AB10-D1E545E6F8E2}
|
||||
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1} = {322566EF-20DC-43A6-B9F8-616AF942579A}
|
||||
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{0217E86E-3476-9946-DE8E-9D200CEBD47A} = {D1D6BC88-09AE-4FB4-AD24-5DED46A791DD}
|
||||
{5F63C743-F6CE-4DBA-A200-2B3F8A14E8C2} = {3846508C-77EB-4034-A702-F8BB263C4F79}
|
||||
{2694E2FB-DCD5-4BFF-A418-B6C3C7CE3B8E} = {89E20BCE-EB9C-46C8-8B50-E01A82E6FDC3}
|
||||
{4E0AE3A4-2EE0-44D7-A2D0-8769977254A1} = {322566EF-20DC-43A6-B9F8-616AF942579A}
|
||||
{43E779F3-D83C-48B1-BA8D-1912DBD76FC9} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF}
|
||||
{829C61AF-BDE6-4575-B13D-E66AB9628905} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}
|
||||
|
30
src/modules/peek/Peek.UITests/Peek.UITests.csproj
Normal file
30
src/modules/peek/Peek.UITests/Peek.UITests.csproj
Normal file
@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\..\..\Common.Dotnet.CsWinRT.props" />
|
||||
<PropertyGroup>
|
||||
<RootNamespace>PowerToys.Peek.UITests</RootNamespace>
|
||||
<AssemblyName>PowerToys.Peek.UITests</AssemblyName>
|
||||
<IsPackable>false</IsPackable>
|
||||
<IsTestProject>true</IsTestProject>
|
||||
<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>$(SolutionDir)$(Platform)\$(Configuration)\tests\Peek.UITests\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MSTest" />
|
||||
<ProjectReference Include="..\..\..\common\UITestAutomation\UITestAutomation.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="TestAssets\sample\" />
|
||||
<Content Include="TestAssets\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
70
src/modules/peek/Peek.UITests/PeekFilePreviewTests.cs
Normal file
70
src/modules/peek/Peek.UITests/PeekFilePreviewTests.cs
Normal file
@ -0,0 +1,70 @@
|
||||
// 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.IO;
|
||||
using Microsoft.PowerToys.UITest;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace Peek.UITests;
|
||||
|
||||
[TestClass]
|
||||
public class PeekFilePreviewTests : UITestBase
|
||||
{
|
||||
public PeekFilePreviewTests()
|
||||
: base(PowerToysModule.PowerToysSettings, WindowSize.Small_Vertical)
|
||||
{
|
||||
}
|
||||
|
||||
[TestMethod("Peek.FilePreview.Folder")]
|
||||
[TestCategory("PeekFilePreview")]
|
||||
public void PeekFolderFilePreview()
|
||||
{
|
||||
string folderFullPath = Path.GetTempPath();
|
||||
|
||||
OpenAndPeekFile(folderFullPath, "Temp - Peek");
|
||||
Assert.IsTrue(FindAll<TextBlock>("File Type: File folder", 500, true).Count > 0, "Should show folder detail in Peek File Preview");
|
||||
}
|
||||
|
||||
[TestMethod("Peek.FilePreview.Image")]
|
||||
[TestCategory("PeekFilePreview")]
|
||||
public void PeekImageFilePreview() => PeekSampleFile(".png");
|
||||
|
||||
[TestMethod("Peek.FilePreview.PDF")]
|
||||
[TestCategory("PeekFilePreview")]
|
||||
public void PeekPDFPreview() => PeekSampleFile(".pdf");
|
||||
|
||||
[TestMethod("Peek.FilePreview.ZIP")]
|
||||
[TestCategory("PeekFilePreview")]
|
||||
public void PeekZIPPreview() => PeekSampleFile(".zip");
|
||||
|
||||
[TestMethod("Peek.FilePreview.QOI")]
|
||||
[TestCategory("PeekFilePreview")]
|
||||
public void PeekQOIPreview() => PeekSampleFile(".qoi");
|
||||
|
||||
private void PeekSampleFile(string ext)
|
||||
{
|
||||
string fileName = $"sample{ext}";
|
||||
string fullPath = Path.GetFullPath($@".\TestAssets\{fileName}");
|
||||
|
||||
OpenAndPeekFile(fullPath, $"{fileName} - Peek");
|
||||
VisualAssertWindow($"{fileName} - Peek");
|
||||
}
|
||||
|
||||
private void OpenAndPeekFile(string fullPath, string peekWindowTitle)
|
||||
{
|
||||
SendKeys(Key.Enter);
|
||||
|
||||
Session.StartExe("explorer.exe", $"/select,\"{fullPath}\"");
|
||||
|
||||
SendKeys(Key.LCtrl, Key.Space);
|
||||
|
||||
Session.Attach(peekWindowTitle);
|
||||
}
|
||||
|
||||
private void VisualAssertWindow(string windowTitle)
|
||||
{
|
||||
VisualAssert.AreEqual(this.TestContext, this.Find(windowTitle, 500, true), "EmptyView");
|
||||
}
|
||||
}
|
17160
src/modules/peek/Peek.UITests/TestAssets/sample.gcode
Normal file
17160
src/modules/peek/Peek.UITests/TestAssets/sample.gcode
Normal file
File diff suppressed because it is too large
Load Diff
BIN
src/modules/peek/Peek.UITests/TestAssets/sample.pdf
Normal file
BIN
src/modules/peek/Peek.UITests/TestAssets/sample.pdf
Normal file
Binary file not shown.
BIN
src/modules/peek/Peek.UITests/TestAssets/sample.png
Normal file
BIN
src/modules/peek/Peek.UITests/TestAssets/sample.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
src/modules/peek/Peek.UITests/TestAssets/sample.qoi
Normal file
BIN
src/modules/peek/Peek.UITests/TestAssets/sample.qoi
Normal file
Binary file not shown.
BIN
src/modules/peek/Peek.UITests/TestAssets/sample.stl
Normal file
BIN
src/modules/peek/Peek.UITests/TestAssets/sample.stl
Normal file
Binary file not shown.
4
src/modules/peek/Peek.UITests/TestAssets/sample.svg
Normal file
4
src/modules/peek/Peek.UITests/TestAssets/sample.svg
Normal file
@ -0,0 +1,4 @@
|
||||
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="50" cy="50" r="50">
|
||||
</circle>
|
||||
</svg>
|
After Width: | Height: | Size: 119 B |
BIN
src/modules/peek/Peek.UITests/TestAssets/sample.zip
Normal file
BIN
src/modules/peek/Peek.UITests/TestAssets/sample.zip
Normal file
Binary file not shown.
@ -0,0 +1,23 @@
|
||||
## Peek
|
||||
* Open different files to check that they're shown properly
|
||||
- [ ] Image
|
||||
- [ ] Text or dev file
|
||||
- [ ] Markdown file
|
||||
- [ ] PDF
|
||||
- [ ] HTML
|
||||
- [ ] Archive files (.zip, .tar, .rar)
|
||||
- [ ] Any other not mentioned file (.exe for example) to verify the unsupported file view is shown
|
||||
|
||||
* Pinning/unpinning
|
||||
- [ ] Pin the window, switch between images of different size, verify the window stays at the same place and the same size.
|
||||
- [ ] Pin the window, close and reopen Peek, verify the new window is opened at the same place and the same size as before.
|
||||
- [ ] Unpin the window, switch to a different file, verify the window is moved to the default place.
|
||||
- [ ] Unpin the window, close and reopen Peek, verify the new window is opened on the default place.
|
||||
|
||||
* Open with a default program
|
||||
- [ ] By clicking a button.
|
||||
- [ ] By pressing enter.
|
||||
|
||||
- [ ] Switch between files in the folder using `LeftArrow` and `RightArrow`, verify you can switch between all files in the folder.
|
||||
- [ ] Open multiple files, verify you can switch only between selected files.
|
||||
- [ ] Change the shortcut, verify the new one works.
|
Loading…
Reference in New Issue
Block a user