Example #1
0
        static void AddUpdatePackage(NuGetPackageOptions packageOptions, Action <string> takeScreenshot, bool isUpdate = false)
        {
            packageOptions.PrintData();
            var nuget = new NuGetController(takeScreenshot, isUpdate);

            nuget.Open();
            nuget.EnterSearchText(packageOptions.PackageName, packageOptions.Version, packageOptions.IsPreRelease);
            for (int i = 0; i < packageOptions.RetryCount; i++)
            {
                try {
                    nuget.SelectResultByPackageName(packageOptions.PackageName, packageOptions.Version);
                    break;
                } catch (NuGetException) {
                    if (i == packageOptions.RetryCount - 1)
                    {
                        throw;
                    }
                }
            }
            nuget.ClickAdd();
            Session.WaitForNoElement(nugetWindow);
            takeScreenshot("NuGet-Update-Is-" + isUpdate);
            try {
                WaitForNuGet.Success(packageOptions.PackageName, isUpdate ? NuGetOperations.Update : NuGetOperations.Add);
            } catch (TimeoutException e) {
                takeScreenshot("Wait-For-NuGet-Operation-Failed");
                throw;
            }
            takeScreenshot("NuGet-Operation-Finished");
        }
		static void AddUpdatePackage (NuGetPackageOptions packageOptions, Action<string> takeScreenshot, bool isUpdate = false)
		{
			packageOptions.PrintData ();
			takeScreenshot = takeScreenshot ?? delegate {};
			var nuget = new NuGetController (takeScreenshot, isUpdate);
			nuget.Open ();
			nuget.EnterSearchText (packageOptions.PackageName, packageOptions.Version, packageOptions.IsPreRelease);
			for (int i = 0; i < packageOptions.RetryCount; i++) {
				try {
					nuget.SelectResultByPackageName (packageOptions.PackageName, packageOptions.Version);
					break;
				} catch (NuGetException) {
					if (i == packageOptions.RetryCount - 1)
						throw;
				}
			}
			nuget.ClickAdd ();
			Session.WaitForNoElement (nugetWindow);
			takeScreenshot ("NuGet-Update-Is-"+isUpdate);
			try {
				WaitForNuGet.Success (packageOptions.PackageName, isUpdate ? NuGetOperations.Update : NuGetOperations.Add);
			} catch (TimeoutException e) {
				takeScreenshot ("Wait-For-NuGet-Operation-Failed");
				throw;
			}
			takeScreenshot ("NuGet-Operation-Finished");
		}
Example #3
0
		public static void UpdatePackage (NuGetPackageOptions packageOptions, UITestBase testContext = null)
		{
			Action<string> screenshotAction = delegate { };
			if (testContext != null) {
				testContext.ReproStep (string.Format ("Update NuGet package '{0}'", packageOptions.PackageName), packageOptions);
				screenshotAction = testContext.TakeScreenShot;
			}
			AddUpdatePackage (packageOptions, screenshotAction, true);
		}
Example #4
0
        public static void UpdatePackage(NuGetPackageOptions packageOptions, UITestBase testContext = null)
        {
            Action <string> screenshotAction = delegate { };

            if (testContext != null)
            {
                testContext.ReproStep(string.Format("Update NuGet package '{0}'", packageOptions.PackageName), packageOptions);
                screenshotAction = testContext.TakeScreenShot;
            }
            AddUpdatePackage(packageOptions, screenshotAction, true);
        }
Example #5
0
		public static void AddPackage (NuGetPackageOptions packageOptions, Action<string> takeScreenshot = null)
		{
			var nuget = new NuGetController (takeScreenshot);
			nuget.Open ();
			nuget.EnterSearchText (packageOptions.PackageName, packageOptions.Version, packageOptions.IsPreRelease);
			nuget.SelectResultByPackageName (packageOptions.PackageName, packageOptions.Version);
			nuget.ClickAdd ();
			Ide.WaitForStatusMessage (new [] {
				string.Format ("{0} successfully added.", packageOptions.PackageName)
			});
			if (takeScreenshot != null)
				takeScreenshot ("Package-Added");
		}
		static void AddUpdatePackage (NuGetPackageOptions packageOptions, Action<string> takeScreenshot, bool isUpdate)
		{
			var nuget = new NuGetController (takeScreenshot, isUpdate);
			nuget.Open ();
			nuget.EnterSearchText (packageOptions.PackageName, packageOptions.Version, packageOptions.IsPreRelease);
			nuget.SelectResultByPackageName (packageOptions.PackageName, packageOptions.Version);
			nuget.ClickAdd ();
			Ide.WaitForStatusMessage (new[] {
				string.Format ("{0} successfully {1}.", packageOptions.PackageName, isUpdate ? "updated": "added")
			});
			if (takeScreenshot != null)
				takeScreenshot ("NuGet-Operation-Finished");
		}
        static void AddUpdatePackage(NuGetPackageOptions packageOptions, Action <string> takeScreenshot, bool isUpdate)
        {
            var nuget = new NuGetController(takeScreenshot, isUpdate);

            nuget.Open();
            nuget.EnterSearchText(packageOptions.PackageName, packageOptions.Version, packageOptions.IsPreRelease);
            nuget.SelectResultByPackageName(packageOptions.PackageName, packageOptions.Version);
            nuget.ClickAdd();
            Ide.WaitForStatusMessage(new[] {
                string.Format("{0} successfully {1}.", packageOptions.PackageName, isUpdate ? "updated": "added")
            });
            if (takeScreenshot != null)
            {
                takeScreenshot("NuGet-Operation-Finished");
            }
        }
Example #8
0
        public static void AddPackage(NuGetPackageOptions packageOptions, Action <string> takeScreenshot = null)
        {
            var nuget = new NuGetController(takeScreenshot);

            nuget.Open();
            nuget.EnterSearchText(packageOptions.PackageName, packageOptions.Version, packageOptions.IsPreRelease);
            nuget.SelectResultByPackageName(packageOptions.PackageName, packageOptions.Version);
            nuget.ClickAdd();
            Ide.WaitForStatusMessage(new [] {
                string.Format("{0} successfully added.", packageOptions.PackageName)
            });
            if (takeScreenshot != null)
            {
                takeScreenshot("Package-Added");
            }
        }
Example #9
0
        public void TestDontOpenReadmeOpenedInOther()
        {
            var packageInfo = new NuGetPackageOptions {
                PackageName  = "RestSharp",
                Version      = "105.2.3",
                IsPreRelease = true
            };

            var projectDetails = CreateProject();

            NuGetController.AddPackage(packageInfo, this);
            WaitForNuGetReadmeOpened();
            Session.ExecuteCommand(FileCommands.CloseFile);

            var pclTemplateOptions = new TemplateSelectionOptions {
                CategoryRoot     = "Other",
                Category         = ".NET",
                TemplateKindRoot = "General",
                TemplateKind     = "Library"
            };
            var pclProjectDetails = ProjectDetails.ToExistingSolution(projectDetails.SolutionName,
                                                                      GenerateProjectName(pclTemplateOptions.TemplateKind));

            CreateProject(pclTemplateOptions, pclProjectDetails);
            Ide.WaitForIdeIdle(30);

            SolutionExplorerController.SelectProject(projectDetails.SolutionName, pclProjectDetails.ProjectName);
            NuGetController.AddPackage(packageInfo, this);
            try {
                WaitForNuGetReadmeOpened(false);
                var failureMessage = string.Format("Expected: {0}\nActual:{1}",
                                                   "readme.txt tab should not open", "readme.txt tab opens");
                ReproStep(failureMessage);
                Assert.Fail(failureMessage);
            } catch (TimeoutException) {
                Session.DebugObject.Debug("readme.txt tab failed to open as expected");
            }
        }
		public void TestDontOpenReadmeOpenedInOther ()
		{
			var packageInfo = new NuGetPackageOptions {
				PackageName = "RestSharp",
				Version = "105.2.3",
				IsPreRelease = true
			};

			var projectDetails = CreateProject ();
			NuGetController.AddPackage (packageInfo, this);
			WaitForNuGetReadmeOpened ();
			Session.ExecuteCommand (FileCommands.CloseFile);

			var pclTemplateOptions = new TemplateSelectionOptions {
				CategoryRoot = "Other",
				Category = ".NET",
				TemplateKindRoot = "General",
				TemplateKind = "Library"
			};
			var pclProjectDetails = ProjectDetails.ToExistingSolution (projectDetails.SolutionName,
				GenerateProjectName (pclTemplateOptions.TemplateKind));
			CreateProject (pclTemplateOptions, pclProjectDetails);
			Ide.WaitForIdeIdle (30);

			SolutionExplorerController.SelectProject (projectDetails.SolutionName, pclProjectDetails.ProjectName);
			NuGetController.AddPackage (packageInfo, this);
			try {
				WaitForNuGetReadmeOpened (false);
				var failureMessage = string.Format ("Expected: {0}\nActual:{1}",
					"readme.txt tab should not open", "readme.txt tab opens");
				ReproStep (failureMessage);
				Assert.Fail (failureMessage);
			} catch (TimeoutException) {
				Session.DebugObject.Debug ("readme.txt tab failed to open as expected");
			}
		}
Example #11
0
		public void TestDontOpenReadmeOpenedInOther ()
		{
			var packageInfo = new NuGetPackageOptions {
				PackageName = "RestSharp",
				Version = "105.0.1",
				IsPreRelease = true
			};

			var projectDetails = CreateProject ();
			NuGetController.AddPackage (packageInfo, TakeScreenShot);
			WaitForNuGetReadmeOpened ();
			Session.ExecuteCommand (FileCommands.CloseFile);

			var pclTemplateOptions = new TemplateSelectionOptions {
				CategoryRoot = "Other",
				Category = ".NET",
				TemplateKindRoot = "General",
				TemplateKind = "Library"
			};
			var pclProjectDetails = ProjectDetails.ToExistingSolution (projectDetails.SolutionName,
				GenerateProjectName (pclTemplateOptions.TemplateKind));
			CreateProject (pclTemplateOptions, pclProjectDetails);

			SolutionExplorerController.SelectProject (projectDetails.SolutionName, pclProjectDetails.ProjectName);
			NuGetController.AddPackage (packageInfo, TakeScreenShot);
			Assert.Throws<TimeoutException> (WaitForNuGetReadmeOpened);
		}
Example #12
0
		public static void UpdatePackage (NuGetPackageOptions packageOptions, Action<string> takeScreenshot = null)
		{
			AddUpdatePackage (packageOptions, takeScreenshot, true);
		}
Example #13
0
 public static void UpdatePackage(NuGetPackageOptions packageOptions, Action <string> takeScreenshot = null)
 {
     AddUpdatePackage(packageOptions, takeScreenshot, true);
 }