コード例 #1
0
        public void RequestThirdPartyOperator()
        {
            // navigate back to Licenses tab
            ClickLicencesTab();

            /*
             * Page Title: Licences & Authorizations
             * Subtitle:   Catering Licences
             */

            string addOrChangeThirdParty = "Add or Change a Third Party Operator";

            // click on the Add or Change a Third Party Operator Link
            NgWebElement uiAddOrChangeThirdPartyOp = ngDriver.FindElement(By.LinkText(addOrChangeThirdParty));

            uiAddOrChangeThirdPartyOp.Click();

            /*
             * Page Title: Add or Change a Third Party Operator
             */

            // 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));

            // create test data
            string thirdparty = "GunderCorp";

            // search for the proposed licensee
            NgWebElement uiThirdPartyOperator = ngDriver.FindElement(By.CssSelector("input[formcontrolname='autocompleteInput']"));

            uiThirdPartyOperator.SendKeys(thirdparty);

            var uiThirdPartyOperatorOption = ngDriver.FindElements(By.CssSelector("mat-option[role='option'] span"));

            if (uiThirdPartyOperatorOption.Count > 0)
            {
                uiThirdPartyOperatorOption[0].Click();
            }
            else
            {
                throw new Exception($"Unable to find {thirdparty}");
            }

            // click on authorized to submit checkbox
            NgWebElement uiAuthorizedToSubmit = ngDriver.FindElement(By.CssSelector("input[formcontrolname='authorizedToSubmit']"));

            JavaScriptClick(uiAuthorizedToSubmit);

            // click on signature agreement checkbox
            NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("input[formcontrolname='signatureAgreement']"));

            JavaScriptClick(uiSignatureAgreement);

            // click on submit button
            ClickOnSubmitButton();

            // navigate back to Licenses tab
            ClickLicencesTab();

            /*
             * Page Title: Welcome to Liquor and Cannabis Licensing
             */

            ngDriver.Navigate().Refresh();

            // confirm that the application has been initiated
            Assert.True(ngDriver.FindElement(By.XPath("//body[contains(.,'Third Party Operator Application Initiated')]")).Displayed);
        }
コード例 #2
0
        public void RequestOwnershipTransfer(string licenceType)
        {
            /*
             * 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));

            if (licenceType != "an agent")
            {
                // 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));

            if (licenceType != "an agent")
            {
                // 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("mat-checkbox[formcontrolname='transferConsent']"));

            uiConsentToTransfer.Click();

            // click on authorize signature checkbox
            NgWebElement uiAuthorizeSignature = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='authorizedToSubmit']"));

            uiAuthorizeSignature.Click();

            // click on signature agreement checkbox
            NgWebElement uiSignatureAgreement = ngDriver.FindElement(By.CssSelector("mat-checkbox[formcontrolname='signatureAgreement']"));

            uiSignatureAgreement.Click();

            // click on submit transfer button
            NgWebElement uiSubmitTransferButton = ngDriver.FindElement(By.CssSelector("app-application-ownership-transfer button.btn-primary"));

            uiSubmitTransferButton.Click();

            ClickLicencesTab();
        }