Beispiel #1
0
        public static void CloseWindow(UIObject window)
        {
            if (window == null)
            {
                throw new ArgumentNullException(paramName: nameof(window));
            }
            using (var processClosedWaiter = new ProcessClosedWaiter(processId: window.ProcessId)) {
                Process.GetProcessById(processId: window.ProcessId).Kill();
                processClosedWaiter.Wait();
            }

            Thread.Sleep(millisecondsTimeout: 750);
        }
Beispiel #2
0
        public static void ForAppDebugger()
        {
            Button   waitForDebuggerInvokerButton = new Button(FindElement.ById("__WaitForDebuggerInvoker"));
            CheckBox debuggerAttachedCheckBox     = new CheckBox(FindElement.ById("__DebuggerAttachedCheckBox"));

            using (UIEventWaiter debuggerAttachedWaiter = debuggerAttachedCheckBox.GetToggledWaiter())
            {
                using (var processWaiter = new ProcessClosedWaiter(TestEnvironment.Application.Process))
                {
                    Log.Comment(string.Format("Waiting for a debugger to attach (processId = {0})...", TestEnvironment.Application.Process.Id));
                    waitForDebuggerInvokerButton.Invoke();

                    var waiter = CompositableWaiter.WaitAny(TimeSpan.FromSeconds(300), debuggerAttachedWaiter, processWaiter);
                    if (waiter == processWaiter)
                    {
                        throw new WaiterException("Process exited while waiting for app debugger.");
                    }
                }
            }
        }