示例#1
0
        /// <summary>
        ///  Signs up a new applicant to be applicable for loan registration
        /// </summary>
        /// <param name="email"></param>
        /// <param name="password"></param>
        /// <param name="currTestContext"></param>
        /// <param name="screenShotDir"></param>
        public void signUpUser(string email, string password, TestContext currTestContext, string screenShotDir)
        {
            try
            {
                PageFactory.InitElements(BaseWebDriver, this);

                // set the email address
                TxtFeildEmailAddress.Clear();
                TxtFeildEmailAddress.SendKeys(email);

                // set the password
                TxtFieldPassword.Clear();
                TxtFieldPassword.SendKeys(password);

                //Take screenshot before sign-up
                var fileName = TakeScreenShot(currTestContext, screenShotDir);

                // store filename
                if (fileName != null)
                {
                    ScreenshotFileCollnt.Add(fileName);
                }

                // signs up a new user
                BtnSignUp.Click();
            } catch (Exception) { }
        }
示例#2
0
        /// <summary>
        ///   Login a user to the application
        /// </summary>
        /// <param name="email"></param>
        /// <param name="password"></param>
        /// <param name="userProfile"></param>
        /// <param name="currTestContext"></param>
        /// <param name="screenShotDir"></param>
        /// <returns></returns>
        public object loginUser(string email, string password, string userProfile, TestContext currTestContext, string screenShotDir)
        {
            object pageObj = null;

            try
            {
                PageFactory.InitElements(BaseWebDriver, this);

                if (userProfile == userType.Admin)
                {
                    email    = adminUserName;
                    password = adminPassword;
                }

                // set the email address
                TxtFeildEmailAddress.Clear();
                TxtFeildEmailAddress.SendKeys(email);

                // set the password
                TxtFieldPassword.Clear();
                TxtFieldPassword.SendKeys(password);

                //Take screenshot before login
                var fileName = TakeScreenShot(currTestContext, screenShotDir);

                // store filename
                if (fileName != null)
                {
                    ScreenshotFileCollnt.Add(fileName);
                }

                // signs up a new user
                BtnLogin.Click();

                if (userProfile == userType.Admin)
                {
                    pageObj = new AdminPage(BaseWebDriver);
                }
                else
                {
                    pageObj = new ApplicantPage(BaseWebDriver);
                }
            }catch (Exception) { }

            return(pageObj);
        }