Exemple #1
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"));
            }
Exemple #2
0
        private void SetRepoPushTo(Guid repo_id, RepositoryPushMode repositoryPushStatus)
        {
            app.NavigateTo <RepositoryController>(c => c.Edit(repo_id));
            var form   = app.FindFormFor <RepositoryDetailModel>();
            var select = new SelectElement(form.Field(f => f.AllowAnonymousPush).Field);

            select.SelectByValue(repositoryPushStatus.ToString("D"));
            form.Submit();
            ITH.AssertThatNoValidationErrorOccurred();
        }
 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());
 }
Exemple #4
0
 public void Authenticate(MvcWebApp app)
 {
     app.NavigateTo <HomeController>(c => c.LogOn("/Account"));
     app.FindFormFor <LogOnModel>()
     .Field(f => f.Username).SetValueTo("admin")
     .Field(f => f.Password).SetValueTo("admin")
     .Submit();
 }
Exemple #5
0
 public void Authenticate(MvcWebApp mvcWebApp)
 {
     mvcWebApp.NavigateTo <AuthController>(c => c.Login());
     mvcWebApp.FindFormFor <LoginForm>()
     .Field(f => f.EmailAddress).SetValueTo("*****@*****.**")
     .Field(f => f.Password).SetValueTo("Password1")
     .Submit();
 }
 public void Authenticate(MvcWebApp app)
 {
     app.NavigateTo<HomeController>(c => c.LogOn("/Account"));
     app.FindFormFor<LogOnModel>()
         .Field(f => f.Username).SetValueTo("admin")
         .Field(f => f.Password).SetValueTo("admin")
         .Submit();
 }
        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 Authenticate(MvcWebApp mvcWebApp)
        {
            mvcWebApp.NavigateTo <AccountController>(c => c.Login(string.Empty));

            mvcWebApp.FindFormFor <LoginViewModel>()
            .Field(m => m.UserName).SetValueTo("*****@*****.**")
            .Field(m => m.Password).SetValueTo("RealPassword")
            .Submit();
        }
		public void Authenticate(MvcWebApp mvcWebApp)
		{
            mvcWebApp.NavigateTo<AccountController>(c => c.Login(string.Empty));

            mvcWebApp.FindFormFor<LoginViewModel>()
				.Field(m => m.UserName).SetValueTo("*****@*****.**")
				.Field(m => m.Password).SetValueTo("RealPassword")
				.Submit();
		}
        public void Authenticate(MvcWebApp mvcWebApp)
        {
            mvcWebApp.NavigateTo("Logon","Account");

            mvcWebApp.FindFormFor<LogOnModel>()
                .Field(m => m.UserName).SetValueTo("*****@*****.**")
                .Field(m => m.Password).SetValueTo("RealPassword")
                .Submit();
        }
        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 Authenticate(MvcWebApp app)
        {
            app.NavigateTo<AuthenticationController>(c => c.LogOn());
            app.Browser.Manage().Cookies.DeleteAllCookies();

            app.FindFormFor<LogOnForm>().Field(f => f.EmailAddress)
                .SetValueTo("*****@*****.**").Field(f => f.Password)
                .SetValueTo("TestPassword01")
                .Submit();
        }
        private void DeleteRepository(Guid guid)
        {
            app.NavigateTo <RepositoryController>(c => c.Delete(guid));
            app.FindFormFor <RepositoryDetailModel>().Submit();

            // make sure it no longer is listed
            app.NavigateTo <RepositoryController>(c => c.Index(null, null));
            try
            {
                var ele = app.Browser.FindElement(By.Id("Repositories"));
                Assert.Fail("Table should not exist without repositories!");
            }
            catch (NoSuchElementException exc)
            {
                if (!exc.Message.Contains(" == Repositories"))
                {
                    throw;
                }
            }
        }
        private void SetAnonPush(string git, bool allowAnonymousPush)
        {
            app.NavigateTo <SettingsController>(c => c.Index());
            var form  = app.FindFormFor <GlobalSettingsModel>();
            var field = form.Field(f => f.AllowAnonymousPush);

            SetCheckbox(field, allowAnonymousPush);
            form.Submit();
        }
Exemple #15
0
        public void Should_create_food()
        {
            var app = new MvcWebApp();

            app.NavigateTo<FoodController>(c => c.Index());

            app.FindLinkTo<FoodController>(x => x.New()).Click();

            app.FindFormFor<EditFoodForm>()
                .Field(f => f.Name).SetValueTo("Rice milk")
                .Submit();

            //assert
            app.AllText().Contains("saved");
        }
        public void EnsureCheckboxesStayCheckOnCreateError()
        {
            CreateUsers(1);
            app.NavigateTo <RepositoryController>(c => c.Create());
            var form     = app.FindFormFor <RepositoryDetailModel>();
            var chkboxes = form.WebApp.Browser.FindElementsByCssSelector("form.pure-form>fieldset>div.pure-control-group.checkboxlist>input");

            foreach (var chk in chkboxes)
            {
                if (!chk.Selected)
                {
                    chk.Click();
                }
            }
            form.Submit();


            form     = app.FindFormFor <RepositoryDetailModel>();
            chkboxes = form.WebApp.Browser.FindElementsByCssSelector("form.pure-form>fieldset>div.pure-control-group.checkboxlist>input");
            foreach (var chk in chkboxes)
            {
                Assert.AreEqual(true, chk.Selected, "A message box was unselected eventhough we selected all!");
            }
        }
Exemple #17
0
        public void Should_create_food()
        {
            var app = new MvcWebApp();

            app.NavigateTo <FoodController>(c => c.Index());

            app.FindLinkTo <FoodController>(x => x.New()).Click();

            app.FindFormFor <EditFoodForm>()
            .Field(f => f.Name).SetValueTo("Rice milk")
            .Submit();

            //assert
            app.AllText().Contains("saved");
        }
 public void LoginAsAdmin()
 {
     _app.NavigateTo <HomeController>(c => c.LogOn("/Account"));
     _app.FindFormFor <LogOnModel>()
     .Field(f => f.Username).SetValueTo("admin")
     .Field(f => f.Password).SetValueTo("admin")
     .Submit();
     _app.UrlMapsTo <AccountController>(c => c.Index());
 }
Exemple #19
0
        public void LoginAsAdmin()
        {
            var cred = _lc.getCredentials("admin");

            _app.NavigateTo <HomeController>(c => c.LogOn("/Account"));
            _app.FindFormFor <LogOnModel>()
            .Field(f => f.Username).SetValueTo(cred.Item1)
            .Field(f => f.Password).SetValueTo(cred.Item2)
            .Submit();
            _app.UrlMapsTo <AccountController>(c => c.Index());
        }