Exemplo n.º 1
0
 public static Func <IWebDriver, bool> ClickAssert(By locator, By assertLocator)
 {
     return((Func <IWebDriver, bool>)(driver => {
         try {
             IWebElement element = driver.FindElement(locator);
             if (element.Enabled && element.Displayed && (!element.Size.IsEmpty || !element.Location.IsEmpty))
             {
                 log.Debug("Element: '" + locator.ToString() + "' is clickable.");
                 element.Click();
                 IWebElement assertElement = SharedServiceClass.ElementIsVisible(driver, assertLocator, 30);
                 if (assertElement.Displayed && (!assertElement.Size.IsEmpty || !assertElement.Location.IsEmpty))
                 {
                     log.Debug("Element: '" + locator.ToString() + "' has been clicked and asserted: '" + assertLocator.ToString() + "'.");
                     return true;
                 }
                 log.Debug("Assert failed for: '" + assertLocator.ToString() + "'.");
                 return false;
             }
             log.Debug("Element: '" + locator.ToString() + "' is not found/clickable.");
             return false;
         } catch (Exception ex) {
             log.Debug("Assert failed for: '" + assertLocator.ToString() + "'.");
             return false;
         }
     }));
 }
Exemplo n.º 2
0
        }//[email protected]

        public void FindCustomer(string logHeader, string identifier)
        {
            actionBot.WriteToLog("Begin method: " + logHeader);
            SharedServiceClass.WaitForBlockUiOff(Driver);
            Actions sendKeyAction = new Actions(Driver);

            sendKeyAction.KeyDown(Keys.Control).SendKeys("g").Build().Perform();

            //IWebElement asd = Driver.FindElement(By.Id("go-to-template"));
            //IWebElement asdasd = asd.FindElement(By.CssSelector("input.goto-customerId.form-control.ui-autocomplete-input"));
            //asdasd.SendKeys(identifier);

            IWebElement idField = SharedServiceClass.ElementIsVisible(Driver, By.XPath("//div[@id='go-to-template']/input[@class='goto-customerId form-control ui-autocomplete-input']"));

            sendKeyAction.Click(idField).Build().Perform();
            sendKeyAction.SendKeys(idField, identifier).Build().Perform();
            sendKeyAction.SendKeys(idField, Keys.Down).Build().Perform();

            idField.Clear();
            idField.SendKeys(identifier);
            idField.SendKeys(Keys.Down);
            idField.SendKeys(Keys.Enter);

            IWebElement okButton = Driver.FindElement(By.CssSelector("div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div.ui-dialog-buttonset > button.ok-button.btn.btn-primary"));

            okButton.Click();
            actionBot.WriteToLog("End method: " + logHeader + Environment.NewLine);
        }
Exemplo n.º 3
0
        //This procedure follows C26.
        //origin - BrokerFillLead: when broker fills lead's wizard; ClientSignup: when accessing from main wizard page.
        public void PerformWizardStepTwo(
            string logHeader,
            string origin,
            string personName,
            string personSurename,
            char gender,
            string dobDay,
            string dobMonth,
            string dobYear,
            string marStatus,
            string postCode,
            string addressTime,
            string resStatus,
            string phone,
            string phone2,
            bool agreeTerms
            )
        {
            actionBot.WriteToLog("Begin method: " + logHeader);

            SharedServiceClass.WaitForAjaxReady(Driver);
            SharedServiceClass.WaitForBlockUiOff(Driver);

            //TODO: remove a-sync locks. must be a workaround this problem.
            if (string.Equals("ClientSignup", origin))
            {
                //Step 1 - Insert first name and focus out.
                lock (this.Locker)
                    actionBot.SendKeys(By.Id("FirstName"), personName, "(first name field)");

                lock (this.Locker)
                    actionBot.SendKeys(By.Id("Surname"), personSurename, "(surname field)");
            }

            if (string.Equals("BrokerFillLead", origin))
            {
                actionBot.WriteToLog("Begin assert: Verify first name in wizard is: " + personName);
                Assert.AreEqual(SharedServiceClass.ElementIsVisible(Driver, By.Id("FirstName")).GetAttribute("value"), personName);
                actionBot.WriteToLog("Positively asserted: first names matched.");

                actionBot.WriteToLog("Begin assert: Verify sure name in wizard is: " + personSurename);
                Assert.AreEqual(SharedServiceClass.ElementIsVisible(Driver, By.Id("Surname")).GetAttribute("value"), personSurename);
                actionBot.WriteToLog("Positively asserted: sure names matched.");
            }

            //Step 3 - Select gender and focus out.
            By formRadioCtrl;

            switch (char.ToUpper(gender))
            {
            case 'F':
                formRadioCtrl = By.XPath("//label[@for='FormRadioCtrl_F']");
                break;

            default:
                formRadioCtrl = By.XPath("//label[@for='FormRadioCtrl_M']");
                break;
            }
            actionBot.MoveToElement(formRadioCtrl);
            actionBot.Click(formRadioCtrl, "(gender select button)");

            //Step 4 -  Select date of birth and focus out.
            actionBot.MoveToElement(By.Id("DateOfBirthDay"));
            actionBot.SelectByValue(By.Id("DateOfBirthDay"), dobDay, "(date of birth - day select)");

            actionBot.SelectByText(By.Id("DateOfBirthMonth"), dobMonth, "(date of birth - month select)");

            actionBot.SelectByValue(By.Id("DateOfBirthYear"), dobYear, "(date of birth - year select)");

            //Step 5 - Select Marital status other and focus out.
            actionBot.SelectByValue(By.Id("MaritalStatus"), marStatus, "(marital status select)");

            //Step 6 - Insert post code.
            actionBot.SendKeys(By.CssSelector("input.addAddressInput"), postCode, "(post code field)");

            //Step 7 - Click Postcode lookup.
            actionBot.Click(By.CssSelector("input.addAddress"), "(postcode lookup button)");

            //Step 8 - Click the correct address.
            actionBot.Click(By.CssSelector("ul.matchingAddressList > li"), "(sellect address from list)");

            //Step 9 - Click OK.
            actionBot.Click(By.CssSelector("button.postCodeBtnOk"), "(address OK button)");

            //Step 10 - In the How long at this address field, select relevant property and focus out.
            actionBot.SelectByValue(By.Id("TimeAtAddress"), addressTime, "(how long at this address select)");

            //Step 11 - In the Residential status field, select relevant property and focus out.
            actionBot.SelectByValue(By.Id("PropertyStatus"), resStatus, "(residential status select)");

            //Step 12 - Insert valid format phone number in the Other contact number field and focus out.
            if (String.Equals(origin, "BrokerFillLead"))
            {
                actionBot.SendKeys(By.Id("MobilePhone"), phone, "(valid format mobile phone number)");
            }

            actionBot.SendKeys(By.Id("DayTimePhone"), phone2, "(valid format day time phone number)");

            //Step 13 - Check the TOS checkbox.
            if (agreeTerms)
            {
                actionBot.Click(By.XPath("//label[@for='ConsentToSearch']"), "(terms and conditions checkBox)");
            }

            //Step 14 - Click continue.
            actionBot.Click(By.Id("personInfoContinueBtn"), "(continue button)");

            actionBot.WriteToLog("End method: " + logHeader + Environment.NewLine);
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
        //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);
        }