Пример #1
0
        public static void WaitForStatusIcon(int timeout = 20000, string text = "", bool waitForExisting = true)
        {
            if (Platform.IsMac)
            {
                Ide.WaitUntil(
                    () => {
                    var icons  = Session.GetGlobalValue <string[]>("MonoDevelop.Ide.IdeApp.Workbench.RootWindow.StatusBar.StatusIcons");
                    bool found = false;
                    foreach (string icon in icons)
                    {
                        if (icon == text)
                        {
                            found = true;
                            break;
                        }
                    }

                    return(found ^ waitForExisting);
                },
                    timeout
                    );
            }

            // TODO:
        }
Пример #2
0
        public static bool IsBuildSuccessful(int timeoutInSecs)
        {
            bool isBuildSuccessful = false;

            Ide.WaitUntil(() => {
                var actualStatusMessage = Workbench.GetStatusMessage();
                if (actualStatusMessage == "Build successful.")
                {
                    isBuildSuccessful = true;
                    return(true);
                }
                if (actualStatusMessage == "Build failed.")
                {
                    isBuildSuccessful = false;
                    return(true);
                }
                var match = buildRegex.Match(actualStatusMessage);
                if (match != null && match.Success)
                {
                    isBuildSuccessful = string.Equals(match.Groups ["errors"].ToString(), "0");
                    return(true);
                }
                return(false);
            },
                          pollStep: 5 * 1000,
                          timeout: timeoutInSecs * 1000,
                          timeoutMessage: () => "GetStatusMessage=" + Workbench.GetStatusMessage());

            return(isBuildSuccessful);
        }
Пример #3
0
        public static string GetStatusMessage(int timeout = 20000, bool waitForNonEmpty = true)
        {
            if (Platform.IsMac)
            {
                const string macStatusTextField = "MonoDevelop.Ide.IdeApp.Workbench.RootWindow.StatusBar.text";
                if (waitForNonEmpty)
                {
                    Ide.WaitUntil(
                        () => Session.GetGlobalValue <string> (macStatusTextField) != string.Empty,
                        timeout
                        );
                }
                return((string)Session.GetGlobalValue(macStatusTextField));
            }

            if (waitForNonEmpty)
            {
                const string gtkStatusMessageCount = "MonoDevelop.Ide.IdeApp.Workbench.RootWindow.StatusBar.messageQueue.Count";
                Ide.WaitUntil(
                    () => Session.GetGlobalValue <int> (gtkStatusMessageCount) == 0,
                    timeout,
                    timeoutMessage: () => "MessageQueue.Count=" + Session.GetGlobalValue <int> (gtkStatusMessageCount)
                    );
            }
            return((string)Session.GetGlobalValue("MonoDevelop.Ide.IdeApp.Workbench.RootWindow.StatusBar.renderArg.CurrentText"));
        }
Пример #4
0
 static void PollStatusMessage(string[] statusMessage, int timeoutInSecs, int pollStepInSecs, bool waitForMessage = true)
 {
     Ide.WaitUntil(() => {
         var actualStatusMessage = Ide.GetStatusMessage();
         return(waitForMessage == (statusMessage.Contains(actualStatusMessage, StringComparer.OrdinalIgnoreCase)));
     }, pollStep: pollStepInSecs * 1000, timeout: timeoutInSecs * 1000);
 }
Пример #5
0
        public static void WaitForStatusIcon(int timeout = 20000, string text = "", bool waitForExisting = true)
        {
            if (Platform.IsMac)
            {
                Ide.WaitUntil(
                    () => {
                    var icons  = Session.GetGlobalValue <string[]>("MonoDevelop.Ide.IdeApp.Workbench.statusBar.CurrentIcons");
                    bool found = false;
                    foreach (string icon in icons)
                    {
                        if (icon == text)
                        {
                            found = true;
                            break;
                        }
                    }

                    return(found ^ waitForExisting);
                },
                    timeout
                    );
            }

            throw new NotImplementedException("Gtk backend not implemented");
        }
Пример #6
0
        public static bool ClickButtonAlertDialog(string buttonText)
        {
            if (Platform.IsMac)
            {
                Ide.WaitUntil(() => Session.Query(c => c.Marked("Xamarin Studio").Marked("AppKit.NSPanel")).Any());
                return(Session.ClickElement(c => c.Marked("AppKit.NSButton").Text(buttonText)));
            }

            throw new PlatformNotSupportedException("ClickButtonAlertDialog is only supported on Mac");
        }
Пример #7
0
 public static bool Debug(int timeoutSeconds = 20, int pollStepSecs = 1)
 {
     Session.ExecuteCommand("MonoDevelop.Debugger.DebugCommands.Debug");
     try {
         Ide.WaitUntil(
             () => !Session.Query(c => IdeQuery.RunButton(c).Property("Icon", "Stop")).Any(),
             timeout: timeoutSeconds * 1000, pollStep: pollStepSecs * 1000);
         return(false);
     } catch (TimeoutException) {
         return(true);
     }
 }
Пример #8
0
 public static bool Run(int timeoutSeconds = 20, int pollStepSecs = 5)
 {
     Session.ExecuteCommand(ProjectCommands.Run);
     try {
         Ide.WaitUntil(
             () => !Session.Query(c => IdeQuery.RunButton(c).Property("Icon", "Stop")).Any(),
             timeout: timeoutSeconds * 1000, pollStep: pollStepSecs * 1000);
         return(false);
     } catch (TimeoutException) {
         return(true);
     }
 }
Пример #9
0
 public static bool ClickButtonAlertDialog(string buttonText)
 {
     if (Platform.IsMac)
     {
         Ide.WaitUntil(() => Session.Query(c => c.Marked("Visual Studio").Marked("AppKit.NSPanel")).Any());
         return(Session.ClickElement(c => c.Marked("AppKit.NSButton").Text(buttonText)));
     }
     else
     {
         Ide.WaitUntil(() => Session.Query(c => c.Window().Marked("MonoDevelop.Ide.Gui.Dialogs.GtkAlertDialog")).Any());
         return(Session.ClickElement(c => c.Window().Marked("MonoDevelop.Ide.Gui.Dialogs.GtkAlertDialog").Children().Button().Text(buttonText)));
     }
 }
Пример #10
0
 public static string GetStatusMessage(int timeout = 20000, bool waitForNonEmpty = true)
 {
     if (waitForNonEmpty)
     {
         string text = null;
         Ide.WaitUntil(
             () => (text = Session.GetGlobalValue <string> ("MonoDevelop.Ide.IdeApp.Workbench.statusBar.CurrentText")) != string.Empty,
             timeout
             );
         return(text);
     }
     return((string)Session.GetGlobalValue("MonoDevelop.Ide.IdeApp.Workbench.statusBar.CurrentText"));
 }
Пример #11
0
 static void PollStatusMessage(string[] statusMessage, int timeoutInSecs, int pollStepInSecs, bool waitForMessage = true)
 {
     Ide.WaitUntil(() => {
         string actualStatusMessage = string.Empty;
         try {
             actualStatusMessage = Workbench.GetStatusMessage();
             return(waitForMessage == (statusMessage.Contains(actualStatusMessage, StringComparer.OrdinalIgnoreCase)));
         } catch (TimeoutException e) {
             throw new TimeoutException(
                 string.Format("Timed out. Found status message '{0}'\nand expected one of these:\n\t {1}",
                               actualStatusMessage, string.Join("\n\t", statusMessage)), e);
         }
     }, pollStep: pollStepInSecs * 1000, timeout: timeoutInSecs * 1000);
 }
Пример #12
0
        public static string GetStatusMessage(int timeout = 20000)
        {
            if (Platform.IsMac)
            {
                Ide.WaitUntil(
                    () => Session.GetGlobalValue <string> ("MonoDevelop.Ide.IdeApp.Workbench.RootWindow.StatusBar.text") != string.Empty,
                    timeout
                    );
                return((string)Session.GetGlobalValue("MonoDevelop.Ide.IdeApp.Workbench.RootWindow.StatusBar.text"));
            }

            Ide.WaitUntil(
                () => Session.GetGlobalValue <int> ("MonoDevelop.Ide.IdeApp.Workbench.RootWindow.StatusBar.messageQueue.Count") == 0,
                timeout
                );
            return((string)Session.GetGlobalValue("MonoDevelop.Ide.IdeApp.Workbench.RootWindow.StatusBar.renderArg.CurrentText"));
        }