public void CompleteCateringEndorsement() { /* * Page Title: Please Review Your Account Profile */ // click on the Continue to Application button ContinueToApplicationButton(); /* * Page Title: Catering Endorsement Application */ // click on the authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.Id("authorizedToSubmit")); uiAuthorizedToSubmit.Click(); // click on the signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.Id("signatureAgreement")); uiSignatureAgreement.Click(); }
public void ModifyDirectorName() { // click on the Edit button for Leader NgWebElement uiEditInfoButton = ngDriver.FindElement(By.XPath("//i/span")); uiEditInfoButton.Click(); // enter a new name for the director string newDirectorFirstName = "Updated Director"; NgWebElement uiNewDirectorFirstName = ngDriver.FindElement(By.XPath("//input[@type='text']")); uiNewDirectorFirstName.Clear(); uiNewDirectorFirstName.SendKeys(newDirectorFirstName); // click on the Confirm button NgWebElement uiConfirmButton = ngDriver.FindElement(By.XPath("//i/span")); uiConfirmButton.Click(); // upload a marriage certificate document FileUpload("marriage_certificate.pdf", "(//input[@type='file'])[15]"); }
public void ClickOnBrandingChangeLink(string changeType) { /* * Page Title: Licences */ string nameBrandingLinkCannabis = "Request Store Name or Branding Change"; string nameBrandingLinkCateringMfg = "Establishment Name Change Application"; if ((changeType == "Catering") || (changeType == "Manufacturing")) { // click on the Establishment Name Change Application link NgWebElement uiRequestChange = ngDriver.FindElement(By.LinkText(nameBrandingLinkCateringMfg)); uiRequestChange.Click(); } if (changeType == "Cannabis") { // click on the Request Store Name or Branding Change link NgWebElement uiRequestChange = ngDriver.FindElement(By.LinkText(nameBrandingLinkCannabis)); uiRequestChange.Click(); } }
public void ShouldSubstract() { #pragma warning disable 618 var first = ngDriver.FindElement(NgBy.Input("first")); #pragma warning restore 618 first.SendKeys("10"); #pragma warning disable 618 var second = ngDriver.FindElement(NgBy.Input("second")); #pragma warning restore 618 second.SendKeys("2"); ReadOnlyCollection <NgWebElement> ng_math_operators = ngDriver.FindElements(NgBy.Options("value for (key, value) in operators")); NgWebElement ng_substract_math_operator = ng_math_operators.First(op => op.Text.Equals("-", StringComparison.Ordinal)); Assert.IsNotNull(ng_substract_math_operator); ng_substract_math_operator.Click(); var goButton = ngDriver.FindElement(By.Id("gobutton")); goButton.Click(); NgWebElement result_element = ngDriver.FindElement(NgBy.Binding("latest")); Assert.AreEqual("8", result_element.Text); ngDriver.Highlight(result_element, 1000); }
public void FirstTest() { driver.Navigate().GoToUrl(URL); ngDriver.WaitForAngular(); //Find product price text box using the ng-model NgWebElement ProductPrice = ngDriver.FindElement(NgBy.Model("productPrice")); ProductPrice.SendKeys("799"); //Find discount text box using the ng-model NgWebElement DiscountOnProduct = ngDriver.FindElement(NgBy.Model("discountPercent")); DiscountOnProduct.SendKeys("10"); //Find button using selenium locator XPath NgWebElement BtnPriceAfterDiscount = ngDriver.FindElement(By.XPath("//*[@id='f1']/fieldset[2]/input[1]")); BtnPriceAfterDiscount.Click(); //Find discounted product text box using the ng-model NgWebElement afterDiscountValue = ngDriver.FindElement(NgBy.Model("afterDiscount")); string value = afterDiscountValue.GetAttribute("value"); //Assert for corect value Assert.AreEqual <string>("719.1", value); //Use if condition for custom checks if (value == "719.1") { //Do Nothing. } else { Assert.Fail(); } }
public void RLRSStructuralAlteration() { /* * Page Title: Structural Alteration Application */ string proposedChanges = "Sample proposed changes"; // enter the proposed changes NgWebElement uiProposedChanges = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='description1']")); uiProposedChanges.SendKeys(proposedChanges); // select 'Yes' for 'Is the public permitted to walk into the cooler space?' NgWebElement uiCoolerAccess = ngDriver.FindElement(By.Id("mat-button-toggle-1-button")); uiProposedChanges.Click(); // upload the signage FileUpload("signage.pdf", "(//input[@type='file'])[2]"); // upload the floor plan FileUpload("floor_plan.pdf", "(//input[@type='file'])[5]"); // upload the site plan FileUpload("site_plan.pdf", "(//input[@type='file'])[8]"); // select the authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.Id("authorizedToSubmit")); uiAuthorizedToSubmit.Click(); // select the signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.Id("signatureAgreement")); uiSignatureAgreement.Click(); }
private string MakeAPICall(string url) { NgWebElement apiInput = ngDriver.FindElement(By.Id("testUrl")); apiInput.SendKeys($"{url}"); NgWebElement inputButton = ngDriver.FindElement(By.Id("testAPIButton")); inputButton.Click(); NgWebElement apiResult = ngDriver.FindElement(By.Id("testAPIResult")); var text = apiResult.Text; int maxTries = 15; int tries = 0; do { text = apiResult.Text; System.Threading.Thread.Sleep(2000); tries++; } while (tries < maxTries && string.IsNullOrEmpty(text)); return(text); }
public void PayLicenceFee() { /* * Page Title: Licences & Authorizations */ // create test data string firstYearLicenceFee = "Pay First Year Fee"; string returnToDashboard = "Return to Dashboard"; // click on the pay first year licence fee link var uiFirstYearLicenceFees = ngDriver.FindElements(By.LinkText(firstYearLicenceFee)); if (uiFirstYearLicenceFees.Count > 0) { uiFirstYearLicenceFees[0].Click(); } else { throw new Exception($"Unable to find Pay First Year Fee link"); } // pay the licence fee MakePayment(); /* * Page Title: Payment Approved */ // click on the return to dashboard link NgWebElement uiReturnToDashboard = ngDriver.FindElement(By.LinkText(returnToDashboard)); uiReturnToDashboard.Click(); ClickLicencesTab(); }
public void ShouldHandleAngularUISelect() { GetPageContent("ng_ui_select_example1.htm"); ReadOnlyCollection <NgWebElement> ng_selected_colors = ngDriver.FindElements(NgBy.Repeater("$item in $select.selected")); Assert.IsTrue(2 == ng_selected_colors.Count); foreach (NgWebElement ng_selected_color in ng_selected_colors) { ngDriver.Highlight(ng_selected_color); Object selected_color_item = ng_selected_color.Evaluate("$item"); Console.Error.WriteLine(String.Format("selected color: {0}", selected_color_item.ToString())); } // IWebElement search = ngDriver.FindElement(By.CssSelector("input[type='search']")); // same element NgWebElement ng_search = ngDriver.FindElement(NgBy.Model("$select.search")); ng_search.Click(); int wait_seconds = 3; WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(wait_seconds)); wait.Until(d => (d.FindElements(By.CssSelector("div[role='option']"))).Count > 0); ReadOnlyCollection <NgWebElement> ng_available_colors = ngDriver.FindElements(By.CssSelector("div[role='option']")); Assert.IsTrue(6 == ng_available_colors.Count); foreach (NgWebElement ng_available_color in ng_available_colors) { ngDriver.Highlight(ng_available_color); int available_color_index = -1; try { available_color_index = Int32.Parse(ng_available_color.Evaluate("$index").ToString()); } catch (Exception) { // ignore } Console.Error.WriteLine(String.Format("available color [{1}]:{0}", ng_available_color.Text, available_color_index)); } }
public void ShouldInviteToOpenAccount() { // When I proceed to "Bank Manager Login" ngDriver.FindElement(NgBy.ButtonText("Bank Manager Login")).Click(); // And I proceed to "Add Customer" ngDriver.FindElement(NgBy.PartialButtonText("Add Customer")).Click(); // And I fill new Customer data IWebElement ng_first_name = ngDriver.FindElement(NgBy.Model("fName")); ngDriver.Highlight(ng_first_name, highlight_timeout); StringAssert.IsMatch("First Name", ng_first_name.GetAttribute("placeholder")); ng_first_name.SendKeys("John"); IWebElement ng_last_name = ngDriver.FindElement(NgBy.Model("lName")); ngDriver.Highlight(ng_last_name, highlight_timeout); StringAssert.IsMatch("Last Name", ng_last_name.GetAttribute("placeholder")); ng_last_name.SendKeys("Doe"); IWebElement ng_post_code = ngDriver.FindElement(NgBy.Model("postCd")); ngDriver.Highlight(ng_post_code, highlight_timeout); StringAssert.IsMatch("Post Code", ng_post_code.GetAttribute("placeholder")); ng_post_code.SendKeys("11011"); // NOTE: there are two 'Add Customer' buttons on this form NgWebElement ng_add_customer_button = ngDriver.FindElements(NgBy.PartialButtonText("Add Customer"))[1]; actions.MoveToElement(ng_add_customer_button.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_add_customer_button, highlight_timeout); ng_add_customer_button.Submit(); // confirm string alert_text = null; try { alert = ngDriver.WrappedDriver.SwitchTo().Alert(); alert_text = alert.Text; StringAssert.StartsWith("Customer added successfully with customer id :", alert_text); alert.Accept(); } catch (NoAlertPresentException ex) { // Alert not present verificationErrors.Append(ex.StackTrace); } catch (WebDriverException ex) { // Alert not handled by PhantomJS verificationErrors.Append(ex.StackTrace); } int customer_id = 0; int.TryParse(alert_text.FindMatch(@"(?<customer_id>\d+)$"), out customer_id); Assert.AreNotEqual(0, customer_id); // And I switch to "Home" screen ngDriver.FindElement(NgBy.ButtonText("Home")).Click(); // And I proceed to "Customer Login" ngDriver.FindElement(NgBy.ButtonText("Customer Login")).Click(); // And I login as new customer "John Doe" ReadOnlyCollection <NgWebElement> ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); int customer_count = ng_customers.Count; NgWebElement ng_new_customer = ng_customers.First(cust => Regex.IsMatch(cust.Text, "John Doe")); Assert.IsNotNull(ng_new_customer); actions.MoveToElement(ng_new_customer.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_new_customer, highlight_timeout); ng_new_customer.Click(); NgWebElement ng_login_button = ngDriver.FindElement(NgBy.ButtonText("Login")); Assert.IsTrue(ng_login_button.Displayed && ng_login_button.Enabled); ngDriver.Highlight(ng_login_button, highlight_timeout); ng_login_button.Click(); // Then I am greeted as "John Doe" NgWebElement ng_user = ngDriver.FindElement(NgBy.Binding("user")); StringAssert.Contains("John", ng_user.Text); StringAssert.Contains("Doe", ng_user.Text); // And I am invited to open an account Object noAccount = ng_user.Evaluate("noAccount"); Assert.IsTrue(Boolean.Parse(noAccount.ToString())); Boolean hasAccounts = !(Boolean.Parse(noAccount.ToString())); Console.Error.WriteLine("Has accounts: " + hasAccounts); // IWebElement invitationMessage = driver.FindElement(By.CssSelector("span[ng-show='noAccount']")); IWebElement invitationMessage = ng_user.FindElement(By.XPath("..")).FindElement(By.XPath("..")).FindElement(By.CssSelector("span[ng-show='noAccount']")); Assert.IsTrue(invitationMessage.Displayed); ngDriver.Highlight(invitationMessage); StringAssert.Contains("Please open an account with us", invitationMessage.Text); Console.Error.WriteLine(invitationMessage.Text); // And I have no accounts NgWebElement accountNo = ngDriver.FindElement(NgBy.Binding("accountNo")); Assert.IsFalse(accountNo.Displayed); ReadOnlyCollection <NgWebElement> ng_accounts = ngDriver.FindElements(NgBy.Repeater("account for account in Accounts")); Assert.AreEqual(0, ng_accounts.Count); }
public void ShouldLoginCustomer() { NgWebElement ng_customer_button = ngDriver.FindElement(NgBy.ButtonText("Customer Login")); StringAssert.IsMatch("Customer Login", ng_customer_button.Text); ngDriver.Highlight(ng_customer_button, highlight_timeout); // core Selenium IWebElement customer_button = driver.FindElement(By.XPath("//button[contains(.,'Customer Login')]")); StringAssert.IsMatch("Customer Login", customer_button.Text); ngDriver.Highlight(customer_button, highlight_timeout); ng_customer_button.Click(); #pragma warning disable 618 NgWebElement ng_customer_select = ngDriver.FindElement(NgBy.Input("custId")); #pragma warning restore 618 StringAssert.IsMatch("userSelect", ng_customer_select.GetAttribute("id")); ReadOnlyCollection <NgWebElement> ng_customers = ng_customer_select.FindElements(NgBy.Repeater("cust in Customers")); Assert.AreNotEqual(0, ng_customers.Count); // won't move to or highlight select options foreach (NgWebElement ng_customer in ng_customers) { actions.MoveToElement(ng_customer); ngDriver.Highlight(ng_customer); } // pick first customer NgWebElement first_customer = ng_customers.First(); Assert.IsTrue(first_customer.Displayed); // the {{user}} is composed from first and last name StringAssert.IsMatch("(?:[^ ]+) +(?:[^ ]+)", first_customer.Text); string user = first_customer.Text; first_customer.Click(); // login button NgWebElement ng_login_button = ngDriver.FindElement(NgBy.ButtonText("Login")); Assert.IsTrue(ng_login_button.Displayed && ng_login_button.Enabled); ngDriver.Highlight(ng_login_button, highlight_timeout); ng_login_button.Click(); NgWebElement ng_greeting = ngDriver.FindElement(NgBy.Binding("user")); Assert.IsNotNull(ng_greeting); StringAssert.IsMatch(user, ng_greeting.Text); ngDriver.Highlight(ng_greeting, highlight_timeout); NgWebElement ng_account_number = ngDriver.FindElement(NgBy.Binding("accountNo")); Assert.IsNotNull(ng_account_number); theReg = new Regex(@"(?<account_id>\d+)$"); Assert.IsTrue(theReg.IsMatch(ng_account_number.Text)); ngDriver.Highlight(ng_account_number, highlight_timeout); NgWebElement ng_account_balance = ngDriver.FindElement(NgBy.Binding("amount")); Assert.IsNotNull(ng_account_balance); theReg = new Regex(@"(?<account_balance>\d+)$"); Assert.IsTrue(theReg.IsMatch(ng_account_balance.Text)); ngDriver.Highlight(ng_account_balance, highlight_timeout); NgWebElement ng_account_currency = ngDriver.FindElement(NgBy.Binding("currency")); Assert.IsNotNull(ng_account_currency); theReg = new Regex(@"(?<account_currency>(?:Dollar|Pound|Rupee))$"); Assert.IsTrue(theReg.IsMatch(ng_account_currency.Text)); ngDriver.Highlight(ng_account_currency, highlight_timeout); NgWebElement ng_logout_botton = ngDriver.FindElement(NgBy.ButtonText("Logout")); ngDriver.Highlight(ng_logout_botton, highlight_timeout); ng_logout_botton.Click(); }
public void LoungeAreaEndorsement() { /* * Page Title: Licences */ string loungeAreaEndorsement = "Lounge Area Endorsement Application"; // click on the Lounge Area Endorsement Application link NgWebElement uiLoungeAreaEndorsement = ngDriver.FindElement(By.LinkText(loungeAreaEndorsement)); uiLoungeAreaEndorsement.Click(); // click on the Continue to Application button NgWebElement uiContinueToApplicationButton = ngDriver.FindElement(By.CssSelector("button#continueToApp.save-cont.btn-primary")); uiContinueToApplicationButton.Click(); /* * Page Title: Lounge Area Endorsement Application */ // select the zoning checkbox NgWebElement uiZoningCheckbox = ngDriver.FindElement(By.CssSelector("mat-checkbox#mat-checkbox-1")); uiZoningCheckbox.Click(); // find the upload test files in the bdd-tests\upload_files folder var environment = Environment.CurrentDirectory; string projectDirectory = Directory.GetParent(environment).Parent.FullName; string projectDirectory2 = Directory.GetParent(projectDirectory).Parent.FullName; // upload the floor plan string floorplanPath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "floor_plan.pdf"); NgWebElement uiUploadFloorplan = ngDriver.FindElement(By.XPath("(//input[@type='file'])[2]")); uiUploadFloorplan.SendKeys(floorplanPath); // upload the site plan string sitePlanPath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "site_plan.pdf"); NgWebElement uiUploadSitePlan = ngDriver.FindElement(By.XPath("(//input[@type='file'])[5]")); uiUploadSitePlan.SendKeys(sitePlanPath); // add a service area NgWebElement uiServiceArea = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceAreas'] button")); uiServiceArea.Click(); // create test data string areaDescription = "Area description"; string occupantLoad = "100"; // enter the area description NgWebElement uiAreaDescription = ngDriver.FindElement(By.CssSelector("input[formcontrolname='areaLocation']")); uiAreaDescription.SendKeys(areaDescription); // enter the occupant load NgWebElement uiOccupantLoad = ngDriver.FindElement(By.CssSelector("input[formcontrolname='capacity']")); uiOccupantLoad.SendKeys(occupantLoad); // select the Sunday opening time NgWebElement uiSundayOpen = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursSundayOpen'] option[value='10:00']")); uiSundayOpen.Click(); // select the Sunday closing time NgWebElement uiSundayClose = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursSundayClose'] option[value='16:00']")); uiSundayClose.Click(); // select the Monday opening time NgWebElement uiMondayOpen = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursMondayOpen'] option[value='09:00']")); uiMondayOpen.Click(); // select the Monday closing time NgWebElement uiMondayClose = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursMondayClose'] option[value='23:00']")); uiMondayClose.Click(); // select the Tuesday opening time NgWebElement uiTuesdayOpen = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursTuesdayOpen'] option[value='09:15']")); uiTuesdayOpen.Click(); // select the Tuesday closing time NgWebElement uiTuesdayClose = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursTuesdayClose'] option[value='22:45']")); uiTuesdayClose.Click(); // select the Wednesday opening time NgWebElement uiWednesdayOpen = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursWednesdayOpen'] option[value='09:30']")); uiWednesdayOpen.Click(); // select the Wednesday closing time NgWebElement uiWednesdayClose = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursWednesdayClose'] option[value='12:00']")); uiWednesdayClose.Click(); // select the Thursday opening time NgWebElement uiThursdayOpen = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursThursdayOpen'] option[value='13:00']")); uiThursdayOpen.Click(); // select the Thursday closing time NgWebElement uiThursdayClose = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursThursdayClose'] option[value='14:00']")); uiThursdayClose.Click(); // select the Friday opening time NgWebElement uiFridayOpen = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursFridayOpen'] option[value='12:15']")); uiFridayOpen.Click(); // select the Friday closing time NgWebElement uiFridayClose = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursFridayClose'] option[value='21:15']")); uiFridayClose.Click(); // select the Saturday opening time NgWebElement uiSaturdayOpen = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursSaturdayOpen'] option[value='10:00']")); uiSaturdayOpen.Click(); // select the Saturday closing time NgWebElement uiSaturdayClose = ngDriver.FindElement(By.CssSelector("select[formcontrolname='serviceHoursSaturdayClose'] option[value='22:00']")); uiSaturdayClose.Click(); // select the authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.CssSelector("input[formcontrolname='authorizedToSubmit'][type='checkbox']")); uiAuthorizedToSubmit.Click(); // select the signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("input[formcontrolname='signatureAgreement'][type='checkbox']")); uiSignatureAgreement.Click(); ClickOnSubmitButton(); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,' Pending External Review ')]")).Displayed); }
public void LPRelocationApplication() { /* * Page Title: Please Review the Account Profile */ ContinueToApplicationButton(); /* * Page Title: Liquor Primary and Liquor Primary Club Relocation Application */ // create test data string patioPerimeter = "Sample patio perimeter"; string patioLocation = "Sample patio location"; string patioAccess = "Sample patio access"; string liquorCarried = "Sample liquor carried details"; string patioAccessControl = "Sample patio access control"; string establishmentType = "Military mess"; // click zoning checkbox NgWebElement uiIsPermittedInZoning = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='isPermittedInZoning']")); uiIsPermittedInZoning.Click(); // select 'yes' for Treaty First Nation Land NgWebElement uiIsTreatyFirstNationLand = ngDriver.FindElement(By.CssSelector("[formcontrolname='isOnINLand'] mat-radio-button#mat-radio-5")); uiIsTreatyFirstNationLand.Click(); // upload a letter of intent FileUpload("letter_of_intent.pdf", "(//input[@type='file'])[2]"); // select 'yes' for patio NgWebElement uiHasPatioYes = ngDriver.FindElement(By.CssSelector("[formcontrolname='isHasPatio'] mat-radio-button#mat-radio-2")); uiHasPatioYes.Click(); // enter patio perimeter details NgWebElement uiPatioComp = ngDriver.FindElement(By.CssSelector("textarea#patioCompDescription")); uiPatioComp.SendKeys(patioPerimeter); // enter patio location details NgWebElement uiPatioLocation = ngDriver.FindElement(By.CssSelector("textarea#patioLocationDescription")); uiPatioLocation.SendKeys(patioLocation); // enter patio access details NgWebElement uiPatioAccess = ngDriver.FindElement(By.CssSelector("textarea#patioAccessDescription")); uiPatioAccess.SendKeys(patioAccess); // check liquor carried checkbox NgWebElement uiPatioLiquorCarried = ngDriver.FindElement(By.CssSelector("mat-checkbox#patioIsLiquorCarried")); uiPatioLiquorCarried.Click(); // enter liquor carried details NgWebElement uiLiquorCarriedDetails = ngDriver.FindElement(By.CssSelector("textarea#patioLiquorCarriedDescription")); uiLiquorCarriedDetails.SendKeys(liquorCarried); // enter patio access control description NgWebElement uiPatioAccessControl = ngDriver.FindElement(By.CssSelector("textarea#patioAccessControlDescription")); uiPatioAccessControl.SendKeys(patioAccessControl); // click Fixed option NgWebElement uiFixedOption = ngDriver.FindElement(By.CssSelector("#mat-button-toggle-1-button")); uiFixedOption.Click(); // click Portable option NgWebElement uiPortableOption = ngDriver.FindElement(By.CssSelector("#mat-button-toggle-2-button")); uiPortableOption.Click(); // click Interior option NgWebElement uiInteriorOption = ngDriver.FindElement(By.CssSelector("#mat-button-toggle-3-button")); uiInteriorOption.Click(); // enter the establishment type NgWebElement uiEstablishmentType = ngDriver.FindElement(By.CssSelector("input[formcontrolname='description1']")); uiEstablishmentType.SendKeys(establishmentType); // upload the signage document FileUpload("signage.pdf", "(//input[@type='file'])[5]"); // upload the floor plan FileUpload("floor_plan.pdf", "(//input[@type='file'])[8]"); // upload the site plan FileUpload("site_plan.pdf", "(//input[@type='file'])[11]"); /* * // click on service area button * NgWebElement uiServiceAreas = ngDriver.FindElement(By.CssSelector("[formcontrolname= 'serviceAreas'] button")); * uiServiceAreas.Click(); * * // enter area description * NgWebElement uiAreaDescription = ngDriver.FindElement(By.CssSelector("input[formcontrolname='areaLocation']")); * uiAreaDescription.SendKeys(areaDescription); * * // enter occupant load * NgWebElement uiOccupantLoad = ngDriver.FindElement(By.CssSelector("input[formcontrolname='capacity']")); * uiOccupantLoad.SendKeys(occupantLoad); */ // enter the hours of sales NgWebElement uiServiceHoursSundayOpen = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursSundayOpen'] option[value='09:00']")); uiServiceHoursSundayOpen.Click(); NgWebElement uiServiceHoursSundayClose = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursSundayClose'] option[value='21:00']")); uiServiceHoursSundayClose.Click(); NgWebElement uiServiceHoursMondayOpen = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursMondayOpen'] option[value='11:00']")); uiServiceHoursMondayOpen.Click(); NgWebElement uiServiceHoursMondayClose = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursMondayClose'] option[value='23:00']")); uiServiceHoursMondayClose.Click(); NgWebElement uiServiceHoursTuesdayOpen = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursTuesdayOpen'] option[value='09:15']")); uiServiceHoursTuesdayOpen.Click(); NgWebElement uiServiceHoursTuesdayClose = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursTuesdayClose'] option[value='10:30']")); uiServiceHoursTuesdayClose.Click(); NgWebElement uiServiceHoursWednesdayOpen = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursWednesdayOpen'] option[value='12:30']")); uiServiceHoursWednesdayOpen.Click(); NgWebElement uiServiceHoursWednesdayClose = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursWednesdayClose'] option[value='21:30']")); uiServiceHoursWednesdayClose.Click(); NgWebElement uiServiceHoursThursdayOpen = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursThursdayOpen'] option[value='14:30']")); uiServiceHoursThursdayOpen.Click(); NgWebElement uiServiceHoursThursdayClose = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursThursdayClose'] option[value='19:00']")); uiServiceHoursThursdayClose.Click(); NgWebElement uiServiceHoursFridayOpen = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursFridayOpen'] option[value='17:00']")); uiServiceHoursFridayOpen.Click(); NgWebElement uiServiceHoursFridayClose = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursFridayClose'] option[value='19:45']")); uiServiceHoursFridayClose.Click(); NgWebElement uiServiceHoursSaturdayOpen = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursSaturdayOpen'] option[value='09:45']")); uiServiceHoursSaturdayOpen.Click(); NgWebElement uiServiceHoursSaturdayClose = ngDriver.FindElement(By.CssSelector("[formcontrolname='serviceHoursSaturdayClose'] option[value='20:00']")); uiServiceHoursSaturdayClose.Click(); // select the owner checkbox NgWebElement uiOwner = ngDriver.FindElement(By.CssSelector(".mat-checkbox[formcontrolname='isOwnerBusiness']")); uiOwner.Click(); // select the valid interest checkbox NgWebElement uiValidInterest = ngDriver.FindElement(By.CssSelector(".mat-checkbox[formcontrolname='hasValidInterest']")); uiValidInterest.Click(); // select the future valid interest checkbox NgWebElement uiFutureValidInterest = ngDriver.FindElement(By.CssSelector(".mat-checkbox[formcontrolname='willHaveValidInterest']")); uiFutureValidInterest.Click(); // select the authorized to submit checkbox NgWebElement uiAuthToSubmit = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='authorizedToSubmit']")); uiAuthToSubmit.Click(); // select the signature agreement checkbox NgWebElement uiSigAgreement = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='signatureAgreement']")); uiSigAgreement.Click(); }
private void DoLogin(string businessType) { ngDriver.Navigate().GoToUrl($"{baseUri}dashboard"); /* * Page Title: Terms of Use */ // select the acceptance checkbox NgWebElement uiTermsOfUseCheckbox = ngDriver.FindElement(By.CssSelector("input.terms-cb[type='checkbox']")); uiTermsOfUseCheckbox.Click(); // click on the Continue button NgWebElement uiContinueButton = ngDriver.FindElement(By.CssSelector("button.termsAccept")); uiContinueButton.Click(); /* * Page Title: Please confirm the business or organization name associated to the Business BCeID. */ // click on the Yes button NgWebElement uiConfirmationButton = ngDriver.FindElement(By.CssSelector("button.confirmYes")); uiConfirmationButton.Click(); /* * Page Title: Please confirm the organization type associated with the Business BCeID: */ // if this is a private corporation, click the radio button if (businessType == " private corporation") { NgWebElement uiPrivateCorporationRadio = ngDriver.FindElement(By.CssSelector("input[value='PrivateCorporation'][type = 'radio']")); uiPrivateCorporationRadio.Click(); } // if this is a public corporation, click the radio button if (businessType == " public corporation") { NgWebElement uiPublicCorporationRadio = ngDriver.FindElement(By.CssSelector("[value='PublicCorporation'][type='radio']")); uiPublicCorporationRadio.Click(); } // if this is a sole proprietorship, click the radio button if (businessType == " sole proprietorship") { NgWebElement uiSoleProprietorshipRadio = ngDriver.FindElement(By.CssSelector("[value='SoleProprietorship'][type='radio']")); uiSoleProprietorshipRadio.Click(); } // if this is a partnership, click the radio button if (businessType == " partnership") { NgWebElement uiPartnershipRadio = ngDriver.FindElement(By.CssSelector("[value='Partnership'][type='radio']")); uiPartnershipRadio.Click(); } // if this is a society, click the radio button if (businessType == " society") { NgWebElement uiSocietyRadio = ngDriver.FindElement(By.CssSelector("[type='radio'][value='Society']")); uiSocietyRadio.Click(); } // if this is a university, click the radio button if (businessType == " university") { NgWebElement uiUniversityRadio = ngDriver.FindElement(By.CssSelector("[type='radio'][value='University']")); uiUniversityRadio.Click(); } // if this is an indigenous nation, click the radio button if (businessType == "n indigenous nation") { NgWebElement uiIndigenousNationRadio = ngDriver.FindElement(By.CssSelector("[value='IndigenousNation'][type='radio']")); uiIndigenousNationRadio.Click(); } // if this is a local government, click the radio button if (businessType == " local government") { NgWebElement uiLocalGovernmentRadio = ngDriver.FindElement(By.CssSelector("[value='LocalGovernment'][type='radio']")); uiLocalGovernmentRadio.Click(); } // click on the Next button NgWebElement uiNextButton = ngDriver.FindElement(By.CssSelector(".btn-primary")); uiNextButton.Click(); /* * Page Title: Please confirm the name associated with the Business BCeID login provided. */ // click on the Yes button NgWebElement uiConfirmNameButton = ngDriver.FindElement(By.CssSelector("app-bceid-confirmation .btn-primary")); uiConfirmNameButton.Click(); }
public void CompleteCateringApplication() { /* * Page Title: Catering Licence Application */ // create application info string prevAppDetails = "Here are the previous application details (automated test)."; string liqConnectionDetails = "Here are the liquor industry connection details (automated test)."; string estName = "Point Ellis Greenhouse"; string estAddress = "645 Tyee Rd"; string estCity = "Victoria"; string estPostal = "V9A 6X5"; string estPID = "012345678"; string estPhone = "2505555555"; string estEmail = "*****@*****.**"; string conGiven = "Given"; string conSurname = "Surname"; string conRole = "CEO"; string conPhone = "2508888888"; string conEmail = "*****@*****.**"; // enter the establishment name try { NgWebElement uiEstabName = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentName']")); uiEstabName.SendKeys(estName); } catch (Exception) { //System.Threading.Thread.Sleep(1000); NgWebElement uiEstabName = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentName']")); uiEstabName.SendKeys(estName); } // enter the establishment address NgWebElement uiEstabAddress = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressStreet']")); uiEstabAddress.SendKeys(estAddress); // enter the establishment city NgWebElement uiEstabCity = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressCity']")); uiEstabCity.SendKeys(estCity); // enter the establishment postal code NgWebElement uiEstabPostal = ngDriver.FindElement(By.Id("establishmentAddressPostalCode")); uiEstabPostal.SendKeys(estPostal); // enter the PID NgWebElement uiEstabPID = ngDriver.FindElement(By.Id("establishmentParcelId")); uiEstabPID.SendKeys(estPID); // enter the store email NgWebElement uiEstabEmail = ngDriver.FindElement(By.Id("establishmentEmail")); uiEstabEmail.SendKeys(estEmail); // enter the store phone number NgWebElement uiEstabPhone = ngDriver.FindElement(By.Id("establishmentPhone")); uiEstabPhone.SendKeys(estPhone); // select 'Yes' // Do you or any of your shareholders currently hold, have held, or have previously applied for a British Columbia liquor licence? NgWebElement uiPreviousLicenceYes = ngDriver.FindElement(By.Id("mat-button-toggle-1-button")); uiPreviousLicenceYes.Click(); // enter the previous application details NgWebElement uiPreviousApplicationDetails = ngDriver.FindElement(By.Id("previousApplicationDetails")); uiPreviousApplicationDetails.SendKeys(prevAppDetails); // select 'Yes' // Do you hold a Rural Agency Store Appointment? NgWebElement uiRuralAgencyStore = ngDriver.FindElement(By.Id("mat-button-toggle-4-button")); uiRuralAgencyStore.Click(); // select 'Yes' // Do you, or any of your shareholders, have any connection, financial or otherwise, direct or indirect, with a distillery, brewery or winery? NgWebElement uiOtherBusinessYes = ngDriver.FindElement(By.Id("mat-button-toggle-7-button")); uiOtherBusinessYes.Click(); // enter the connection details NgWebElement uiLiqIndConnection = ngDriver.FindElement(By.Id("liquorIndustryConnectionsDetails")); uiLiqIndConnection.SendKeys(liqConnectionDetails); // upload a store signage document FileUpload("signage.pdf", "(//input[@type='file'])[2]"); // enter the first name of the application contact NgWebElement uiContactGiven = ngDriver.FindElement(By.Id("contactPersonFirstName")); uiContactGiven.SendKeys(conGiven); // enter the last name of the application contact NgWebElement uiContactSurname = ngDriver.FindElement(By.Id("contactPersonLastName")); uiContactSurname.SendKeys(conSurname); // enter the role of the application contact NgWebElement uiContactRole = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonRole']")); uiContactRole.SendKeys(conRole); // enter the phone number of the application contact NgWebElement uiContactPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonPhone']")); uiContactPhone.SendKeys(conPhone); // enter the email of the application contact NgWebElement uiContactEmail = ngDriver.FindElement(By.Id("contactPersonEmail")); uiContactEmail.SendKeys(conEmail); // click on the authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.Id("authorizedToSubmit")); uiAuthorizedToSubmit.Click(); // click on the signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.Id("signatureAgreement")); uiSignatureAgreement.Click(); // retrieve the current URL to get the application ID (needed downstream) string URL = ngDriver.Url; // retrieve the application ID string[] parsedURL = URL.Split('/'); string[] tempFix = parsedURL[5].Split(';'); applicationID = tempFix[0]; }
public void RequestEventAuthorization(string eventType) { /* * Page Title: Licences & Authorizations * Subtitle: Catering Licences */ /* * Temporary workaround for LCSD-3867 - start */ // sign out SignOut(); // log back in as same user ReturnLogin(); // navigate to Licences tab ClickLicencesTab(); /* * Temporary workaround for LCSD-3867 - end */ string requestEventAuthorization = "Request Event Authorization"; // click on the request event authorization link NgWebElement uiRequestEventAuthorization = ngDriver.FindElement(By.LinkText(requestEventAuthorization)); uiRequestEventAuthorization.Click(); /* * Page Title: Catered Event Authorization Request */ // create event authorization data string eventContactName = "AutoTestEventContactName"; string eventContactPhone = "2500000000"; string eventDescription = "Automated test event description added here."; string eventClientOrHostName = "Automated test event"; string maximumAttendance = "100"; string maximumStaffAttendance = "25"; string maximumAttendanceApproval = "300"; string maximumStaffAttendanceApproval = "300"; string venueNameDescription = "Automated test venue name or description"; string venueAdditionalInfo = "Automated test additional venue information added here."; string physicalAddStreetAddress1 = "Automated test street address 1"; string physicalAddStreetAddress2 = "Automated test street address 2"; string physicalAddCity = "Victoria"; string physicalAddPostalCode = "V9A 6X5"; // enter event contact name NgWebElement uiEventContactName = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactName']")); uiEventContactName.SendKeys(eventContactName); // enter event contact phone NgWebElement uiEventContactPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPhone']")); uiEventContactPhone.SendKeys(eventContactPhone); if (eventType == "for a community event after 2am") { // select community event type NgWebElement uiEventType = ngDriver.FindElement(By.CssSelector("[formcontrolname='eventType'] [value='1: 845280001']")); uiEventType.Click(); } else { // select corporate event type NgWebElement uiEventType = ngDriver.FindElement(By.CssSelector("[formcontrolname='eventType'] option[value='2: 845280002']")); uiEventType.Click(); } // enter event description NgWebElement uiEventDescription = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='eventTypeDescription']")); uiEventDescription.SendKeys(eventDescription); // enter event client or host name NgWebElement uiEventClientOrHostName = ngDriver.FindElement(By.CssSelector("input[formcontrolname='clientHostname']")); uiEventClientOrHostName.SendKeys(eventClientOrHostName); if (eventType == "with more than 500 people") { // enter maximum attendance NgWebElement uiMaxAttendance = ngDriver.FindElement(By.CssSelector("input[formcontrolname='maxAttendance']")); uiMaxAttendance.SendKeys(maximumAttendanceApproval); // enter maximum staff attendance NgWebElement uiMaxStaffAttendance = ngDriver.FindElement(By.CssSelector("input[formcontrolname='maxStaffAttendance']")); uiMaxStaffAttendance.SendKeys(maximumStaffAttendanceApproval); } else { // enter maximum attendance NgWebElement uiMaxAttendance = ngDriver.FindElement(By.CssSelector("input[formcontrolname='maxAttendance']")); uiMaxAttendance.SendKeys(maximumAttendance); // enter maximum staff attendance NgWebElement uiMaxStaffAttendance = ngDriver.FindElement(By.CssSelector("input[formcontrolname='maxStaffAttendance']")); uiMaxStaffAttendance.SendKeys(maximumStaffAttendance); } // select whether minors are attending - yes NgWebElement uiMinorsAttending = ngDriver.FindElement(By.CssSelector("[formcontrolname='minorsAttending'] option[value='true']")); uiMinorsAttending.Click(); // select type of food service provided NgWebElement uiFoodServiceProvided = ngDriver.FindElement(By.CssSelector("[formcontrolname='foodService'] option[value='0: 845280000']")); uiFoodServiceProvided.Click(); // select type of entertainment provided NgWebElement uiEntertainmentProvided = ngDriver.FindElement(By.CssSelector("[formcontrolname='entertainment'] option[value='1: 845280001']")); uiEntertainmentProvided.Click(); // enter venue name description NgWebElement uiVenueNameDescription = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='venueDescription']")); uiVenueNameDescription.SendKeys(venueNameDescription); if (eventType == "for an outdoor location") { // select outdoor venue location NgWebElement uiVenueLocation = ngDriver.FindElement(By.CssSelector("[formcontrolname='specificLocation'] option[value='1: 845280001']")); uiVenueLocation.Click(); } else if (eventType == "for an indoor and outdoor location") { // select both indoor/outdoor venue location NgWebElement uiVenueLocation = ngDriver.FindElement(By.CssSelector("[formcontrolname='specificLocation'] option[value='2: 845280002']")); uiVenueLocation.Click(); } else { // select indoor venue location NgWebElement uiVenueLocation = ngDriver.FindElement(By.CssSelector("[formcontrolname='specificLocation'] option[value='0: 845280000']")); uiVenueLocation.Click(); } // enter venue additional info NgWebElement uiVenueAdditionalInfo = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='additionalLocationInformation']")); uiVenueAdditionalInfo.SendKeys(venueAdditionalInfo); // enter physical address - street address 1 NgWebElement uiPhysicalAddStreetAddress1 = ngDriver.FindElement(By.CssSelector("input[formcontrolname='street1']")); uiPhysicalAddStreetAddress1.SendKeys(physicalAddStreetAddress1); // enter physical address - street address 2 NgWebElement uiPhysicalAddStreetAddress2 = ngDriver.FindElement(By.CssSelector("input[formcontrolname='street2']")); uiPhysicalAddStreetAddress2.SendKeys(physicalAddStreetAddress2); // enter physical address - city NgWebElement uiPhysicalAddCity = ngDriver.FindElement(By.CssSelector("input[formcontrolname='city']")); uiPhysicalAddCity.SendKeys(physicalAddCity); // enter physical address - postal code NgWebElement uiPhysicalAddPostalCode = ngDriver.FindElement(By.CssSelector("input[formcontrolname='postalCode']")); uiPhysicalAddPostalCode.SendKeys(physicalAddPostalCode); // select start date NgWebElement uiVenueStartDate1 = ngDriver.FindElement(By.CssSelector("input[formcontrolname='startDate']")); uiVenueStartDate1.Click(); NgWebElement uiVenueStartDate2 = ngDriver.FindElement(By.CssSelector(".mat-calendar-body-cell-content.mat-calendar-body-today")); uiVenueStartDate2.Click(); // select end date NgWebElement uiEndDate1 = ngDriver.FindElement(By.CssSelector("input[formcontrolname='endDate']")); uiEndDate1.Click(); // click on the next button NgWebElement uiOpenCalendarNext = ngDriver.FindElement(By.CssSelector(".mat-calendar .mat-calendar-next-button")); uiOpenCalendarNext.Click(); // click on the first day NgWebElement uiOpenCalendarFirstDay = ngDriver.FindElement(By.CssSelector(".mat-calendar-content .mat-calendar-body-cell-content:first-child")); JavaScriptClick(uiOpenCalendarFirstDay); // select event and liquor end time after 2am if ((eventType == "for after 2am") || (eventType == "for a community event after 2am")) { NgWebElement uiEventCloseTime = ngDriver.FindElement(By.CssSelector(".col-md-2:nth-child(3) .ngb-tp-minute .ng-star-inserted:nth-child(1) .ngb-tp-chevron")); JavaScriptClick(uiEventCloseTime); NgWebElement uiLiquorCloseTime = ngDriver.FindElement(By.CssSelector(".col-md-2:nth-child(5) .ngb-tp-minute .btn-link:nth-child(1) .ngb-tp-chevron")); JavaScriptClick(uiLiquorCloseTime); } // select terms and conditions checkbox NgWebElement uiTermsAndConditions = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='agreement']")); uiTermsAndConditions.Click(); if ((eventType == "for a draft") || (eventType == "being validated")) { // click on the Save For Later button NgWebElement uiSaveForLater = ngDriver.FindElement(By.CssSelector(".btn-primary:nth-child(1)")); uiSaveForLater.Click(); } else { // click on the Submit button NgWebElement uiSubmit = ngDriver.FindElement(By.CssSelector(".btn-primary~ .btn-primary+ .btn-primary")); uiSubmit.Click(); } }
public void EventAuthorizationValidation() { /* * Page Title: Catered Event Authorization Request */ // remove event contact name NgWebElement uiEventContactName = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactName']")); uiEventContactName.Clear(); // remove event contact phone NgWebElement uiEventContactPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPhone']")); uiEventContactPhone.Clear(); // remove event description NgWebElement uiEventDescription = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='eventTypeDescription']")); uiEventDescription.Clear(); // remove event client or host name NgWebElement uiEventClientOrHostName = ngDriver.FindElement(By.CssSelector("input[formcontrolname='clientHostname']")); uiEventClientOrHostName.Clear(); // remove maximum attendance NgWebElement uiMaxAttendance = ngDriver.FindElement(By.CssSelector("input[formcontrolname='maxAttendance']")); uiMaxAttendance.Clear(); // remove maximum staff attendance NgWebElement uiMaxStaffAttendance = ngDriver.FindElement(By.CssSelector("input[formcontrolname='maxStaffAttendance']")); uiMaxStaffAttendance.Clear(); // remove venue name description NgWebElement uiVenueNameDescription = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='venueDescription']")); uiVenueNameDescription.Clear(); // remove venue additional info NgWebElement uiVenueAdditionalInfo = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='additionalLocationInformation']")); uiVenueAdditionalInfo.Clear(); // remove physical address - street address 1 NgWebElement uiPhysicalAddStreetAddress1 = ngDriver.FindElement(By.CssSelector("input[formcontrolname='street1']")); uiPhysicalAddStreetAddress1.Clear(); // remove physical address - street address 2 NgWebElement uiPhysicalAddStreetAddress2 = ngDriver.FindElement(By.CssSelector("input[formcontrolname='street2']")); uiPhysicalAddStreetAddress2.Clear(); // remove physical address - city NgWebElement uiPhysicalAddCity = ngDriver.FindElement(By.CssSelector("input[formcontrolname='city']")); uiPhysicalAddCity.Clear(); // remove physical address - postal code NgWebElement uiPhysicalAddPostalCode = ngDriver.FindElement(By.CssSelector("input[formcontrolname='postalCode']")); uiPhysicalAddPostalCode.Clear(); // deselect terms and conditions checkbox NgWebElement uiTermsAndConditions = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='agreement']")); uiTermsAndConditions.Click(); }
public void ShouldSelectOneByOne() { // Given multuselect directive NgWebElement ng_directive = ngDriver.FindElement(NgBy.Model("selectedCar")); Assert.IsNotNull(ng_directive.WrappedElement); Assert.That(ng_directive.TagName, Is.EqualTo("am-multiselect")); // open am-multiselect IWebElement toggleSelect = ng_directive.FindElement(By.CssSelector("button[ng-click='toggleSelect()']")); Assert.IsNotNull(toggleSelect); Assert.IsTrue(toggleSelect.Displayed); toggleSelect.Click(); // When I want to select every "Audi", "Honda" or "Toyota" car String makeMatcher = "(?i:" + String.Join("|", new String[] { "audi", "honda", "toyota" }) + ")"; ReadOnlyCollection <NgWebElement> cars = ng_directive.FindElements(NgBy.Repeater("i in items")); Assert.Greater(cars.Count(car => Regex.IsMatch(car.Text, makeMatcher)), 0); // And I pick every matching car one item at a time int selected_cars_count = 0; for (int num_row = 0; num_row < cars.Count(); num_row++) { NgWebElement ng_item = ng_directive.FindElement(NgBy.Repeaterelement("i in items", num_row, "i.label")); if (Regex.IsMatch(ng_item.Text, makeMatcher, RegexOptions.IgnoreCase)) { Console.Error.WriteLine("Selecting: " + ng_item.Text); ng_item.Click(); selected_cars_count++; ngDriver.Highlight(ng_item, highlight_timeout); } } // Then button text shows the total number of cars I have selected IWebElement button = driver.FindElement(By.CssSelector("am-multiselect > div > button")); ngDriver.Highlight(button, highlight_timeout); StringAssert.IsMatch(@"There are (\d+) car\(s\) selected", button.Text); int displayed_count = 0; int.TryParse(button.Text.FindMatch(@"(?<count>\d+)"), out displayed_count); Assert.AreEqual(displayed_count, selected_cars_count); Console.Error.WriteLine("Button text: " + button.Text); try { // NOTE: the following does not work: // ms-selected = "There are {{selectedCar.length}} NgWebElement ng_button = new NgWebElement(ngDriver, button); Console.Error.WriteLine(ng_button.GetAttribute("innerHTML")); NgWebElement ng_length = ng_button.FindElement(NgBy.Binding("selectedCar.length")); ng_length = ngDriver.FindElement(NgBy.Binding("selectedCar.length")); Console.Error.WriteLine(ng_length.Text); } catch (NullReferenceException) { } }
public void StructuralAlterations() { /* * Page Title: Licences */ string structuralAlterations = "Structural Alterations to an Approved Lounge or Special Events Area"; // click on the Structural Alterations Application link NgWebElement uiStructuralAlterations = ngDriver.FindElement(By.LinkText(structuralAlterations)); uiStructuralAlterations.Click(); ContinueToApplicationButton(); // create test data string outdoorAreaDescription = "Sample outdoor area description"; string outdoorAreaCapacity = "10"; string capacityAreaOccupants = "20"; // find the upload test files in the bdd-tests\upload_files folder var environment = Environment.CurrentDirectory; string projectDirectory = Directory.GetParent(environment).Parent.FullName; string projectDirectory2 = Directory.GetParent(projectDirectory).Parent.FullName; // upload the floor plan string floorplanPath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "floor_plan.pdf"); NgWebElement uiUploadFloorplan = ngDriver.FindElement(By.XPath("(//input[@type='file'])[2]")); uiUploadFloorplan.SendKeys(floorplanPath); // add outside area NgWebElement uiOutdoorArea = ngDriver.FindElement(By.CssSelector("[formcontrolname='outsideAreas'] button")); uiOutdoorArea.Click(); // enter the outdooor area description NgWebElement uiOutdoorAreaDescription = ngDriver.FindElement(By.CssSelector("[formcontrolname='outsideAreas'] input[formcontrolname='areaLocation']")); uiOutdoorAreaDescription.SendKeys(outdoorAreaDescription); // enter the outdoor area occupant load NgWebElement uiOutdoorAreaOccupantLoad = ngDriver.FindElement(By.CssSelector("[formcontrolname='outsideAreas'] input[formcontrolname='capacity']")); uiOutdoorAreaOccupantLoad.SendKeys(outdoorAreaCapacity); // enter capacity area occupant load NgWebElement uiCapacityAreaOccupantLoad = ngDriver.FindElement(By.CssSelector("[formgroupname='capacityArea'] input[formcontrolname='capacity']")); uiCapacityAreaOccupantLoad.SendKeys(capacityAreaOccupants); // select the authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.CssSelector("input[formcontrolname='authorizedToSubmit'][type='checkbox']")); uiAuthorizedToSubmit.Click(); // select the signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("input[formcontrolname='signatureAgreement'][type='checkbox']")); uiSignatureAgreement.Click(); // click on the Submit & Pay button ClickOnSubmitButton(); MakePayment(); }
public void ShouldDirectSelectFromDatePicker() { Common.GetLocalHostPageContent("ng_datepicker.htm"); // http://dalelotts.github.io/angular-bootstrap-datetimepicker/ NgWebElement ng_result = ngDriver.FindElement(NgBy.Model("data.inputOnTimeSet")); ng_result.Clear(); ngDriver.Highlight(ng_result); IWebElement calendar = ngDriver.FindElement(By.CssSelector(".input-group-addon")); ngDriver.Highlight(calendar); Actions actions = new Actions(ngDriver.WrappedDriver); actions.MoveToElement(calendar).Click().Build().Perform(); int datepicker_width = 900; int datepicker_heght = 800; driver.Manage().Window.Size = new System.Drawing.Size(datepicker_width, datepicker_heght); IWebElement dropdown = driver.FindElement(By.CssSelector("div.dropdown.open ul.dropdown-menu")); NgWebElement ng_dropdown = new NgWebElement(ngDriver, dropdown); Assert.IsNotNull(ng_dropdown); ReadOnlyCollection <NgWebElement> elements = ng_dropdown.FindElements(NgBy.Repeater("dateObject in week.dates")); Assert.IsTrue(28 <= elements.Count); String monthDate = "12"; IWebElement dateElement = ng_dropdown.FindElements(NgBy.CssContainingText("td.ng-binding", monthDate)).First(); Console.Error.WriteLine("Mondh Date: " + dateElement.Text); dateElement.Click(); NgWebElement ng_element = ng_dropdown.FindElement(NgBy.Model("data.inputOnTimeSet")); Assert.IsNotNull(ng_element); ngDriver.Highlight(ng_element); ReadOnlyCollection <NgWebElement> ng_dataDates = ng_element.FindElements(NgBy.Repeater("dateObject in data.dates")); Assert.AreEqual(24, ng_dataDates.Count); String timeOfDay = "6:00 PM"; NgWebElement ng_hour = ng_element.FindElements(NgBy.CssContainingText("span.hour", timeOfDay)).First(); Assert.IsNotNull(ng_hour); ngDriver.Highlight(ng_hour); Console.Error.WriteLine("Hour of the day: " + ng_hour.Text); ng_hour.Click(); String specificMinute = "6:35 PM"; // reload // dropdown = driver.FindElement(By.CssSelector("div.dropdown.open ul.dropdown-menu")); // ng_dropdown = new NgWebElement(ngDriver, dropdown); ng_element = ng_dropdown.FindElement(NgBy.Model("data.inputOnTimeSet")); Assert.IsNotNull(ng_element); ngDriver.Highlight(ng_element); NgWebElement ng_minute = ng_element.FindElements(NgBy.CssContainingText("span.minute", specificMinute)).First(); Assert.IsNotNull(ng_minute); ngDriver.Highlight(ng_minute); Console.Error.WriteLine("Time of the day: " + ng_minute.Text); ng_minute.Click(); ng_result = ngDriver.FindElement(NgBy.Model("data.inputOnTimeSet")); ngDriver.Highlight(ng_result, 100); Console.Error.WriteLine("Selected Date/time: " + ng_result.GetAttribute("value")); }
public void PicnicAreaEndorsement() { /* * Page Title: Licences */ string picnicAreaEndorsement = "Picnic Area Endorsement Application"; // click on the Picnic Area Endorsement Application link NgWebElement uiPicnicAreaEndorsement = ngDriver.FindElement(By.LinkText(picnicAreaEndorsement)); uiPicnicAreaEndorsement.Click(); /* * Page Title: Please Review the Account Profile */ ContinueToApplicationButton(); /* * Page Title: Manufacturer Picnic Area Endorsement Application */ // create test data string proposedChange = "Description of proposed change(s) such as moving, adding or changing approved picnic area(s)"; string otherBizDetails = "Description of other business details"; string patioCompositionDescription = "Description of patio composition"; string capacity = "100"; // enter the description of the proposed change NgWebElement uiProposedChange = ngDriver.FindElement(By.CssSelector("textarea#description1")); uiProposedChange.SendKeys(proposedChange); // enter the other business details NgWebElement uiOtherBizDetails = ngDriver.FindElement(By.CssSelector("textarea#otherBusinessesDetails")); uiOtherBizDetails.SendKeys(otherBizDetails); // enter the patio composition description NgWebElement uiPatioCompDesc = ngDriver.FindElement(By.CssSelector("textarea#patioCompDescription")); uiPatioCompDesc.SendKeys(patioCompositionDescription); // select 'Grass' for patio location NgWebElement uiGrass = ngDriver.FindElement(By.CssSelector("button#mat-button-toggle-43-button")); uiGrass.Click(); // select 'Earth' for patio location NgWebElement uiEarth = ngDriver.FindElement(By.CssSelector("button#mat-button-toggle-44-button")); uiEarth.Click(); // select 'Gravel' for patio location NgWebElement uiGravel = ngDriver.FindElement(By.CssSelector("button#mat-button-toggle-45-button")); uiGravel.Click(); // select 'Finished Flooring' for patio location NgWebElement uiFinishedFlooring = ngDriver.FindElement(By.CssSelector("button#mat-button-toggle-46-button")); uiFinishedFlooring.Click(); // select 'Cement Sidewalk' for patio location NgWebElement uiCementSidewalk = ngDriver.FindElement(By.CssSelector("button#mat-button-toggle-47-button")); uiCementSidewalk.Click(); // select 'Other' for patio location NgWebElement uiOther = ngDriver.FindElement(By.CssSelector("button#mat-button-toggle-48-button")); uiOther.Click(); // enter the capacity NgWebElement uiCapacity = ngDriver.FindElement(By.CssSelector("input[formcontrolname='capacity']")); uiCapacity.Clear(); uiCapacity.SendKeys(capacity); // upload the site plan FileUpload("site_plan.pdf", "(//input[@type='file'])[2]"); // upload the exterior photos FileUpload("exterior_photos.jpg", "(//input[@type='file'])[5]"); // click on the authorized to submit checkbox NgWebElement uiAuthorizedSubmit = ngDriver.FindElement(By.Id("authorizedToSubmit")); uiAuthorizedSubmit.Click(); // click on the signature agreement checkbox NgWebElement uiSignatureAgree = ngDriver.FindElement(By.Id("signatureAgreement")); uiSignatureAgree.Click(); ClickOnSubmitButton(); //System.Threading.Thread.Sleep(3000); }
public void CompleteLRSApplication() { /* * Page Title: LRS Relocation Application */ // create test data string proposedAddress = "645 Tyee Road"; string proposedCity = "Victoria"; string proposedPostalCode = "V9A 6X5"; string proposedPID = "111111111"; // enter the proposed address NgWebElement uiProposedAddress = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressStreet']")); uiProposedAddress.SendKeys(proposedAddress); // enter the proposed city NgWebElement uiProposedCity = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressCity']")); uiProposedCity.SendKeys(proposedCity); // enter the proposed postal code NgWebElement uiProposedPostalCode = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressPostalCode']")); uiProposedPostalCode.SendKeys(proposedPostalCode); // enter the proposed PID NgWebElement uiProposedPID = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentParcelId']")); uiProposedPID.SendKeys(proposedPID); // find the upload test files in the bdd-tests\upload_files folder var environment = Environment.CurrentDirectory; string projectDirectory = Directory.GetParent(environment).Parent.FullName; string projectDirectory2 = Directory.GetParent(projectDirectory).Parent.FullName; // upload the signage document string signagePath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "signage.pdf"); NgWebElement uiUploadSignage = ngDriver.FindElement(By.XPath("(//input[@type='file'])[2]")); uiUploadSignage.SendKeys(signagePath); // upload the floor plan string floorPlanPath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "floor_plan.pdf"); NgWebElement uiUploadFloorPlan = ngDriver.FindElement(By.XPath("(//input[@type='file'])[5]")); uiUploadFloorPlan.SendKeys(floorPlanPath); // upload the site plan string sitePlanPath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "site_plan.pdf"); NgWebElement uiUploadSitePlan = ngDriver.FindElement(By.XPath("(//input[@type='file'])[8]")); uiUploadSitePlan.SendKeys(sitePlanPath); // upload the exterior photos string exteriorPhotosPath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "exterior_photos.jpg"); NgWebElement uiUploadExteriorPhotos = ngDriver.FindElement(By.XPath("(//input[@type='file'])[11]")); uiUploadExteriorPhotos.SendKeys(exteriorPhotosPath); // select 'Yes' for proposed LRS site located within a grocery store NgWebElement uiProposedSiteInGrocery = ngDriver.FindElement(By.CssSelector("#mat-button-toggle-1 button#mat-button-toggle-1-button")); uiProposedSiteInGrocery.Click(); // upload grocery declaration document string groceryDeclarationPath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "grocery_declaration.pdf"); NgWebElement uiUploadGroceryDeclaration = ngDriver.FindElement(By.XPath("(//input[@type='file'])[15]")); uiUploadGroceryDeclaration.SendKeys(groceryDeclarationPath); // select the owner checkbox NgWebElement uiOwner = ngDriver.FindElement(By.CssSelector(".mat-checkbox[formcontrolname='isOwnerBusiness']")); uiOwner.Click(); // select the valid interest checkbox NgWebElement uiValidInterest = ngDriver.FindElement(By.CssSelector(".mat-checkbox[formcontrolname='hasValidInterest']")); uiValidInterest.Click(); // select the future valid interest checkbox NgWebElement uiFutureValidInterest = ngDriver.FindElement(By.CssSelector("mat-checkbox#mat-checkbox-4[formcontrolname='willhaveValidInterest']")); uiFutureValidInterest.Click(); // upload valid interest document string validInterestPath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "valid_interest.pdf"); NgWebElement uiUploadValidInterest = ngDriver.FindElement(By.XPath("(//input[@type='file'])[18]")); uiUploadValidInterest.SendKeys(validInterestPath); // select the authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.CssSelector("input[formcontrolname='authorizedToSubmit'][type='checkbox']")); uiAuthorizedToSubmit.Click(); // select the signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("input[formcontrolname='signatureAgreement'][type='checkbox']")); uiSignatureAgreement.Click(); // click on the submit for LG/IN review button ClickOnSubmitButton(); }
public void UBrewUVinApplication(string businessType) { string establishmentName = "Point Ellis Greenhouse"; string streetAddress = "645 Tyee Road"; string city = "Victoria"; string postalCode = "V9A6X5"; string PID = "999999999"; string storeEmail = "*****@*****.**"; string storePhone = "2222222222"; string contactTitle = "Brewmaster"; string contactPhone = "3333333333"; string contactEmail = "*****@*****.**"; if (businessType != " sole proprietorship") { // upload a central securities register FileUpload("central_securities_register.pdf", "(//input[@type='file'])[3]"); // upload supporting business documentation FileUpload("associates.pdf", "(//input[@type='file'])[6]"); // upload notice of articles FileUpload("notice_of_articles.pdf", "(//input[@type='file'])[9]"); } // upload personal history summary form if (businessType == " sole proprietorship") { FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[3]"); } else { FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[12]"); } // upload shareholders < 10% interest if (businessType != " sole proprietorship") { FileUpload("shareholders_less_10_interest.pdf", "(//input[@type='file'])[15]"); } // enter the establishment name NgWebElement uiEstablishmentName = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentName']")); uiEstablishmentName.SendKeys(establishmentName); // enter the street address NgWebElement uiEstablishmentAddressStreet = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressStreet']")); uiEstablishmentAddressStreet.SendKeys(streetAddress); // enter the city NgWebElement uiEstablishmentAddressCity = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressCity']")); uiEstablishmentAddressCity.SendKeys(city); // enter the postal code NgWebElement uiEstablishmentAddressPostalCode = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressPostalCode']")); uiEstablishmentAddressPostalCode.SendKeys(postalCode); // enter the PID NgWebElement uiEstablishmentParcelId = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentParcelId']")); uiEstablishmentParcelId.SendKeys(PID); // enter the store email NgWebElement uiEstablishmentEmail = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentEmail']")); uiEstablishmentEmail.SendKeys(storeEmail); // enter the store phone NgWebElement uiEstablishmentPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentPhone']")); uiEstablishmentPhone.SendKeys(storePhone); if (businessType == " sole proprietorship") { // upload the signage document FileUpload("signage.pdf", "(//input[@type='file'])[5]"); } else { // upload the signage document FileUpload("signage.pdf", "(//input[@type='file'])[17]"); } // select owner business checkbox NgWebElement uiIsOwnerBusiness = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='isOwnerBusiness']")); uiIsOwnerBusiness.Click(); // select has valid interest checkbox NgWebElement uiHasValidInterest = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='hasValidInterest']")); uiHasValidInterest.Click(); // select will have valid interest checkbox NgWebElement uiWillhaveValidInterest = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='willHaveValidInterest']")); uiWillhaveValidInterest.Click(); if (businessType == " sole proprietorship") { // upload the valid interest document FileUpload("valid_interest.pdf", "(//input[@type='file'])[9]"); } else { // upload the valid interest document FileUpload("valid_interest.pdf", "(//input[@type='file'])[21]"); } // enter the contact title NgWebElement uiContactPersonRole = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonRole']")); uiContactPersonRole.SendKeys(contactTitle); // enter the contact phone number NgWebElement uiContactPersonPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonPhone']")); uiContactPersonPhone.SendKeys(contactPhone); // enter the contact email address NgWebElement uiContactPersonEmail = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonEmail']")); uiContactPersonEmail.SendKeys(contactEmail); // click on authorize signature checkbox NgWebElement uiAuthorizeSignature = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='authorizedToSubmit']")); uiAuthorizeSignature.Click(); // click on signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='signatureAgreement']")); uiSignatureAgreement.Click(); // retrieve the current URL to get the application ID (needed downstream) string URL = ngDriver.Url; // retrieve the application ID string[] parsedURL = URL.Split('/'); applicationID = parsedURL[5]; }
public void CannabisMarketingApplication(string bizType) { string nameOfFederalProducer = "Canadian Cannabis"; string marketerConnectionToCrsDetails = "Details of association (marketer to store)"; string crsConnectionToMarketer = "Details of association (store to marketer)"; string contactTitle = "VP Marketing"; string contactPhone = "5555555555"; string contactEmail = "vp@cannabis_marketing.com"; if ((bizType != "a local government") && (bizType != "a university")) { // enter name of federal producer NgWebElement uiFederalProducer = ngDriver.FindElement(By.CssSelector("input[formcontrolname='federalProducerNames']")); uiFederalProducer.SendKeys(nameOfFederalProducer); // select 'Yes' // Does the corporation have any association, connection or financial interest in a B.C. non-medical cannabis retail store licensee or applicant of cannabis? NgWebElement uiMarketerConnectionToCrs = ngDriver.FindElement(By.CssSelector("input[formcontrolname='marketerConnectionToCrs'][type='radio'][value='Yes']")); uiMarketerConnectionToCrs.Click(); // enter the details NgWebElement uiMarketerConnectionToCrsDetails = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='marketerConnectionToCrsDetails']")); uiMarketerConnectionToCrsDetails.SendKeys(marketerConnectionToCrsDetails); // !society !indigenousnation if ((bizType == "a private corporation") || (bizType == "a partnership")) { // select 'Yes' // Does a B.C. non-medical cannabis retail store licensee or applicant of cannabis have any association, connection or financial interest in the corporation? NgWebElement uiCrsConnectionToMarketer = ngDriver.FindElement(By.CssSelector("input[formcontrolname='crsConnectionToMarketer'][type='radio'][value='Yes']")); uiCrsConnectionToMarketer.Click(); // enter the details NgWebElement uiCrsConnectionToMarketerDetails = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='crsConnectionToMarketerDetails']")); uiCrsConnectionToMarketerDetails.SendKeys(crsConnectionToMarketer); } if (bizType == "a public corporation") { // select 'Yes' // Does any shareholder with 20% or more voting shares have any association, connection or financial interest in a B.C. non-medical cannabis retail store licensee or applicant of cannabis? NgWebElement uiCrsConnectionToMarketer = ngDriver.FindElement(By.CssSelector("input[formcontrolname='crsConnectionToMarketer'][type='radio'][value='Yes']")); uiCrsConnectionToMarketer.Click(); // enter the details NgWebElement uiCrsConnectionToMarketerDetails = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='crsConnectionToMarketerDetails']")); uiCrsConnectionToMarketerDetails.SendKeys(crsConnectionToMarketer); } if (bizType == "a sole proprietorship") { // select 'Yes' // Does the sole proprietor have an immediate family member that has any interest in a licensee or applicant? NgWebElement uiCrsConnectionToMarketer = ngDriver.FindElement(By.CssSelector("input[formcontrolname='crsConnectionToMarketer'][type='radio'][value='Yes']")); uiCrsConnectionToMarketer.Click(); // enter the details NgWebElement uiCrsConnectionToMarketerDetails = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='crsConnectionToMarketerDetails']")); uiCrsConnectionToMarketerDetails.SendKeys(crsConnectionToMarketer); } } // upload the Associates form FileUpload("associates.pdf", "(//input[@type='file'])[3]"); // upload the Notice of Articles FileUpload("notice_of_articles.pdf", "(//input[@type='file'])[5]"); // upload the Central Securities Register FileUpload("central_securities_register.pdf", "(//input[@type='file'])[5]"); // enter the contact title NgWebElement uiContactPersonRole = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonRole']")); uiContactPersonRole.SendKeys(contactTitle); // enter the contact phone number NgWebElement uiContactPersonPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonPhone']")); uiContactPersonPhone.SendKeys(contactPhone); // enter the contact email address NgWebElement uiContactPersonEmail = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonEmail']")); uiContactPersonEmail.SendKeys(contactEmail); // select authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.CssSelector("input[formcontrolname='authorizedToSubmit']")); uiAuthorizedToSubmit.Click(); // select signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("input[formcontrolname='signatureAgreement']")); uiSignatureAgreement.Click(); }
public void ShouldDeposit() { ngDriver.FindElement(NgBy.ButtonText("Customer Login")).Click(); ReadOnlyCollection <NgWebElement> ng_customers = ngDriver.FindElement(NgBy.Model("custId")).FindElements(NgBy.Repeater("cust in Customers")); // select customer to log in ng_customers.First(cust => Regex.IsMatch(cust.Text, "Harry Potter")).Click(); ngDriver.FindElement(NgBy.ButtonText("Login")).Click(); ngDriver.FindElement(NgBy.Options("account for account in Accounts")).Click(); // inspect the account NgWebElement ng_account_number = ngDriver.FindElement(NgBy.Binding("accountNo")); int account_id = 0; int.TryParse(ng_account_number.Text.FindMatch(@"(?<account_number>\d+)$"), out account_id); Assert.AreNotEqual(0, account_id); /* * IEnumerable<IWebElement>elements = driver.FindElements(By.CssSelector("[data-id]")); * int[] results = elements.TakeWhile(e => Regex.IsMatch(e.GetAttribute("data-id") , "[0-9]+" )).Select(x => Int32.Parse(x.GetAttribute("data-id"))).ToArray<int>(); */ int account_balance = -1; int.TryParse(ngDriver.FindElement(NgBy.Binding("amount")).Text.FindMatch(@"(?<account_balance>\d+)$"), out account_balance); Assert.AreNotEqual(-1, account_balance); NgWebElement ng_deposit_button = ngDriver.FindElement(NgBy.PartialButtonText("Deposit")); Assert.IsTrue(ng_deposit_button.Displayed); actions.MoveToElement(ng_deposit_button.WrappedElement).Build().Perform(); Thread.Sleep(500); ng_deposit_button.Click(); // core Selenium wait.Until(ExpectedConditions.ElementExists(By.CssSelector("form[name='myForm']"))); NgWebElement ng_form_element = new NgWebElement(ngDriver, driver.FindElement(By.CssSelector("form[name='myForm']"))); // deposit amount NgWebElement ng_deposit_amount = ng_form_element.FindElement(NgBy.Model("amount")); ng_deposit_amount.SendKeys("100"); // Confirm to perform deposit NgWebElement ng_submit_deposit_button = ng_form_element.FindElements(NgBy.ButtonText("Deposit")).First(o => o.GetAttribute("class").IndexOf("btn-default", StringComparison.InvariantCultureIgnoreCase) > -1); actions.MoveToElement(ng_submit_deposit_button.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_submit_deposit_button, highlight_timeout); ng_submit_deposit_button.Click(); // http://www.way2automation.com/angularjs-protractor/banking/depositTx.html // inspect message var ng_message = ngDriver.FindElement(NgBy.Binding("message")); StringAssert.Contains("Deposit Successful", ng_message.Text); ngDriver.Highlight(ng_message, highlight_timeout); // re-read the amount int updated_account_balance = -1; int.TryParse(ngDriver.FindElement(NgBy.Binding("amount")).Text.FindMatch(@"(?<account_balance>\d+)$"), out updated_account_balance); Assert.AreEqual(updated_account_balance, account_balance + 100); }
public void CompleteCateringApplication(string bizType) { /* * Page Title: Catering Licence Application */ // create application info string estName = "Point Ellis Greenhouse"; string estAddress = "645 Tyee Rd"; string estCity = "Victoria"; string estPostal = "V9A 6X5"; string estPID = "012345678"; string estPhone = "2505555555"; string estEmail = "*****@*****.**"; string conGiven = "Given"; string conSurname = "Surname"; string conRole = "CEO"; string conPhone = "2508888888"; string conEmail = "*****@*****.**"; string prevAppDetails = "Here are the previous application details (automated test)."; string liqConnectionDetails = "Here are the liquor industry connection details (automated test)."; string kitchenDetails = "Here are the details of the kitchen equipment."; string transportDetails = "Here are the transport details."; if (bizType == "partnership") { // upload a partnership agreement FileUpload("partnership_agreement.pdf", "(//input[@type='file'])[3]"); // upload personal history summary FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[6]"); } if (bizType == "public corporation") { // upload a central securities register FileUpload("central_securities_register.pdf", "(//input[@type='file'])[3]"); // upload supporting biz documents FileUpload("business_plan.pdf", "(//input[@type='file'])[6]"); // upload notice of articles FileUpload("notice_of_articles.pdf", "(//input[@type='file'])[9]"); // upload personal history summary documents FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[12]"); // upload shareholders < 10% interest FileUpload("shareholders_less_10_interest.pdf", "(//input[@type='file'])[15]"); } if (bizType == "private corporation") { // upload a central securities register FileUpload("central_securities_register.pdf", "(//input[@type='file'])[3]"); // upload supporting business documentation FileUpload("associates.pdf", "(//input[@type='file'])[6]"); // upload notice of articles FileUpload("notice_of_articles.pdf", "(//input[@type='file'])[9]"); // upload personal history summary documents FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[12]"); // upload shareholders < 10% interest FileUpload("shareholders_less_10_interest.pdf", "(//input[@type='file'])[15]"); } if (bizType == "society") { // upload notice of articles FileUpload("notice_of_articles.pdf", "(//input[@type='file'])[3]"); // upload personal history summary documents FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[6]"); } if (bizType == "sole proprietorship") { // upload personal history summary documents FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[3]"); } // enter the establishment name NgWebElement uiEstabName = null; for (int i = 0; i < 10; i++) { try { var names = ngDriver.FindElements(By.CssSelector("input[formcontrolname='establishmentName']")); if (names.Count > 0) { uiEstabName = names[0]; break; } } catch (Exception) { } } uiEstabName.SendKeys(estName); // enter the establishment address NgWebElement uiEstabAddress = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressStreet']")); uiEstabAddress.SendKeys(estAddress); // enter the establishment city NgWebElement uiEstabCity = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressCity']")); uiEstabCity.SendKeys(estCity); // enter the establishment postal code NgWebElement uiEstabPostal = ngDriver.FindElement(By.Id("establishmentAddressPostalCode")); uiEstabPostal.SendKeys(estPostal); // enter the PID NgWebElement uiEstabPID = ngDriver.FindElement(By.Id("establishmentParcelId")); uiEstabPID.SendKeys(estPID); // enter the store email NgWebElement uiEstabEmail = ngDriver.FindElement(By.Id("establishmentEmail")); uiEstabEmail.SendKeys(estEmail); // enter the store phone number NgWebElement uiEstabPhone = ngDriver.FindElement(By.Id("establishmentPhone")); uiEstabPhone.SendKeys(estPhone); // select 'Yes' // Do you or any of your shareholders currently hold, have held, or have previously applied for a British Columbia liquor licence? if ((bizType == "private corporation") || (bizType == "partnership") || (bizType == "society") || (bizType == "public corporation") || (bizType == "sole proprietorship")) { NgWebElement uiPreviousLicenceYes = null; for (int i = 0; i < 10; i++) { try { var names = ngDriver.FindElements(By.Id("mat-button-toggle-73-button")); if (names.Count > 0) { uiPreviousLicenceYes = names[0]; break; } } catch (Exception) { } } JavaScriptClick(uiPreviousLicenceYes); } if ((bizType == "combined application")) { NgWebElement uiPreviousLicenceYes = ngDriver.FindElement(By.Id("mat-button-toggle-55-button")); JavaScriptClick(uiPreviousLicenceYes); } // enter the previous application details NgWebElement uiPreviousApplicationDetails = ngDriver.FindElement(By.Id("previousApplicationDetails")); uiPreviousApplicationDetails.SendKeys(prevAppDetails); // select 'Yes' // Do you hold a Rural Agency Store Appointment? if ((bizType == "private corporation") || (bizType == "partnership") || (bizType == "society") || (bizType == "public corporation") || (bizType == "sole proprietorship")) { NgWebElement uiRuralAgencyStore = ngDriver.FindElement(By.Id("mat-button-toggle-76-button")); JavaScriptClick(uiRuralAgencyStore); } if ((bizType == "combined application")) { NgWebElement uiRuralAgencyStore = ngDriver.FindElement(By.Id("mat-button-toggle-58-button")); uiRuralAgencyStore.Click(); } // select 'Yes' // Do you, or any of your shareholders, have any connection, financial or otherwise, direct or indirect, with a distillery, brewery or winery? if ((bizType == "private corporation") || (bizType == "partnership") || (bizType == "society") || (bizType == "public corporation") || (bizType == "sole proprietorship")) { NgWebElement uiOtherBusinessYes = ngDriver.FindElement(By.Id("mat-button-toggle-79-button")); JavaScriptClick(uiOtherBusinessYes); } if ((bizType == "combined application")) { NgWebElement uiOtherBusinessYes = ngDriver.FindElement(By.Id("mat-button-toggle-61-button")); uiOtherBusinessYes.Click(); } // enter the connection details NgWebElement uiLiqIndConnection = ngDriver.FindElement(By.Id("liquorIndustryConnectionsDetails")); uiLiqIndConnection.SendKeys(liqConnectionDetails); // enter the kitchen details NgWebElement uiKitchenDescription = ngDriver.FindElement(By.CssSelector("textarea#description2")); uiKitchenDescription.SendKeys(kitchenDetails); // enter the transport details NgWebElement uiTransportDetails = ngDriver.FindElement(By.CssSelector("textarea#description3")); uiTransportDetails.SendKeys(transportDetails); if ((bizType == "partnership") || (bizType == "society")) { // upload a store signage document FileUpload("signage.pdf", "(//input[@type='file'])[8]"); // upload a valid interest document FileUpload("valid_interest.pdf", "(//input[@type='file'])[12]"); } if ((bizType == "private corporation") || (bizType == "combined application") || (bizType == "public corporation")) { // upload a store signage document FileUpload("signage.pdf", "(//input[@type='file'])[17]"); // upload a valid interest document FileUpload("valid_interest.pdf", "(//input[@type='file'])[21]"); } if (bizType == "sole proprietorship") { // upload a store signage document FileUpload("signage.pdf", "(//input[@type='file'])[5]"); // upload a valid interest document FileUpload("valid_interest.pdf", "(//input[@type='file'])[9]"); } // enter the first name of the application contact NgWebElement uiContactGiven = ngDriver.FindElement(By.Id("contactPersonFirstName")); uiContactGiven.SendKeys(conGiven); // enter the last name of the application contact NgWebElement uiContactSurname = ngDriver.FindElement(By.Id("contactPersonLastName")); uiContactSurname.SendKeys(conSurname); // enter the role of the application contact NgWebElement uiContactRole = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonRole']")); uiContactRole.SendKeys(conRole); // enter the phone number of the application contact NgWebElement uiContactPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonPhone']")); uiContactPhone.SendKeys(conPhone); // enter the email of the application contact NgWebElement uiContactEmail = ngDriver.FindElement(By.Id("contactPersonEmail")); uiContactEmail.SendKeys(conEmail); // click on the authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.Id("authorizedToSubmit")); uiAuthorizedToSubmit.Click(); // click on the signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.Id("signatureAgreement")); uiSignatureAgreement.Click(); // retrieve the current URL to get the application ID (needed downstream) string URL = ngDriver.Url; // retrieve the application ID string[] parsedURL = URL.Split('/'); string[] tempFix = parsedURL[5].Split(';'); applicationID = tempFix[0]; }
public void ShouldAddCustomer() { // When I proceed to "Bank Manager Login" ngDriver.FindElement(NgBy.ButtonText("Bank Manager Login")).Click(); // And I proceed to "Add Customer" ngDriver.FindElement(NgBy.PartialButtonText("Add Customer")).Click(); // And I fill new Customer data IWebElement ng_first_name = ngDriver.FindElement(NgBy.Model("fName")); ngDriver.Highlight(ng_first_name, highlight_timeout); StringAssert.IsMatch("First Name", ng_first_name.GetAttribute("placeholder")); ng_first_name.SendKeys("John"); IWebElement ng_last_name = ngDriver.FindElement(NgBy.Model("lName")); ngDriver.Highlight(ng_last_name, highlight_timeout); StringAssert.IsMatch("Last Name", ng_last_name.GetAttribute("placeholder")); ng_last_name.SendKeys("Doe"); IWebElement ng_post_code = ngDriver.FindElement(NgBy.Model("postCd")); ngDriver.Highlight(ng_post_code, highlight_timeout); StringAssert.IsMatch("Post Code", ng_post_code.GetAttribute("placeholder")); ng_post_code.SendKeys("11011"); // NOTE: there are two 'Add Customer' buttons on this form NgWebElement ng_add_customer_button = ngDriver.FindElements(NgBy.PartialButtonText("Add Customer"))[1]; actions.MoveToElement(ng_add_customer_button.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_add_customer_button, highlight_timeout); ng_add_customer_button.Submit(); // confirm string alert_text = null; try { alert = ngDriver.WrappedDriver.SwitchTo().Alert(); alert_text = alert.Text; StringAssert.StartsWith("Customer added successfully with customer id :", alert_text); alert.Accept(); } catch (NoAlertPresentException ex) { // Alert not present verificationErrors.Append(ex.StackTrace); } catch (WebDriverException ex) { // Alert not handled by PhantomJS verificationErrors.Append(ex.StackTrace); } int customer_id = 0; int.TryParse(alert_text.FindMatch(@"(?<customer_id>\d+)$"), out customer_id); Assert.AreNotEqual(0, customer_id); // And I switch to "Customers" screen ngDriver.FindElement(NgBy.PartialButtonText("Customers")).Click(); // discover newly added customer ReadOnlyCollection <NgWebElement> ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); int customer_count = ng_customers.Count; NgWebElement ng_new_customer = ng_customers.First(cust => Regex.IsMatch(cust.Text, "John Doe")); Assert.IsNotNull(ng_new_customer); actions.MoveToElement(ng_new_customer.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_new_customer, highlight_timeout); // confirm searching for the customer name ngDriver.FindElement(NgBy.Model("searchCustomer")).SendKeys("John"); ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); Assert.AreEqual(1, ng_customers.Count); // show all customers again ngDriver.FindElement(NgBy.Model("searchCustomer")).Clear(); Thread.Sleep(500); wait.Until(ExpectedConditions.ElementIsVisible(NgBy.Repeater("cust in Customers"))); // discover newly added customer again ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); ng_new_customer = ng_customers.First(cust => Regex.IsMatch(cust.Text, "John Doe")); // delete new customer NgWebElement ng_delete_button = ng_new_customer.FindElement(NgBy.ButtonText("Delete")); Assert.IsNotNull(ng_delete_button); actions.MoveToElement(ng_delete_button.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_delete_button, highlight_timeout); // in slow motion actions.MoveToElement(ng_delete_button.WrappedElement).ClickAndHold().Build().Perform(); Thread.Sleep(1000); actions.Release(); // sometimes actions do not work - for example in this test ng_delete_button.Click(); // wait for customer list to reload Thread.Sleep(1000); wait.Until(ExpectedConditions.ElementIsVisible(NgBy.Repeater("cust in Customers"))); // count the remaining customers ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); int new_customer_count = ng_customers.Count; // conrirm the customer count changed Assert.IsTrue(customer_count - 1 == new_customer_count); }
public void RequestStoreRelocation(string applicationType) { /* * Page Title: Licences & Authorizations */ string requestRelocationLink = "Request Relocation"; // click on the request location link NgWebElement uiRequestRelocation = ngDriver.FindElement(By.LinkText(requestRelocationLink)); uiRequestRelocation.Click(); /* * Page Title: Please Review the Account Profile */ ContinueToApplicationButton(); /* * Page Title: Submit a Licence Relocation Application */ if (applicationType == "Cannabis") { string proposedAddress = "Automated Test Street"; string proposedCity = "Victoria"; string proposedPostalCode = "V9A 6X5"; string pid = "012345678"; // enter the proposed street address NgWebElement uiProposedAddress = ngDriver.FindElement(By.CssSelector(".ngtest-new-address input[formcontrolname='establishmentAddressStreet']")); uiProposedAddress.SendKeys(proposedAddress); // enter the proposed city NgWebElement uiProposedCity = ngDriver.FindElement(By.CssSelector(".ngtest-new-address input[formcontrolname='establishmentAddressCity']")); uiProposedCity.SendKeys(proposedCity); // enter the postal code NgWebElement uiProposedPostalCode = ngDriver.FindElement(By.CssSelector(".ngtest-new-address input[formcontrolname='establishmentAddressPostalCode']")); uiProposedPostalCode.SendKeys(proposedPostalCode); // enter the PID NgWebElement uiProposedPID = ngDriver.FindElement(By.Id("establishmentParcelId")); uiProposedPID.SendKeys(pid); } // upload a supporting document FileUpload("checklist.pdf", "(//input[@type='file'])[2]"); // select the authorized to submit checkbox NgWebElement uiAuthToSubmit = ngDriver.FindElement(By.Id("authorizedToSubmit")); uiAuthToSubmit.Click(); // select the signature agreement checkbox NgWebElement uiSigAgreement = ngDriver.FindElement(By.Id("signatureAgreement")); uiSigAgreement.Click(); // click on the Submit & Pay button ClickOnSubmitButton(); // pay for the relocation application MakePayment(); if (applicationType == "Cannabis") { /* * Page Title: Payment Approved */ // confirm correct payment amount //Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'$220.00')]")).Displayed); // return to the Licences tab ClickLicencesTab(); } }
public void ShouldOpenAccount() { // switch to "Add Customer" screen ngDriver.FindElement(NgBy.ButtonText("Bank Manager Login")).Click(); ngDriver.FindElement(NgBy.PartialButtonText("Open Account")).Click(); // fill new Account data NgWebElement ng_customer_select = ngDriver.FindElement(NgBy.Model("custId")); StringAssert.IsMatch("userSelect", ng_customer_select.GetAttribute("id")); ReadOnlyCollection <NgWebElement> ng_customers = ng_customer_select.FindElements(NgBy.Repeater("cust in Customers")); // select customer to log in NgWebElement account_customer = ng_customers.First(cust => Regex.IsMatch(cust.Text, "Harry Potter*")); Assert.IsNotNull(account_customer); account_customer.Click(); NgWebElement ng_currencies_select = ngDriver.FindElement(NgBy.Model("currency")); // use core Selenium SelectElement currencies_select = new SelectElement(ng_currencies_select.WrappedElement); IList <IWebElement> account_currencies = currencies_select.Options; IWebElement account_currency = account_currencies.First(cust => Regex.IsMatch(cust.Text, "Dollar")); Assert.IsNotNull(account_currency); currencies_select.SelectByText("Dollar"); // add the account var submit_button = ngDriver.FindElement(By.XPath("/html/body//form/button[@type='submit']")); StringAssert.IsMatch("Process", submit_button.Text); submit_button.Click(); try { alert = driver.SwitchTo().Alert(); alert_text = alert.Text; StringAssert.StartsWith("Account created successfully with account Number", alert_text); alert.Accept(); } catch (NoAlertPresentException ex) { // Alert not present verificationErrors.Append(ex.StackTrace); } catch (WebDriverException ex) { // Alert not handled by PhantomJS verificationErrors.Append(ex.StackTrace); } // Confirm account added for customer Assert.IsEmpty(verificationErrors.ToString()); // switch to "Customers" screen ngDriver.FindElement(NgBy.PartialButtonText("Customers")).Click(); // get customers ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); // discover customer NgWebElement ng_customer = ng_customers.First(cust => Regex.IsMatch(cust.Text, "Harry Potter")); Assert.IsNotNull(ng_customer); // extract the account id from the alert message string account_id = alert_text.FindMatch(@"(?<account_id>\d+)$"); Assert.IsNotNullOrEmpty(account_id); // search accounts of specific customer ReadOnlyCollection <NgWebElement> ng_customer_accounts = ng_customer.FindElements(NgBy.Repeater("account in cust.accountNo")); NgWebElement account_matching = ng_customer_accounts.First(acc => String.Equals(acc.Text, account_id)); Assert.IsNotNull(account_matching); ngDriver.Highlight(account_matching, highlight_timeout); }
public void CompleteOffsiteStorage() { /* * Page Title: Manage Off-Site Storage */ // create test data string location1 = "LCRB1"; string street1 = "645 Tyee Road"; string city1 = "Victoria"; string postal1 = "V9A6X5"; string location2 = "LCRB2"; string street2 = "645 Tyee St"; string city2 = "Duncan"; string postal2 = "V9L1W4"; string location3 = "LCRB3"; string street3 = "645 Tyee Road"; string city3 = "Umpqua"; string postal3 = "97486"; string location4 = "LCRB4"; string street4 = "645 Champion Drive"; string city4 = "Vancouver"; string postal4 = "V5H3Z7"; string location5 = "LCRB5"; string street5 = "645 Chief St"; string city5 = "Port Hardy"; string postal5 = "V0N 2P0"; // click on Add Additional Storage button NgWebElement uiOffsiteStorageLocations = ngDriver.FindElement(By.CssSelector("[formcontrolname='offsiteStorageLocations'] button[type='button']")); uiOffsiteStorageLocations.Click(); // enter location 1 NgWebElement uiLocation1 = ngDriver.FindElement(By.CssSelector("[formcontrolname='offsiteStorageLocations'] input[formcontrolname='name']")); uiLocation1.SendKeys(location1); // enter street 1 NgWebElement uiStreet1 = ngDriver.FindElement(By.CssSelector("[formcontrolname='offsiteStorageLocations'] input[formcontrolname='street1']")); uiStreet1.SendKeys(street1); // enter city 1 NgWebElement uiCity1 = ngDriver.FindElement(By.CssSelector("[formcontrolname='offsiteStorageLocations'] input[formcontrolname='city']")); uiCity1.SendKeys(city1); // enter postal code 1 NgWebElement uiPostalCode1 = ngDriver.FindElement(By.CssSelector("[formcontrolname='offsiteStorageLocations'] input[formcontrolname='postalCode']")); uiPostalCode1.SendKeys(postal1); // open second row NgWebElement uiSecondRow = ngDriver.FindElement(By.CssSelector("[formcontrolname='offsiteStorageLocations'] button.btn-secondary")); uiSecondRow.Click(); // enter location 2 NgWebElement uiLocation2 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[5]")); uiLocation2.SendKeys(location2); // enter street 2 NgWebElement uiStreet2 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[6]")); uiStreet2.SendKeys(street2); // enter city 2 NgWebElement uiCity2 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[7]")); uiCity2.SendKeys(city2); // enter postal code 2 NgWebElement uiPostalCode2 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[8]")); uiPostalCode2.SendKeys(postal2); // open third row NgWebElement uiThirdRow = ngDriver.FindElement(By.CssSelector("[formcontrolname='offsiteStorageLocations'] button.btn-secondary")); uiThirdRow.Click(); // enter location 3 NgWebElement uiLocation3 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[9]")); uiLocation3.SendKeys(location3); // enter street 3 NgWebElement uiStreet3 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[10]")); uiStreet3.SendKeys(street3); // enter city 3 NgWebElement uiCity3 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[11]")); uiCity3.SendKeys(city3); // enter postal code 3 NgWebElement uiPostalCode3 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[12]")); uiPostalCode3.SendKeys(postal3); // open fourth row NgWebElement uiFourthRow = ngDriver.FindElement(By.CssSelector("[formcontrolname='offsiteStorageLocations'] button.btn-secondary")); uiFourthRow.Click(); // enter location 4 NgWebElement uiLocation4 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[13]")); uiLocation4.SendKeys(location4); // enter street 4 NgWebElement uiStreet4 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[14]")); uiStreet4.SendKeys(street4); // enter city 4 NgWebElement uiCity4 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[15]")); uiCity4.SendKeys(city4); // enter postal code 4 NgWebElement uiPostalCode4 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[16]")); uiPostalCode4.SendKeys(postal4); // open fifth row NgWebElement uiFifthRow = ngDriver.FindElement(By.CssSelector("[formcontrolname='offsiteStorageLocations'] button.btn-secondary")); uiFifthRow.Click(); // enter location 5 NgWebElement uiLocation5 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[17]")); uiLocation5.SendKeys(location5); // enter street 5 NgWebElement uiStreet5 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[18]")); uiStreet5.SendKeys(street5); // enter city 5 NgWebElement uiCity5 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[19]")); uiCity5.SendKeys(city5); // enter postal code 5 NgWebElement uiPostalCode5 = ngDriver.FindElement(By.XPath("(//input[@type='text'])[20]")); uiPostalCode5.SendKeys(postal5); // click on the signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='agreement']")); uiSignatureAgreement.Click(); }