Ejemplo n.º 1
0
        public void Test_Edge()
        {
            // 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 Test:\n---------------------");

            // --- Fill form fields ---
            FillDetails(driver);

            // --- Address ---
            FillAddress(driver);

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

            // Check if the next page loaded successfuly
            ElementMethods.CheckLoadedPage(driver, ElementSelectors.ById, testElementId); // Edge is case-sensitive on selecting by text

            // Logging the end of this test
            Console.WriteLine("End of Edge Test\n---------------------");
        }
Ejemplo n.º 2
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
        }
Ejemplo n.º 3
0
        private void FillAddress(IWebDriver driver)
        {
            // Click on find address
            ElementMethods.Click(driver, ElementSelectors.ById, findAddrButtonId);
            // Pick "B G L Group" address from the list
            ElementMethods.PickAddress(driver, targetAddress);

            // Click on "change address"
            ElementMethods.Click(driver, ElementSelectors.ById, changeAddressButtonId);
            // Click on find address (with the same set values)
            ElementMethods.Click(driver, ElementSelectors.ById, findAddrButtonId);
            // Pick "B G L Group" address from the list
            ElementMethods.PickAddress(driver, targetAddress);
        }
Ejemplo n.º 4
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---------------------");
        }