public void CreateProject(TemplateSelectionOptions templateOptions,
                                  ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null)
        {
            var newProject = new NewProjectController();

            if (projectDetails.AddProjectToExistingSolution)
            {
                newProject.Open(projectDetails.SolutionName);
            }
            else
            {
                newProject.Open();
            }
            TakeScreenShot("Open");

            OnSelectTemplate(newProject, templateOptions);

            OnEnterTemplateSpecificOptions(newProject, projectDetails.ProjectName, miscOptions);

            OnEnterProjectDetails(newProject, projectDetails, gitOptions, miscOptions);

            OnClickCreate(newProject, projectDetails);

            FoldersToClean.Add(projectDetails.SolutionLocation);
        }
Example #2
0
 void PrintToTestRunner(TemplateSelectionOptions templateOptions,
                        ProjectDetails projectDetails, GitOptions gitOptions, object miscOptions)
 {
     templateOptions.PrintData();
     projectDetails.PrintData();
     gitOptions.PrintData();
     miscOptions.PrintData();
 }
Example #3
0
        public bool UseGit(GitOptions options)
        {
            var gitSelectionSuccess = SetCheckBox("useGitCheckBox", options.UseGit);

            if (gitSelectionSuccess && options.UseGit)
            {
                return(gitSelectionSuccess && SetCheckBox("createGitIgnoreFileCheckBox", options.UseGitIgnore));
            }
            return(gitSelectionSuccess);
        }
		public void CreateBuildProject (TemplateSelectionOptions templateOptions, Action beforeBuild,
			GitOptions gitOptions = null, object miscOptions = null)
		{
			var projectName = GenerateProjectName (templateOptions.TemplateKind);
			var projectDetails = new ProjectDetails {
				ProjectName = projectName,
				SolutionName = projectName,
				SolutionLocation = Util.CreateTmpDir (),
				ProjectInSolution = true
			};
			CreateBuildProject (templateOptions, projectDetails, beforeBuild, gitOptions, miscOptions);
		}
        public void CreateBuildProject(TemplateSelectionOptions templateOptions, Action beforeBuild,
                                       GitOptions gitOptions = null, object miscOptions = null)
        {
            var projectName    = GenerateProjectName(templateOptions.TemplateKind);
            var projectDetails = new ProjectDetails {
                ProjectName       = projectName,
                SolutionName      = projectName,
                SolutionLocation  = Util.CreateTmpDir(),
                ProjectInSolution = true
            };

            CreateBuildProject(templateOptions, projectDetails, beforeBuild, gitOptions, miscOptions);
        }
Example #6
0
        void TestFolderPreview(GitOptions gitOptions, bool projectWithinSolution)
        {
            var projectDetails = new ProjectDetails {
                ProjectName       = projectName,
                SolutionName      = solutionName,
                SolutionLocation  = solutionLocation,
                ProjectInSolution = projectWithinSolution
            };

            ctrl.Open();
            OnSelectTemplate(ctrl, templateOptions);
            OnEnterProjectDetails(ctrl, projectDetails, gitOptions);
            ctrl.ValidatePreviewTree(projectDetails, gitOptions);
            ctrl.Close();
        }
		void TestFolderPreview (GitOptions gitOptions, bool projectWithinSolution)
		{
			var projectDetails = new ProjectDetails {
				ProjectName = projectName,
				SolutionName = solutionName,
				SolutionLocation = solutionLocation,
				ProjectInSolution = projectWithinSolution
			};

			ctrl.Open ();
			OnSelectTemplate (ctrl, templateOptions);
			OnEnterProjectDetails (ctrl, projectDetails, gitOptions);
			ctrl.ValidatePreviewTree (projectDetails, gitOptions);
			ctrl.Close ();
		}
Example #8
0
        public void CreateProject(TemplateSelectionOptions templateOptions,
                                  ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null)
        {
            var newProject = new NewProjectController();

            newProject.Open();
            TakeScreenShot("Open");

            OnSelectTemplate(newProject, templateOptions);

            OnEnterTemplateSpecificOptions(newProject, projectDetails.ProjectName, miscOptions);

            OnEnterProjectDetails(newProject, projectDetails, gitOptions, miscOptions);

            OnClickCreate(newProject);
        }
Example #9
0
        public void ValidatePreviewTree(ProjectDetails projectDetails, GitOptions gitOptions)
        {
            var rootFolder = projectDetails.ProjectInSolution ? projectDetails.SolutionName : projectDetails.ProjectName;

            Func <AppQuery, AppQuery> solutionLocation         = (c) => previewTree(c).Contains(projectDetails.SolutionLocation);
            Func <AppQuery, AppQuery> solutionLocationChildren = (c) => solutionLocation(c).Children();

            Func <AppQuery, AppQuery> rootFolderChildren = (c) => solutionLocationChildren(c).Contains(rootFolder).Children();
            Func <AppQuery, AppQuery> checkForGit        = c => rootFolderChildren(c).Index(0).Contains("<span color='#AAAAAA'>.git</span>");
            Func <AppQuery, AppQuery> checkForGitIgnore  = c => rootFolderChildren(c).Index(1).Contains("<span color='#AAAAAA'>.gitignore</span>");

            Assert.IsNotEmpty(Session.Query(c => solutionLocation(c)));
            Assert.IsNotEmpty(Session.Query(c => solutionLocation(c).Children().Contains(rootFolder)));

            if (gitOptions.UseGit)
            {
                Assert.IsNotEmpty(Session.Query(checkForGit));
                if (gitOptions.UseGitIgnore)
                {
                    Assert.IsNotEmpty(Session.Query(checkForGitIgnore));
                }
                else
                {
                    Assert.IsEmpty(Session.Query(checkForGitIgnore));
                }
            }
            else
            {
                Assert.IsEmpty(Session.Query(checkForGit));
                Assert.IsEmpty(Session.Query(checkForGitIgnore));
            }

            Assert.IsNotEmpty(Session.Query(c => rootFolderChildren(c).Contains(projectDetails.SolutionName + ".sln")));

            if (projectDetails.ProjectInSolution)
            {
                Assert.IsNotEmpty(Session.Query(c => rootFolderChildren(c).Contains(projectDetails.ProjectName)));
                Assert.IsNotEmpty(Session.Query(c => rootFolderChildren(c).Contains(projectDetails.ProjectName).Children().Contains(projectDetails.ProjectName + ".csproj")));
            }
            else
            {
                Assert.IsNotEmpty(Session.Query(c => rootFolderChildren(c).Contains(projectDetails.ProjectName + ".csproj")));
            }
        }
Example #10
0
        public void CreateBuildProject(TemplateSelectionOptions templateOptions, ProjectDetails projectDetails,
                                       Action beforeBuild, GitOptions gitOptions = null, object miscOptions = null)
        {
            try {
                CreateProject(templateOptions, projectDetails, gitOptions, miscOptions);

                try {
                    beforeBuild();
                    TakeScreenShot("BeforeBuild");
                } catch (TimeoutException e) {
                    TakeScreenShot("BeforeBuildActionFailed");
                    Assert.Fail(e.ToString());
                }
                OnBuildTemplate((int)projectDetails.BuildTimeout.TotalSeconds);
            } catch (Exception e) {
                TakeScreenShot("TestFailedWithGenericException");
                Assert.Fail(e.ToString());
            } finally {
                FoldersToClean.Add(projectDetails.SolutionLocation);
            }
        }
		public void CreateBuildProject (TemplateSelectionOptions templateOptions, ProjectDetails projectDetails,
			Action beforeBuild, GitOptions gitOptions = null, object miscOptions = null)
		{
			try {
				CreateProject (templateOptions, projectDetails, gitOptions, miscOptions);

				try {
					beforeBuild ();
					TakeScreenShot ("BeforeBuild");
				} catch (TimeoutException e) {
					TakeScreenShot ("BeforeBuildActionFailed");
					Assert.Fail (e.ToString ());
				}
				OnBuildTemplate ((int)projectDetails.BuildTimeout.TotalSeconds);
			} catch (Exception e) {
				TakeScreenShot ("TestFailedWithGenericException");
				Assert.Fail (e.ToString ());
			} finally {
				FoldersToClean.Add (projectDetails.SolutionLocation);
			}
		}
        protected virtual void OnEnterProjectDetails(NewProjectController newProject, ProjectDetails projectDetails,
                                                     GitOptions gitOptions = null, object miscOptions = null)
        {
            if (!newProject.SetProjectName(projectDetails.ProjectName))
            {
                throw new CreateProjectException(string.Format("Failed at entering ProjectName as '{0}'", projectDetails.ProjectName));
            }

            if (!string.IsNullOrEmpty(projectDetails.SolutionName))
            {
                if (!newProject.SetSolutionName(projectDetails.SolutionName, projectDetails.AddProjectToExistingSolution))
                {
                    throw new CreateProjectException(string.Format("Failed at entering SolutionName as '{0}'", projectDetails.SolutionName));
                }
            }

            if (!string.IsNullOrEmpty(projectDetails.SolutionLocation))
            {
                if (!newProject.SetSolutionLocation(projectDetails.SolutionLocation))
                {
                    throw new CreateProjectException(string.Format("Failed at entering SolutionLocation as '{0}'", projectDetails.SolutionLocation));
                }
            }

            if (!newProject.CreateProjectInSolutionDirectory(projectDetails.ProjectInSolution))
            {
                throw new CreateProjectException(string.Format("Failed at entering ProjectInSolution as '{0}'", projectDetails.ProjectInSolution));
            }

            if (gitOptions != null && !projectDetails.AddProjectToExistingSolution)
            {
                if (!newProject.UseGit(gitOptions))
                {
                    throw new CreateProjectException(string.Format("Failed at setting Git as - '{0}'", gitOptions));
                }
            }

            TakeScreenShot("AfterProjectDetailsFilled");
        }
Example #13
0
        protected virtual void OnEnterProjectDetails(NewProjectController newProject, ProjectDetails projectDetails,
                                                     GitOptions gitOptions = null, object miscOptions = null)
        {
            Assert.IsTrue(newProject.SetProjectName(projectDetails.ProjectName));

            if (!string.IsNullOrEmpty(projectDetails.SolutionName))
            {
                Assert.IsTrue(newProject.SetSolutionName(projectDetails.SolutionName));
            }

            if (!string.IsNullOrEmpty(projectDetails.SolutionLocation))
            {
                Assert.IsTrue(newProject.SetSolutionLocation(projectDetails.SolutionLocation));
            }

            Assert.IsTrue(newProject.CreateProjectInSolutionDirectory(projectDetails.ProjectInSolution));

            if (gitOptions != null)
            {
                Assert.IsTrue(newProject.UseGit(gitOptions));
            }

            TakeScreenShot("AfterProjectDetailsFilled");
        }
		protected virtual void OnEnterProjectDetails (NewProjectController newProject, ProjectDetails projectDetails,
			GitOptions gitOptions = null, object miscOptions = null)
		{
			Assert.IsTrue (newProject.SetProjectName (projectDetails.ProjectName));

			if (!string.IsNullOrEmpty (projectDetails.SolutionName)) {
				Assert.IsTrue (newProject.SetSolutionName (projectDetails.SolutionName));
			}

			if (!string.IsNullOrEmpty (projectDetails.SolutionLocation)) {
				Assert.IsTrue (newProject.SetSolutionLocation (projectDetails.SolutionLocation));
			}

			Assert.IsTrue (newProject.CreateProjectInSolutionDirectory (projectDetails.ProjectInSolution));

			if (gitOptions != null)
				Assert.IsTrue (newProject.UseGit (gitOptions));

			TakeScreenShot ("AfterProjectDetailsFilled");
		}
		public void CreateProject (TemplateSelectionOptions templateOptions,
			ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null)
		{
			var newProject = new NewProjectController ();
			newProject.Open ();
			TakeScreenShot ("Open");

			OnSelectTemplate (newProject, templateOptions);

			OnEnterTemplateSpecificOptions (newProject, projectDetails.ProjectName, miscOptions);

			OnEnterProjectDetails (newProject, projectDetails, gitOptions, miscOptions);

			OnClickCreate (newProject);
		}
		void PrintToTestRunner (TemplateSelectionOptions templateOptions,
			ProjectDetails projectDetails, GitOptions gitOptions, object miscOptions)
		{
			templateOptions.PrintData ();
			projectDetails.PrintData ();
			gitOptions.PrintData ();
			miscOptions.PrintData ();
		}
		protected virtual void OnEnterProjectDetails (NewProjectController newProject, ProjectDetails projectDetails,
			GitOptions gitOptions = null, object miscOptions = null)
		{
			if (!newProject.SetProjectName (projectDetails.ProjectName, projectDetails.AddProjectToExistingSolution)) {
				throw new CreateProjectException (string.Format ("Failed at entering ProjectName as '{0}'", projectDetails.ProjectName));
			}

			if (!string.IsNullOrEmpty (projectDetails.SolutionName)) {
				if (!newProject.SetSolutionName (projectDetails.SolutionName, projectDetails.AddProjectToExistingSolution)) {
					throw new CreateProjectException (string.Format ("Failed at entering SolutionName as '{0}'", projectDetails.SolutionName));
				}
			}

			if (!string.IsNullOrEmpty (projectDetails.SolutionLocation)) {
				if (!newProject.SetSolutionLocation (projectDetails.SolutionLocation)) {
					throw new CreateProjectException (string.Format ("Failed at entering SolutionLocation as '{0}'", projectDetails.SolutionLocation));
				}
			}

			if (!newProject.CreateProjectInSolutionDirectory (projectDetails.ProjectInSolution)) {
				throw new CreateProjectException (string.Format ("Failed at entering ProjectInSolution as '{0}'", projectDetails.ProjectInSolution));
			}

			if (gitOptions != null && !projectDetails.AddProjectToExistingSolution) {
				if (!newProject.UseGit (gitOptions)) {
					throw new CreateProjectException (string.Format ("Failed at setting Git as - '{0}'", gitOptions));
				}
			}

			TakeScreenShot ("AfterProjectDetailsFilled");
		}
		public void CreateProject (TemplateSelectionOptions templateOptions,
			ProjectDetails projectDetails, GitOptions gitOptions = null, object miscOptions = null)
		{
			PrintToTestRunner (templateOptions, projectDetails, gitOptions, miscOptions);
			var newProject = new NewProjectController ();

			if (projectDetails.AddProjectToExistingSolution)
				newProject.Open (projectDetails.SolutionName);
			else
				newProject.Open ();
			TakeScreenShot ("Open");

			OnSelectTemplate (newProject, templateOptions);

			OnEnterTemplateSpecificOptions (newProject, projectDetails.ProjectName, miscOptions);
			
			OnEnterProjectDetails (newProject, projectDetails, gitOptions, miscOptions);

			OnClickCreate (newProject, projectDetails);

			FoldersToClean.Add (projectDetails.SolutionLocation);
		}
		public void ValidatePreviewTree (ProjectDetails projectDetails, GitOptions gitOptions)
		{
			var rootFolder = projectDetails.ProjectInSolution ? projectDetails.SolutionName : projectDetails.ProjectName;

			Func<AppQuery, AppQuery> solutionLocation = (c) => previewTree (c).Contains (projectDetails.SolutionLocation);
			Func<AppQuery, AppQuery> solutionLocationChildren = (c) => solutionLocation (c).Children ();

			Func<AppQuery, AppQuery> rootFolderChildren = (c) => solutionLocationChildren (c).Contains (rootFolder).Children ();
			Func<AppQuery, AppQuery> checkForGit = c => rootFolderChildren (c).Index (0).Contains ("<span color='#AAAAAA'>.git</span>");
			Func<AppQuery, AppQuery> checkForGitIgnore = c => rootFolderChildren (c).Index (1).Contains ("<span color='#AAAAAA'>.gitignore</span>");

			Assert.IsNotEmpty (Session.Query (c => solutionLocation (c)));
			Assert.IsNotEmpty (Session.Query (c => solutionLocation (c).Children ().Contains (rootFolder)));

			if (gitOptions.UseGit) {
				Assert.IsNotEmpty (Session.Query (checkForGit));
				if (gitOptions.UseGitIgnore)
					Assert.IsNotEmpty (Session.Query (checkForGitIgnore));
				else
					Assert.IsEmpty (Session.Query (checkForGitIgnore));
			} else {
				Assert.IsEmpty (Session.Query (checkForGit));
				Assert.IsEmpty (Session.Query (checkForGitIgnore));
			}

			Assert.IsNotEmpty (Session.Query (c => rootFolderChildren (c).Contains (projectDetails.SolutionName + ".sln")));

			if (projectDetails.ProjectInSolution) {
				Assert.IsNotEmpty (Session.Query (c => rootFolderChildren (c).Contains (projectDetails.ProjectName)));
				Assert.IsNotEmpty (Session.Query (c => rootFolderChildren (c).Contains (projectDetails.ProjectName).Children ().Contains (projectDetails.ProjectName + ".csproj")));
			} else {
				Assert.IsNotEmpty (Session.Query (c => rootFolderChildren (c).Contains (projectDetails.ProjectName + ".csproj")));
			}
		}
		public bool UseGit (GitOptions options)
		{
			var gitSelectionSuccess = SetCheckBox ("useGitCheckBox", options.UseGit);
			if (gitSelectionSuccess && options.UseGit)
				return gitSelectionSuccess && SetCheckBox ("createGitIgnoreFileCheckBox", options.UseGitIgnore);
			return gitSelectionSuccess;
		}