示例#1
0
        public static void GoTo(TestEnvironment env, string customUrl)
        {
            Logger.AddCustomMsg("Goto ", env.ToString(), " environment");

            switch (env)
            {
            case TestEnvironment.Local:
                Driver.Instance.Navigate().GoToUrl(customUrl);
                break;

            case TestEnvironment.Dev:
                Driver.Instance.Navigate().GoToUrl("http://trunk.betabeds.com");
                break;

            case TestEnvironment.QA:
                Driver.Instance.Navigate().GoToUrl("http://qa.betabeds.com");
                break;

            case TestEnvironment.Staging:
                Driver.Instance.Navigate().GoToUrl("http://staging.betabeds.com");
                break;

            case TestEnvironment.Live:
                Driver.Instance.Navigate().GoToUrl("http://betabeds.com");
                break;
            }
            Guids.SearchGuid    = null;
            Guids.ValuationGUID = null;
            Guids.pageUrl       = PageFunctions.GetUrl();
        }
示例#2
0
 internal static void WaitForLoad()
 {
     Driver.WaitForAjax();
     Guids.SearchGuid = PageFunctions.GetSearchGUID();
     Guids.pageUrl    = PageFunctions.GetUrl();
     Driver.FindElementWithTimeout(By.Id("accommodationresultspage"), 40, "Accommodation result page not displayed in 40 secs");
 }
示例#3
0
 public void Continue()
 {
     foreach (Room room in this.rooms)
     {
         if (this.rooms.IndexOf(room) > 0)
         {
             EstablishmentPage.SelectRoomTab(room.roomNumber);
             if (room.availableRoomNumber != 0)
             {
                 EstablishmentPage.SelectRoomByNumber(room.availableRoomNumber);
             }
             Driver.WaitForAjax();
             Driver.Wait(TimeSpan.FromSeconds(1));
             EstablishmentPage.ClickContinueButton();
             try
             {
                 PageFunctions.WaitForLoad("agentpaymentpage", "Payment page not displayed in 40 secs");
             }
             catch (Exception ex)
             {
                 Guids.SearchGuid = PageFunctions.GetSearchGUID();
                 Guids.pageUrl    = PageFunctions.GetUrl();
                 ReadOnlyCollection <IWebElement> ErrMsgsDivs = Driver.Instance.FindElements(By.CssSelector("div.box-header h4.box-heading"));
                 IWebElement displayedErrMsg;
                 try
                 {
                     displayedErrMsg = ErrMsgsDivs.First(i => i.Displayed);
                 }
                 catch
                 {
                     throw ex;
                 }
                 if (displayedErrMsg.Text.Trim() == "Hotel unavailable")
                 {
                     throw new Exception(string.Format("Selected Hotel room(s) are fully booked for the dates selected."));
                 }
                 if (displayedErrMsg.Text.Trim() == "No results found")
                 {
                     throw new Exception(string.Format("For Selected Hotel 'No results found' error message is displayed."));
                 }
                 if (displayedErrMsg.Text.Trim() == "Room unavailable")
                 {
                     throw new Exception(string.Format("For Room Number {0} selected room {1} is no longer available.", room.roomNumber, room.availableRoomNumber));
                 }
                 throw ex;
             }
         }
         else
         {
             if (room.availableRoomNumber != 0)
             {
                 EstablishmentPage.SelectRoomByNumber(room.availableRoomNumber);
             }
         }
     }
 }
示例#4
0
        public void Search()
        {
            if (destination != null)
            {
                HomePage.TypeDestination(this.destination, this.IsHotel);
            }

            if (fromDate != null)
            {
                HomePage.SelectCheckIn(this.fromDate);
            }

            if (toDate != null)
            {
                HomePage.SelectCheckOut(toDate);
            }

            PassangerPopUpBox.Open();

            foreach (Room room in this.rooms)
            {
                if (this.rooms.IndexOf(room) > 0)
                {
                    PassangerPopUpBox.ClickAddAnotherRoom();
                }
                if (room.noOfAdults != 0)
                {
                    PassangerPopUpBox.SelectAdults(room.noOfAdults, this.rooms.IndexOf(room));
                }
                if (room.noOfChildren != 0)
                {
                    PassangerPopUpBox.SelectChildren(room.noOfChildren, room.childrenAges, this.rooms.IndexOf(room));
                }
            }

            PassangerPopUpBox.SaveChanges();

            HomePage.ClickSearchButton();

            if (IsHotel)
            {
                try
                {
                    PageFunctions.WaitForLoad("establishmentpage", "Establishment page not displayed in 40 secs");
                }
                catch (Exception ex)
                {
                    ReadOnlyCollection <IWebElement> ErrMsgsDivs = Driver.Instance.FindElements(By.CssSelector("div.box-header h4.box-heading"));
                    IWebElement displayedErrMsg;
                    try
                    {
                        displayedErrMsg = ErrMsgsDivs.First(i => i.Displayed);
                    }
                    catch
                    {
                        throw ex;
                    }
                    if (displayedErrMsg.Text.Trim() == "Hotel unavailable")
                    {
                        throw new Exception(string.Format("Selected Hotel {0} is fully booked for the dates {1} to {2}.", this.destination, this.fromDate, this.toDate));
                    }
                    if (displayedErrMsg.Text.Trim() == "No results found")
                    {
                        throw new Exception(string.Format("For Selected Hotel {0} between {1} to {2} dates 'No results found' error message is displayed.", this.destination, this.fromDate, this.toDate));
                    }
                    throw ex;
                }
            }
            else
            {
                try
                {
                    PageFunctions.WaitForLoad("accommodationresultspage", "Accommodation result page not displayed in 40 secss");
                }
                catch (Exception ex)
                {
                    ReadOnlyCollection <IWebElement> ErrMsgsDivs = Driver.Instance.FindElements(By.CssSelector("div.box-header h4.box-heading"));
                    IWebElement displayedErrMsg;
                    try
                    {
                        displayedErrMsg = ErrMsgsDivs.First(i => i.Displayed);
                    }
                    catch
                    {
                        throw ex;
                    }
                    displayedErrMsg = ErrMsgsDivs.First(i => i.Displayed);
                    if (displayedErrMsg.Text.Trim() == "No results found")
                    {
                        throw new Exception(string.Format("For Selected destination {0} between {1} to {2} dates 'No results found' error message is displayed.", this.destination, this.fromDate, this.toDate));
                    }
                    throw ex;
                }
            }
        }