2024-02-23 20:21:40 +01:00
|
|
|
|
// 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.Diagnostics;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Microsoft.FancyZonesEditor.UITests
|
|
|
|
|
|
{
|
|
|
|
|
|
[TestClass]
|
|
|
|
|
|
public class Init
|
|
|
|
|
|
{
|
|
|
|
|
|
private static Process? appDriver;
|
|
|
|
|
|
|
|
|
|
|
|
[AssemblyInitialize]
|
|
|
|
|
|
public static void SetupAll(TestContext context)
|
|
|
|
|
|
{
|
2024-02-27 12:40:46 +01:00
|
|
|
|
string? sourceDirPath = Environment.GetEnvironmentVariable("SrcPath"); // get source dir in CI
|
|
|
|
|
|
if (sourceDirPath == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
sourceDirPath = Path.GetFullPath($"{Environment.CurrentDirectory}" + @".\..\..\..\..\..\"); // local
|
|
|
|
|
|
}
|
2024-02-26 12:38:01 +01:00
|
|
|
|
|
2024-02-27 16:15:00 +01:00
|
|
|
|
context.WriteLine($"Source dir: {sourceDirPath}");
|
2024-02-26 12:38:01 +01:00
|
|
|
|
string winAppDriver = Path.Combine(sourceDirPath, @".\deps\WinAppDriver", "WinAppDriver.exe");
|
2024-02-23 20:21:40 +01:00
|
|
|
|
|
|
|
|
|
|
context.WriteLine($"Attempting to launch WinAppDriver at: {winAppDriver}");
|
|
|
|
|
|
appDriver = Process.Start(winAppDriver);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[AssemblyCleanup]
|
|
|
|
|
|
public static void CleanupAll()
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
appDriver?.Kill();
|
|
|
|
|
|
}
|
|
|
|
|
|
catch
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|