public void CustomerLogIn( string logHeader, bool isFirstTime, string brokerMail ) { actionBot.WriteToLog("Begin method: " + logHeader); SharedServiceClass.WaitForAjaxReady(Driver); string url = String.Concat(EnvironmentConfig.GetString("ENV_address"), BrandConfig.GetString("Brand_url"), IsRunLocal, BrandConfig.GetString("CustomerLogIn")); Driver.Navigate().GoToUrl(url); actionBot.WriteToLog("Nevigate to url: " + url); //Insert register customer's e-mail to the user name field. actionBot.SendKeys(By.Id("UserName"), brokerMail, "(user name field)"); //Insert password to the password field. Default: '123456' actionBot.SendKeys(By.Id("Password"), "123123", "(password field)"); //Click on submit button. actionBot.Click(By.Id("loginSubmit"), "(login button)"); if (isFirstTime) { actionBot.Click(By.CssSelector("div.automation-popup-content > div.alignright > button.button"), "(automation - accept terms button)"); } actionBot.WriteToLog("End method: " + logHeader + Environment.NewLine); }
public void BrokerLogIn( string logHeader, string brokerMail ) { actionBot.WriteToLog("Begin method: " + logHeader); SharedServiceClass.WaitForAjaxReady(Driver); //Navigate to broker log-in page. string url = String.Concat(EnvironmentConfig.GetString("ENV_address"), BrandConfig.GetString("Brand_url"), IsRunLocal, BrandConfig.GetString("BrokerLoginHost")); Driver.Navigate().GoToUrl(url); actionBot.WriteToLog("Nevigate to url: " + url); //Insert a registered broker's email address and focus out. actionBot.SendKeys(By.Id("LoginEmail"), brokerMail, "(registered broker email address)"); //Insert a valid password to the password field and focus out. actionBot.SendKeys(By.Id("LoginPassword"), "123456", "(password field)"); //Click sign up. actionBot.Click(By.Id("LoginBrokerButton"), "(sign up button)"); //Accept terms button only appears when terms are changed. TODO: check why this button shows up without terms change. try { actionBot.Click(By.Id("AcceptTermsButton"), "(accept terms button)", 2); } catch { } actionBot.WriteToLog("End method: " + logHeader + Environment.NewLine); }
public void LogIn(string logHeader, string user, string pass) { actionBot.WriteToLog("Begin method: " + logHeader); string url = String.Concat(EnvironmentConfig.GetString("ENV_address"), BrandConfig.GetString("Brand_url"), IsRunLocal, "/Account/AdminLogOn"); Driver.Navigate().GoToUrl(url); IWebElement userName = Driver.FindElement(By.Id("UserName")); userName.SendKeys(user); IWebElement password = Driver.FindElement(By.Id("Password")); password.SendKeys(pass); IWebElement logIn = Driver.FindElement(By.Id("loginSubmitBtn")); logIn.Click(); actionBot.WriteToLog("End method: " + logHeader + Environment.NewLine); }//[email protected]
/// <summary> /// This procedure follows C1202. /// </summary> /// <returns></returns> public void CreateNewBrokerAccount( string logHeader, string iFirmName, string iContactName, string iContactEmail, string iContactMobile, string iMobileCode, string iEstimatedMonthlyAppCount, string iEstimatedMonthlyClientAmount, string iPassword ) { actionBot.WriteToLog("Begin method: " + logHeader); //Step 4 - Click create an account. string url = String.Concat(EnvironmentConfig.GetString("ENV_address"), BrandConfig.GetString("Brand_url"), IsRunLocal, BrandConfig.GetString("BrokerSignupHost")); Driver.Navigate().GoToUrl(url); actionBot.WriteToLog("Nevigate to url: " + url); //Step 5 - Insert company name to the company name field and focus out. actionBot.SendKeys(By.Id("FirmName"), iFirmName, "(company name field)"); //Step 6 - Insert contact person full name and focus out. actionBot.SendKeys(By.Id("ContactName"), iContactName, "(contact person full name)"); //Step 7 - Insert a valid email address and focus out. actionBot.SendKeys(By.Id("ContactEmail"), iContactEmail, "(valid email addressma)"); //Step 8 - Insert a valid number to the contact person mobile phone field and focus out. Mobile phone via work around is: 01111111111 actionBot.SendKeys(By.Id("ContactMobile"), iContactMobile, "(contact person mobile phone)"); //Work around is to replace Step 13 - Insert valid CAPTCHA and focus out //Work around - configuration change in Table: [ezbob].[ConfigurationVariables] Parameter: Name='BrokerForceCaptcha' Value='0' actionBot.Click(By.Id("generateMobileCode"), "(generate mobile code button)"); //Mobile code via work around is: 222222 actionBot.SendKeys(By.Id("MobileCode"), iMobileCode, "(valid mobile code)"); //Step 9 - Insert any amount to the number of applications per month field and focus out. //actionBot.SendKeys(By.Id("EstimatedMonthlyAppCount"), iEstimatedMonthlyAppCount, "(number of applications per month)"); //Step 10 - Insert any amount to the value of credit per month field and focus out. //actionBot.SendKeys(By.Id("EstimatedMonthlyClientAmount"), iEstimatedMonthlyClientAmount, "(value of credit per month)"); //Check the FCA Registered check box. //actionBot.Click(By.XPath("//label[@for='FCARegistered']"), "(Click on the FCS Registered checkbox)"); //Step 11 - Insert a valid password to the password field and focus out. actionBot.SendKeys(By.Id("Password"), iPassword, "(password field)"); //Step 12 - Insert the same password to the confirm password field and focus out. actionBot.SendKeys(By.Id("Password2"), iPassword, "(confirm password)"); By terms; By privacy; switch (BrandConfig.BaseName) { case "UIAutomationTests.configs.Brand.Ezbob": terms = By.Id("AgreeToTerms"); privacy = By.Id("AgreeToPrivacyPolicy"); break; case "UIAutomationTests.configs.Brand.Everline": terms = By.XPath("//label[@for='AgreeToTerms']"); privacy = By.XPath("//label[@for='AgreeToPrivacyPolicy']"); break; default: terms = By.Id(""); privacy = By.Id(""); break; } //Step 14 - Check all required checkboxe's. actionBot.Click(terms, "(agree to terms checkBox)"); actionBot.Click(privacy, "(agree to privacy policy checkBox)"); //Step 15 - Click sign up. actionBot.Click(By.Id("SignupBrokerButton"), "(sign up button)"); actionBot.WriteToLog("Begin assert: Verify broker dashboard is displayed."); SharedServiceClass.ElementIsVisible(Driver, By.Id("AddNewCustomer")); actionBot.WriteToLog("Positively asserted: Dashboard is displayed."); actionBot.WriteToLog("End method: " + logHeader + Environment.NewLine); }
//This procedure follows C3. //origin - BrokerFillLead: when broker fills lead's wizard; ClientSignup: when accessing from main wizard page. public void PerformWizardStepOne( string logHeader, string origin, string emailAdress, string password, int secretQuestion, string secAnswer, string reqAmmount ) { actionBot.WriteToLog("Begin method: " + logHeader); if (string.Equals("ClientSignup", origin)) { string url = String.Concat(EnvironmentConfig.GetString("ENV_address"), BrandConfig.GetString("Brand_url"), IsRunLocal, BrandConfig.GetString("WizardHost")); //Step 2 - Browse to OM app. Driver.Navigate().GoToUrl(url); actionBot.WriteToLog("Nevigate to url: " + url); //Step 3 - Insert a valid email address to the Email address field and focus out. actionBot.SendKeys(By.Id("Email"), emailAdress, "(valid email address)"); } if (string.Equals("BrokerFillLead", origin)) { actionBot.WriteToLog("Begin assert: Verify e-mail address in wizard is: " + emailAdress); Assert.AreEqual(SharedServiceClass.ElementIsVisible(Driver, By.Id("Email")).GetAttribute("value"), emailAdress); actionBot.WriteToLog("Positively asserted: e-mail addresses matched."); } //Step 4 - Insert a valid password to the password field and focus out. actionBot.SendKeys(By.Id("signupPass1"), password, "(password field)"); //Step 5 - Insert the same password to the confirm password field and focus out. actionBot.SendKeys(By.Id("signupPass2"), password, "(confirm password)"); //Step 6 - Select secret question from the list. actionBot.SelectByIndex(By.Id("securityQuestion"), secretQuestion, "(secret question select)"); //Step 7 - Insert answer in the Secret answer field and focus out. actionBot.SendKeys(By.Id("SecurityAnswer"), secAnswer, "(secret answer field)"); //IWebElement amount = Driver.FindElement(By.Id("amount")); //amount.SendKeys(reqAmmount); if (String.Equals(origin, "ClientSignup")) //This code is ilrelevant in case accessed from Broker-lead-fill //Step 8 - Insert number in the Mobile phone field and focus out. { actionBot.SendKeys(By.Id("mobilePhone"), "1111111111", "(contact person mobile phone)"); //Step 9 - Click send activation code. actionBot.Click(By.Id("generateMobileCode"), "(generate mobile code button)"); //Step 10 - Insert the authentication code. Workaround is: 222222 actionBot.SendKeys(By.Id("mobileCode"), "222222", "(valid mobile code)"); } //Step 11 - Click continue. actionBot.Click(By.Id("signupSubmitButton"), "(continue button)"); actionBot.WriteToLog("End method: " + logHeader + Environment.NewLine); }