예제 #1
0
        private void FillDetails(IWebDriver driver)
        {
            // Fill title field
            ElementMethods.SetText(driver, ElementSelectors.ByName, titleFieldName, userTitle);

            // Fill first name field
            ElementMethods.SetText(driver, ElementSelectors.ByName, firstnameFieldName, firstName);

            // Fill surname field
            ElementMethods.SetText(driver, ElementSelectors.ById, surnameFieldId, surname);

            // Fill Day of Birth field
            ElementMethods.SetDropdownOption(driver, ElementSelectors.ByName, bDayFieldName, dayOfBirth);

            // Fill Month of Birth field
            ElementMethods.SetDropdownOption(driver, ElementSelectors.ByName, bMonthFieldName, monthOfBirth);

            // Fill Year of Birth field
            ElementMethods.SetDropdownOption(driver, ElementSelectors.ByName, bYearFieldName, yearOfBirth);

            // Fill house name or number field
            ElementMethods.SetText(driver, ElementSelectors.ByName, houseFieldName, houseNameOrNumber);

            // Fill postcode field
            ElementMethods.SetText(driver, ElementSelectors.ByName, postcodeFieldName, postcode);

            // Fill Vehicle registration field
            //ElementMethods.SetText(driver, ElementSelectors.ByName, regFieldName, regFielValue); // does not affect the functionality in test
        }
예제 #2
0
        public void Test_Edge_Validations()
        {
            // Initialize Initiating IE webdriver which is copied by the package installer to the bi\Debug folder
            // If a different driver is required then the full path must be pased as a string parameter
            // Then add to the collection to be cleaned at the end of the test process
            IWebDriver driver = new EdgeDriver();

            drivers.Add(driver);

            // Navigate to target Url
            driver.Navigate().GoToUrl(targetUrl);

            // Logging test steps for debug
            Console.WriteLine("\nStart of Edge valuation Test:\n---------------------");

            // Fill first name with less than the required length
            ElementMethods.SetText(driver, ElementSelectors.ByName, firstnameFieldName, firstName.Substring(0, 1));

            // Fill surname  with less than the required length
            ElementMethods.SetText(driver, ElementSelectors.ById, surnameFieldId, surname.Substring(0, 1));

            // Submit the for by clicking on "continue" button
            ElementMethods.Click(driver, ElementSelectors.ByCssClass, continueButtonClass);

            // Title validation
            string errors = ElementMethods.CheckValidations(driver, validationClass, new string[] {
                titleFieldName,
                firstnameFieldName,
                surnameFieldId,
                dateOfBirthFields
            });

            Console.WriteLine($"Edge Validation errors:\n{errors}");
            Assert.IsEmpty(errors);
            // Address validators - House name or number
            string hVal = ElementMethods.GetContentText(driver, ElementSelectors.ByCssClass, houseValidationClass);

            Assert.IsNotNull(hVal);
            Assert.IsNotEmpty(hVal);
            // Address validators - Postcode
            string pVal = ElementMethods.GetContentText(driver, ElementSelectors.ByCssClass, pcodeValidationClass);

            Assert.IsNotNull(pVal);
            Assert.IsNotEmpty(pVal);

            // Logging the end of this test
            Console.WriteLine("End of Edge valuation Test\n---------------------");
        }