public void Should_SelectSingle() { wait.Until(ExpectedConditions.ElementExists(By.CssSelector( "body > nav button i.icon-play"))); IWebElement buttonElement = driver.FindElement(By.CssSelector("body > nav button i.icon-play")); Assert.IsNotNull(buttonElement); driver.Highlight(buttonElement); buttonElement.Click(); // // IWebElement frameElement = driver.FindElement(By.CssSelector("iframe[name='plunkerPreviewTarget']")); Assert.IsNotNull(frameElement); iframe = driver.SwitchTo().Frame(frameElement); String headerText = "Single select example"; Thread.Sleep(1500); wait.Until(ExpectedConditions.ElementExists(By.XPath( String.Format("//form/div[contains(text(), '{0}')]", headerText)))); IWebElement header = iframe.FindElement(By.XPath( String.Format("//form/div[contains(text(), '{0}')]", headerText))); Assert.IsNotNull(header); actions.MoveToElement(header).Build().Perform(); driver.Highlight(header); IWebElement selectOne = iframe.FindElement(By.XPath("//ng-select")); Assert.IsNotNull(selectOne); actions.MoveToElement(selectOne).Build().Perform(); driver.Highlight(selectOne); Console.Error.WriteLine("Element contents:\n{0}", selectOne.GetAttribute("innerHTML")); String buttonText = "Select one"; IWebElement selectButtonElement = selectOne.FindElement(By.XPath(String.Format("//div[@class='placeholder'][contains(text(), '{0}')]", buttonText))); Assert.IsNotNull(selectButtonElement); actions.MoveToElement(selectButtonElement).Build().Perform(); driver.Highlight(selectButtonElement); selectButtonElement.Click(); wait.Until(d => (d.FindElements(By.CssSelector("select-dropdown div.options ul li")).Count > 0)); IWebElement dropdownElement = iframe.FindElement(By.CssSelector("select-dropdown div.options")); Assert.IsNotNull(dropdownElement); IWebElement[] optionElements = dropdownElement.FindElements(By.CssSelector("ul li")).ToArray(); Assert.IsTrue(1 <= optionElements.Length); foreach (IWebElement optionElement in optionElements) { actions.MoveToElement(optionElement).Build().Perform(); if (optionElement.Text.Contains("10")) { Console.Error.WriteLine("Selecting option:\"{0}\"", optionElement.Text); driver.Highlight(optionElement); optionElement.Click(); } try { NgWebElement ng_option_element = new NgWebElement(ngDriver, optionElement); Assert.IsNotNull(ng_option_element.WrappedElement); Console.Error.WriteLine("Option angular object:{0}\n", ng_option_element.Evaluate("ng-reflect-ng-outlet-context")); } catch (InvalidOperationException e) { // angular is not defined Console.Error.WriteLine("Ignore exception: " + e.Message); } catch (StaleElementReferenceException) { break; } } IWebElement selectOptions = iframe.FindElement(By.XPath("//ng-select[@formcontrolname='selectSingle']/following-sibling::div")); Assert.IsNotNull(selectOptions); actions.MoveToElement(selectOptions).Build().Perform(); driver.Highlight(selectOptions); String idPattern = @"Selected option id: (?<result>\d{1,2})"; Assert.IsTrue((new Regex(idPattern)).IsMatch(selectOptions.Text)); int result = 0; int.TryParse(selectOptions.Text.FindMatch(idPattern), out result); Assert.AreEqual(10, result); Console.Error.WriteLine("FindMatch result: {0}\n", result.ToString()); }
public void CompleteCateringApplication(string bizType) { /* * Page Title: Catering Licence Application */ // create application info var estName = "Point Ellis Greenhouse"; var estAddress = "645 Tyee Rd"; var estCity = "Victoria"; var estPostal = "V9A 6X5"; var estPID = "012345678"; var estPhone = "2505555555"; var estEmail = "*****@*****.**"; var conGiven = "Given"; var conSurname = "Surname"; var conRole = "CEO"; var conPhone = "2508888888"; var conEmail = "*****@*****.**"; var prevAppDetails = "Here are the previous application details (automated test)."; var liqConnectionDetails = "Here are the liquor industry connection details (automated test)."; var kitchenDetails = "Here are the details of the kitchen equipment."; var 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" || bizType == "military mess" || bizType == "co-op") { // 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 (var 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 var uiEstabAddress = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressStreet']")); uiEstabAddress.SendKeys(estAddress); // enter the establishment city var uiEstabCity = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressCity']")); uiEstabCity.SendKeys(estCity); // enter the establishment postal code var uiEstabPostal = ngDriver.FindElement(By.Id("establishmentAddressPostalCode")); uiEstabPostal.SendKeys(estPostal); // enter the PID var uiEstabPID = ngDriver.FindElement(By.Id("establishmentParcelId")); uiEstabPID.SendKeys(estPID); // enter the store email var uiEstabEmail = ngDriver.FindElement(By.Id("establishmentEmail")); uiEstabEmail.SendKeys(estEmail); // enter the store phone number var 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" || bizType == "military mess" || bizType == "co-op") { NgWebElement uiPreviousLicenceYes = null; for (var i = 0; i < 50; i++) { try { var names = ngDriver.FindElements(By.Id("mat-button-toggle-109-button")); if (names.Count > 0) { uiPreviousLicenceYes = names[0]; break; } } catch (Exception) { } } JavaScriptClick(uiPreviousLicenceYes); } if (bizType == "combined application") { var uiPreviousLicenceYes = ngDriver.FindElement(By.Id("mat-button-toggle-55-button")); JavaScriptClick(uiPreviousLicenceYes); } // enter the previous application details var 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" || bizType == "military mess" || bizType == "co-op") { var uiRuralAgencyStore = ngDriver.FindElement(By.Id("mat-button-toggle-112-button")); JavaScriptClick(uiRuralAgencyStore); } if (bizType == "combined application") { var 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" || bizType == "military mess" || bizType == "co-op") { var uiOtherBusinessYes = ngDriver.FindElement(By.Id("mat-button-toggle-115-button")); JavaScriptClick(uiOtherBusinessYes); } if (bizType == "combined application") { var uiOtherBusinessYes = ngDriver.FindElement(By.Id("mat-button-toggle-61-button")); uiOtherBusinessYes.Click(); } // enter the connection details var uiLiqIndConnection = ngDriver.FindElement(By.Id("liquorIndustryConnectionsDetails")); uiLiqIndConnection.SendKeys(liqConnectionDetails); // enter the kitchen details var uiKitchenDescription = ngDriver.FindElement(By.CssSelector("textarea#description2")); uiKitchenDescription.SendKeys(kitchenDetails); // enter the transport details var uiTransportDetails = ngDriver.FindElement(By.CssSelector("textarea#description3")); uiTransportDetails.SendKeys(transportDetails); if (bizType == "partnership" || bizType == "society" || bizType == "military mess" || bizType == "co-op") { // 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 var uiContactGiven = ngDriver.FindElement(By.Id("contactPersonFirstName")); uiContactGiven.SendKeys(conGiven); // enter the last name of the application contact var uiContactSurname = ngDriver.FindElement(By.Id("contactPersonLastName")); uiContactSurname.SendKeys(conSurname); // enter the role of the application contact var uiContactRole = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonRole']")); uiContactRole.SendKeys(conRole); // enter the phone number of the application contact var uiContactPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonPhone']")); uiContactPhone.SendKeys(conPhone); // enter the email of the application contact var uiContactEmail = ngDriver.FindElement(By.Id("contactPersonEmail")); uiContactEmail.SendKeys(conEmail); // click on the authorized to submit checkbox var uiAuthorizedToSubmit = ngDriver.FindElement(By.Id("authorizedToSubmit")); uiAuthorizedToSubmit.Click(); // click on the signature agreement checkbox var uiSignatureAgreement = ngDriver.FindElement(By.Id("signatureAgreement")); uiSignatureAgreement.Click(); // retrieve the current URL to get the application ID (needed downstream) var URL = ngDriver.Url; // retrieve the application ID var parsedURL = URL.Split('/'); var tempFix = parsedURL[5].Split(';'); applicationID = tempFix[0]; }
public void TempUseAreaApplication() { /* * Page Title: Please Review the Account Profile */ ContinueToApplicationButton(); /* * Page Title: Temporary Use Area Endorsement at a Ski Hill or Golf Course Application */ // create test data string patioCompDescription = "Patio comp description."; string patioAccessControlDescription = "Patio access control description."; string patioLiquorCarriedDescription = "Patio liquor carried description."; string removeIntoxicatedPatrons = "Removal of intoxicated patrons description."; string respectForNeighbours = "Respect for neighbours description."; string areaDescription = "Area description."; string occupantLoad = "180"; // enter patio comp description NgWebElement uiPatioCompDescription = ngDriver.FindElement(By.CssSelector("textarea#patioCompDescription")); uiPatioCompDescription.SendKeys(patioCompDescription); // enter patio access control description NgWebElement uiPatioAccessControlDescription = ngDriver.FindElement(By.CssSelector("textarea#patioAccessControlDescription")); uiPatioAccessControlDescription.SendKeys(patioAccessControlDescription); // enter patio liquor carried description NgWebElement uiPatioLiquorCarriedDescription = ngDriver.FindElement(By.CssSelector("textarea#patioLiquorCarriedDescription")); uiPatioLiquorCarriedDescription.SendKeys(patioLiquorCarriedDescription); // enter removal of intoxicated patrons description NgWebElement uiRemoveIntoxicatedPatrons = ngDriver.FindElement(By.CssSelector("textarea#description1")); uiRemoveIntoxicatedPatrons.SendKeys(removeIntoxicatedPatrons); // enter respect for neighbours NgWebElement uiRespectForNeighbours = ngDriver.FindElement(By.CssSelector("textarea#description2")); uiRespectForNeighbours.SendKeys(respectForNeighbours); // click Fixed option NgWebElement uiFixedOption = ngDriver.FindElement(By.CssSelector("#mat-button-toggle-25-button")); JavaScriptClick(uiFixedOption); // click Portable option NgWebElement uiPortableOption = ngDriver.FindElement(By.CssSelector("#mat-button-toggle-26-button")); uiPortableOption.Click(); // click Interior option NgWebElement uiInteriorOption = ngDriver.FindElement(By.CssSelector("#mat-button-toggle-27-button")); uiInteriorOption.Click(); // select the outside areas button NgWebElement uiOutsideAreas = ngDriver.FindElement(By.CssSelector("[formcontrolname='outsideAreas'] button")); uiOutsideAreas.Click(); // 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); // upload the signage document FileUpload("signage.pdf", "(//input[@type='file'])[2]"); // upload the exterior photos FileUpload("exterior_photos.pdf", "(//input[@type='file'])[5]"); // upload the supporting documents FileUpload("associates.pdf", "(//input[@type='file'])[8]"); // click on the authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='authorizedToSubmit']")); uiAuthorizedToSubmit.Click(); // click on the 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('/'); endorsementID = parsedURL[5]; }
public void ClickOnSubmitButton() { NgWebElement uiSubmitButton = ngDriver.FindElement(By.CssSelector("button.btn-primary")); uiSubmitButton.Click(); }
public void RenewLicence(string responses) { if (responses == "negative responses for Cannabis") { // select 'No' // 1. Have you or any partner, shareholder, director, or officer of this licensee been arrested for, charged with, or convicted of a criminal offence within the past 12 months that you have not reported to the LCRB? NgWebElement uiCriminalOffence = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalCriminalOffenceCheck'] button#mat-button-toggle-10-button")); JavaScriptClick(uiCriminalOffence); // select 'No' // 2. Has there been an unreported sale of the business associated with the licence within the past 12 months? NgWebElement uiUnreportedSale = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalUnreportedSaleOfBusiness'] button#mat-button-toggle-12-button")); JavaScriptClick(uiUnreportedSale); // select 'No' // 3. Our records show that this establishment is licensed as a Private Corporation. Has this changed? NgWebElement uiBusinessType = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalBusinessType'] button#mat-button-toggle-14-button")); JavaScriptClick(uiBusinessType); // select 'No' // 4. Have you, any partner, shareholder, director, officer, or an immediate family member of any of the aforementioned associates acquired a new interest or expanded an existing interest - financial or otherwise - in a federal producer of cannabis within the past 12 months? NgWebElement uiTiedHouse = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalTiedhouse'] button#mat-button-toggle-16-button")); JavaScriptClick(uiTiedHouse); // select 'No' // 5. Has a federal produce of cannabis acquired a new interest or expanded an existing interest - financial or otherwise - in the licensee Private Corporation within the past 12 months? NgWebElement uiTiedHouseFederalInterest = ngDriver.FindElement(By.CssSelector("[formcontrolname='tiedhouseFederalInterest'] button#mat-button-toggle-18-button")); JavaScriptClick(uiTiedHouseFederalInterest); // select 'No' // 6. Have you made any unreported changes to your organizational leadership within the past 12 months? NgWebElement uiOrgLeadership = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalOrgLeadership'] button#mat-button-toggle-20-button")); JavaScriptClick(uiOrgLeadership); // select 'No' // 7. Have you made any unreported changes to your key personnel within the past 12 months? NgWebElement uiKeyPersonnel = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalkeypersonnel'] button#mat-button-toggle-22-button")); JavaScriptClick(uiKeyPersonnel); // select 'No' // 8. Have you made any unreported changes to your share structure within the past 12 months? NgWebElement uiShareholderStructure = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalShareholders'] button#mat-button-toggle-24-button")); JavaScriptClick(uiShareholderStructure); // select 'No' // 9. Do you have an outstanding payable fine under the Offence Act or outstanding payable monetary penalty under the Cannabis Control and Licensing Act that has not yet been paid? NgWebElement uiOutstandingFine = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalOutstandingFines'] button#mat-button-toggle-26-button")); JavaScriptClick(uiOutstandingFine); // select 'No' // 10. Have you made an unreported change to your store’s name in the past 12 months? NgWebElement uiBrandingChange = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalBranding'] button#mat-button-toggle-34-button")); JavaScriptClick(uiBrandingChange); // select 'No' // 11. Have you updated the store’s signage or branding in the past 12 months? NgWebElement uiSignageChange = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalSignage'] button#mat-button-toggle-36-button")); JavaScriptClick(uiSignageChange); // select 'No' // 12. Have you made an unreported change of location of your establishment within the past 12 months? (This includes any changes to the Parcel Identification Number where your establishment is located, even if the physical location has not changed). NgWebElement uiEstablishmentAddress = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalEstablishmentAddress'] button#mat-button-toggle-38-button")); JavaScriptClick(uiEstablishmentAddress); // select 'No' // 13. Have you sold the property or transferred the lease associated with this cannabis retail store licence within the past 12 months? NgWebElement uiValidInterest = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalValidInterest'] button#mat-button-toggle-40-button")); JavaScriptClick(uiValidInterest); // select 'No' // 14. Are you aware of any local government or Indigenous nation zoning changes with respect to your establishment location? NgWebElement uiZoning = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalZoning'] button#mat-button-toggle-42-button")); JavaScriptClick(uiZoning); // select 'No' // 15. Have you made any unreported changes to the store’s floor plan within the past 12 months? NgWebElement uiFloorPlan = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalFloorPlan'] button#mat-button-toggle-44-button")); JavaScriptClick(uiFloorPlan); } if (responses == "positive responses for Cannabis") { // select 'Yes' // 1. Have you or any partner, shareholder, director, or officer of this licensee been arrested for, charged with, or convicted of a criminal offence within the past 12 months that you have not reported to the LCRB? NgWebElement uiCriminalOffence = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalCriminalOffenceCheck'] button#mat-button-toggle-9-button")); JavaScriptClick(uiCriminalOffence); // select 'Yes' // 2. Has there been an unreported sale of the business associated with the licence within the past 12 months? NgWebElement uiUnreportedSale = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalUnreportedSaleOfBusiness'] button#mat-button-toggle-11-button")); JavaScriptClick(uiUnreportedSale); // select 'Yes' // 3. Our records show that this establishment is licensed as a Private Corporation. Has this changed? NgWebElement uiBusinessType = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalBusinessType'] button#mat-button-toggle-13-button")); JavaScriptClick(uiBusinessType); // select 'Yes' // 4. Have you, any partner, shareholder, director, officer, or an immediate family member of any of the aforementioned associates acquired a new interest or expanded an existing interest - financial or otherwise - in a federal producer of cannabis within the past 12 months? NgWebElement uiTiedHouse = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalTiedhouse'] button#mat-button-toggle-15-button")); JavaScriptClick(uiTiedHouse); // select 'Yes' // 5. Has a federal produce of cannabis acquired a new interest or expanded an existing interest - financial or otherwise - in the licensee Private Corporation within the past 12 months? NgWebElement uiTiedHouseFederalInterest = ngDriver.FindElement(By.CssSelector("[formcontrolname='tiedhouseFederalInterest'] button#mat-button-toggle-17-button")); JavaScriptClick(uiTiedHouseFederalInterest); // select 'Yes' // 6. Have you made any unreported changes to your organizational leadership within the past 12 months? NgWebElement uiOrgLeadership = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalOrgLeadership'] button#mat-button-toggle-19-button")); JavaScriptClick(uiOrgLeadership); // select 'Yes' // 7. Have you made any unreported changes to your key personnel within the past 12 months? NgWebElement uiKeyPersonnel = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalkeypersonnel'] button#mat-button-toggle-21-button")); JavaScriptClick(uiKeyPersonnel); // select 'Yes' // 8. Have you made any unreported changes to your share structure within the past 12 months? NgWebElement uiShareholderStructure = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalShareholders'] button#mat-button-toggle-23-button")); JavaScriptClick(uiShareholderStructure); // select 'Yes' // 9. Do you have an outstanding payable fine under the Offence Act or outstanding payable monetary penalty under the Cannabis Control and Licensing Act that has not yet been paid? NgWebElement uiOutstandingFine = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalOutstandingFines'] button#mat-button-toggle-25-button")); JavaScriptClick(uiOutstandingFine); // select 'Yes' // 10. Have you made an unreported change to your store’s name in the past 12 months? NgWebElement uiBrandingChange = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalBranding'] button#mat-button-toggle-33-button")); JavaScriptClick(uiBrandingChange); // select 'Yes' // 11. Have you updated the store’s signage or branding in the past 12 months? NgWebElement uiSignageChange = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalSignage'] button#mat-button-toggle-35-button")); JavaScriptClick(uiSignageChange); // select 'Yes' // 12. Have you made an unreported change of location of your establishment within the past 12 months? (This includes any changes to the Parcel Identification Number where your establishment is located, even if the physical location has not changed). NgWebElement uiEstablishmentAddress = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalEstablishmentAddress'] button#mat-button-toggle-37-button")); JavaScriptClick(uiEstablishmentAddress); // select 'Yes' // 13. Have you sold the property or transferred the lease associated with this cannabis retail store licence within the past 12 months? NgWebElement uiValidInterest = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalValidInterest'] button#mat-button-toggle-39-button")); JavaScriptClick(uiValidInterest); // select 'Yes' // 14. Are you aware of any local government or Indigenous nation zoning changes with respect to your establishment location? NgWebElement uiZoning = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalZoning'] button#mat-button-toggle-41-button")); JavaScriptClick(uiZoning); // select 'Yes' // 15. Have you made any unreported changes to the store’s floor plan within the past 12 months? NgWebElement uiFloorPlan = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalFloorPlan'] button#mat-button-toggle-43-button")); JavaScriptClick(uiFloorPlan); // confirm that correct information re positive responses for a Cannabis licensing renewal is displayed Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'You can still renew your licence. Please contact us as soon as possible to transfer this licence to its new owner. ')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'You can still renew your licence. Please contact us to update this information. ')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,' You can still renew your licence. After submitting your renewal, you can update your federal producer information on the Account Profile page on the Dashboard. A member of LCRB may contact you to determine any additional next steps. ')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,' You can still renew your licence. Please contact us to to pay your fines. ')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,' You can still renew your licence. After submitting your renewal, please start a Establishment Name or Branding Change application from the Dashboard. ')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'You can still renew your licence. After submitting your renewal, please start a Relocation Request application from the Dashboard. ')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'A LCRB Licensing Staff member may contact you as part of this renewal process ')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,' You can still renew your licence. After submitting your renewal, please start a Structural Change Request application from the Dashboard. ')]")).Displayed); } if (responses == "negative responses for Catering") { // select 'No' // 1.Have you or any partner, shareholder, director, or officer of this licensee been arrested for, charged with, or convicted of a criminal offence within the past 12 months that you have not reported to the LCRB ? NgWebElement uiCriminalOffence = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalCriminalOffenceCheck'] button#mat-button-toggle-11-button")); JavaScriptClick(uiCriminalOffence); // select 'No' // 2. Have you or any of your partners, shareholders or directors of this establishment received any alcohol related driving infractions in the past 12 months? NgWebElement uiAlcoholInfraction = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalDUI'] button#mat-button-toggle-13-button")); JavaScriptClick(uiAlcoholInfraction); // select 'No' // 3. Our records show that this establishment is licensed as a PrivateCorporation. Has this changed? NgWebElement uiBusinessType = ngDriver.FindElement(By.CssSelector("[formcontrolname = 'renewalBusinessType'] button#mat-button-toggle-15-button")); JavaScriptClick(uiBusinessType); // select 'No' // 4. Have you redistributed any shares within the past 12 months without notifying LCRB? NgWebElement uiRenewalShareholders = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalShareholders'] button#mat-button-toggle-17-button")); JavaScriptClick(uiRenewalShareholders); // select 'No' // 5. Have you entered into an agreement allowing another person or business to use your licence within the past 12 months? NgWebElement uiRenewalThirdParty = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalThirdParty'] button#mat-button-toggle-19-button")); JavaScriptClick(uiRenewalThirdParty); // select 'No' // 6. Have you made any unreported structural changes to your establishment within the past 12 months? NgWebElement uiRenewalFloorPlan = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalFloorPlan'] button#mat-button-toggle-21-button")); JavaScriptClick(uiRenewalFloorPlan); // select 'No' // 7. Have you acquired a new interest or expanded an existing interest financial or otherwise in a winery, brewery, distillery, liquor agent and/or a UBrew/UVin within the past 12 months without notifying LCRB? NgWebElement uiRenewalTiedhouse = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalTiedhouse'] button#mat-button-toggle-23-button")); JavaScriptClick(uiRenewalTiedhouse); // select 'No' // 8. Have you sold the business associated with this liquor licence within the last 12 months without notifying LCRB? NgWebElement uiRenewalUnreportedSaleOfBusiness = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalUnreportedSaleOfBusiness'] button#mat-button-toggle-25-button")); JavaScriptClick(uiRenewalUnreportedSaleOfBusiness); // select 'No' // 9.Have you sold the property or transferred the lease associated with this liquor licence within the last 12 months? NgWebElement uiRenewalValidInterest = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalValidInterest'] button#mat-button-toggle-27-button")); JavaScriptClick(uiRenewalValidInterest); // select 'No' // 10. Have you added, changed or removed a licensee representative within the past 12 months? NgWebElement uiRenewalKeyPersonnel = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalkeypersonnel'] button#mat-button-toggle-29-button")); JavaScriptClick(uiRenewalKeyPersonnel); } if (responses == "positive responses for Catering") { // select 'Yes' // 1.Have you or any partner, shareholder, director, or officer of this licensee been arrested for, charged with, or convicted of a criminal offence within the past 12 months that you have not reported to the LCRB ? NgWebElement uiCriminalOffence = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalCriminalOffenceCheck'] button#mat-button-toggle-10-button")); JavaScriptClick(uiCriminalOffence); // select 'Yes' // 2. Have you or any of your partners, shareholders or directors of this establishment received any alcohol related driving infractions in the past 12 months? NgWebElement uiAlcoholInfraction = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalDUI'] button#mat-button-toggle-12-button")); JavaScriptClick(uiAlcoholInfraction); // select 'Yes' // 3. Our records show that this establishment is licensed as a PrivateCorporation. Has this changed? NgWebElement uiBusinessType = ngDriver.FindElement(By.CssSelector("[formcontrolname = 'renewalBusinessType'] button#mat-button-toggle-14-button")); JavaScriptClick(uiBusinessType); // select 'Yes' // 4. Have you redistributed any shares within the past 12 months without notifying LCRB? NgWebElement uiRenewalShareholders = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalShareholders'] button#mat-button-toggle-16-button")); JavaScriptClick(uiRenewalShareholders); // select 'Yes' // 5. Have you entered into an agreement allowing another person or business to use your licence within the past 12 months? NgWebElement uiRenewalThirdParty = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalThirdParty'] button#mat-button-toggle-18-button")); JavaScriptClick(uiRenewalThirdParty); // select 'Yes' // 6. Have you made any unreported structural changes to your establishment within the past 12 months? NgWebElement uiRenewalFloorPlan = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalFloorPlan'] button#mat-button-toggle-20-button")); JavaScriptClick(uiRenewalFloorPlan); // select 'Yes' // 7. Have you acquired a new interest or expanded an existing interest financial or otherwise in a winery, brewery, distillery, liquor agent and/or a UBrew/UVin within the past 12 months without notifying LCRB? NgWebElement uiRenewalTiedhouse = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalTiedhouse'] button#mat-button-toggle-22-button")); JavaScriptClick(uiRenewalTiedhouse); // select 'Yes' // 8. Have you sold the business associated with this liquor licence within the last 12 months without notifying LCRB? NgWebElement uiRenewalUnreportedSaleOfBusiness = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalUnreportedSaleOfBusiness'] button#mat-button-toggle-24-button")); JavaScriptClick(uiRenewalUnreportedSaleOfBusiness); // select 'Yes' // 9.Have you sold the property or transferred the lease associated with this liquor licence within the last 12 months? NgWebElement uiRenewalValidInterest = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalValidInterest'] button#mat-button-toggle-26-button")); JavaScriptClick(uiRenewalValidInterest); // select 'Yes' // 10. Have you added, changed or removed a licensee representative within the past 12 months? NgWebElement uiRenewalKeyPersonnel = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalkeypersonnel'] button#mat-button-toggle-28-button")); JavaScriptClick(uiRenewalKeyPersonnel); // confirm that correct information re positive responses for a Catering licensing renewal is displayed Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Update your Shareholder Information on the Organization Details page')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Submit a Third Party Operator application from the Licences Dashboard')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Submit a Structural Change from the Licences Dashboard')]")).Displayed); //Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Update your Financial Interest information on the Account Profile')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Transfer this Licence from the Licences Dashboard')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Add, Remove or Update your Licensee Representative from the Licences Dashboard')]")).Displayed); } if ((responses == "positive responses for a brewery") || (responses == "negative responses for a brewery")) { string volumeProduced = "5000"; // enter the volume produced NgWebElement uiVolumeProduced = ngDriver.FindElement(By.CssSelector("input[formcontrolname='volumeProduced']")); uiVolumeProduced.SendKeys(volumeProduced); } if ((responses == "positive responses for a winery") || (responses == "negative responses for a winery")) { string volumeProduced = "5000"; string volumeDestroyed = "200"; // click on manufacturer minimum checkbox NgWebElement uiIsManufacturedMinimum = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='isManufacturedMinimum']")); JavaScriptClick(uiIsManufacturedMinimum); // upload the discretion letter FileUpload("discretion_letter.pdf", "(//input[@type='file'])[3]"); // enter the volume produced NgWebElement uiVolumeProduced = ngDriver.FindElement(By.CssSelector("input[formcontrolname='volumeProduced']")); uiVolumeProduced.SendKeys(volumeProduced); // enter the volume destroyed NgWebElement uiVolumeDestroyed = ngDriver.FindElement(By.CssSelector("input[formcontrolname='volumeDestroyed']")); uiVolumeDestroyed.SendKeys(volumeDestroyed); } if ((responses == "positive responses for a brewery") || (responses == "positive responses for a winery") || (responses == "positive responses for a distillery") || (responses == "positive responses for a co-packer")) { // select 'Yes' // 1. Have you or any partner, shareholder, director, or officer of this licensee been arrested for, charged with, or convicted of a criminal offence within the past 12 months that you have not reported to the LCRB? NgWebElement uiRenewalCriminalOffenceCheckYes = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalCriminalOffenceCheck'] button#mat-button-toggle-10-button")); JavaScriptClick(uiRenewalCriminalOffenceCheckYes); // select 'Yes' // 2. Have you or any of your partners, shareholders or directors of this establishment received any alcohol related driving infractions in the past 12 months? NgWebElement uiRenewalDUIYes = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalDUI'] button#mat-button-toggle-12-button")); JavaScriptClick(uiRenewalDUIYes); // select 'Yes' // 3. Our records show that this establishment is licensed as a PrivateCorporation. Has this changed? NgWebElement uiRenewalBusinessTypeYes = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalBusinessType'] button#mat-button-toggle-14-button")); JavaScriptClick(uiRenewalBusinessTypeYes); // select 'Yes' // 4. Have you redistributed any shares within the past 12 months without notifying LCRB? NgWebElement uiRenewalShareholdersYes = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalShareholders'] button#mat-button-toggle-16-button")); JavaScriptClick(uiRenewalShareholdersYes); // select 'Yes' // 5. Have you entered into an agreement allowing another person or business to use your licence within the past 12 months? NgWebElement uiRenewalThirdPartyYes = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalThirdParty'] button#mat-button-toggle-18-button")); JavaScriptClick(uiRenewalThirdPartyYes); // select 'Yes' // 6. Have you made any unreported structural changes to your establishment within the past 12 months? NgWebElement uiRenewalFloorPlanYes = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalFloorPlan'] button#mat-button-toggle-20-button")); JavaScriptClick(uiRenewalFloorPlanYes); // select 'Yes' // 7. Have you acquired a new interest or expanded an existing interest financial or otherwise in a winery, brewery, distillery, liquor agent and/or a UBrew/UVin within the past 12 months without notifying LCRB? NgWebElement uiRenewalTiedhouseYes = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalTiedhouse'] button#mat-button-toggle-22-button")); JavaScriptClick(uiRenewalTiedhouseYes); // select 'Yes' // 8. Have you sold the business associated with this liquor licence within the last 12 months without notifying LCRB? NgWebElement uiRenewalUnreportedSaleOfBusinessYes = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalUnreportedSaleOfBusiness'] button#mat-button-toggle-24-button")); JavaScriptClick(uiRenewalUnreportedSaleOfBusinessYes); // select 'Yes' // 9.Have you sold the property or transferred the lease associated with this liquor licence within the last 12 months? NgWebElement uiRenewalValidInterestYes = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalValidInterest'] button#mat-button-toggle-26-button")); JavaScriptClick(uiRenewalValidInterestYes); // select 'Yes' // 10. Have you added, changed or removed a licensee representative within the past 12 months? NgWebElement uiRenewalKeyPersonnelYes = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalkeypersonnel'] button#mat-button-toggle-28-button")); JavaScriptClick(uiRenewalKeyPersonnelYes); // confirm that correct information re positive responses for a Catering licensing renewal is displayed Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Update your Shareholder Information on the Organization Details page')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Submit a Third Party Operator application from the Licences Dashboard')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Submit a Structural Change from the Licences Dashboard')]")).Displayed); //Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Update your Financial Interest information on the Account Profile')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Transfer this Licence from the Licences Dashboard')]")).Displayed); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Add, Remove or Update your Licensee Representative from the Licences Dashboard')]")).Displayed); } if ((responses == "negative responses for a brewery") || (responses == "negative responses for a winery") || (responses == "negative responses for a distillery") || (responses == "negative responses for a co-packer")) { // select 'No' // 1. Have you or any partner, shareholder, director, or officer of this licensee been arrested for, charged with, or convicted of a criminal offence within the past 12 months that you have not reported to the LCRB? NgWebElement uiRenewalCriminalOffenceCheckNo = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalCriminalOffenceCheck'] button#mat-button-toggle-11-button")); JavaScriptClick(uiRenewalCriminalOffenceCheckNo); // select 'No' // 2. Have you or any of your partners, shareholders or directors of this establishment received any alcohol related driving infractions in the past 12 months? NgWebElement uiRenewalDUINo = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalDUI'] button#mat-button-toggle-13-button")); JavaScriptClick(uiRenewalDUINo); // select 'No' // 3. Our records show that this establishment is licensed as a PrivateCorporation. Has this changed? NgWebElement uiRenewalBusinessTypeNo = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalBusinessType'] button#mat-button-toggle-15-button")); JavaScriptClick(uiRenewalBusinessTypeNo); // select 'No' // 4. Have you redistributed any shares within the past 12 months without notifying LCRB? NgWebElement uiRenewalShareholdersNo = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalShareholders'] button#mat-button-toggle-17-button")); JavaScriptClick(uiRenewalShareholdersNo); // select 'No' // 5. Have you entered into an agreement allowing another person or business to use your licence within the past 12 months? NgWebElement uiRenewalThirdPartyNo = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalThirdParty'] button#mat-button-toggle-19-button")); JavaScriptClick(uiRenewalThirdPartyNo); // select 'No' // 6. Have you made any unreported structural changes to your establishment within the past 12 months? NgWebElement uiRenewalFloorPlanNo = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalFloorPlan'] button#mat-button-toggle-21-button")); JavaScriptClick(uiRenewalFloorPlanNo); // select 'No' // 7. Have you acquired a new interest or expanded an existing interest financial or otherwise in a winery, brewery, distillery, liquor agent and/or a UBrew/UVin within the past 12 months without notifying LCRB? NgWebElement uiRenewalTiedhouseNo = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalTiedhouse'] button#mat-button-toggle-23-button")); JavaScriptClick(uiRenewalTiedhouseNo); // select 'No' // 8. Have you sold the business associated with this liquor licence within the last 12 months without notifying LCRB? NgWebElement uiRenewalUnreportedSaleOfBusinessNo = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalUnreportedSaleOfBusiness'] button#mat-button-toggle-25-button")); JavaScriptClick(uiRenewalUnreportedSaleOfBusinessNo); // select 'No' // 9.Have you sold the property or transferred the lease associated with this liquor licence within the last 12 months? NgWebElement uiRenewalValidInterestNo = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalValidInterest'] button#mat-button-toggle-27-button")); JavaScriptClick(uiRenewalValidInterestNo); // select 'No' // 10. Have you added, changed or removed a licensee representative within the past 12 months? NgWebElement uiRenewalKeyPersonnelNo = ngDriver.FindElement(By.CssSelector("[formcontrolname='renewalkeypersonnel'] button#mat-button-toggle-29-button")); JavaScriptClick(uiRenewalKeyPersonnelNo); } // temporary fix System.Threading.Thread.Sleep(5000); // select the authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='authorizedToSubmit']")); uiAuthorizedToSubmit.Click(); // select the signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='signatureAgreement']")); uiSignatureAgreement.Click(); // click on the Submit & Pay button NgWebElement uiSubmitAndPay = ngDriver.FindElement(By.CssSelector("button.mat-primary")); uiSubmitAndPay.Click(); MakePayment(); ClickLicencesTab(); // reload Licences page as needed for (int i = 0; i < 5; i++) { try { if ((ngDriver.FindElement(By.XPath("//body[contains(.,'Active')]")).Displayed == false)) { ngDriver.Navigate().Refresh(); System.Threading.Thread.Sleep(2000); } else { break; } } catch (Exception) { } } }
public void CompleteCateringApplication() { /* * 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."; // enter the establishment name NgWebElement uiEstabName = null; // try up to 10 times to get an element. 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? 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); // enter the kitchen details NgWebElement uiKitchenDescription = ngDriver.FindElement(By.CssSelector("textarea#Description2")); uiKitchenDescription.SendKeys(kitchenDetails); // 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 ReviewAccountProfile(string businessType) { /* * Page Title: Please Review the Account Profile */ // used for OneStop testing // string bizNumber = "977517895"; // used for release testing string bizNumber = "111111111"; string incorporationNumber = "BC1234567"; string physStreetAddress1 = "645 Tyee Road"; string physStreetAddress2 = "West"; string physCity = "Victoria"; string physPostalCode = "V9A 6X5"; string mailStreet1 = "#22"; string mailStreet2 = "700 Bellevue Way NE"; string mailCity = "Bellevue"; string mailPostalCode = "T2E 8A2"; string bizPhoneNumber = "2501811818"; string bizEmail = "*****@*****.**"; string corpGiven = "Automated"; string corpSurname = "Testing"; string corpTitle = "CEO"; string corpContactPhone = "7781811818"; string corpContactEmail = "*****@*****.**"; // enter the business number NgWebElement uiBizNumber = null; for (int i = 0; i < 50; i++) { try { var numbers = ngDriver.FindElements(By.CssSelector("input[formControlName='businessNumber']")); if (numbers.Count > 0) { uiBizNumber = numbers[0]; break; } } catch (Exception) { } } uiBizNumber.SendKeys(bizNumber); // enter the private/public corporation or society incorporation number if (businessType == " private corporation" || businessType == " society" || businessType == " public corporation") { // enter incorporation number NgWebElement uiCorpNumber = ngDriver.FindElement(By.CssSelector("input[formcontrolname='bcIncorporationNumber']")); uiCorpNumber.SendKeys(incorporationNumber); // select date of incorporation (= today) NgWebElement uiCalendar1 = ngDriver.FindElement(By.CssSelector("input[formcontrolname='dateOfIncorporationInBC']")); JavaScriptClick(uiCalendar1); NgWebElement uiCalendar2 = ngDriver.FindElement(By.CssSelector(".mat-calendar-body-cell-content.mat-calendar-body-today")); JavaScriptClick(uiCalendar2); } // enter the physical street address 1 NgWebElement uiPhysStreetAddress1 = ngDriver.FindElement(By.CssSelector("input[formControlName='physicalAddressStreet']")); uiPhysStreetAddress1.SendKeys(physStreetAddress1); // enter the physical street address 2 NgWebElement uiPhysStreetAddress2 = ngDriver.FindElement(By.CssSelector("input[formControlName='physicalAddressStreet2']")); uiPhysStreetAddress2.SendKeys(physStreetAddress2); // enter the physical city NgWebElement uiPhysCity = ngDriver.FindElement(By.CssSelector("input[formControlName='physicalAddressCity']")); uiPhysCity.SendKeys(physCity); // select non default province NgWebElement uiNonDefaultProvince = ngDriver.FindElement(By.CssSelector("select[formcontrolname='physicalAddressProvince'] option[value='Alberta']")); uiNonDefaultProvince.Click(); // select default province NgWebElement uiDefaultProvince = ngDriver.FindElement(By.CssSelector("select[formcontrolname='physicalAddressProvince'] option[value='British Columbia']")); uiDefaultProvince.Click(); // enter the physical postal code NgWebElement uiPhysPostalCode = ngDriver.FindElement(By.CssSelector("input[formControlName='physicalAddressPostalCode']")); uiPhysPostalCode.SendKeys(physPostalCode); // enter the mailing street address 1 NgWebElement uiMailingStreetAddress1 = ngDriver.FindElement(By.CssSelector("input[formControlName='mailingAddressStreet']")); uiMailingStreetAddress1.Clear(); uiMailingStreetAddress1.SendKeys(mailStreet1); // enter the mailing street address 2 NgWebElement uiMailingStreetAddress2 = ngDriver.FindElement(By.CssSelector("input[formControlName='mailingAddressStreet2']")); uiMailingStreetAddress2.Clear(); uiMailingStreetAddress2.SendKeys(mailStreet2); // enter the mailing city NgWebElement uiMailingCity = ngDriver.FindElement(By.CssSelector("input[formControlName='mailingAddressCity']")); uiMailingCity.Clear(); uiMailingCity.SendKeys(mailCity); // select non default province NgWebElement uiNonDefaultProvince2 = ngDriver.FindElement(By.CssSelector("select[formcontrolname='mailingAddressProvince'] option[value='Alberta']")); uiNonDefaultProvince2.Click(); // enter the mailing postal code NgWebElement uiMailingPostalCode = ngDriver.FindElement(By.CssSelector("input[formControlName='mailingAddressPostalCode']")); uiMailingPostalCode.Clear(); uiMailingPostalCode.SendKeys(mailPostalCode); // enter the business phone number NgWebElement uiBizPhoneNumber = ngDriver.FindElement(By.CssSelector("input[formControlName='contactPhone']")); uiBizPhoneNumber.SendKeys(bizPhoneNumber); // enter the business email NgWebElement uiBizEmail = ngDriver.FindElement(By.CssSelector("input[formControlName='contactEmail']")); uiBizEmail.SendKeys(bizEmail); if ((businessType == "n indigenous nation") || (businessType == " local government")) { string liquorPolicyLink = "https://www.liquorpolicy.org"; // enter the liquor policy information link NgWebElement uiLiquorPolicyLink = ngDriver.FindElement(By.CssSelector("input[formcontrolname='websiteUrl']")); uiLiquorPolicyLink.SendKeys(liquorPolicyLink); } // enter the contact given name NgWebElement uiFirstName = ngDriver.FindElement(By.CssSelector("input[formcontrolname='firstname']")); uiFirstName.SendKeys(corpGiven); // enter the contact surname NgWebElement uiLastName = ngDriver.FindElement(By.CssSelector("input[formcontrolname='lastname']")); uiLastName.SendKeys(corpSurname); // enter the contact title NgWebElement uiCorpTitle = ngDriver.FindElement(By.CssSelector("input[formControlName='jobTitle']")); uiCorpTitle.SendKeys(corpTitle); // enter the contact phone number NgWebElement uiCorpContactPhone = ngDriver.FindElement(By.CssSelector("input[formControlName='telephone1']")); uiCorpContactPhone.SendKeys(corpContactPhone); // enter the contact email NgWebElement uiCorpContactEmail = ngDriver.FindElement(By.CssSelector("input[formcontrolname='emailaddress1']")); uiCorpContactEmail.SendKeys(corpContactEmail); if ((businessType == "n indigenous nation") || (businessType == " local government")) { // select 'Yes' for connection to a federal producer NgWebElement uiINConnectionFederalProducer = ngDriver.FindElement(By.CssSelector("input[formcontrolname='iNConnectionToFederalProducer']")); uiINConnectionFederalProducer.Click(); // enter the name of the federal producer and details of the connection string INnameAndDetails = "Name and details of federal producer (automated test) for IN/local government."; NgWebElement uiINDetailsFederalProducer = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='iNConnectionToFederalProducerDetails']")); uiINDetailsFederalProducer.SendKeys(INnameAndDetails); } if ((businessType == " private corporation") || (businessType == " sole proprietorship") || (businessType == " university")) { // select 'Yes' for corporation connection to federal producer NgWebElement uiCorpConnectionFederalProducer = ngDriver.FindElement(By.CssSelector("input[formcontrolname='corpConnectionFederalProducer']")); uiCorpConnectionFederalProducer.Click(); // enter the name of the federal producer and details of the connection string nameAndDetails = "The name of the federal producer and details of the connection."; NgWebElement uiDetailsFederalProducer2 = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='corpConnectionFederalProducerDetails']")); uiDetailsFederalProducer2.SendKeys(nameAndDetails); // select 'Yes' for federal producer connection to corporation NgWebElement uiCorpConnectionFederalProducer2 = ngDriver.FindElement(By.CssSelector("input[formcontrolname='federalProducerConnectionToCorp']")); uiCorpConnectionFederalProducer2.Click(); // enter the name of the federal producer and details of the connection string nameAndDetails2 = "Name and details of federal producer connection to corporation."; NgWebElement uiDetailsFederalProducer3 = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='federalProducerConnectionToCorpDetails']")); uiDetailsFederalProducer3.SendKeys(nameAndDetails2); } if ((businessType == " partnership")) { // select 'Yes' for partnership connection to federal producer NgWebElement uiPartnerConnectionFederalProducer = ngDriver.FindElement(By.CssSelector("input[formcontrolname='partnersConnectionFederalProducer']")); uiPartnerConnectionFederalProducer.Click(); // enter the name of the federal producer and details of the connection string nameAndDetails = "The name of the federal producer and details of the connection (partnership)."; NgWebElement uiDetailsFederalProducer2 = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='partnersConnectionFederalProducerDetails']")); uiDetailsFederalProducer2.SendKeys(nameAndDetails); // select 'Yes' for federal producer connection to corporation NgWebElement uiCorpConnectionFederalProducer2 = ngDriver.FindElement(By.CssSelector("input[formcontrolname='federalProducerConnectionToCorp']")); uiCorpConnectionFederalProducer2.Click(); // enter the name of the federal producer and details of the connection string nameAndDetails2 = "Name and details of federal producer connection to corporation."; NgWebElement uiDetailsFederalProducer3 = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='federalProducerConnectionToCorpDetails']")); uiDetailsFederalProducer3.SendKeys(nameAndDetails2); } if (businessType == " public corporation") { // select 'Yes' for 'Does the corporation have any association, connection or financial interest in a federally licensed producer of cannabis?' NgWebElement uiCorpConnectionFederalProducer = ngDriver.FindElement(By.CssSelector("input[formcontrolname='corpConnectionFederalProducer']")); uiCorpConnectionFederalProducer.Click(); // enter the name of the federal producer and details of the connection string nameAndDetails = "The name of the federal producer and details of the connection."; NgWebElement uiDetailsFederalProducer2 = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='corpConnectionFederalProducerDetails']")); uiDetailsFederalProducer2.SendKeys(nameAndDetails); // select 'Yes' for 'Does a federally licensed producer of cannabis have any association, connection or financial interest in the corporation?' NgWebElement uiShareholderConnectionConnectionToCorp = ngDriver.FindElement(By.CssSelector("input[formcontrolname='federalProducerConnectionToCorp']")); uiShareholderConnectionConnectionToCorp.Click(); string shareholderDetails = "Details of shareholder relationship."; NgWebElement uiShareholderDetails = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='federalProducerConnectionToCorpDetails']")); uiShareholderDetails.SendKeys(shareholderDetails); // select 'Yes' for 'Do you or any of your shareholders have any amount of ownership interest in another B.C. liquor licence, or any association with a third party operator for another liquor licence, or have an immediate family member (spouse, parent, sibling or child) with any amount of ownership interest in another liquor licence?' NgWebElement uiFamilyConnectionConnectionToCorp = ngDriver.FindElement(By.CssSelector("input[formcontrolname='liquorFinancialInterest']")); uiFamilyConnectionConnectionToCorp.Click(); // enter details of family connection string familyRelationship = "Details of family relationship (automated test)."; NgWebElement uiFamilyConnectionDetails = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='liquorFinancialInterestDetails']")); uiFamilyConnectionDetails.SendKeys(familyRelationship); } if (businessType == " society") { // select 'Yes' for society connection to federal producer NgWebElement uiSocietyConnectionFederalProducer = ngDriver.FindElement(By.CssSelector("input[formcontrolname='societyConnectionFederalProducer']")); uiSocietyConnectionFederalProducer.Click(); // enter details of society connection string societyDetails = "Details of society/federal producer relationship."; NgWebElement uiSocietyConnectionDetails = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='societyConnectionFederalProducerDetails']")); uiSocietyConnectionDetails.SendKeys(societyDetails); } // click on the liquor financial interest radio button NgWebElement uiLiquorFinInterestRadio = ngDriver.FindElement(By.XPath("//app-connection-to-producers/div[2]/section/input[1]")); uiLiquorFinInterestRadio.Click(); // enter the details of the financial interest string finDetails = "Details of the financial interest (automated test)."; NgWebElement uiLiquorFinInterestTextArea = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname = 'liquorFinancialInterestDetails']")); uiLiquorFinInterestTextArea.SendKeys(finDetails); // click on Continue to Organization Review button NgWebElement uiContinueAppButton = ngDriver.FindElement(By.Id("continueToApp")); uiContinueAppButton.Click(); }
public void ShouldHandleSearchAngularUISelect() { GetPageContent("ng_ui_select_example1.htm"); String searchText = "Ma"; IWebElement search = ngDriver.FindElement(By.CssSelector("input[type='search']")); search.SendKeys(searchText); NgWebElement ng_search = new NgWebElement(ngDriver, search); StringAssert.IsMatch(@"input", ng_search.TagName); // triggers ngDriver.waitForAngular(); ReadOnlyCollection<IWebElement> available_colors = ngDriver.WrappedDriver.FindElements(By.CssSelector("div[role='option']")); var matching_colors = available_colors.Where(color => color.Text.Contains(searchText)); foreach (IWebElement matching_color in matching_colors) { ngDriver.Highlight(matching_color); Console.Error.WriteLine(String.Format("Matched color: {0}", matching_color.Text)); } }
public void PermanentChangeLicensee(string appType) { /* * Page Title: Permanent Change to a Licensee */ // create test data string firstName = "Firstname"; string lastName = "Lastname"; string newFirstName = "Newfirstname"; string newLastName = "Newlastname"; string societyName = "Societyname"; string newSocietyName = "Newsocietyname"; string partnershipName = "Partnershipname"; string newPartnershipName = "Newpartnershipname"; string companyName = "Companyname"; string newCompanyName = "Newcompanyname"; string executorFirstName = "Executorfirstname"; string executorLastName = "Executorlastname"; string receiverFirstName = "Receiverfirstname"; string receiverLastName = "Receiverlastname"; switch (appType) { case "society": /* * TYPES OF CHANGES REQUESTED */ // click on Change of Directors or Officers NgWebElement uiChangeOfDirectorsOrOfficers = ngDriver.FindElement(By.CssSelector("#mat-checkbox-3.mat-checkbox")); uiChangeOfDirectorsOrOfficers.Click(); // click on Name Change, Licensee -- Society NgWebElement uiNameChangeLicenseeSociety = ngDriver.FindElement(By.CssSelector("#mat-checkbox-4.mat-checkbox")); uiNameChangeLicenseeSociety.Click(); // click on Name Change, Person NgWebElement uiNameChangePerson = ngDriver.FindElement(By.CssSelector("#mat-checkbox-5.mat-checkbox")); uiNameChangePerson.Click(); // click on Addition of Receiver or Executor NgWebElement uiAdditionOfReceiverOrExecutor = ngDriver.FindElement(By.CssSelector("#mat-checkbox-6.mat-checkbox")); uiAdditionOfReceiverOrExecutor.Click(); /* * CHANGE OF DIRECTORS OR OFFICERS */ // upload notice of articles FileUpload("notice_of_articles.pdf", "(//input[@type='file'])[3]"); /* * PERSON'S NAME CHANGE */ // enter person first name NgWebElement uiFirstNameSociety = ngDriver.FindElement(By.CssSelector("input#mat-input-2")); uiFirstNameSociety.SendKeys(firstName); // enter person last name NgWebElement uiLastNameSociety = ngDriver.FindElement(By.CssSelector("input#mat-input-3")); uiLastNameSociety.SendKeys(lastName); // enter person new first name NgWebElement uiNewFirstNameSociety = ngDriver.FindElement(By.CssSelector("input#mat-input-4")); uiNewFirstNameSociety.SendKeys(newFirstName); // enter person new last name NgWebElement uiNewLastNameSociety = ngDriver.FindElement(By.CssSelector("input#mat-input-5")); uiNewLastNameSociety.SendKeys(newLastName); // upload copy of marriage certificate FileUpload("marriage_certificate.pdf", "(//input[@type='file'])[6]"); /* * SOCIETY NAME CHANGE */ // enter society name NgWebElement uiSocietyName = ngDriver.FindElement(By.CssSelector("input#mat-input-0")); uiSocietyName.SendKeys(societyName); // enter society name NgWebElement uiNewSocietyName = ngDriver.FindElement(By.CssSelector("input#mat-input-1")); uiNewSocietyName.SendKeys(newSocietyName); // upload name change certificate FileUpload("certificate_of_name_change.pdf", "(//input[@type='file'])[8]"); /* * ADDITION OF EXECUTOR OR RECEIVER */ // enter executor first name NgWebElement uiExecutorFirstNameSociety = ngDriver.FindElement(By.CssSelector("input#mat-input-6")); uiExecutorFirstNameSociety.SendKeys(executorFirstName); // enter executor last name NgWebElement uiExecutorLastNameSociety = ngDriver.FindElement(By.CssSelector("input#mat-input-7")); uiExecutorLastNameSociety.SendKeys(executorLastName); // upload assignment of executor FileUpload("assignment_of_executor.pdf", "(//input[@type='file'])[11]"); // upload death certificate FileUpload("death_certificate.pdf", "(//input[@type='file'])[14]"); // enter receiver first name NgWebElement uiReceiverFirstNameSociety = ngDriver.FindElement(By.CssSelector("input#mat-input-8")); uiReceiverFirstNameSociety.SendKeys(receiverFirstName); // enter receiver last name NgWebElement uiReceiverLastNameSociety = ngDriver.FindElement(By.CssSelector("input#mat-input-9")); uiReceiverLastNameSociety.SendKeys(receiverLastName); // upload receiver appointment order FileUpload("receiver_appointment_order.pdf", "(//input[@type='file'])[17]"); // upload court order FileUpload("court_order.pdf", "(//input[@type='file'])[20]"); /* * PERSONAL HISTORY SUMMARY FORMS */ // upload Personal History Summary document FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[24]"); break; case "private corporation": /* * TYPES OF CHANGES REQUESTED */ // click on Internal Transfer of Shares NgWebElement uiInternalTransferOfShares = ngDriver.FindElement(By.CssSelector("#mat-checkbox-3.mat-checkbox")); uiInternalTransferOfShares.Click(); // click on External Transfer of Shares NgWebElement uiExternalTransferOfShares = ngDriver.FindElement(By.CssSelector("#mat-checkbox-4.mat-checkbox")); uiExternalTransferOfShares.Click(); // click on Change of Directors or Officers NgWebElement uiChangeOfDirectorsOrOfficersPrivateCorporation = ngDriver.FindElement(By.CssSelector("#mat-checkbox-5.mat-checkbox")); uiChangeOfDirectorsOrOfficersPrivateCorporation.Click(); // click on Name Change, Licensee -- Corporation NgWebElement uiNameChangeLicenseePrivateCorporation = ngDriver.FindElement(By.CssSelector("#mat-checkbox-6.mat-checkbox")); uiNameChangeLicenseePrivateCorporation.Click(); // click on Name Change, Person NgWebElement uiNameChangePersonPrivateCorporation = ngDriver.FindElement(By.CssSelector("#mat-checkbox-7.mat-checkbox")); uiNameChangePersonPrivateCorporation.Click(); // click on Addition of Receiver or Executor NgWebElement uiAdditionOfReceiverOrExecutorPrivateCorporation = ngDriver.FindElement(By.CssSelector("#mat-checkbox-8.mat-checkbox")); uiAdditionOfReceiverOrExecutorPrivateCorporation.Click(); /* * INTERNAL SHARE TRANSFER */ // upload Central Securities Register document FileUpload("central_securities_register.pdf", "(//input[@type='file'])[3]"); // upload shareholders < 10% interest FileUpload("shareholders_less_10_interest.pdf", "(//input[@type='file'])[6]"); // click 'Yes' for amalgamation with another company NgWebElement uiAmalgamationYes = ngDriver.FindElement(By.CssSelector("mat-radio-button#mat-radio-2")); uiAmalgamationYes.Click(); // upload certificate of amalgamation FileUpload("certificate_of_amalgamation.pdf", "(//input[@type='file'])[9]"); // upload Central Securities Register document for amalgamated company FileUpload("central_securities_register.pdf", "(//input[@type='file'])[12]"); // upload notice of articles for amalgamated company FileUpload("notice_of_articles.pdf", "(//input[@type='file'])[15]"); /* * EXTERNAL SHARE TRANSFER */ // upload central securities register FileUpload("central_securities_register.pdf", "(//input[@type='file'])[18]"); // upload supporting business documentation FileUpload("associates.pdf", "(//input[@type='file'])[21]"); // upload shareholders < 10% interest FileUpload("shareholders_less_10_interest.pdf", "(//input[@type='file'])[24]"); /* * CHANGE OF DIRECTORS OR OFFICERS */ // upload notice of articles FileUpload("notice_of_articles.pdf", "(//input[@type='file'])[27]"); /* * PERSON'S NAME CHANGE */ // enter person first name NgWebElement uiFirstNamePrivateCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-2")); uiFirstNamePrivateCorporation.SendKeys(firstName); // enter person last name NgWebElement uiLastNamePrivateCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-3")); uiLastNamePrivateCorporation.SendKeys(lastName); // enter person new first name NgWebElement uiNewFirstNamePrivateCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-4")); uiNewFirstNamePrivateCorporation.SendKeys(newFirstName); // enter person new last name NgWebElement uiNewLastNamePrivateCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-5")); uiNewLastNamePrivateCorporation.SendKeys(newLastName); // upload copy of marriage certificate FileUpload("marriage_certificate.pdf", "(//input[@type='file'])[30]"); /* * CORPORATION NAME CHANGE */ // enter company name NgWebElement uiCompanyNamePrivateCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-0")); uiCompanyNamePrivateCorporation.SendKeys(companyName); // enter new company name NgWebElement uiNewCompanyNamePrivateCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-1")); uiNewCompanyNamePrivateCorporation.SendKeys(newCompanyName); // upload certificate of name change FileUpload("certificate_of_name_change.pdf", "(//input[@type='file'])[32]"); /* * ADDITION OF EXECUTOR OR RECEIVER */ // enter executor first name NgWebElement uiExecutorFirstNamePrivateCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-6")); uiExecutorFirstNamePrivateCorporation.SendKeys(executorFirstName); // enter executor last name NgWebElement uiExecutorLastNamePrivateCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-7")); uiExecutorLastNamePrivateCorporation.SendKeys(executorLastName); // upload assignment of executor FileUpload("assignment_of_executor.pdf", "(//input[@type='file'])[35]"); // upload death certificate FileUpload("death_certificate.pdf", "(//input[@type='file'])[38]"); // enter receiver first name NgWebElement uiReceiverFirstNamePrivateCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-8")); uiReceiverFirstNamePrivateCorporation.SendKeys(receiverFirstName); // enter receiver last name NgWebElement uiReceiverLastNamePrivateCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-9")); uiReceiverLastNamePrivateCorporation.SendKeys(receiverLastName); // upload receiver appointment order FileUpload("receiver_appointment_order.pdf", "(//input[@type='file'])[41]"); // upload court order FileUpload("court_order.pdf", "(//input[@type='file'])[44]"); /* * PERSONAL HISTORY SUMMARY FORMS */ // upload Personal History Summary document FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[48]"); break; case "public corporation": /* * TYPES OF CHANGES REQUESTED */ // click on Internal Transfer of Shares NgWebElement uiInternalTransferOfSharesPublicCorp = ngDriver.FindElement(By.CssSelector("#mat-checkbox-3.mat-checkbox")); uiInternalTransferOfSharesPublicCorp.Click(); // click on External Transfer of Shares NgWebElement uiExternalTransferOfSharesPublicCorp = ngDriver.FindElement(By.CssSelector("#mat-checkbox-4.mat-checkbox")); uiExternalTransferOfSharesPublicCorp.Click(); // click on Change of Directors or Officers NgWebElement uiChangeOfDirectorsPublicCorp = ngDriver.FindElement(By.CssSelector("#mat-checkbox-5.mat-checkbox")); uiChangeOfDirectorsPublicCorp.Click(); // click on Name Change, Licensee -- Corporation NgWebElement uiNameChangePublicCorp = ngDriver.FindElement(By.CssSelector("#mat-checkbox-6.mat-checkbox")); uiNameChangePublicCorp.Click(); // click on Name Change, Person NgWebElement uiNameChangePersonPublicCorp = ngDriver.FindElement(By.CssSelector("#mat-checkbox-7.mat-checkbox")); uiNameChangePersonPublicCorp.Click(); // click on Addition of Receiver or Executor NgWebElement uiAdditionReceiverExecutor = ngDriver.FindElement(By.CssSelector("#mat-checkbox-8.mat-checkbox")); uiAdditionReceiverExecutor.Click(); /* * INTERNAL SHARE TRANSFER */ // upload central securities register FileUpload("central_securities_register.pdf", "(//input[@type='file'])[2]"); // upload Shareholders (individuals) Holding Less Than 10% Interest FileUpload("shareholders_less_10_interest.pdf", "(//input[@type='file'])[5]"); // select 'Yes' for 'Have you amalgamated with another company?' NgWebElement uiAmalgamatedYes = ngDriver.FindElement(By.CssSelector("#mat-radio-2")); uiAmalgamatedYes.Click(); // upload certificate of amalgamation FileUpload("certificate_of_amalgamation.pdf", "(//input[@type='file'])[8]"); // upload central securities register FileUpload("central_securities_register.pdf", "(//input[@type='file'])[11]"); // upload notice of articles FileUpload("notice_of_articles.pdf", "(//input[@type='file'])[14]"); /* * EXTERNAL SHARE TRANSFER */ // upload central securities register FileUpload("central_securities_register.pdf", "(//input[@type='file'])[17]"); // upload supporting business documentation FileUpload("business_plan.pdf", "(//input[@type='file'])[20]"); // upload Shareholders (individuals) Holding Less Than 10% Interest FileUpload("shareholders_less_10_interest.pdf", "(//input[@type='file'])[23]"); /* * CHANGE OF DIRECTORS OR OFFICERS */ // upload notice of articles FileUpload("notice_of_articles.pdf", "(//input[@type='file'])[26]"); /* * PERSON'S NAME CHANGE */ // enter person first name NgWebElement uiFirstNamePublicCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-2")); uiFirstNamePublicCorporation.SendKeys(firstName); // enter person last name NgWebElement uiLastNamePublicCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-3")); uiLastNamePublicCorporation.SendKeys(lastName); // enter person new first name NgWebElement uiNewFirstNamePublicCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-4")); uiNewFirstNamePublicCorporation.SendKeys(newFirstName); // enter person new last name NgWebElement uiNewLastNamePublicCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-5")); uiNewLastNamePublicCorporation.SendKeys(newLastName); // upload copy of marriage certificate FileUpload("marriage_certificate.pdf", "(//input[@type='file'])[29]"); /* * CORPORATION NAME CHANGE */ // enter company name NgWebElement uiCompanyNamePublicCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-0")); uiCompanyNamePublicCorporation.SendKeys(companyName); // enter new company name NgWebElement uiNewCompanyNamePublicCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-1")); uiNewCompanyNamePublicCorporation.SendKeys(newCompanyName); // upload certificate of name change FileUpload("certificate_of_name_change.pdf", "(//input[@type='file'])[32]"); /* * ADDITION OF EXECUTOR OR RECEIVER */ // enter executor first name NgWebElement uiExecutorFirstNamePublicCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-6")); uiExecutorFirstNamePublicCorporation.SendKeys(executorFirstName); // enter executor last name NgWebElement uiExecutorLastNamePublicCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-7")); uiExecutorLastNamePublicCorporation.SendKeys(executorLastName); // upload assignment of executor FileUpload("assignment_of_executor.pdf", "(//input[@type='file'])[35]"); // upload death certificate FileUpload("death_certificate.pdf", "(//input[@type='file'])[38]"); // enter receiver first name NgWebElement uiReceiverFirstNamePublicCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-8")); uiReceiverFirstNamePublicCorporation.SendKeys(receiverFirstName); // enter receiver last name NgWebElement uiReceiverLastNamePublicCorporation = ngDriver.FindElement(By.CssSelector("input#mat-input-9")); uiReceiverLastNamePublicCorporation.SendKeys(receiverLastName); // upload receiver appointment order FileUpload("receiver_appointment_order.pdf", "(//input[@type='file'])[41]"); // upload court order FileUpload("court_order.pdf", "(//input[@type='file'])[44]"); /* * PERSONAL HISTORY SUMMARY FORMS */ // upload Personal History Summary document FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[47]"); break; case "partnership": /* * TYPES OF CHANGES REQUESTED */ // click on Name Change, Licensee -- Partnership NgWebElement uiNameChangeLicenseePartnership = ngDriver.FindElement(By.CssSelector("#mat-checkbox-3.mat-checkbox")); uiNameChangeLicenseePartnership.Click(); // click on Name Change, Person NgWebElement uiNameChangePersonPartnership = ngDriver.FindElement(By.CssSelector("#mat-checkbox-4.mat-checkbox")); uiNameChangePersonPartnership.Click(); // click on Addition of Receiver or Executor NgWebElement uiAdditionOfReceiverOrExecutorPartnership = ngDriver.FindElement(By.CssSelector("#mat-checkbox-5.mat-checkbox")); uiAdditionOfReceiverOrExecutorPartnership.Click(); // enter person first name NgWebElement uiFirstNamePartnership = ngDriver.FindElement(By.CssSelector("input#mat-input-2")); uiFirstNamePartnership.SendKeys(firstName); // enter person last name NgWebElement uiLastNamePartnership = ngDriver.FindElement(By.CssSelector("input#mat-input-3")); uiLastNamePartnership.SendKeys(lastName); // enter person new first name NgWebElement uiNewFirstNamePartnership = ngDriver.FindElement(By.CssSelector("input#mat-input-4")); uiNewFirstNamePartnership.SendKeys(newFirstName); // enter person new last name NgWebElement uiNewLastNamePartnership = ngDriver.FindElement(By.CssSelector("input#mat-input-5")); uiNewLastNamePartnership.SendKeys(newLastName); // upload copy of marriage certificate FileUpload("marriage_certificate.pdf", "(//input[@type='file'])[3]"); // enter partnership name NgWebElement uiPartnershipName = ngDriver.FindElement(By.CssSelector("input#mat-input-0")); uiPartnershipName.SendKeys(partnershipName); // enter new partnership name NgWebElement uiNewPartnershipName = ngDriver.FindElement(By.CssSelector("input#mat-input-1")); uiNewPartnershipName.SendKeys(newPartnershipName); // upload partnership registration FileUpload("partnership_agreement.pdf", "(//input[@type='file'])[5]"); // enter executor first name NgWebElement uiExecutorFirstNamePartnership = ngDriver.FindElement(By.CssSelector("input#mat-input-6")); uiExecutorFirstNamePartnership.SendKeys(executorFirstName); // enter executor last name NgWebElement uiExecutorLastNamePartnership = ngDriver.FindElement(By.CssSelector("input#mat-input-7")); uiExecutorLastNamePartnership.SendKeys(executorLastName); // upload assignment of executor FileUpload("assignment_of_executor.pdf", "(//input[@type='file'])[8]"); // upload death certificate FileUpload("death_certificate.pdf", "(//input[@type='file'])[11]"); // enter receiver first name NgWebElement uiReceiverFirstNamePartnership = ngDriver.FindElement(By.CssSelector("input#mat-input-8")); uiReceiverFirstNamePartnership.SendKeys(receiverFirstName); // enter receiver last name NgWebElement uiReceiverLastNamePartnership = ngDriver.FindElement(By.CssSelector("input#mat-input-9")); uiReceiverLastNamePartnership.SendKeys(receiverLastName); // upload receiver appointment order FileUpload("receiver_appointment_order.pdf", "(//input[@type='file'])[14]"); // upload court order FileUpload("court_order.pdf", "(//input[@type='file'])[17]"); // upload Personal History Summary document FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[21]"); break; case "sole proprietorship": /* * TYPES OF CHANGES REQUESTED */ // click on Name Change, Licensee -- Corporation NgWebElement uiNameChangeLicenseeSoleProprietorship = ngDriver.FindElement(By.CssSelector("#mat-checkbox-3.mat-checkbox")); uiNameChangeLicenseeSoleProprietorship.Click(); /* * CORPORATION NAME CHANGE */ // enter company name NgWebElement uiCompanyNameSoleProprietorship = ngDriver.FindElement(By.CssSelector("input#mat-input-0")); uiCompanyNameSoleProprietorship.SendKeys(companyName); // enter new company name NgWebElement uiNewCompanyNameSoleProprietorship = ngDriver.FindElement(By.CssSelector("input#mat-input-1")); uiNewCompanyNameSoleProprietorship.SendKeys(newCompanyName); // upload certificate of name change FileUpload("certificate_of_name_change.pdf", "(//input[@type='file'])[3]"); // upload Personal History Summary document FileUpload("personal_history_summary.pdf", "(//input[@type='file'])[6]"); break; } // select the authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='authorizedToSubmit']")); uiAuthorizedToSubmit.Click(); // select the signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='signatureAgreement']")); uiSignatureAgreement.Click(); }
/// <summary> /// Take element under input (label class="custom-checkbox d-flex align-items-center" for="knowledge-map-0"). /// Format "label.custom-checkbox[for=knowledge-map-0]" /// </summary> /// <param name="checkbox"></param> public NgCustomCheckboxElement(NgWebElement checkbox) { checkboxElement = checkbox; }
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); // upload the signage document 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]"); // upload the exterior photos FileUpload("exterior_photos.jpg", "(//input[@type='file'])[11]"); // 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")); JavaScriptClick(uiProposedSiteInGrocery); // upload grocery declaration document FileUpload("grocery_declaration.pdf", "(//input[@type='file'])[15]"); // 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 FileUpload("valid_interest.pdf", "(//input[@type='file'])[18]"); // 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 ShouldWithdraw() { ShouldDeposit(); int account_balance = -1; int.TryParse(ngDriver.FindElement(NgBy.Binding("amount")).Text.FindMatch(@"(?<account_balance>\d+)$"), out account_balance); Assert.AreNotEqual(-1, account_balance); ngDriver.FindElement(NgBy.PartialButtonText("Withdrawl")).Click(); // core Selenium Thread.Sleep(1000); wait.Until(ExpectedConditions.ElementExists(By.CssSelector("form[name='myForm']"))); NgWebElement ng_form_element = new NgWebElement(ngDriver, driver.FindElement(By.CssSelector("form[name='myForm']"))); NgWebElement ng_withdrawl_amount = ng_form_element.FindElement(NgBy.Model("amount")); ng_withdrawl_amount.SendKeys((account_balance + 100).ToString()); NgWebElement ng_withdrawl_button = ng_form_element.FindElement(NgBy.ButtonText("Withdraw")); ngDriver.Highlight(ng_withdrawl_button); ng_withdrawl_button.Click(); // inspect message var ng_message = ngDriver.FindElement(NgBy.Binding("message")); StringAssert.Contains("Transaction Failed. You can not withdraw amount more than the balance.", ng_message.Text); ngDriver.Highlight(ng_message); // 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(account_balance, updated_account_balance); // core Selenium Thread.Sleep(1000); wait.Until(ExpectedConditions.ElementExists(By.CssSelector("form[name='myForm']"))); ng_form_element = new NgWebElement(ngDriver, driver.FindElement(By.CssSelector("form[name='myForm']"))); ng_form_element.FindElement(NgBy.Model("amount")).SendKeys((account_balance - 10).ToString()); ng_form_element.FindElement(NgBy.ButtonText("Withdraw")).Click(); // inspect message ng_message = ngDriver.FindElement(NgBy.Binding("message")); StringAssert.Contains("Transaction successful", ng_message.Text); ngDriver.Highlight(ng_message); // re-read the amount int.TryParse(ngDriver.FindElement(NgBy.Binding("amount")).Text.FindMatch(@"(?<account_balance>\d+)$"), out updated_account_balance); Assert.AreEqual(10, updated_account_balance); }
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); 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"); wait.Until(ExpectedConditions.ElementIsVisible(NgBy.ButtonText("Deposit"))); ng_deposit_button = ng_form_element.FindElement(NgBy.ButtonText("Deposit")); actions.MoveToElement(ng_deposit_button.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_deposit_button); ng_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); // 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); }
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 JavaScriptClick(NgWebElement element) { var executor = (IJavaScriptExecutor)ngDriver.WrappedDriver; executor.ExecuteScript("arguments[0].click();", element); }
public void ShouldEvaluateIf() { GetPageContent("ng_watch_ng_if.htm"); IWebElement button = ngDriver.FindElement(By.CssSelector("button.btn")); NgWebElement ng_button = new NgWebElement(ngDriver, button); Object state = ng_button.Evaluate("!house.frontDoor.isOpen"); Assert.IsTrue(Convert.ToBoolean(state)); StringAssert.IsMatch("house.frontDoor.open()", button.GetAttribute("ng-click")); StringAssert.IsMatch("Open Door", button.Text); button.Click(); }
public void business_shareholder_2() { /********** Business Shareholder #2 **********/ // create the business shareholder #2 data string businessName2 = "Business Shareholder 2"; string businessVotingShares2 = "100"; string businessEmail2 = "*****@*****.**"; // open business shareholder #2 form NgWebElement uiOpenShareBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] button")); uiOpenShareBiz2.Click(); // enter business sharedholder #2 name NgWebElement uiShareFirstBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] input[formcontrolname='businessNameNew']")); uiShareFirstBiz2.SendKeys(businessName2); // enter business shareholder #2 voting shares NgWebElement uiShareVotesBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] input[formcontrolname='numberofSharesNew']")); uiShareVotesBiz2.SendKeys(businessVotingShares2); // select business shareholder #2 business type (private corporation) from dropdown NgWebElement uiShareBizType2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [formcontrolname='businessType'] option[value='PrivateCorporation']")); uiShareBizType2.Click(); // enter business shareholder #2 email NgWebElement uiShareEmailBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] input[formcontrolname='emailNew']")); uiShareEmailBiz2.SendKeys(businessEmail2); // select the business shareholder #2 confirm button NgWebElement uiShareBizConfirmButton2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] .fa-save span")); uiShareBizConfirmButton2.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 a notice of articles document for business shareholder string noticeOfArticlesBiz2 = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "notice_of_articles.pdf"); NgWebElement uploadNoticeofArticlesBiz2 = ngDriver.FindElement(By.XPath("(//input[@type='file'])[21]")); uploadNoticeofArticlesBiz2.SendKeys(noticeOfArticlesBiz2); // upload a central securities register document for business shareholder string centralSecuritiesRegisterBiz2 = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "central_securities_register.pdf"); NgWebElement uploadCentralSecRegBiz2 = ngDriver.FindElement(By.XPath("(//input[@type='file'])[24]")); uploadCentralSecRegBiz2.SendKeys(centralSecuritiesRegisterBiz2); // upload a special rights and restrictions document for business shareholder string specialRightsRestrictionsBiz2 = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "special_rights_restrictions.pdf"); NgWebElement uploadSpecialRightsResBiz2 = ngDriver.FindElement(By.XPath("(//input[@type='file'])[27]")); uploadSpecialRightsResBiz2.SendKeys(specialRightsRestrictionsBiz2); /********** Business Shareholder #2 - Key Personnel **********/ // create business shareholder #2 key personnel data string keyPersonnelFirstNameBiz2 = "KeyPersonnelBiz2First"; string keyPersonnelLastNameBiz2 = "KeyPersonnelBiz2Last"; string keyPersonnelTitleBiz2 = "KeyPersonnelBiz2Title"; string keyPersonnelEmailBiz2 = "*****@*****.**"; // open business shareholder #2 > key personnel form NgWebElement openKeyPersonnelFormBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='Leadership'] button")); openKeyPersonnelFormBiz2.Click(); // enter business shareholder #2 > key personnel first name NgWebElement uiKeyPersonFirstBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='Leadership'] input[formcontrolname='firstNameNew']")); uiKeyPersonFirstBiz2.SendKeys(keyPersonnelFirstNameBiz2); // enter business shareholder #2 > key personnel last name NgWebElement uiKeyPersonLastBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='Leadership'] input[formcontrolname='lastNameNew']")); uiKeyPersonLastBiz2.SendKeys(keyPersonnelLastNameBiz2); // select business shareholder #2 > key personnel role using checkbox NgWebElement uiKeyPersonRoleBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='Leadership'] input[formcontrolname='isDirectorNew']")); uiKeyPersonRoleBiz2.Click(); // enter business shareholder #2 > key personnel title NgWebElement uiKeyPersonTitleBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='Leadership'] input[formcontrolname='titleNew']")); uiKeyPersonTitleBiz2.SendKeys(keyPersonnelTitleBiz2); // enter business shareholder #2 > key personnel email NgWebElement uiKeyPersonEmailBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='Leadership'] input[formcontrolname='emailNew']")); uiKeyPersonEmailBiz2.SendKeys(keyPersonnelEmailBiz2); // enter business shareholder #2 > key personnel DOB NgWebElement uiKeyPersonnelDOB1Biz12 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='Leadership'] input[formcontrolname='dateofBirthNew']")); uiKeyPersonnelDOB1Biz12.Click(); SharedCalendarDate(); /********** Business Shareholder #2 - Individual Shareholder **********/ // create the business shareholder > individual shareholder data string shareholderFirstNameBiz2 = "IndividualShareholderBiz2First"; string shareholderLastNameBiz2 = "IndividualShareholderBiz2Last"; string shareholderVotingSharesBiz2 = "1800"; string shareholderEmailBiz2 = "*****@*****.**"; // open business shareholder #2 > individual shareholder form NgWebElement uiOpenIndyShareBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='IndividualShareholder'] button")); uiOpenIndyShareBiz2.Click(); // enter business shareholder #2 > individual shareholder first name NgWebElement uiIndyShareFirstBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='IndividualShareholder'] input[formcontrolname='firstNameNew']")); uiIndyShareFirstBiz2.SendKeys(shareholderFirstNameBiz2); // enter business shareholder #2 > individual shareholder last name NgWebElement uiIndyShareLastBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='IndividualShareholder'] input[formcontrolname='lastNameNew']")); uiIndyShareLastBiz2.SendKeys(shareholderLastNameBiz2); // enter business shareholder #2 > individual number of voting shares NgWebElement uiIndyShareVotesBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='IndividualShareholder'] input[formcontrolname='numberofSharesNew']")); uiIndyShareVotesBiz2.SendKeys(shareholderVotingSharesBiz2); // enter business shareholder > individual shareholder email NgWebElement uiIndyShareEmailBiz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='IndividualShareholder'] input[formcontrolname='emailNew']")); uiIndyShareEmailBiz2.SendKeys(shareholderEmailBiz2); // enter business shareholder > individual shareholder DOB NgWebElement uiCalendarIndyS1Biz2 = ngDriver.FindElement(By.CssSelector("[changetypesuffix='BusinessShareholder'] [changetypesuffix='BusinessShareholder'] [changetypesuffix='IndividualShareholder'] input[formcontrolname='dateofBirthNew']")); uiCalendarIndyS1Biz2.Click(); SharedCalendarDate(); }
public void RequestStructuralChange() { /* * Page Title: Licences & Authorizations * Subtitle: Cannabis Retail Store Licences */ string structuralChange = "Request a Structural Change"; // click on the request structural change link NgWebElement uiStructuralChange = ngDriver.FindElement(By.LinkText(structuralChange)); uiStructuralChange.Click(); /* * Page Title: Please Review the Account Profile */ ContinueToApplicationButton(); /* * Page Title: Submit the Cannabis Retail Store Structural Change Application */ // create test data string description = "Test automation outline of the proposed change."; // enter the description of the change NgWebElement uiDescriptionOfChange = ngDriver.FindElement(By.Id("description1")); uiDescriptionOfChange.SendKeys(description); // select not visible from outside checkbox NgWebElement uiVisibleFromOutside = ngDriver.FindElement(By.CssSelector(".mat-checkbox-inner-container")); JavaScriptClick(uiVisibleFromOutside); // upload a floor plan document FileUpload("floor_plan.pdf", "(//input[@type='file'])[2]"); // upload a site plan FileUpload("site_plan.pdf", "(//input[@type='file'])[5]"); // select authorizedToSubmit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.Id("authorizedToSubmit")); uiAuthorizedToSubmit.Click(); // select signatureAgreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.Id("signatureAgreement")); uiSignatureAgreement.Click(); // click on the Submit & Pay button ClickOnSubmitButton(); // pay for the structural change application MakePayment(); /* * Page Title: Payment Approved */ ClickLicencesTab(); }
public void CompleteEligibilityDisclosure() { /* * Page Title: Cannabis Retail Store Licence Eligibility Disclosure */ // select response: On or after March 1, 2020, did you or any of your associates own, operate, provide financial support to, or receive income from an unlicensed cannabis retail store or retailer? // select Yes radio button NgWebElement uiYesRadio1 = ngDriver.FindElement(By.CssSelector("[formcontrolname='isConnectedToUnlicencedStore'] mat-radio-button")); uiYesRadio1.Click(); // complete field: Please indicate the name and location of the retailer or store string nameAndLocation = "Automated test name and location of retailer"; NgWebElement uiNameAndLocation = ngDriver.FindElement(By.CssSelector("input[formcontrolname='nameLocationUnlicencedRetailer']")); uiNameAndLocation.SendKeys(nameAndLocation); // select response: Does the retailer or store continue to operate? // select Yes for Question 2 using radio button NgWebElement uiYesRadio2 = ngDriver.FindElement(By.CssSelector("[formcontrolname='isRetailerStillOperating'] mat-radio-button")); uiYesRadio2.Click(); // select response: On or after March 1, 2020, were you or any of your associates involved with the distribution or supply of cannabis to a licensed or unlicensed cannabis retail store or retailer? // select Yes using radio button NgWebElement uiYesRadio3 = ngDriver.FindElement(By.CssSelector("[formcontrolname='isInvolvedIllegalDistribution'] mat-radio-button")); uiYesRadio3.Click(); // complete field: Please indicate the details of your involvement string involvementDetails = "Automated test - details of the involvement"; NgWebElement uiInvolvementDetails = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='illegalDistributionInvolvementDetails']")); uiInvolvementDetails.SendKeys(involvementDetails); // complete field: Please indicate the name and location of the retailer or store string nameAndLocation2 = "Automated test name and location of retailer (2)"; NgWebElement uiNameAndLocation2 = ngDriver.FindElement(By.CssSelector("input[formControlName='nameLocationRetailer']")); uiNameAndLocation2.SendKeys(nameAndLocation2); // select response: Do you continue to be involved? // select Yes for Question 2 using radio button NgWebElement uiYesRadio4 = ngDriver.FindElement(By.CssSelector("[formcontrolname='isInvolvementContinuing'] mat-radio-button")); uiYesRadio4.Click(); // select certification checkbox NgWebElement uiCheckbox = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='isEligibilityCertified']")); uiCheckbox.Click(); // enter the electronic signature string electricSignature = "Automated Test"; NgWebElement uiSigCheckbox = ngDriver.FindElement(By.CssSelector("input[formcontrolname='eligibilitySignature']")); uiSigCheckbox.SendKeys(electricSignature); // click on the Submit button NgWebElement uiEligibilitySubmit = ngDriver.FindElement(By.CssSelector("app-eligibility-form button.btn-primary")); uiEligibilitySubmit.Click(); }
public void CompleteManufacturerApplication(string manufacturerType) { /* * Page Title: Manufacturer (Winery, Brewery, Distillery or Co-Packer) Licence Application */ // create test data string estName = "Manufacturer's Establishment"; string streetLocation = "123 Innovation Street"; string city = "Victoria"; string postal = "V9A 6X5"; string PID = "111111111"; string additionalPIDs = "999999999, 000000000, 181818181"; string storeEmail = "*****@*****.**"; string storePhone = "250-012-3456"; string contactTitle = "Sommelier"; string contactPhone = "778-181-1818"; string contactEmail = "*****@*****.**"; string indigenousNation = "Parksville"; string policeJurisdiction = "RCMP Shawnigan Lake"; string localGovernmentParksville = "Parksville"; string policeJurisdictionParksville = "RCMP Oceanside"; // upload 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 holding less than 10% interest FileUpload("shareholders_less_10_interest.pdf", "(//input[@type='file'])[15]"); // 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 street address NgWebElement uiEstabStreetAddress = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressStreet']")); uiEstabStreetAddress.SendKeys(streetLocation); // enter the establishment city NgWebElement uiEstabCity = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressCity']")); uiEstabCity.SendKeys(city); // enter the establishment postal code NgWebElement uiEstabPostal = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressPostalCode']")); uiEstabPostal.SendKeys(postal); // enter the PID NgWebElement uiEstabPID = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentParcelId']")); uiEstabPID.SendKeys(PID); // enter additional PIDs NgWebElement uiAdditionalEstabPID = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='pidList']")); uiAdditionalEstabPID.SendKeys(additionalPIDs); // select the proof of zoning checkbox NgWebElement uiProofOfZoning = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='isPermittedInZoning']")); JavaScriptClick(uiProofOfZoning); // select 'yes' for Treaty First Nation Land NgWebElement uiTreatyFirstNationLand = ngDriver.FindElement(By.CssSelector("[formcontrolname='isOnINLand'] mat-radio-button")); ScrollToElement(uiTreatyFirstNationLand); JavaScriptClick(uiTreatyFirstNationLand); // select 'yes' for ALR inclusion NgWebElement uiALRInclusion = ngDriver.FindElement(By.CssSelector("[formcontrolname='isAlr'] mat-radio-button")); JavaScriptClick(uiALRInclusion); // search for and select the indigenous nation NgWebElement uiIndigenousNation = ngDriver.FindElement(By.CssSelector("input[formcontrolname='indigenousNation']")); ScrollToElement(uiIndigenousNation); if (manufacturerType == "winery in Parksville") { uiIndigenousNation.SendKeys(localGovernmentParksville); NgWebElement uiIndigenousNation2 = ngDriver.FindElement(By.CssSelector("#mat-option-0 span")); uiIndigenousNation2.Click(); // search for and select the police jurisdiction NgWebElement uiPoliceJurisdiction = ngDriver.FindElement(By.CssSelector("input[formcontrolname='policeJurisdiction']")); uiPoliceJurisdiction.SendKeys(policeJurisdictionParksville); NgWebElement uiPoliceJurisdiction2 = ngDriver.FindElement(By.CssSelector("#mat-option-2 span")); uiPoliceJurisdiction2.Click(); } else { uiIndigenousNation.SendKeys(indigenousNation); NgWebElement uiIndigenousNation2 = ngDriver.FindElement(By.CssSelector("#mat-option-0 span")); JavaScriptClick(uiIndigenousNation2); // search for and select the police jurisdiction NgWebElement uiPoliceJurisdiction = ngDriver.FindElement(By.CssSelector("input[formcontrolname='policeJurisdiction']")); uiPoliceJurisdiction.SendKeys(policeJurisdiction); NgWebElement uiPoliceJurisdiction2 = ngDriver.FindElement(By.CssSelector("#mat-option-2 span")); JavaScriptClick(uiPoliceJurisdiction2); } // enter the store email NgWebElement uiEstabEmail = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentEmail']")); uiEstabEmail.SendKeys(storeEmail); // enter the store phone number NgWebElement uiEstabPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentPhone']")); ScrollToElement(uiEstabPhone); uiEstabPhone.SendKeys(storePhone); // this will likely need to be refactored with better CSS selectors. if ((manufacturerType == "winery") || (manufacturerType == "winery in Parksville")) { // select winery radio button NgWebElement uiWinery = ngDriver.FindElement(By.CssSelector("[formcontrolname='licenceSubCategory'] mat-radio-button input[value='Winery']")); JavaScriptClick(uiWinery); } if (manufacturerType == "distillery") { // select distillery radio button NgWebElement uiDistillery = ngDriver.FindElement(By.CssSelector("[formcontrolname='licenceSubCategory'] mat-radio-button input[value='Distillery']")); JavaScriptClick(uiDistillery); } if (manufacturerType == "brewery") { // select brewery radio button NgWebElement uiBrewery = ngDriver.FindElement(By.CssSelector("[formcontrolname='licenceSubCategory'] mat-radio-button input[value='Brewery']")); JavaScriptClick(uiBrewery); } if (manufacturerType == "co-packer") { // select co-packer radio button NgWebElement uiCoPacker = ngDriver.FindElement(By.CssSelector("[formcontrolname='licenceSubCategory'] mat-radio-button input[value='Co-packer']")); JavaScriptClick(uiCoPacker); } // upload the business plan FileUpload("business_plan.pdf", "(//input[@type='file'])[17]"); if (manufacturerType != "co-packer") { // upload the production sales forecast FileUpload("production_sales_forecast.pdf", "(//input[@type='file'])[20]"); } if ((manufacturerType == "winery") || (manufacturerType == "winery in Parksville")) { // create winery test data string grapesAcres = "100"; string fruitAcres = "5"; string honeyBeehives = "7"; // enter the grapes acreage NgWebElement uiGrapes = ngDriver.FindElement(By.CssSelector("input[formcontrolname='mfgAcresOfGrapes']")); uiGrapes.SendKeys(grapesAcres); // enter the fruit acreage NgWebElement uiFruit = ngDriver.FindElement(By.CssSelector("input[formcontrolname='mfgAcresOfFruit']")); uiFruit.SendKeys(fruitAcres); // enter the number of beehives NgWebElement uiHoney = ngDriver.FindElement(By.CssSelector("input[formcontrolname='mfgAcresOfHoney']")); uiHoney.SendKeys(honeyBeehives); // select the blending checkbox NgWebElement uiBlending = ngDriver.FindElement(By.CssSelector("#mat-checkbox-15 .mat-checkbox-inner-container")); uiBlending.Click(); // select the crushing checkbox NgWebElement uiCrushing = ngDriver.FindElement(By.CssSelector("#mat-checkbox-16 .mat-checkbox-inner-container")); JavaScriptClick(uiCrushing); // select the filtering checkbox NgWebElement uiFiltering = ngDriver.FindElement(By.CssSelector("#mat-checkbox-17 .mat-checkbox-inner-container")); JavaScriptClick(uiFiltering); // select the aging, for at least 3 months checkbox NgWebElement uiAging = ngDriver.FindElement(By.CssSelector("#mat-checkbox-18 .mat-checkbox-inner-container")); uiAging.Click(); // select the secondary fermentation or carbonation checkbox NgWebElement uiSecondaryFermentation = ngDriver.FindElement(By.CssSelector("#mat-checkbox-19 .mat-checkbox-inner-container")); uiSecondaryFermentation.Click(); // select the packaging checkbox NgWebElement uiPackaging = ngDriver.FindElement(By.CssSelector("#mat-checkbox-20 .mat-checkbox-inner-container")); uiPackaging.Click(); } if (manufacturerType != "co-packer") { // select 'yes' for neutral grain spirits NgWebElement uiNeutralGrains = ngDriver.FindElement(By.CssSelector("[formcontrolname='mfgUsesNeutralGrainSpirits'] mat-radio-button[value='Yes']")); uiNeutralGrains.Click(); } if (manufacturerType == "brewery") { // select 'Yes' for the brewery operating with brew pub on site NgWebElement uiPubOnSite = ngDriver.FindElement(By.CssSelector("[formcontrolname='mfgBrewPubOnSite'] mat-radio-button[value='Yes']")); uiPubOnSite.Click(); // select 'Yes' for piping from brewery NgWebElement uiPiping = ngDriver.FindElement(By.CssSelector("[formcontrolname='mfgPipedInProduct'] mat-radio-button[value='Yes']")); uiPiping.Click(); // upload brew sheets sample FileUpload("brew_sheets.pdf", "(//input[@type='file'])[23]"); // upload the business insurance FileUpload("business_insurance.pdf", "(//input[@type='file'])[26]"); } if (manufacturerType == "brewery") { // upload the store signage FileUpload("signage.pdf", "(//input[@type='file'])[29]"); // upload the floor plan FileUpload("floor_plan.pdf", "(//input[@type='file'])[32]"); // upload the site plan FileUpload("site_plan.pdf", "(//input[@type='file'])[35]"); } else { // upload the store signage FileUpload("signage.pdf", "(//input[@type='file'])[23]"); // upload the floor plan FileUpload("floor_plan.pdf", "(//input[@type='file'])[26]"); // upload the site plan FileUpload("site_plan.pdf", "(//input[@type='file'])[29]"); } // 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(); // upload the valid interest document if (manufacturerType == "brewery") { FileUpload("valid_interest.pdf", "(//input[@type='file'])[39]"); } else { FileUpload("valid_interest.pdf", "(//input[@type='file'])[33]"); } // enter the contact title NgWebElement uiContactTitle = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonRole']")); uiContactTitle.SendKeys(contactTitle); // enter the contact phone number NgWebElement uiContactPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonPhone']")); uiContactPhone.SendKeys(contactPhone); // enter the contact email address NgWebElement uiContactEmail = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonEmail']")); uiContactEmail.SendKeys(contactEmail); // select the authorized to submit checkbox NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='authorizedToSubmit']")); uiAuthorizedToSubmit.Click(); // select the 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]; // click on the Submit & Pay button ClickOnSubmitButton(); }
public void CompleteCannabisApplication(string businessType) { /* * Page Title: Submit the Cannabis Retail Store 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 estEmail = "*****@*****.**"; string estPhone = "2505555555"; string conGiven = "Given"; string conSurname = "Surname"; string conRole = "CEO"; string conPhone = "2508888888"; string conEmail = "*****@*****.**"; string indigenousNation = "Cowichan Tribes"; string policeJurisdiction = "RCMP Shawnigan Lake"; // enter the establishment name NgWebElement uiEstabName = null; // try up to 10 times to get an element. for (int i = 0; i < 10; i++) { try { var names = ngDriver.FindElements(By.Id("establishmentName")); if (names.Count > 0) { uiEstabName = names[0]; break; } } catch (Exception) { } } uiEstabName.SendKeys(estName); // enter the establishment address NgWebElement uiEstabAddress = ngDriver.FindElement(By.Id("establishmentAddressStreet")); uiEstabAddress.SendKeys(estAddress); // enter the establishment city NgWebElement uiEstabCity = ngDriver.FindElement(By.Id("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); if (businessType == "n indigenous nation") { // select the IN NgWebElement uiSelectNation = ngDriver.FindElement(By.CssSelector("[formcontrolname='indigenousNationId'] option[value='236686fc-d9d3-e811-90f0-005056832371']")); uiSelectNation.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 a proof of zoning form string zoningPath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "fin_integrity.pdf"); NgWebElement uiUploadZoning = ngDriver.FindElement(By.XPath("(//input[@type='file'])[3]")); uiUploadZoning.SendKeys(zoningPath); // search for and select the indigenous nation NgWebElement uiIndigenousNation = ngDriver.FindElement(By.CssSelector("input[formcontrolname='indigenousNation']")); uiIndigenousNation.SendKeys(indigenousNation); NgWebElement uiIndigenousNation2 = ngDriver.FindElement(By.CssSelector("#mat-option-0 span")); uiIndigenousNation2.Click(); // search for and select the police jurisdiction NgWebElement uiPoliceJurisdiction = ngDriver.FindElement(By.CssSelector("input[formcontrolname='policeJurisdiction']")); uiPoliceJurisdiction.SendKeys(policeJurisdiction); NgWebElement uiPoliceJurisdiction2 = ngDriver.FindElement(By.CssSelector("#mat-option-2 span")); uiPoliceJurisdiction2.Click(); // 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); // upload a store 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'])[5]")); uiUploadSignage.SendKeys(signagePath); // select not visible from outside checkbox NgWebElement uiVisibleFromOutside = ngDriver.FindElement(By.CssSelector(".mat-checkbox-inner-container")); uiVisibleFromOutside.Click(); // upload a floor plan document 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'])[8]")); uiUploadFloorplan.SendKeys(floorplanPath); // upload a site plan document 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'])[11]")); uiUploadSitePlan.SendKeys(sitePlanPath); // upload a financial integrity form string finIntegrityPath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "fin_integrity.pdf"); NgWebElement uiUploadFinIntegrity = ngDriver.FindElement(By.XPath("(//input[@type='file'])[15]")); uiUploadFinIntegrity.SendKeys(finIntegrityPath); // upload a ownership details document string ownershipDetailsPath = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "fin_integrity.pdf"); NgWebElement uiOwnershipDetails = ngDriver.FindElement(By.XPath("(//input[@type='file'])[18]")); uiOwnershipDetails.SendKeys(ownershipDetailsPath); // 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 uiAuthorizedSubmit = ngDriver.FindElement(By.Id("authorizedToSubmit")); uiAuthorizedSubmit.Click(); // click on the signature agreement checkbox NgWebElement uiSignatureAgree = ngDriver.FindElement(By.Id("signatureAgreement")); uiSignatureAgree.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]; // click on the submit button NgWebElement uiSubmitButton = ngDriver.FindElement(By.CssSelector(".application-wrapper button.btn-primary")); uiSubmitButton.Click(); }
public void RelocationApplication() { /* * Page Title: Please Review the Account Profile */ ContinueToApplicationButton(); /* * Page Title: Application to Request Relocation */ // create test data string areaDescription = "Sample area description"; string occupantLoad = "180"; // 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(); // select 'yes' for ALR location NgWebElement uiIsALR = ngDriver.FindElement(By.CssSelector("[formcontrolname='isAlr'] mat-radio-button#mat-radio-8")); uiIsALR.Click(); // upload a signage document FileUpload("signage.pdf", "(//input[@type='file'])[2]"); // upload a floor plan FileUpload("floor_plan.pdf", "(//input[@type='file'])[5]"); // 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); // 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(); // click on the Submit & Pay button ClickOnSubmitButton(); // pay for the relocation application MakePayment(); }
public void ShouldDirectSelectFromDatePicker() { GetPageContent("ng_datepicker.htm"); 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 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")); }
protected void ScrollToElement(NgWebElement element) { IJavaScriptExecutor executor = (IJavaScriptExecutor)(ngDriver.WrappedDriver); executor.ExecuteScript("arguments[0].scrollIntoView(true);", element); }
public void ShouldUpload() { // GetPageContent("ng_upload1.htm"); // need to run ngDriver.Navigate().GoToUrl("http://localhost:8080/ng_upload1.htm"); IWebElement file = driver.FindElement(By.CssSelector("div[ng-controller = 'myCtrl'] > input[type='file']")); Assert.IsNotNull(file); StringAssert.AreEqualIgnoringCase(file.GetAttribute("file-model"), "myFile"); String localPath = CreateTempFile("lorem ipsum dolor sit amet"); IAllowsFileDetection fileDetectionDriver = driver as IAllowsFileDetection; if (fileDetectionDriver == null) { Assert.Fail("driver does not support file detection. This should not be"); } fileDetectionDriver.FileDetector = new LocalFileDetector(); try { file.SendKeys(localPath); } catch (WebDriverException e) { // the operation has timed out Console.Error.WriteLine(e.Message); } NgWebElement button = ngDriver.FindElement(NgBy.ButtonText("Upload")); button.Click(); NgWebElement ng_file = new NgWebElement(ngDriver, file); Object myFile = ng_file.Evaluate("myFile"); if (myFile != null) { Dictionary <String, Object> result = (Dictionary <String, Object>)myFile; Assert.IsTrue(result.Keys.Contains("name")); Assert.IsTrue(result.Keys.Contains("type")); Assert.IsTrue(result.Keys.Contains("size")); } else { Console.Error.WriteLine("myFile is null"); } String script = "var e = angular.element(arguments[0]); var f = e.scope().myFile; if (f){return f.name} else {return null;}"; try { Object result = ((IJavaScriptExecutor)driver).ExecuteScript(script, ng_file); if (result != null) { Console.Error.WriteLine(result.ToString()); } else { Console.Error.WriteLine("result is null"); } } catch (InvalidOperationException e) { Console.Error.WriteLine(e.Message); } }
public void RequestNameBrandingChange(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(); } /* * Page Title: Please Review the Account Profile */ ContinueToApplicationButton(); /* * Page Title: Submit a Name or Branding Change Application */ // click on the authorized to submit checkbox NgWebElement uiAuthSubmit = ngDriver.FindElement(By.Id("authorizedToSubmit")); uiAuthSubmit.Click(); // click on the signature agreement checkbox NgWebElement uiSigAgreement = ngDriver.FindElement(By.Id("signatureAgreement")); uiSigAgreement.Click(); // find the upload test file 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 a supporting document string supportingDocument = Path.Combine(projectDirectory2 + Path.DirectorySeparatorChar + "bdd-tests" + Path.DirectorySeparatorChar + "upload_files" + Path.DirectorySeparatorChar + "signage.pdf"); NgWebElement uiUploadSupportingDoc = ngDriver.FindElement(By.XPath("(//input[@type='file'])[2]")); uiUploadSupportingDoc.SendKeys(supportingDocument); if (changeType == "Cannabis") { // click on the store exterior change button NgWebElement uiStoreExterior = ngDriver.FindElement(By.Id("mat-button-toggle-2-button")); uiStoreExterior.Click(); } // click on the Submit & Pay button ClickOnSubmitButton(); // pay for the branding change application MakePayment(); }
public void FacilityStructuralChange() { /* * Page Title: Licences & Authorizations */ string facilityStructuralChange = "Facility Structural Change Application"; // click on the Facility Structural Change Application link NgWebElement uiFacilityStructuralChange = ngDriver.FindElement(By.LinkText(facilityStructuralChange)); uiFacilityStructuralChange.Click(); /* * Page Title: Please Review the Account Profile */ ContinueToApplicationButton(); /* * Page Title: Manufacturing Facility Structural Change Application */ // create test data string applicationDetails = "Sample application details."; string proposedChange = "Sample proposed change"; // enter the application details into the text area NgWebElement uiApplicationDetails = ngDriver.FindElement(By.CssSelector("textarea#otherBusinessesDetails")); uiApplicationDetails.SendKeys(applicationDetails); // enter the proposed change into the text area NgWebElement uiProposedChange = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='description1']")); uiProposedChange.SendKeys(proposedChange); // 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(); // upload the floor plan FileUpload("floor_plan.pdf", "(//input[@type='file'])[2]"); // upload the site plan FileUpload("site_plan.pdf", "(//input[@type='file'])[5]"); uiAuthorizedToSubmit.Click(); uiSignatureAgreement.Click(); // click on the Submit & Pay button ClickOnSubmitButton(); MakePayment(); }
public void UBrewUVinApplication() { 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 = "*****@*****.**"; // 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); // upload the signage document FileUpload("signage.pdf", "(//input[@type='file'])[2]"); // select owner business checkbox NgWebElement uiIsOwnerBusiness = ngDriver.FindElement(By.CssSelector("mat-checkbox#mat-checkbox-1[formcontrolname='isOwnerBusiness']")); uiIsOwnerBusiness.Click(); // select has valid interest checkbox NgWebElement uiHasValidInterest = ngDriver.FindElement(By.CssSelector("mat-checkbox#mat-checkbox-2[formcontrolname='hasValidInterest']")); uiHasValidInterest.Click(); // select will have valid interest checkbox NgWebElement uiWillhaveValidInterest = ngDriver.FindElement(By.CssSelector("mat-checkbox#mat-checkbox-3[formcontrolname='willhaveValidInterest']")); uiWillhaveValidInterest.Click(); // 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("input[formcontrolname='authorizedToSubmit']")); uiAuthorizeSignature.Click(); // click on signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("input[formcontrolname='signatureAgreement'][type='checkbox']")); 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 RequestOwnershipTransfer() { /* * Page Title: Licences & Authorizations */ string transferOwnership = "Transfer Licence"; // click on the Transfer Ownership link NgWebElement uiTransferOwnership = ngDriver.FindElement(By.LinkText(transferOwnership)); uiTransferOwnership.Click(); // check that licence number field is populated NgWebElement uiLicenseNumber = ngDriver.FindElement(By.CssSelector("input[formcontrolname='licenseNumber']")); string fieldValueLicenseNumber = uiLicenseNumber.GetProperty("value"); Assert.False(string.IsNullOrEmpty(fieldValueLicenseNumber)); // check that establishment name field is populated NgWebElement uiEstablishmentName = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentName']")); string fieldValueEstablishmentName = uiEstablishmentName.GetProperty("value"); Assert.False(string.IsNullOrEmpty(fieldValueEstablishmentName)); // check that establishment address street field is populated NgWebElement uiEstablishmentAddressStreet = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressStreet']")); string fieldValueEstablishmentAddressStreet = uiEstablishmentAddressStreet.GetProperty("value"); Assert.False(string.IsNullOrEmpty(fieldValueEstablishmentAddressStreet)); // check that establishment address city field is populated NgWebElement uiEstablishmentAddressCity = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressCity']")); string fieldValueEstablishmentAddressCity = uiEstablishmentAddressCity.GetProperty("value"); Assert.False(string.IsNullOrEmpty(fieldValueEstablishmentAddressCity)); // check that establishment province field is populated NgWebElement uiEstablishmentProvince = ngDriver.FindElement(By.CssSelector("input.form-control[value='British Columbia']")); string fieldValueEstablishmentProvince = uiEstablishmentProvince.GetProperty("value"); Assert.False(string.IsNullOrEmpty(fieldValueEstablishmentProvince)); // check that establishment postal code field is populated NgWebElement uiEstablishmentAddressPostalCode = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressPostalCode']")); string fieldValueEstablishmentAddressPostalCode = uiEstablishmentAddressPostalCode.GetProperty("value"); Assert.False(string.IsNullOrEmpty(fieldValueEstablishmentAddressPostalCode)); // check that establishment country field is populated NgWebElement uiEstablishmentAddressCountry = ngDriver.FindElement(By.CssSelector("input.form-control[value='Canada']")); string fieldValueEstablishmentCountry = uiEstablishmentAddressCountry.GetProperty("value"); Assert.False(string.IsNullOrEmpty(fieldValueEstablishmentCountry)); // check that establishment PID is populated NgWebElement uiEstablishmentParcelId = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentParcelId']")); string fieldValueEstablishmentParcelId = uiEstablishmentParcelId.GetProperty("value"); Assert.False(string.IsNullOrEmpty(fieldValueEstablishmentParcelId)); string licensee = "GunderCorp"; // search for the proposed licensee NgWebElement uiProposedLicensee = ngDriver.FindElement(By.CssSelector("input[formcontrolname='autocompleteInput']")); uiProposedLicensee.SendKeys(licensee); NgWebElement uiThirdPartyOperatorOption = ngDriver.FindElement(By.CssSelector("mat-option[role='option'] span")); uiThirdPartyOperatorOption.Click(); // click on consent to licence transfer checkbox NgWebElement uiConsentToTransfer = ngDriver.FindElement(By.CssSelector("input[formcontrolname = 'transferConsent']")); uiConsentToTransfer.Click(); // click on authorize signature checkbox NgWebElement uiAuthorizeSignature = ngDriver.FindElement(By.CssSelector("input[formcontrolname='authorizedToSubmit']")); uiAuthorizeSignature.Click(); // click on signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("input[formcontrolname='signatureAgreement'][type='checkbox']")); uiSignatureAgreement.Click(); // click on submit transfer button NgWebElement uiSubmitTransferButton = ngDriver.FindElement(By.CssSelector("app-application-ownership-transfer button.btn-primary")); uiSubmitTransferButton.Click(); ClickLicencesTab(); /* * Page Title: Licences & Authorizations */ // check for transfer initiated status Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Transfer Requested')]")).Displayed); }
public void PicnicAreaEndorsement() { /* * 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(); Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,' Pending External Review ')]")).Displayed); }
public void FacilityStructuralChange() { /* * Page Title: Licences */ string facilityStructuralChange = "Facility Structural Change Application"; // click on the Facility Structural Change Application link NgWebElement uiFacilityStructuralChange = ngDriver.FindElement(By.LinkText(facilityStructuralChange)); uiFacilityStructuralChange.Click(); /* * Page Title: Please Review the Account Profile */ ContinueToApplicationButton(); /* * Page Title: Manufacturing Facility Structural Change Application */ // create test data string applicationDetails = "Sample application details."; string proposedChange = "Sample proposed change"; // enter the application details into the text area NgWebElement uiApplicationDetails = ngDriver.FindElement(By.CssSelector("textarea#otherBusinessesDetails")); uiApplicationDetails.SendKeys(applicationDetails); // enter the proposed change into the text area NgWebElement uiProposedChange = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='description1']")); uiProposedChange.SendKeys(proposedChange); // 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); // 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() { GetPageContent("ng_datepicker.htm"); 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 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 CannabisMarketingApplication(string bizType) { /* * Page Title: Submit the Cannabis Marketing Licence Application */ 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"; // 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 cannabis associate security screening FileUpload("cannabis_associate_security_screening.pdf", "(//input[@type='file'])[12]"); // upload financial integrity documents FileUpload("fin_integrity.pdf", "(//input[@type='file'])[15]"); // upload shareholders < 10% interest FileUpload("shareholders_less_10_interest.pdf", "(//input[@type='file'])[18]"); 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'])[21]"); // upload the Notice of Articles FileUpload("notice_of_articles.pdf", "(//input[@type='file'])[23]"); // upload the Central Securities Register FileUpload("central_securities_register.pdf", "(//input[@type='file'])[23]"); // 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("mat-checkbox[formcontrolname='authorizedToSubmit']")); uiAuthorizedToSubmit.Click(); // select signature agreement checkbox NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='signatureAgreement']")); uiSignatureAgreement.Click(); // retrieve the application ID string[] parsedURL = ngDriver.Url.Split('/'); applicationID = parsedURL[5]; }
public void ShouldFindOrderByField() { GetPageContent("ng_headers_sort_example1.htm"); String[] headers = new String[] { "First Name", "Last Name", "Age" }; foreach (String header in headers) { IWebElement headerelement = ngDriver.FindElement(By.XPath(String.Format("//th/a[contains(text(),'{0}')]", header))); Console.Error.WriteLine(header); headerelement.Click(); // to trigger WaitForAngular Assert.IsNotEmpty(ngDriver.Url); IWebElement emp = ngDriver.FindElement(NgBy.Repeater("emp in data.employees")); NgWebElement ngRow = new NgWebElement(ngDriver, emp); String orderByField = emp.GetAttribute("ng-order-by"); Console.Error.WriteLine(orderByField + ": " + ngRow.Evaluate(orderByField).ToString()); } ReadOnlyCollection<NgWebElement> ng_people = ngDriver.FindElements(NgBy.Repeater("person in people")); var ng_people_enumerator = ng_people.GetEnumerator(); ng_people_enumerator.Reset(); while (ng_people_enumerator.MoveNext()) { NgWebElement ng_person = (NgWebElement)ng_people_enumerator.Current; if (ng_person.Text == null) { break; } NgWebElement ng_name = ng_person.FindElement(NgBy.Binding("person.Name")); Assert.IsNotNull(ng_name.WrappedElement); Object obj_country = ng_person.Evaluate("person.Country"); Assert.IsNotNull(obj_country); if (String.Compare("Around the Horn", ng_name.Text) == 0) { StringAssert.IsMatch("UK", obj_country.ToString()); } } }
public void CompleteManufacturerApplication(string manufacturerType) { /* * Page Title: Manufacturer (Winery, Brewery, Distillery or Co-Packer) Licence Application */ // create test data string estName = "Manufacturer's Establishment"; string streetLocation = "123 Innovation Street"; string city = "Victoria"; string postal = "V9A 6X5"; string PID = "111111111"; string additionalPIDs = "999999999, 000000000, 181818181"; string storeEmail = "*****@*****.**"; string storePhone = "250-012-3456"; string contactTitle = "Sommelier"; string contactPhone = "778-181-1818"; string contactEmail = "*****@*****.**"; string indigenousNation = "Cowichan Tribes"; string policeJurisdiction = "RCMP Shawnigan Lake"; string localGovernmentSaanich = "Saanich"; string policeJurisdictionSaanich = "Saanich Police Department"; // enter the establishment name NgWebElement uiEstabName = null; // try up to 10 times to get an element. 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 street address NgWebElement uiEstabStreetAddress = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressStreet']")); uiEstabStreetAddress.SendKeys(streetLocation); // enter the establishment city NgWebElement uiEstabCity = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressCity']")); uiEstabCity.SendKeys(city); // enter the establishment postal code NgWebElement uiEstabPostal = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentAddressPostalCode']")); uiEstabPostal.SendKeys(postal); // enter the PID NgWebElement uiEstabPID = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentParcelId']")); uiEstabPID.SendKeys(PID); // enter additional PIDs NgWebElement uiAdditionalEstabPID = ngDriver.FindElement(By.CssSelector("textarea[formcontrolname='pidList']")); uiAdditionalEstabPID.SendKeys(additionalPIDs); // select the proof of zoning checkbox NgWebElement uiProofOfZoning = ngDriver.FindElement(By.CssSelector("mat-checkbox#mat-checkbox-1")); uiProofOfZoning.Click(); // select 'yes' for ALR inclusion NgWebElement uiALRInclusion = ngDriver.FindElement(By.CssSelector("[formcontrolname='isAlr'] mat-radio-button#mat-radio-2")); uiALRInclusion.Click(); if (manufacturerType == "winery in Saanich") { // search for and select the local government NgWebElement uiIndigenousNation = ngDriver.FindElement(By.CssSelector("input[formcontrolname='indigenousNation']")); uiIndigenousNation.SendKeys(localGovernmentSaanich); NgWebElement uiIndigenousNation2 = ngDriver.FindElement(By.CssSelector("#mat-option-2 span")); uiIndigenousNation2.Click(); // search for and select the police jurisdiction NgWebElement uiPoliceJurisdiction = ngDriver.FindElement(By.CssSelector("input[formcontrolname='policeJurisdiction']")); uiPoliceJurisdiction.SendKeys(policeJurisdictionSaanich); NgWebElement uiPoliceJurisdiction2 = ngDriver.FindElement(By.CssSelector("#mat-option-6 span")); uiPoliceJurisdiction2.Click(); } else { // search for and select the indigenous nation NgWebElement uiIndigenousNation = ngDriver.FindElement(By.CssSelector("input[formcontrolname='indigenousNation']")); uiIndigenousNation.SendKeys(indigenousNation); NgWebElement uiIndigenousNation2 = ngDriver.FindElement(By.CssSelector("#mat-option-0 span")); uiIndigenousNation2.Click(); // search for and select the police jurisdiction NgWebElement uiPoliceJurisdiction = ngDriver.FindElement(By.CssSelector("input[formcontrolname='policeJurisdiction']")); uiPoliceJurisdiction.SendKeys(policeJurisdiction); NgWebElement uiPoliceJurisdiction2 = ngDriver.FindElement(By.CssSelector("#mat-option-2 span")); uiPoliceJurisdiction2.Click(); } // enter the store email NgWebElement uiEstabEmail = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentEmail']")); uiEstabEmail.SendKeys(storeEmail); // enter the store phone number NgWebElement uiEstabPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='establishmentPhone']")); uiEstabPhone.SendKeys(storePhone); if ((manufacturerType == "winery") || (manufacturerType == "winery in Saanich")) { // select winery radio button NgWebElement uiWinery = ngDriver.FindElement(By.CssSelector("mat-radio-button#mat-radio-5")); uiWinery.Click(); } if (manufacturerType == "distillery") { // select distillery radio button NgWebElement uiDistillery = ngDriver.FindElement(By.CssSelector("mat-radio-button#mat-radio-6")); uiDistillery.Click(); } if (manufacturerType == "brewery") { // select brewery radio button NgWebElement uiBrewery = ngDriver.FindElement(By.CssSelector("mat-radio-button#mat-radio-7")); uiBrewery.Click(); } if (manufacturerType == "co-packer") { // select co-packer radio button NgWebElement uiCoPacker = ngDriver.FindElement(By.CssSelector("mat-radio-button#mat-radio-8")); uiCoPacker.Click(); } // upload the business plan FileUpload("business_plan.pdf", "(//input[@type='file'])[2]"); // upload the production sales forecast FileUpload("production_sales_forecast.pdf", "(//input[@type='file'])[5]"); if ((manufacturerType == "winery") || (manufacturerType == "winery in Saanich")) { // create winery test data string grapesAcres = "100"; string fruitAcres = "5"; string honeyBeehives = "7"; // enter the grapes acreage NgWebElement uiGrapes = ngDriver.FindElement(By.CssSelector("input[formcontrolname='mfgAcresOfGrapes']")); uiGrapes.SendKeys(grapesAcres); // enter the fruit acreage NgWebElement uiFruit = ngDriver.FindElement(By.CssSelector("input[formcontrolname='mfgAcresOfFruit']")); uiFruit.SendKeys(fruitAcres); // enter the number of beehives NgWebElement uiHoney = ngDriver.FindElement(By.CssSelector("input[formcontrolname='mfgAcresOfHoney']")); uiHoney.SendKeys(honeyBeehives); // select the blending checkbox NgWebElement uiBlending = ngDriver.FindElement(By.CssSelector("#mat-checkbox-10 .mat-checkbox-inner-container")); uiBlending.Click(); // select the crushing checkbox NgWebElement uiCrushing = ngDriver.FindElement(By.CssSelector("#mat-checkbox-11 .mat-checkbox-inner-container")); uiCrushing.Click(); // select the filtering checkbox NgWebElement uiFiltering = ngDriver.FindElement(By.CssSelector("#mat-checkbox-12 .mat-checkbox-inner-container")); uiFiltering.Click(); // select the aging, for at least 3 months checkbox NgWebElement uiAging = ngDriver.FindElement(By.CssSelector("#mat-checkbox-13 .mat-checkbox-inner-container")); uiAging.Click(); // select the secondary fermentation or carbonation checkbox NgWebElement uiSecondaryFermentation = ngDriver.FindElement(By.CssSelector("#mat-checkbox-14 .mat-checkbox-inner-container")); uiSecondaryFermentation.Click(); // select the packaging checkbox NgWebElement uiPackaging = ngDriver.FindElement(By.CssSelector("#mat-checkbox-15 .mat-checkbox-inner-container")); uiPackaging.Click(); } // select 'yes' for neutral grain spirits NgWebElement uiNeutralGrains = ngDriver.FindElement(By.CssSelector("[formcontrolname='mfgUsesNeutralGrainSpirits'] mat-radio-button[value='Yes']")); uiNeutralGrains.Click(); if (manufacturerType == "brewery") { // select 'Yes' for the brewery operating with brew pub on site NgWebElement uiPubOnSite = ngDriver.FindElement(By.CssSelector("[formcontrolname='mfgBrewPubOnSite'] mat-radio-button[value='Yes']")); uiPubOnSite.Click(); // select 'Yes' for piping from brewery NgWebElement uiPiping = ngDriver.FindElement(By.CssSelector("[formcontrolname='mfgPipedInProduct'] mat-radio-button[value='Yes']")); uiPiping.Click(); // upload brew sheets sample FileUpload("brew_sheets.pdf", "(//input[@type='file'])[8]"); // upload the business insurance FileUpload("business_insurance.pdf", "(//input[@type='file'])[11]"); } if (manufacturerType == "brewery") { // upload the store signage FileUpload("signage.pdf", "(//input[@type='file'])[14]"); // upload the floor plan FileUpload("floor_plan.pdf", "(//input[@type='file'])[17]"); // upload the site plan FileUpload("site_plan.pdf", "(//input[@type='file'])[20]"); } else { // upload the store signage FileUpload("signage.pdf", "(//input[@type='file'])[8]"); // upload the floor plan FileUpload("floor_plan.pdf", "(//input[@type='file'])[11]"); // upload the site plan FileUpload("site_plan.pdf", "(//input[@type='file'])[14]"); } // 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 the valid interest document if (manufacturerType == "brewery") { FileUpload("valid_interest.pdf", "(//input[@type='file'])[24]"); } else { FileUpload("valid_interest.pdf", "(//input[@type='file'])[18]"); } // enter the contact title NgWebElement uiContactTitle = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonRole']")); uiContactTitle.SendKeys(contactTitle); // enter the contact phone number NgWebElement uiContactPhone = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonPhone']")); uiContactPhone.SendKeys(contactPhone); // enter the contact email address NgWebElement uiContactEmail = ngDriver.FindElement(By.CssSelector("input[formcontrolname='contactPersonEmail']")); uiContactEmail.SendKeys(contactEmail); // 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(); // 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]; // click on the Submit & Pay button ClickOnSubmitButton(); }
public void ShouldUpload() { // GetPageContent("ng_upload1.htm"); // need to run ngDriver.Navigate().GoToUrl("http://localhost:8080/ng_upload1.htm"); IWebElement file = driver.FindElement(By.CssSelector("div[ng-controller = 'myCtrl'] > input[type='file']")); Assert.IsNotNull(file); StringAssert.AreEqualIgnoringCase(file.GetAttribute("file-model"), "myFile"); String localPath = CreateTempFile("lorem ipsum dolor sit amet"); IAllowsFileDetection fileDetectionDriver = driver as IAllowsFileDetection; if (fileDetectionDriver == null) { Assert.Fail("driver does not support file detection. This should not be"); } fileDetectionDriver.FileDetector = new LocalFileDetector(); try { file.SendKeys(localPath); } catch (WebDriverException e) { // the operation has timed out Console.Error.WriteLine(e.Message); } NgWebElement button = ngDriver.FindElement(NgBy.ButtonText("Upload")); button.Click(); NgWebElement ng_file = new NgWebElement(ngDriver, file); Object myFile = ng_file.Evaluate("myFile"); if (myFile != null) { Dictionary<String, Object> result = (Dictionary<String, Object>)myFile; Assert.IsTrue(result.Keys.Contains("name")); Assert.IsTrue(result.Keys.Contains("type")); Assert.IsTrue(result.Keys.Contains("size")); } else { Console.Error.WriteLine("myFile is null"); } String script = "var e = angular.element(arguments[0]); var f = e.scope().myFile; if (f){return f.name} else {return null;}"; try { Object result = ((IJavaScriptExecutor)driver).ExecuteScript(script, ng_file); if (result != null) { Console.Error.WriteLine(result.ToString()); } else { Console.Error.WriteLine("result is null"); } } catch (InvalidOperationException e) { Console.Error.WriteLine(e.Message); } }
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); // 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 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'])[2]")); 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'])[5]")); uiUploadExteriorPhotos.SendKeys(exteriorPhotosPath); // 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); }