Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManish Sinha <manish.sinha@xamarin.com>2015-07-21 23:41:44 +0300
committerManish Sinha <manish.sinha@xamarin.com>2015-07-23 00:35:39 +0300
commitd43c5811f976c77b829476d5d758c0d1b2a9aaf6 (patch)
treea2b262d4924d8ba197c22f98fc49dd3adfc90b09 /main/tests/UserInterfaceTests/Ide.cs
parent2278532feccbd635b1edd83d1e2517a78dd8b43a (diff)
[UITests] Add Workbench class for Workbench related activities and fix tests
* Git Delete Branch * Git Delete Remote * Check that XS opens readme.txt when a NuGetPackage is added which has a readme.txt file * Check that XS opens readme.txt when a NuGet Package is updated which has a readme.txt file * Updated NuGetController to handle update cases
Diffstat (limited to 'main/tests/UserInterfaceTests/Ide.cs')
-rw-r--r--main/tests/UserInterfaceTests/Ide.cs55
1 files changed, 9 insertions, 46 deletions
diff --git a/main/tests/UserInterfaceTests/Ide.cs b/main/tests/UserInterfaceTests/Ide.cs
index cd16a17bb6..3474ce10cf 100644
--- a/main/tests/UserInterfaceTests/Ide.cs
+++ b/main/tests/UserInterfaceTests/Ide.cs
@@ -1,5 +1,5 @@
//
-// IdeApi.cs
+// Ide.cs
//
// Author:
// Lluis Sanchez Gual <lluis@novell.com>
@@ -26,6 +26,7 @@
using System;
using System.Threading;
+using System.Linq;
using MonoDevelop.Core;
using MonoDevelop.Core.Instrumentation;
@@ -34,11 +35,6 @@ using MonoDevelop.Components.AutoTest;
using NUnit.Framework;
-using Gdk;
-using System.Linq;
-using System.Text.RegularExpressions;
-
-
namespace UserInterfaceTests
{
public static class Ide
@@ -47,8 +43,6 @@ namespace UserInterfaceTests
get { return TestService.Session; }
}
- static Regex buildRegex = new Regex (@"Build: (?<errors>\d*) error\D*, (?<warnings>\d*) warning\D*", RegexOptions.Compiled);
-
public static void OpenFile (FilePath file)
{
Session.GlobalInvoke ("MonoDevelop.Ide.IdeApp.Workbench.OpenDocument", (string) file, true);
@@ -69,7 +63,7 @@ namespace UserInterfaceTests
public static bool BuildSolution (bool isPass = true, int timeoutInSecs = 360)
{
Session.ExecuteCommand (ProjectCommands.BuildSolution);
- return isPass == IsBuildSuccessful (timeoutInSecs);
+ return isPass == Workbench.IsBuildSuccessful (timeoutInSecs);
}
public static void WaitUntil (Func<bool> done, int timeout = 20000, int pollStep = 200)
@@ -84,45 +78,14 @@ namespace UserInterfaceTests
throw new TimeoutException ("Timed out waiting for Function: "+done.Method.Name);
}
- //no saner way to do this
- public static string GetStatusMessage (int timeout = 20000)
+ public static bool ClickButtonAlertDialog (string buttonText)
{
if (Platform.IsMac) {
- 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.Query (c => c.Marked ("Xamarin Studio").Marked ("AppKit.NSPanel")).Any ());
+ return Session.ClickElement (c => c.Marked ("AppKit.NSButton").Text (buttonText));
}
- 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");
- }
-
- public static bool IsBuildSuccessful (int timeoutInSecs)
- {
- bool isBuildSuccessful = false;
- Ide.WaitUntil (() => {
- var actualStatusMessage = Ide.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);
- return isBuildSuccessful;
+ throw new PlatformNotSupportedException ("ClickButtonAlertDialog is only supported on Mac");
}
public static void RunAndWaitForTimer (Action action, string counter, int timeout = 20000)
@@ -172,10 +135,10 @@ namespace UserInterfaceTests
static void PollStatusMessage (string[] statusMessage, int timeoutInSecs, int pollStepInSecs, bool waitForMessage = true)
{
Ide.WaitUntil (() => {
- var actualStatusMessage = Ide.GetStatusMessage ();
+ var actualStatusMessage = Workbench.GetStatusMessage ();
return waitForMessage == (statusMessage.Contains (actualStatusMessage, StringComparer.OrdinalIgnoreCase));
}, pollStep: pollStepInSecs * 1000, timeout: timeoutInSecs * 1000);
}
}
-} \ No newline at end of file
+}