Exemplo n.º 1
0
 public static ToolTip FindToolTip(Clock.Do perform)
 {
     var clock = new Clock(CoreAppXmlConfiguration.Instance.TooltipWaitTime);
     Clock.Matched matched = obj => obj != null;
     Clock.Expired expired = () => null;
     var automationElement = (AutomationElement) clock.Perform(perform, matched, expired);
     return automationElement == null ? null : new ToolTip(automationElement, new NullActionListener());
 }
 private Window ModalWindow(Clock.Do find, InitializeOption option, WindowSession windowSession)
 {
     var clock = new Clock(CoreAppXmlConfiguration.Instance.BusyTimeout);
     Clock.Matched matched = obj => obj != null;
     Clock.Expired expired = () => null;
     var automationElement = (AutomationElement) clock.Perform(find, matched, expired);
     return automationElement == null ? null: Create(automationElement, option, windowSession);
 }
        private static object FindUiElement(Func<object> find, int busyTimeOut, Clock.Matched matched, Clock.Expired expired)
        {
            var doSearch = new Clock.Do(() => SwallowAllExceptions(find, null));

            var clock = new Clock(busyTimeOut);

            return clock.Perform(doSearch, matched, expired);
        }
        public static void AreEqual(object expected, Func<object> getActual)
        {
            Clock.Do retrieveExpectedValue = () => getActual();
            Clock.Matched matched = actual => Equals(actual, expected);
            Clock.Expired expired = delegate { throw new AssertFailedException(); };

            var clock = new Clock(MAX_ASSERTION_TIMEOUT);
            clock.Perform(retrieveExpectedValue, matched, expired);
        }
Exemplo n.º 5
0
        private BricksCollection<AutomationElement> FindAllWindowElements(Process process)
        {
            var clock = new Clock(CoreAppXmlConfiguration.Instance.UIAutomationZeroWindowBugTimeout, 200);
            Clock.Do @do = delegate
                               {
                                   var windowElements = new BricksCollection<AutomationElement>();
                                   FindDescendantWindowElements(finder, process, windowElements);
                                   if (windowElements.Count == 0) WhiteLogger.Instance.Warn("Could not find any windows for this application.");
                                   return windowElements;
                               };
            Clock.Matched matched = obj => ((BricksCollection<AutomationElement>) obj).Count > 0;
            Clock.Expired expired = () => new BricksCollection<AutomationElement>();

            return (BricksCollection<AutomationElement>) clock.Perform(@do, matched, expired);
        }
Exemplo n.º 6
0
 private static AutomationElement WaitTillFound(Clock.Do find, string message)
 {
     var clock = new Clock(CoreAppXmlConfiguration.Instance.BusyTimeout);
     Clock.Matched matched = obj => obj != null;
     Clock.Expired expired = delegate { throw new UIActionException(message + Debug.GetAllWindows()); };
     return (AutomationElement) clock.Perform(find, matched, expired);
 }
Exemplo n.º 7
0
 public virtual void WaitTill(WaitTillDelegate waitTillDelegate)
 {
     var clock = new Clock(CoreAppXmlConfiguration.Instance.BusyTimeout);
     clock.Perform(() => waitTillDelegate(), obj => obj.Equals(true),
                   delegate { throw new UIActionException("Time out happened" + Constants.BusyMessage); });
 }
 private bool TryGetPopupMenu(AutomationSearchCondition[] searchConditions, ActionListener actionListener, out PopUpMenu popUpMenu)
 {
     var clock = new Clock(CoreAppXmlConfiguration.Instance.PopupTimeout, 100);
     Clock.Do @do = () => finder.Child(searchConditions);
     Clock.Matched matched = obj => obj != null;
     var element = (AutomationElement) clock.Perform(@do, matched, () => null);
     if (element == null)
     {
         popUpMenu = null;
         return false;
     }
     popUpMenu = new PopUpMenu(element, actionListener);
     return true;
 }
 private void WaitTill(Clock.Matched matched)
 {
     window.WaitWhileBusy();
     dashboard.WaitWhileBusy();
     Clock.Do @do = () => editor.Text.Trim();
     var clock = new Clock(5000);
     Clock.Expired expired = delegate { throw new Exception(); };
     clock.Perform(@do, matched, expired);
 }