示例#1
0
 public void FillUserForm(string initial, string firstName, string middleName)
 {
     InitialElement.EnterText(initial);
     FirstNameElement.EnterText(firstName);
     MiddleNameElement.EnterText(middleName);
     ButtonSaveElement.ClickElement();
 }
        //Methods

        // Creates a user given a set of details
        public static void CreateUser(string firstname, string lastname, string startdate, string email)
        {
            //Wait for First Name Box
            Helper.WaitForElement(By.XPath("/html/body/div/div/div/form/fieldset/label[1]/input"));
            //Enter First Name
            FirstNameElement.SendKeys(firstname);
            //Enter Last Name
            LastNameElement.SendKeys(lastname);
            //Enter Start Date
            StartDateElement.SendKeys(startdate);
            //Enter Email Address
            EmailElement.SendKeys(email);
            //Click Create Button
            Setup.cDriver.FindElement(AddButton).Click();
        }
示例#3
0
        // Methods

        // Edits User to hold new values
        public static void UpdateUser(string firstname, string lastname, string startdate, string email)
        {
            //Wait for Email Box
            Helper.WaitForElement(By.CssSelector("body > div > div > div > form > fieldset > label:nth-child(6) > input"));
            //Enter First Name
            FirstNameElement.Clear();
            FirstNameElement.SendKeys(firstname);
            //Enter Last Name
            LastNameElement.Clear();
            LastNameElement.SendKeys(lastname);
            //Enter Start Date
            StartDateElement.Clear();
            StartDateElement.SendKeys(startdate);
            //Enter Email Address
            EmailElement.Clear();
            EmailElement.SendKeys(email);
            //Click update Button
            Setup.cDriver.FindElement(UpdateButton).Click();
        }
示例#4
0
 /// <summary>
 /// Gets the first name.
 /// </summary>
 /// <returns></returns>
 public virtual string GetFirstName()
 {
     return(FirstNameElement.GetValue <string>());
 }
示例#5
0
        /// <summary>
        /// Enters the first name.
        /// </summary>
        /// <param name="firstName">The first name.</param>
        /// <returns></returns>
        public virtual _CreateOrUpdateInfoComponent EnterFirstName(string firstName)
        {
            FirstNameElement.SetValue(firstName);

            return(this);
        }
        /// <summary>
        /// Sets the first name.
        /// </summary>
        /// <param name="firstName">The first name.</param>
        /// <returns></returns>
        public virtual IAddressesCreateOrUpdatePage <T> SetFirstName(string firstName)
        {
            FirstNameElement.SetValue(firstName);

            return(this);
        }
        /// <summary>
        /// Searches using the search model.
        /// </summary>
        /// <param name="searchModel">The search model.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">searchModel</exception>
        public virtual IListPage Search(CustomerSearchModel searchModel)
        {
            if (searchModel == null)
            {
                throw new ArgumentNullException(nameof(searchModel));
            }

            EmailElement.SetValue(searchModel.Email);
            FirstNameElement.SetValue(searchModel.FirstName);
            LastNameElement.SetValue(searchModel.LastName);

            if (searchModel.DateOfBirth.HasValue)
            {
                DateOfBirthMonthElement.SelectByValue(
                    searchModel.DateOfBirth.Value.Month.ToString());

                DateOfBirthDayElement.SelectByValue(
                    searchModel.DateOfBirth.Value.Day.ToString());
            }
            else
            {
                DateOfBirthMonthElement.SelectByIndex(0);
                DateOfBirthDayElement.SelectByIndex(0);
            }

            CompanyElement.SetValue(searchModel.Company);
            IpAddressElement.SetValue(searchModel.IpAddress);

            var currentlySelectedItems = CustomerRoles.GetSelectedOptions();

            if (searchModel.CustomerRoles != null)
            {
                foreach (var opt in currentlySelectedItems)
                {
                    if (!searchModel.CustomerRoles?.Contains(opt) ?? true)
                    {
                        CustomerRoles.DeselectItem(opt);
                    }

                    // Check if there are items that have yet to be selected.
                    if (searchModel.CustomerRoles?.Except(currentlySelectedItems).Any() ?? false)
                    {
                        foreach (var _opt in searchModel.CustomerRoles)
                        {
                            CustomerRoles.SelectItem(_opt);
                        }
                    }
                }
            }

            SearchElement.Click();

            // Wait for the ajax indicator to toggle.
            WrappedDriver
            .Wait(TimeSpan.FromSeconds(10))
            .TrySequentialWait(
                out var exception,
                d => IsAjaxBusy(),
                d => !IsAjaxBusy());

            // Page should reload.
            Load();

            return(this);
        }
        /// <summary>
        /// Sets the first name.
        /// </summary>
        /// <param name="firstName">The first name.</param>
        /// <returns></returns>
        public virtual IInfoPage SetFirstName(string firstName)
        {
            FirstNameElement.SetValue(firstName);

            return(this);
        }