using System.Diagnostics;

namespace Tests.E2ETests {
    public class WinAppDriver : IDisposable {

        public const string WinAppDriverUrl = "http://127.0.0.1:4723";
        private const string WinAppDriverPath = @"C:\Program Files (x86)\Windows Application Driver\WinAppDriver.exe";
        private readonly Process WinAppDriverProcess;

        public WinAppDriver() {
            WinAppDriverProcess = Process.Start(new ProcessStartInfo(WinAppDriverPath) {
                //UseShellExecute = true,
                //Verb = "runas",  // run as administrator
                RedirectStandardInput = true,
                EnvironmentVariables = {
                //    { "DX.UITESTINGENABLED", "1" },
                }
            })!;
        }

        public void Dispose() {
            GC.SuppressFinalize(this);
            WinAppDriverProcess.StandardInput.WriteLine("");
            WinAppDriverProcess.Dispose();
        }
    }
}
