public void LoginIntoApplication(UserDto user)
        {
            //EmailFieldTextBox.SendKeys(user.userEmail);
            //PasswordFieldTextBox.SendKeys(user.userPassword);

            //var validUser = user.GetValidUser();
            //var userRuntimeProperties = user.GetType().GetRuntimeProperties(); //returns a collection
            //var userProperties = user.GetType().GetProperties(); //returns an array

            var emailValue = user.GetType().GetRuntimeProperty("userEmail").GetValue(user);

            if (emailValue != null)
            {
                EmailFieldTextBox.SendKeys(emailValue.ToString());
            }

            var passwordValue = user.GetType().GetRuntimeProperty("userPassword").GetValue(user);

            if (passwordValue != null)
            {
                PasswordFieldTextBox.SendKeys(passwordValue.ToString());
            }

            SubmitButton.Click();
        }
        public void FillInForm(DemoQaUserAddressInfoDto user)
        {
            var FullNameValue = user.GetType().GetRuntimeProperty("FullName").GetValue(user);

            if (FullNameValue != null)
            {
                FullNameFieldTextBox.SendKeys(FullNameValue.ToString());
            }

            var EmailValue = user.GetType().GetRuntimeProperty("Email").GetValue(user);

            if (EmailValue != null)
            {
                EmailFieldTextBox.SendKeys(EmailValue.ToString());
            }

            var CurrentAddressValue = user.GetType().GetRuntimeProperty("CurrentAddress").GetValue(user);

            if (CurrentAddressValue != null)
            {
                CurrentAddressFieldTextBox.SendKeys(CurrentAddressValue.ToString());
            }

            var PermanentAddressValue = user.GetType().GetRuntimeProperty("PermanentAddress").GetValue(user);

            if (PermanentAddressValue != null)
            {
                PermanentAddressFieldTextBox.SendKeys(PermanentAddressValue.ToString());
            }
        }
Ejemplo n.º 3
0
 public void LoginIntoApplication(string emailUser, string passwordUser)
 {
     EmailFieldTextBox.SendKeys(emailUser);
     PasswordFieldTextBox.SendKeys(passwordUser);
     Thread.Sleep(2000);
     AutentificareButtonLoginPage.Click();
 }
Ejemplo n.º 4
0
 public void AuthenticateUser(string user, string password)
 {
     EmailFieldTextBox.Click();
     EmailFieldTextBox.SendKeys(user);
     PasswordFieldTextBox.SendKeys(password);
     AuthenticateButton.Click();
 }
Ejemplo n.º 5
0
        public void FillInForm(DemoQaUserDetailsDto user)
        {
            var FirstNameValue = user.GetType().GetRuntimeProperty("FirstName").GetValue(user);

            if (FirstNameValue != null)
            {
                FirstNameFieldTextBox.SendKeys(FirstNameValue.ToString());
            }

            var LastNameValue = user.GetType().GetRuntimeProperty("LastName").GetValue(user);

            if (LastNameValue != null)
            {
                LastNameFieldTextBox.SendKeys(LastNameValue.ToString());
            }

            var EmailValue = user.GetType().GetRuntimeProperty("Email").GetValue(user);

            if (EmailValue != null)
            {
                EmailFieldTextBox.SendKeys(EmailValue.ToString());
            }

            var GenderValue = user.GetType().GetRuntimeProperty("Gender").GetValue(user);

            if (GenderValue != null)
            {
                _driver.FindElement(By.XPath($"//label[text()='{GenderValue}']")).Click();
            }

            var MobilePhoneValue = user.GetType().GetRuntimeProperty("MobilePhone").GetValue(user);

            if (MobilePhoneValue != null)
            {
                MobileFieldTextBox.SendKeys(MobilePhoneValue.ToString());
            }

            var DateOfBirthValue = user.GetType().GetRuntimeProperty("DateOfBirth").GetValue(user);

            if (DateOfBirthValue != null)
            {
                var dob = DateOfBirthValue.ToString().Split('/').ToList();
                SelectDateOfBirth(dob[0], dob[1], dob[2]);
            }

            var SubjectsValue = user.GetType().GetRuntimeProperty("Subjects").GetValue(user);

            if (SubjectsValue != null)
            {
                var subjects = SubjectsValue.ToString().Split(',').ToList();
                foreach (var subject in subjects)
                {
                    SelectSubject(subject);
                }
            }

            var HobbiesValue = user.GetType().GetRuntimeProperty("Hobbies").GetValue(user);

            if (HobbiesValue != null)
            {
                var hobbies = HobbiesValue.ToString().Split(',').ToList();
                foreach (var hobby in hobbies)
                {
                    _driver.FindElement(By.XPath($"//label[text()='{hobby.Trim()}']")).Click();
                }
            }

            var PictureNameValue = user.GetType().GetRuntimeProperty("PictureName").GetValue(user);

            if (PictureNameValue != null)
            {
                var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                ChooseFileButton.SendKeys($"{path}\\Resources\\{PictureNameValue}");
            }

            var CurrentAddressValue = user.GetType().GetRuntimeProperty("CurrentAddress").GetValue(user);

            if (CurrentAddressValue != null)
            {
                CurrentAddressFieldTextBox.SendKeys(CurrentAddressValue.ToString());
            }

            var StateValue = user.GetType().GetRuntimeProperty("State").GetValue(user);

            if (StateValue != null)
            {
                Helper.ScrollElementIntoView(_driver, StateDropdown);
                SelectFromDropdown(StateDropdown, StateValue.ToString());
            }

            var CityValue = user.GetType().GetRuntimeProperty("City").GetValue(user);

            if (CityValue != null)
            {
                SelectFromDropdown(CityDropdown, CityValue.ToString());
            }
        }
 public void LoginIntoApplication(User user)
 {
     EmailFieldTextBox.SendKeys(user.userEmail);
     PasswordFieldTextBox.SendKeys(user.userPassword);
     SubmitButton.Click();
 }