예제 #1
0
 private static void VerifyContactInformation(RequestSummaryPage requestSummaryPage, Person person)
 {
     requestSummaryPage.GetFirstName().ShouldBe(person.FirstName, "First name");
     requestSummaryPage.GetLastName().ShouldBe(person.LastName, "Last name");
     requestSummaryPage.GetPhoneNumber().ShouldBe(person.Phone, "Phone");
     requestSummaryPage.GetEmail().ShouldBe(person.Email, "Email");
 }
예제 #2
0
        public void CareRequest_Test()
        {
            IWebDriver driver = DriverUtils.CreateDriver();

            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
            TestWrapper.Test(driver, () =>
            {
                // Open Landing Page
                var landingPage = URLs.OpenUrl(driver);

                //Open Care Request page
                var careRequestPage = landingPage.ClickCareRequestLink();

                var customer     = new Person();
                var catsNumber   = "2";
                var otherNumber  = "3+";
                var visitsPerDay = "2";
                var comment      = "Please be quiet, our spiders are easily scared";

                //Fill out inputs
                careRequestPage.FillOutContactInformation(customer);

                //Click Animal Type checkboxes
                careRequestPage.RequestCatCare(catsNumber);
                careRequestPage.RequestOtherCare(otherNumber);

                //Visits per day
                careRequestPage.SetVisitsPerDay(visitsPerDay);

                //Comments
                careRequestPage.FillOutComments(comment);

                //Open Request summary page
                RequestSummaryPage requestSummaryPage = careRequestPage.ClickRequestButton();

                //Verify Page opened by checking page element is visible
                requestSummaryPage.IsSummaryBlockDisplayed().ShouldBeTrue("Summary Block is Displayed");

                //Verify Header text
                var header = requestSummaryPage.PageHeader.Text;
                header.ShouldBe("Request Summary", "Header");

                //Verify contact info
                VerifyContactInformation(requestSummaryPage, customer);

                //Verify all other information is populated correctly
                VerifyOtherInformation(requestSummaryPage, catsNumber, otherNumber, visitsPerDay, comment);
                string[] data = { $"{catsNumber} cat(s)", $"{otherNumber} other animal(s)", $"{visitsPerDay} visits per day are required.", comment };
                VerifyOtherInformationAlternative(requestSummaryPage, data);

                //Click Close button and verify the page was closed
                requestSummaryPage.CloseButton.Click();
                Thread.Sleep(1000);
                requestSummaryPage.IsSummaryBlockDisplayed().ShouldBeFalse("Summary Block is not displayed");
            });
        }
예제 #3
0
        private static void VerifyOtherInformationAlternative(RequestSummaryPage requestSummaryPage, string [] data)
        {
            var allText = requestSummaryPage.ModalContent.Text;

            for (var i = 0; i < data.Length; i++)
            {
                Logger.Log.Info("Checking presence of " + data[i]);
                allText.Contains(data[i]).ShouldBeTrue("");
            }
        }
예제 #4
0
        private static void VerifyOtherInformation(RequestSummaryPage requestSummaryPage, string catsNumber, string otherNumber,
                                                   string visitsPerDay, string comment)
        {
            var allText = requestSummaryPage.ModalContent.Text;

            allText.Contains($"{catsNumber} cat(s)").ShouldBeTrue("Cats number");
            allText.Contains($"{otherNumber} other animal(s)").ShouldBeTrue("Other Animals");
            allText.Contains($"{visitsPerDay} visits per day are required.").ShouldBeTrue("Visits per day");
            allText.Contains(comment).ShouldBeTrue("Comment");
        }
예제 #5
0
        public void CareRequestPageTest()
        {
            var person = new Person();



            using (var driver = new ChromeDriver())
            {
                driver.Navigate().GoToUrl("http://nitro.duckdns.org/Pets.QA/index.html");

                var navigationMenuPage = new NavigationMenuPage(driver);
                navigationMenuPage.OpenCareRequestPage();

                //Fill out form
                var careRequestPage = new CareRequestPage(driver);
                careRequestPage.FillOutContactInformation(person);
                //Choose a pet by checking checkbox , Choose amount of pets in the dropdown
                careRequestPage.RequestCatCare("3+");
                //Choose number of visit per day //Choose how many times per day
                careRequestPage.SetVisitsPerDay(4);

                //Type additionl comments
                careRequestPage.FillOutComments("I would like to hire a person for 1-2 years.");
                //var yourComments = driver.FindElement(By.Id("comments"));
                //yourComments.SendKeys("I would like to hire a person for 1-2 years.");

                //Submit your request
                //var requestButton = driver.FindElement(By.Id("requestButton"));
                //requestButton.Click();
                careRequestPage.ClickRequestButton();

                //var requestSummaryPage = new RequestSummaryPage();
                // var username = requestSummaryPage.GetUserName();
                // username.ShouldBe("Vova S");


                Thread.Sleep(1000);
                var requestSummaryPage = new RequestSummaryPage(driver);
                var modalText          = requestSummaryPage.GetModalText();


                Console.WriteLine(modalText);
                modalText.ShouldContain($"Phone #: {person.PhoneNumber}");
                modalText.ShouldContain($"Email: {person.Email}");
                modalText.ShouldContain($"First Name: {person.FirstName}");
                modalText.ShouldContain($"Last Name: {person.LastName}");

                requestSummaryPage.CloseModal();
            }
        }
        public void RequestSummaryPage()
        {
            using (var driver = new ChromeDriver())
            {
                driver.Navigate().GoToUrl("http://nitro.duckdns.org/Pets.QA/index.html");

                var navigationMenuPage = new NavigationMenuPage(driver);
                navigationMenuPage.OpenContactRequestPage();



                var requestSummaryPage = new RequestSummaryPage(driver);

                requestSummaryPage.ContactPageHeader().ShouldContain("Contact Me");


                requestSummaryPage.SubmitCareReuestForm();
            }
        }