public void ChangeResource()
        {
            utilities.ConsoleMessageStart();

            utilities.extenttest = utilities.extent.StartTest("ChangeResource");
            //  utilities.extenttest = utilities.extent.StartTest("Find Resource");

            login.NavigateTo();
            login.LoginSuccess();
            login.Wait();
            Thread.Sleep(4000);
            homepage.SelectResource();
            Thread.Sleep(2000);
            homepage.NextButton();
            login.Wait();
            Thread.Sleep(2500);
            bookings.BookingTitle();
            //homepage.NextButton();
            login.Wait();
            Thread.Sleep(4000);
            editbooking.CloseButton();
            Thread.Sleep(3000);
            mybooking.MyBookingsEnter();
            login.Wait();
            Thread.Sleep(5000);
            editbooking.EditBookingPencil();
            login.Wait();
            Thread.Sleep(4000);
            editbooking.EditBookingBurgerButton();
            Thread.Sleep(4000);
            editbooking.EditResourceDropdownSelectChangeResource();
            login.Wait();
            Thread.Sleep(4500);
            editbooking.ChangeResourceBTN();
            Thread.Sleep(4000);
            editbooking.Finding();
            Thread.Sleep(6000);
            editbooking.ExactMatchSelect();
            Thread.Sleep(3000);
            homepage.NextButton();
            Thread.Sleep(4000);
            //editbooking.Next();
            // homepage.NextButton();
            Thread.Sleep(4000);
            login.Wait();
            //editbooking.Finish();
            editbooking.FinishBTN();
            //EditBooking.CloseButton();
            // homepage.NextButton();

            // editbooking.EditBookingResource();

            /* Assert.IsTrue(driver.FindElement(By.XPath("//*[@id='tblResourcesGrid']/tbody/tr[2]/td")).Displayed);
             * utilities.extenttest.Log(LogStatus.Pass, "Assert pass ");
             * utilities.extenttest.Log(LogStatus.Info, "Test");*/
        }
예제 #2
0
 public void NavigateToBookingSummaryPage()
 {
     utilities.ConsoleMessageStart();
     utilities.extenttest = utilities.extent.StartTest("Navigate Ti Booking Summary Page");
     utilities.extenttest.AssignCategory("Booking Tests");
     login.NavigateTo();
     login.LoginSuccess();
     Thread.Sleep(4000);
     homepage.SelectResource();
     attendee.AddingInternalAttendee();
     homepage.NextButton();
     Thread.Sleep(3000);
     Assert.IsTrue(driver.FindElement(By.XPath("//*[@id='step4ConfirmBooking']/div/form")).Displayed);
     utilities.extenttest.Log(LogStatus.Pass, "Assert pass ");
 }
예제 #3
0
        public void Case3615()
        {
            utilities.ConsoleMessageStart();
            utilities.extenttest = utilities.extent.StartTest("TFS Case 3615 Cancel Popup not displaying properly");
            utilities.extenttest.AssignCategory("Case 3615. Cancel Popup");
            login.NavigateTo();
            login.LoginSuccess();
            Thread.Sleep(4000);
            homepage.SelectResource();
            login.Wait();
            attendees.AddingInternalAttendee();
            Thread.Sleep(2000);
            homepage.NextButton();
            Thread.Sleep(2000);
            booking.BookingTitle();
            var refnumber = this.driver.FindElement(By.XPath("//*[@id='page-wrap']/section[2]/div[1]/div/div[3]/span")).Text;

            Console.WriteLine(refnumber);
            mybookings.MyBookingsSelect();
            Thread.Sleep(3000);

            //Querying DB to get BookingID which is linked with cancel button on the page.
            utilities.DBConnect("SELECT BookingID, StartTime FROM [Booking] where ReferenceNumber = '" + refnumber + "'");
            Thread.Sleep(2000);
            string S1 = utilities.data[0];
            string S2 = utilities.data[1];

            Console.WriteLine("Test: " + S1);
            Console.WriteLine("Booking Date : " + S2);

            DateTime Date  = Convert.ToDateTime(S2);
            string   date  = Date.ToShortDateString();
            int      month = Date.Month;

            Console.WriteLine(date);
            Console.WriteLine(month);

            DateTime TodayDate  = DateTime.Now;
            int      TodayMonth = TodayDate.Month;

            Console.WriteLine("Current Month : " + TodayMonth);


            //Passing Text inside Text Box with JavascriptExecutor
            IWebElement         element = driver.FindElement(By.CssSelector(".mybooking-calendar .text-box"));
            IJavaScriptExecutor jse     = (IJavaScriptExecutor)driver;

            jse.ExecuteScript("arguments[0].value='" + S2 + "';", element);

            driver.FindElement(By.CssSelector(".mybooking-calendar .text-box")).SendKeys(Keys.Enter);

            Thread.Sleep(2000);

            this.driver.FindElement(By.XPath("//*[@id='page-wrap']/section[3]/span[1]")).Click();


            //Try and catch block. When try element is not found. No such element expection is thrown and then changing the page number and going through the whole processs again.
            try
            {
                IJavaScriptExecutor ex1 = (IJavaScriptExecutor)driver;
                ex1.ExecuteScript("arguments[0].click();", driver.FindElement(By.XPath("//*[@data-id='" + S1 + "']")));
            }
            catch (NoSuchElementException e)
            {
                IList <IWebElement>       se         = driver.FindElements(By.XPath("//*[@id='customPageList']/div/ul/li"));
                IEnumerator <IWebElement> enumerator = se.GetEnumerator();

                bool hasNext = enumerator.MoveNext();

                while (hasNext)
                {
                    login.Wait();

                    int c = se.Count;

                    this.driver.FindElement(By.XPath("//*[@id='customPageList']/div/ul/li[" + c + "]/a")).Click();

                    Thread.Sleep(2000);

                    try
                    {
                        IJavaScriptExecutor ex1 = (IJavaScriptExecutor)driver;
                        ex1.ExecuteScript("arguments[0].click();", driver.FindElement(By.XPath("//*[@data-id='" + S1 + "']")));

                        var abc = this.driver.FindElement(By.XPath("//*[@id='ConfirmationModal']/div"));

                        if (abc.Displayed)
                        {
                            break;
                        }
                    }
                    catch (NoSuchElementException e2)
                    {
                        hasNext = enumerator.MoveNext();
                    }
                }
                enumerator.Dispose();
            }

            var confirmText = this.driver.FindElement(By.XPath("//*[@id='ConfirmationModal']/div[1]"));

            var CancelText = this.driver.FindElement(By.XPath("//*[@id='myBookingdialog']/div[1]"));

            //If Confirmation box contains the ref number then click on yes. If cancel text contains Ref number then click on OK.
            if (confirmText.Text.Contains(refnumber))
            {
                mybookings.YesBTN();

                if (CancelText.Text.Contains("Booking with reference number " + refnumber + " cancelled successfully"))
                {
                    mybookings.SelectOK();
                    Console.WriteLine("Booking Cancelled Successfully");
                    utilities.extenttest.Log(LogStatus.Pass, "Assert pass ");
                }
            }
            //If
            else
            {
                Console.WriteLine("Reference numnber doesn't match");
                Assert.Fail();
            }
        }