public void BeSubmittedWhenValidationErrorsCorrected()
        {
            using (IWebDriver driver = new ChromeDriver())
            {
                const string firstName  = "Rashiid";
                const string lastName   = "Jama";
                const string invalidAge = "17";
                const string validAge   = "23";
                const string number     = "123456-A";
                const string income     = "50000";

                var applicationPage = new ApplicationPage(driver);

                applicationPage.NavigateTo();

                applicationPage.EnterFirstName(firstName);

                // Not entering last name

                applicationPage.EnterFrequentFlyerNumber(number);

                applicationPage.EnterAge(invalidAge);

                applicationPage.EnterGrossAnnualIncome(income);

                applicationPage.ChooseMaritalStatusSingle();

                applicationPage.ChooseBusinessSourceIntenet();

                applicationPage.ClickAcceptTerms();

                applicationPage.SumbitApplication();

                // Asserting that validation failed

                Assert.Equal(2, applicationPage.ValidationErrorMessages.Count);

                Assert.Contains("Please provide a last name", applicationPage.ValidationErrorMessages);

                Assert.Contains("You must be at least 18 years old", applicationPage.ValidationErrorMessages);

                // Fix Errors
                applicationPage.EnterLastName(lastName);

                applicationPage.ClearAge();

                applicationPage.EnterAge(validAge);

                // Resubmit form
                ApplicationCompletePage applicationCompletePage = applicationPage.SumbitApplication();

                //applicationCompletePage.EnsurePageLoaded();
            }
        }
        public void BeSubmittedWhenValid()
        {
            using (IWebDriver driver = new ChromeDriver())
            {
                const string FirstName = "Rashiid";
                const string LastName  = "Jama";
                const string Number    = "123456-A";
                const string Age       = "23";
                const string Income    = "50000";

                var applicationPage = new ApplicationPage(driver);

                applicationPage.NavigateTo();

                applicationPage.EnterFirstName(FirstName);
                applicationPage.EnterLastName(LastName);
                applicationPage.EnterFrequentFlyerNumber(Number);
                applicationPage.EnterAge(Age);
                applicationPage.EnterGrossAnnualIncome(Income);
                applicationPage.ChooseMaritalStatusSingle();
                applicationPage.ChooseBusinessSourceIntenet();
                applicationPage.ClickAcceptTerms();

                ApplicationCompletePage applicationCompletePage = applicationPage.SumbitApplication();

                //applicationCompletePage.EnsurePageLoaded();

                Assert.Equal("ReferredToHuman", applicationCompletePage.Decision);
                Assert.NotEmpty(applicationCompletePage.ReferenceNumber);
                Assert.Equal($"{FirstName} {LastName}", applicationCompletePage.FullName);
                Assert.Equal(Age, applicationCompletePage.Age);
                Assert.Equal(Income, applicationCompletePage.Income);
                Assert.Equal("Single", applicationCompletePage.RelationShipStatus);
                Assert.Equal("Internet", applicationCompletePage.BusinessSource);
            }
        }
예제 #3
0
        public void GivenIAcceptTheTerms()
        {
            var applicationPage = new ApplicationPage(driver);

            applicationPage.ClickAcceptTerms();
        }