示例#1
0
        public void MyData_User_ChangePassword_Test()
        {
            username = RandomString();
            password = RandomString();
            var user = CreateUser();

            Login();
            var newPassword = RandomString() + "1!";

            Find(css: profileMenu).Click();
            Find(text: "Change Password").Click();

            CurrentUrl.ShouldBe($"{rootUrl}Account/ChangePassword/");

            Find(id: "currentPassword").SendKeys(password);
            Find(id: "newPassword").SendKeys(newPassword);
            Find(id: "confirmPassword").SendKeys(newPassword);
            Find(css: "input[type=submit]").Click();

            PageSource.ShouldContain("Password Changed");

            Find(text: "Return to Home").Click();

            Logout();
            Login(withPassword: newPassword);

            PageSource.ShouldContain(user.Person.Name);
            PageSource.ShouldContain(user.Person.EmailAddress);
        }
示例#2
0
        public void OneTimeGiving_Processes_Payment()
        {
            username = RandomString();
            password = RandomString();
            var user = CreateUser(username, password);
            var org  = db.Organizations.First(o => o.RegistrationTypeId == RegistrationTypeCode.OnlineGiving);

            org.ShouldNotBeNull();
            var orgId = org.OrganizationId;

            FinanceTestUtils.CreateMockPaymentProcessor(db, PaymentProcessTypes.OneTimeGiving, GatewayTypes.Transnational);
            Login();

            Open($"{rootUrl}Person2/{user.PeopleId}");
            WaitForPageLoad();
            Find(css: @"a[href=""#giving""]").Click();
            Wait(1);
            WaitForElementToDisappear(loadingUI);

            Find(text: "Make a One Time Gift").Click();
            Wait(3);
            SwitchToWindow(d => d.Title == "Online Registration");

            CurrentUrl.ShouldBe($"{rootUrl}OnlineReg/{orgId}");
        }
示例#3
0
        public void Create_Role_Test()
        {
            username = RandomString();
            password = RandomString();
            string roleName = "role_" + RandomString();
            var    user     = CreateUser(username, password, roles: new string[] { "Access", "Edit", "Admin" });

            Login();

            Open($"{rootUrl}Lookups/");
            PageSource.ShouldContain("Lookup Codes");

            Find(text: "Roles").Click();
            CurrentUrl.ShouldBe($"{rootUrl}Roles");

            RepeatUntil(() => Find(css: ".box-tools button[type=submit]")?.Click(),
                        condition: () => Find(id: "RoleName.NEW") != null);
            var newRole = Find(id: "RoleName.NEW");

            ScrollTo(newRole);
            RepeatUntil(() => newRole.Click(),
                        condition: () => Find(css: ".editable-input input[type=text]") != null);
            Find(css: ".editable-input input[type=text]").Clear();
            Find(css: ".editable-input input[type=text]").SendKeys(roleName);
            Find(css: ".editable-buttons button[type=submit]").Click();
            Wait(2);

            var adminRole = db.Roles.SingleOrDefault(r => r.RoleName == "Admin");
            var role      = db.Roles.SingleOrDefault(r => r.RoleName == roleName);

            role.ShouldNotBeNull();
            role.Priority.GetValueOrDefault().ShouldBeGreaterThan(adminRole.Priority.GetValueOrDefault());
        }
示例#4
0
        public void MyData_User_ForgotPassword_Test()
        {
            username = RandomString();
            password = RandomString();

            var newPassword = RandomString() + "1!";
            var user        = CreateUser();

            Open(rootUrl);
            WaitForElement("#inputEmail", 30);

            Find(text: "Forgot?").Click();
            CurrentUrl.ShouldBe($"{rootUrl}Account/ForgotPassword");

            var input  = "[name=UsernameOrEmail]";
            var button = "input[type=submit]";

            RepeatUntil(() => {
                Find(css: input)?.SendKeys(username);
                Find(css: button)?.Click();
            }, () => PageSource.Contains("Password Sent"));

            db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, user);
            user.ResetPasswordCode.ShouldNotBeNull();

            Open($"{rootUrl}Account/SetPassword/{user.ResetPasswordCode}");
            PageSource.ShouldContain("Confirm Password Reset");
            Find(css: "button[type=submit]").Click();
            CurrentUrl.ShouldBe($"{rootUrl}Account/SetPasswordConfirm");

            RepeatUntil(() => {
                Find(id: "newPassword").SendKeys(newPassword);
                Find(id: "confirmPassword").SendKeys(newPassword);
                Find(css: button).Click();
            }, () => PageSource.Contains("Password Changed"));

            Find(text: "Return to Home").Click();
            WaitForPageLoad();

            Logout();
            Login(withPassword: newPassword);

            PageSource.ShouldContain(user.Person.Name);
            PageSource.ShouldContain(user.Person.EmailAddress);
        }