static void Shot(string FileName, IntPtr Window) { Thread.Sleep(500); var startInfo = new ProcessStartInfo { FileName = TestManagerFixture.GetCliPath(), Arguments = $"shot --source win:{Window} -f {FileName}", UseShellExecute = false, CreateNoWindow = true }; var process = Process.Start(startInfo); process?.WaitForExit(); Assert.False(process == null || process.ExitCode != 0, $"Error occurred when taking ScreenShot, hWnd: {Window}, FileName: {FileName}, ExitCode: {process?.ExitCode}"); Assert.True(File.Exists(FileName), $"ScreenShot was not saved: {FileName}"); }
static Process Start(string Arguments) { var path = TestManagerFixture.GetCliPath(); var process = new Process { StartInfo = { FileName = path, Arguments = Arguments, UseShellExecute = false, CreateNoWindow = true, RedirectStandardInput = true, RedirectStandardOutput = true, RedirectStandardError = true }, EnableRaisingEvents = true }; process.Start(); process.BeginErrorReadLine(); process.BeginOutputReadLine(); void Write(string Data, string Prefix) { if (string.IsNullOrWhiteSpace(Data)) { return; } Trace.WriteLine($"{Prefix}: {Data}"); } process.ErrorDataReceived += (S, E) => Write(E.Data, "Err"); process.OutputDataReceived += (S, E) => Write(E.Data, "Out"); return(process); }
public AppRunnerFixture() { App = Application.Launch(new ProcessStartInfo(TestManagerFixture.GetUiPath(), "--no-persist")); MainWindow = App.GetWindow("Captura"); }