Exemple #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.statusBar.CurrentIcons");
                    bool found = false;
                    foreach (string icon in icons)
                    {
                        if (icon == text)
                        {
                            found = true;
                            break;
                        }
                    }

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

            // TODO:
        }
Exemple #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);
        }
Exemple #3
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);
     }
 }
Exemple #4
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"));
 }
Exemple #5
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)));
     }
 }
Exemple #6
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,
                   timeoutMessage: () => "GetStatusMessage=" + Workbench.GetStatusMessage());
 }
Exemple #7
0
        public static string GetStatusMessage(int timeout = 20000, bool waitForNonEmpty = true)
        {
            if (Platform.IsMac)
            {
                if (waitForNonEmpty)
                {
                    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"));
            }

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