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(); }
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"); }
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); } } } }