public void DeleteUser(Guid userId)
 {
     _app.NavigateTo <AccountController>(c => c.Delete(userId));
     _app.FindFormFor <UserModel>().Submit();
     _app.WaitForElementToBeVisible(By.CssSelector("div.summary-success"), TimeSpan.FromSeconds(1));
     _app.UrlShouldMapTo <AccountController>(c => c.Index());
 }
Example #2
0
            public void UserDetailRequiresLogin()
            {
                app.NavigateTo <HomeController>(c => c.LogOff());
                app.UrlShouldMapTo <HomeController>(c => c.LogOn("/Home/Index"));

                app.NavigateTo <AccountController>(c => c.Detail(new Guid("7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f")));

                app.UrlShouldMapTo <HomeController>(c => c.LogOn("/Account/Detail/7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f"));
            }
 public static void DeleteTeam(MvcWebApp app, Guid Id)
 {
     app.NavigateTo <TeamController>(c => c.Delete(Id));
     app.FindFormFor <TeamEditModel>().Submit();
     app.WaitForElementToBeVisible(By.CssSelector("div.summary-success"), TimeSpan.FromSeconds(1));
     app.UrlShouldMapTo <TeamController>(c => c.Index());
 }
Example #4
0
        public void EnsureCookiePersistBetweenBrowserRestart()
        {
            app.NavigateTo <HomeController>(c => c.LogOff()); // in case the cookie is set
            app.NavigateTo <RepositoryController>(c => c.Index(null, null));
            app.Browser.Manage().Cookies.DeleteAllCookies();
            Thread.Sleep(TimeSpan.FromSeconds(5)); // give it some time to delete the cookies

            app.NavigateTo <AccountController>(c => c.Detail(new Guid("7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f")));
            app.UrlShouldMapTo <HomeController>(c => c.LogOn("/Account/Detail/7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f"));

            var form     = app.FindFormFor <LogOnModel>();
            var chkField = form.Field(f => f.Username).SetValueTo("admin")
                           .Field(f => f.Password).SetValueTo("admin")
                           .Field(f => f.RememberMe).Field;

            ITH.SetCheckbox(chkField, true);
            form.Submit();
            app.UrlShouldMapTo <AccountController>(c => c.Detail(new Guid("7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f")));

            MvcWebApp.Driver.Shutdown();
            app = new MvcWebApp();
            ITH = new IntegrationTestHelpers(app, lc);
            app.NavigateTo <AccountController>(c => c.Detail(new Guid("7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f")));
            app.UrlShouldMapTo <AccountController>(c => c.Detail(new Guid("7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f")));
            // ok we re logged in with success.

            // Now let's make sure we can unset remember me
            app.NavigateTo <HomeController>(c => c.LogOff());
            app.NavigateTo <HomeController>(c => c.LogOn(""));
            form     = app.FindFormFor <LogOnModel>();
            chkField = form.Field(f => f.Username).SetValueTo("admin")
                       .Field(f => f.Password).SetValueTo("admin")
                       .Field(f => f.RememberMe).Field;
            ITH.SetCheckbox(chkField, false);
            form.Submit();

            app.UrlShouldMapTo <RepositoryController>(c => c.Index(null, null));

            MvcWebApp.Driver.Shutdown();
            app = new MvcWebApp();
            ITH = new IntegrationTestHelpers(app, lc);

            app.NavigateTo <AccountController>(c => c.Detail(new Guid("7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f")));
            app.UrlShouldMapTo <HomeController>(c => c.LogOn("/Account/Detail/7479fc09-2c0b-4e93-a2cf-5e4bbf6bab4f"));
        }
        public void EnsureCookiePersistBetweenBrowserRestart()
        {
            app.NavigateTo<HomeController>(c => c.LogOff()); // in case the cookie is set
            app.NavigateTo<RepositoryController>(c => c.Index(null, null));
            app.Browser.Manage().Cookies.DeleteAllCookies();
            Thread.Sleep(TimeSpan.FromSeconds(5)); // give it some time to delete the cookies

            app.NavigateTo<RepositoryController>(c => c.Index(null, null));
            app.UrlShouldMapTo<HomeController>(c => c.LogOn("/Repository/Index"));
            var form = app.FindFormFor<LogOnModel>();
            var chkField = form.Field(f => f.Username).SetValueTo("admin")
                .Field(f=> f.Password).SetValueTo("admin")
                .Field(f => f.RememberMe).Field;
            ITH.SetCheckbox(chkField, true);
            form.Submit();
            app.UrlShouldMapTo<RepositoryController>(c => c.Index(null, null));

            MvcWebApp.Driver.Shutdown();
            app = new MvcWebApp();

            app.NavigateTo<RepositoryController>(c => c.Index(null, null));
            app.UrlShouldMapTo<RepositoryController>(c => c.Index(null, null));
            // ok we re logged in with success.

            // Now let's make sure we can unset remember me
            app.NavigateTo<HomeController>(c => c.LogOff());
            app.NavigateTo<HomeController>(c => c.LogOn(""));
            form = app.FindFormFor<LogOnModel>();
            chkField = form.Field(f => f.Username).SetValueTo("admin")
                .Field(f=> f.Password).SetValueTo("admin")
                .Field(f => f.RememberMe).Field;
            ITH.SetCheckbox(chkField, false);
            form.Submit();

            app.UrlShouldMapTo<RepositoryController>(c => c.Index(null, null));

            MvcWebApp.Driver.Shutdown();
            app = new MvcWebApp();
            ITH = new IntegrationTestHelpers(app, lc);

            app.NavigateTo<RepositoryController>(c => c.Index(null, null));
            app.UrlShouldMapTo<HomeController>(c => c.LogOn("/Repository/Index"));
        }
        public void CheckTagLinksWorkInViews()
        {
            ForAllGits(git =>
            {
                var repo_id = ITH.CreateRepositoryOnWebInterface(RepositoryName);
                CloneEmptyRepositoryWithCredentials(git);
                CreateIdentity(git);
                CreateAndAddFiles(git);
                RunGitOnRepo(git, "push origin master").ExpectSuccess();
                RunGitOnRepo(git, "tag a HEAD").ExpectSuccess();
                RunGitOnRepo(git, "push --tags").ExpectSuccess();

                var gitresult = RunGitOnRepo(git, "rev-parse HEAD").ExpectSuccess();
                var commit_id = gitresult.StdOut.TrimEnd();
                // check link in Commits
                app.NavigateTo <RepositoryController>(c => c.Commits(repo_id, string.Empty, 1));
                var link = app.Browser.FindElementByCssSelector("span.tag a");
                link.Click();

                app.UrlShouldMapTo <RepositoryController>(c => c.Commits(repo_id, "a", 1));

                // check link in tags
                app.NavigateTo <RepositoryController>(c => c.Tags(repo_id, string.Empty, 1));
                link = app.Browser.FindElementByCssSelector("div.tag a");
                link.Click();
                app.UrlShouldMapTo <RepositoryController>(c => c.Commits(repo_id, "a", 1));

                // check link in single commit
                app.NavigateTo <RepositoryController>(c => c.Commit(repo_id, commit_id));
                link = app.Browser.FindElementByCssSelector("span.tag a");
                link.Click();
                app.UrlShouldMapTo <RepositoryController>(c => c.Commits(repo_id, "a", 1));

                ITH.DeleteRepositoryUsingWebsite(repo_id);
            });
        }