Ejemplo n.º 1
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 CareRequestPageTest()
        {
            var person = new Person();

            person.SeedRandomData();


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

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

                var careRequestPage = new CareRequestPage(driver);
                careRequestPage.FillOutContactInformation(person);

                careRequestPage.RequestCatCare("3");

                //Choose number of visit per day
                var daysTotal = driver.FindElement(By.Id("visitSeveralTimesPerDay"));
                daysTotal.Click();

                //Choose how many times per day
                var timesPerDay = new SelectElement(driver.FindElement(By.Id("visitsPerDay")));
                timesPerDay.SelectByText("4");

                //Type additionl comments
                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();

                Thread.Sleep(1000);

                var closeButton = driver.FindElementByXPath("//button[.='Close']");
                var modal       = driver.FindElement(By.ClassName("modal-body"));
                var modalText   = modal.Text;
                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}");

                closeButton.Click();
            }
        }
Ejemplo n.º 3
0
        public void CareRequestPageTest()
        {
            var testPhoneNumber = "7733969481";
            var testEmail       = "*****@*****.**";
            var firstNameValue  = "iryna";
            var lastNameValue   = "Lemeha";

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

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

                var careRequestPage = new CareRequestPage(driver);
                careRequestPage.FillOutContactInformation(firstNameValue, lastNameValue, testPhoneNumber, testEmail);

                careRequestPage.RequestCatCare("3+");
                careRequestPage.RequestOtherCare("2");
                careRequestPage.SetVisitsPerDay(2);
                careRequestPage.FillOutComments("Hello World");
                careRequestPage.ClickRequestButton();
                careRequestPage.GetHeaderText();



                Thread.Sleep(1000);

                var closeButton = driver.FindElementByXPath("//button[.='Close']");


                var modal     = driver.FindElement(By.ClassName("modal-body"));
                var modalText = modal.Text;
                Console.WriteLine(modalText);
                modalText.ShouldContain($"Phone #: {testPhoneNumber}");
                modalText.ShouldContain($"Email: {testEmail}");
                modalText.ShouldContain($"First Name: {firstNameValue}");
                modalText.ShouldContain($"Last Name: {lastNameValue}");

                closeButton.Click();
            }
        }