mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
file utils
This commit is contained in:
@@ -0,0 +1,43 @@
|
|||||||
|
// 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 FancyZonesEditorCommon.Data;
|
||||||
|
|
||||||
|
namespace Microsoft.FancyZonesEditor.UITests.Utils
|
||||||
|
{
|
||||||
|
public class FancyZonesEditorFiles
|
||||||
|
{
|
||||||
|
public IOTestHelper ParamsIOHelper { get; }
|
||||||
|
|
||||||
|
public IOTestHelper AppliedLayoutsIOHelper { get; }
|
||||||
|
|
||||||
|
public IOTestHelper CustomLayoutsIOHelper { get; }
|
||||||
|
|
||||||
|
public IOTestHelper DefaultLayoutsIOHelper { get; }
|
||||||
|
|
||||||
|
public IOTestHelper LayoutHotkeysIOHelper { get; }
|
||||||
|
|
||||||
|
public IOTestHelper LayoutTemplatesIOHelper { get; }
|
||||||
|
|
||||||
|
public FancyZonesEditorFiles()
|
||||||
|
{
|
||||||
|
ParamsIOHelper = new IOTestHelper(new EditorParameters().File);
|
||||||
|
AppliedLayoutsIOHelper = new IOTestHelper(new AppliedLayouts().File);
|
||||||
|
CustomLayoutsIOHelper = new IOTestHelper(new CustomLayouts().File);
|
||||||
|
DefaultLayoutsIOHelper = new IOTestHelper(new DefaultLayouts().File);
|
||||||
|
LayoutHotkeysIOHelper = new IOTestHelper(new LayoutHotkeys().File);
|
||||||
|
LayoutTemplatesIOHelper = new IOTestHelper(new LayoutTemplates().File);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Restore()
|
||||||
|
{
|
||||||
|
ParamsIOHelper.RestoreData();
|
||||||
|
AppliedLayoutsIOHelper.RestoreData();
|
||||||
|
CustomLayoutsIOHelper.RestoreData();
|
||||||
|
DefaultLayoutsIOHelper.RestoreData();
|
||||||
|
LayoutHotkeysIOHelper.RestoreData();
|
||||||
|
LayoutTemplatesIOHelper.RestoreData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using Microsoft.FancyZonesEditor.UITests.Utils;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using OpenQA.Selenium;
|
using OpenQA.Selenium;
|
||||||
using OpenQA.Selenium.Appium;
|
using OpenQA.Selenium.Appium;
|
||||||
@@ -18,6 +19,21 @@ namespace Microsoft.FancyZonesEditor.UnitTests.Utils
|
|||||||
protected const string WindowsApplicationDriverUrl = "http://127.0.0.1:4723";
|
protected const string WindowsApplicationDriverUrl = "http://127.0.0.1:4723";
|
||||||
private const string FancyZonesEditorPath = @"\..\..\..\PowerToys.FancyZonesEditor.exe";
|
private const string FancyZonesEditorPath = @"\..\..\..\PowerToys.FancyZonesEditor.exe";
|
||||||
|
|
||||||
|
private static FancyZonesEditorFiles? _files;
|
||||||
|
|
||||||
|
public static FancyZonesEditorFiles Files
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_files == null)
|
||||||
|
{
|
||||||
|
_files = new FancyZonesEditorFiles();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _files;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public WindowsDriver<WindowsElement>? Session { get; }
|
public WindowsDriver<WindowsElement>? Session { get; }
|
||||||
|
|
||||||
public WindowsElement? MainEditorWindow { get; }
|
public WindowsElement? MainEditorWindow { get; }
|
||||||
@@ -76,6 +92,8 @@ namespace Microsoft.FancyZonesEditor.UnitTests.Utils
|
|||||||
Session.Quit();
|
Session.Quit();
|
||||||
Session.Dispose();
|
Session.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Files.Restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
private WindowsElement? GetLayout(string layoutName)
|
private WindowsElement? GetLayout(string layoutName)
|
||||||
|
|||||||
Reference in New Issue
Block a user