[FancyZones]UI testing that works in CI (#29453)

* added test project

* run fz test

* rename proj

* editor test project

* check if FZ is running

* rename

* added assert messages

* spelling

* dev docs

* spelling

* update to latest stable

* exclude ui tests deps

* update packages list in notice.md

* added sample tests

* added file for tests run

* removed unrecognized

* removed run

* fix test configuration

* rename job

* change dependance

* run test template

* removed condition

* tabulation fix

* removed arg

* removed dependance

* removed log

* removed parameters

* test

* test

* added parameters

* pool

* pool

* vs test

* dependance

* download artifact

* publish artifact

* artifact publish conditions

* artifact name, default download path

* set folders

* prepare dotnet and vstest platform

* copy all

* target dotnet8

* test build agents

* set vs test version

* spellcheck

* set test platform version

* package feed selector

* hardcoded vstest location

* are other tests running?

* location

* vstest.console

* upd command

* script path

* search vstest.console

* vs path

* tools dir

* check files

* try full path

* try vstest task

* try full path in vstest task

* change path, remove unnecessary

* test with full vsconsole path

* winappdriver task

* changed args and condition

* default address

* added start operation type

* task name

* remove resolution

* Update run-ui-tests-ci.yml

* Update run-ui-tests-ci.yml

* Update run-ui-tests-ci.yml

* Update run-ui-tests-ci.yml

* AgentResolution should be a string

* Update run-ui-tests-ci.yml

testing against what WinUI gallery has for agent

* Update run-ui-tests-ci.yml

* Update run-ui-tests-ci.yml

* added WinAppDriver.exe

* spellcheck

* remove task

* checkout

* path

* src dir variable

* added init to the second project

* set longer timeout

* try waiting

* rerun

* log session info

* exclude WinAppDriver files from spell-check

* split io class: editor params

* remove unnecessary

* move data to the common project

* io test helper

* write retry

* Moved constants

* file utils

* prepare editor files before launch

* remove unused file

* spellcheck

* create directory

* fixed cleaning up

* remove WinAppDriver from deps

* start WinAppDriver from the default installation path

* installation script

* Revert "spellcheck"

This reverts commit 4bdc395730.

* Revert "exclude WinAppDriver files from spell-check"

This reverts commit 21ee6db3f5.

* install

* installation argument

* spellcheck

* change winappdriver path in fz tests

* delete iohelper

* update docs

* deleted obsolete winappdriver tests

* net version

* try without vstest location

* spellcheck

* Revert "try without vstest location"

This reverts commit 7cd39f3ae6.

* moved json tag constants to the common project
This commit is contained in:
Seraphima Zykova
2024-03-22 13:10:10 +01:00
committed by GitHub
parent c39e306784
commit f6e7635a4e
57 changed files with 1692 additions and 4172 deletions

View File

@@ -1,20 +0,0 @@
// 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.Text.Json;
using FancyZonesEditor.Utils;
namespace FancyZonesEditor
{
public class DashCaseNamingPolicy : JsonNamingPolicy
{
public static DashCaseNamingPolicy Instance { get; } = new DashCaseNamingPolicy();
public override string ConvertName(string name)
{
return name.UpperCamelCaseToDashCase();
}
}
}

View File

@@ -69,6 +69,7 @@
<ProjectReference Include="..\..\..\..\common\interop\PowerToys.Interop.vcxproj" />
<ProjectReference Include="..\..\..\..\common\ManagedCommon\ManagedCommon.csproj" />
<ProjectReference Include="..\..\..\..\common\Common.UI\Common.UI.csproj" />
<ProjectReference Include="..\..\FancyZonesEditorCommon\FancyZonesEditorCommon.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">

View File

@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using FancyZonesEditorCommon.Data;
namespace FancyZonesEditor.Models
{
@@ -99,7 +100,7 @@ namespace FancyZonesEditor.Models
}
}
private bool _showSpacing = LayoutSettings.DefaultShowSpacing;
private bool _showSpacing = LayoutDefaultSettings.DefaultShowSpacing;
// Spacing - free space between cells
public int Spacing
@@ -129,7 +130,7 @@ namespace FancyZonesEditor.Models
get { return 1000; }
}
private int _spacing = LayoutSettings.DefaultSpacing;
private int _spacing = LayoutDefaultSettings.DefaultSpacing;
public GridLayoutModel()
: base()

View File

@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.CompilerServices;
using FancyZonesEditorCommon.Data;
namespace FancyZonesEditor.Models
{
@@ -195,7 +196,7 @@ namespace FancyZonesEditor.Models
}
}
private int _sensitivityRadius = LayoutSettings.DefaultSensitivityRadius;
private int _sensitivityRadius = LayoutDefaultSettings.DefaultSensitivityRadius;
public int SensitivityRadiusMinimum
{
@@ -304,13 +305,13 @@ namespace FancyZonesEditor.Models
}
}
private int _zoneCount = LayoutSettings.DefaultZoneCount;
private int _zoneCount = LayoutDefaultSettings.DefaultZoneCount;
public bool IsZoneAddingAllowed
{
get
{
return TemplateZoneCount < LayoutSettings.MaxZones;
return TemplateZoneCount < LayoutDefaultSettings.MaxZones;
}
}

View File

@@ -3,32 +3,22 @@
// See the LICENSE file in the project root for more information.
using FancyZonesEditor.Models;
using FancyZonesEditorCommon.Data;
namespace FancyZonesEditor
{
public class LayoutSettings
{
// TODO: share the constants b/w C# Editor and FancyZoneLib
public const bool DefaultShowSpacing = true;
public const int DefaultSpacing = 16;
public const int DefaultZoneCount = 3;
public const int DefaultSensitivityRadius = 20;
public const int MaxZones = 128;
public string ZonesetUuid { get; set; } = string.Empty;
public LayoutType Type { get; set; } = LayoutType.PriorityGrid;
public bool ShowSpacing { get; set; } = DefaultShowSpacing;
public bool ShowSpacing { get; set; } = LayoutDefaultSettings.DefaultShowSpacing;
public int Spacing { get; set; } = DefaultSpacing;
public int Spacing { get; set; } = LayoutDefaultSettings.DefaultSpacing;
public int ZoneCount { get; set; } = DefaultZoneCount;
public int ZoneCount { get; set; } = LayoutDefaultSettings.DefaultZoneCount;
public int SensitivityRadius { get; set; } = DefaultSensitivityRadius;
public int SensitivityRadius { get; set; } = LayoutDefaultSettings.DefaultSensitivityRadius;
}
}

View File

@@ -487,6 +487,15 @@ namespace FancyZonesEditor.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to An error occurred while parsing editor parameters..
/// </summary>
public static string Error_Parsing_Editor_Parameters_Message {
get {
return ResourceManager.GetString("Error_Parsing_Editor_Parameters_Message", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to An error occurred while parsing layout hotkeys..
/// </summary>

View File

@@ -435,4 +435,7 @@
<data name="Set_Layout_As_Vertical_Default" xml:space="preserve">
<value>Set layout as a default for vertical monitor orientation</value>
</data>
<data name="Error_Parsing_Editor_Parameters_Message" xml:space="preserve">
<value>An error occurred while parsing editor parameters.</value>
</data>
</root>

View File

@@ -1,22 +0,0 @@
// 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.Linq;
namespace FancyZonesEditor.Utils
{
public static class StringUtils
{
public static string UpperCamelCaseToDashCase(this string str)
{
// If it's single letter variable, leave it as it is
if (str.Length == 1)
{
return str;
}
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "-" + x.ToString() : x.ToString())).ToLowerInvariant();
}
}
}

View File

@@ -0,0 +1,22 @@
// 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.
namespace FancyZonesEditor.Utils
{
public struct ParsingResult
{
public bool Result { get; }
public string Message { get; }
public string MalformedData { get; }
public ParsingResult(bool result, string message = "", string data = "")
{
Result = result;
Message = message;
MalformedData = data;
}
}
}