Example #1
0
        public SubmittedNewUserForm ChangeRole(string roleName)
        {
            var rolesList = _driver.FindElementWait(By.XPath("//select[contains(@data-bind, 'options: Model.roles')]"));
            var roleField = new SelectElement(rolesList);

            var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(10));

            wait.Until(x => roleField.Options.Any(o => o.Text == roleName));
            roleField.SelectByText(roleName);

            var submitButton = _driver.FindElementWait(By.XPath("//button[text()='Save']"));

            submitButton.Click();
            var submittedForm = new SubmittedNewUserForm(_driver);

            return(submittedForm);
        }
Example #2
0
        public SubmittedNewUserForm SubmitEditedData(AdminUserRegistrationData editAdminUserData)
        {
            var usernameField = _driver.FindElementWait(By.XPath("//input[contains(@data-bind, 'value: Model.username')]"));

            usernameField.SendKeys(editAdminUserData.UserName);

            var firstNameField = _driver.FindElementWait(By.XPath("//input[contains(@data-bind, 'value: Model.firstName')]"));

            firstNameField.SendKeys(editAdminUserData.FirstName);

            _driver.ScrollPage(0, 600);
            var lastNameField = _driver.FindElementWait(By.XPath("//input[contains(@data-bind, 'value: Model.lastName')]"));

            lastNameField.SendKeys(editAdminUserData.LastName);

            var statusOption = string.Format("//span[text()='{0}']", editAdminUserData.Status);
            var statusField  = _driver.FindElementWait(By.XPath(statusOption));

            statusField.Click();
            _driver.ScrollPage(0, 400);

            var licenseesWidget = new MultiSelectWidget(_driver, By.XPath("//div[contains(@data-bind, 'items: Model.assignedLicensees')]"));

            licenseesWidget.SelectFromMultiSelect(editAdminUserData.Licensee);

            var brandsWidget = new MultiSelectWidget(_driver, By.XPath("//div[contains(@data-bind, 'items: Model.allowedBrands')]"));

            brandsWidget.SelectFromMultiSelect(editAdminUserData.Brand);
            var currenciesWidget = new MultiSelectWidget(_driver, By.XPath("//div[contains(@data-bind, 'items: Model.currencies')]"));

            currenciesWidget.SelectFromMultiSelect(editAdminUserData.Currency);

            _driver.ScrollPage(0, 800);

            var descriptionField = _driver.FindElementWait(By.XPath("//textarea[contains(@data-bind, 'value: Model.description')]"));

            descriptionField.SendKeys(editAdminUserData.Description);

            var submitButton = _driver.FindElementWait(By.XPath("//button[text()='Save']"));

            submitButton.Click();
            var submittedForm = new SubmittedNewUserForm(_driver);

            return(submittedForm);
        }
Example #3
0
        public SubmittedNewUserForm Submit(AdminUserRegistrationData data)
        {
            var userName = _driver.FindElementWait(By.XPath("//input[contains(@data-bind, 'value: Model.username')]"));

            userName.SendKeys(data.UserName);

            var password = _driver.FindElementWait(By.XPath("//input[@data-bind='value: Model.password']"));

            password.SendKeys(data.Password);

            var retypePassword = _driver.FindElementWait(By.XPath("//input[@data-bind='value: Model.passwordConfirmation']"));

            retypePassword.SendKeys(data.Password);

            var firstName = _driver.FindElementWait(By.XPath("//input[contains(@data-bind, 'value: Model.firstName')]"));

            firstName.SendKeys(data.FirstName);

            var lastName = _driver.FindElementWait(By.XPath("//input[contains(@data-bind, 'value: Model.lastName')]"));

            lastName.SendKeys(data.LastName);

            var statusOption = string.Format("//span[text()='{0}']", data.Status);
            var status       = _driver.FindElementWait(By.XPath(statusOption));

            status.Click();

            //_driver.FindElementScroll(By.XPath("//div[contains(@data-bind, 'items: Model.assignedLicensees')]"));
            var licenseesWidget = new MultiSelectWidget(_driver, By.XPath("//div[contains(@data-bind, 'items: Model.assignedLicensees')]"));

            licenseesWidget.SelectFromMultiSelect(data.Licensee);

            _driver.ScrollPage(0, 850);

            var rolesList = _driver.FindElementWait(By.XPath("//select[contains(@data-bind, 'options: Model.roles')]"));

            _driver.FindElementScroll(By.XPath("//select[contains(@data-bind, 'options: Model.roles')]"));
            var roleField = new SelectElement(rolesList);

            roleField.SelectByText(data.Role);

            _driver.ScrollPage(0, 1100);

            //_driver.FindElementScroll(By.XPath("//div[contains(@data-bind, 'items: Model.allowedBrands')]"));
            var brandsWidget = new MultiSelectWidget(_driver, By.XPath("//div[contains(@data-bind, 'items: Model.allowedBrands')]"));

            brandsWidget.SelectFromMultiSelect(data.Brand);

            var currenciesWidget = new MultiSelectWidget(_driver, By.XPath("//div[contains(@data-bind, 'items: Model.currencies')]"));

            currenciesWidget.SelectFromMultiSelect(data.Currency);

            var description = _driver.FindElementWait(By.XPath("//textarea[contains(@data-bind, 'value: Model.description')]"));

            description.SendKeys(data.Description);

            _driver.ScrollPage(0, 1600);

            var submitButton = _driver.FindElementWait(By.XPath("//button[text()='Save']"));

            //_driver.FindElementScroll(By.XPath("//button[text()='Save']"));
            submitButton.Click();
            var submittedForm = new SubmittedNewUserForm(_driver);

            return(submittedForm);
        }