//Select enviorment to run the automation tests public static void Navigate(TestEnvironment Env) { switch (Env) { case TestEnvironment.Live: //Capture Page Load Times NonFunctionalReq.CaptureTime(() => Driver.Instance.Navigate().GoToUrl("https://www.alpharooms.com"), "Landing Page load time is"); break; case TestEnvironment.Staging: //Capture Page Load Times NonFunctionalReq.CaptureTime(() => Driver.Instance.Navigate().GoToUrl("https://no.staging.alpharooms.com/"), "Landing Page load time is"); break; case TestEnvironment.QA: //Capture Page Load Times NonFunctionalReq.CaptureTime(() => Driver.Instance.Navigate().GoToUrl("http://flightshotfix.alpha2.com/"), "Landing Page load time is"); break; case TestEnvironment.SOAFlights: //Capture Page Load Times NonFunctionalReq.CaptureTime(() => Driver.Instance.Navigate().GoToUrl("http://flights3.alpha2.com/"), "Landing Page load time is"); break; } Logger.Clear(); HomePage.ResetData(); FlightResultsPage.ResetData(); HotelResultsPage.ResetData(); HotelDetailPage.ResetData(); ExtrasPage.ResetData(); InsurancePage.ResetData(); PaymentPage.ResetData(); }
public static void ClickSearch() { Logger.AddClickAction("Search"); //click search button GetSearchButton().Click(); //capture the page load time HomePage.Data.SearchTime = NonFunctionalReq.CaptureTime(() => Driver.Instance.FindElementWithTimeout(By.CssSelector("div.row-fluid a.pull-left div.logo"), 65, "Result page is not displayed within 60 Sec"), "Search Page load time is"); switch (HomePage.Data.SearchOption) { case SearchOption.FlightOnly: //Wait for java script to load FlightResultsPage.WaitToLoad(); break; case SearchOption.HotelOnly: //Wait for java script to load HotelResultsPage.WaitToLoad(); break; case SearchOption.FlightAndHotel: //Wait for java script to load FlightResultsPage.WaitToLoad(); break; } }
public void ClickShowPricesAndCapture() { Logger.AddClickAction("Show Prices"); IWebElement showPrices = Driver.Instance.FindElement(By.CssSelector("div.span12 button[class='btn btn-orange pull-right search-btn-wide']")); showPrices.Click(); data.SearchTime = NonFunctionalReq.CaptureTime(() => Driver.Instance.FindElementWithTimeout(By.CssSelector("div.row-fluid a.pull-left div.logo"), 60, "Result page is not displayed within 60 Sec"), "Search Page load time is"); }
public static void ClickConfirmAndCapture() { Logger.AddClickAction("ConfirmAndCapture"); //click confirm button var confirmBtn = Driver.Instance.FindElement(By.Id("submitPaymentButton")); confirmBtn.Click(); //capture the page load time NonFunctionalReq.CaptureTime(() => Driver.Instance.FindElementWithTimeout(By.Id("threedspage"), 40, "3DS Page not loaded within 60 sec"), "3DS Page load time is"); //capture screenshot NonFunctionalReq.GetScreenShot("3DS Page"); }
//public static void CheckAndConfirm() //{ // Logger.AddTypeAction("PostCode", postCode); // var paymentOptionDiv = Driver.Instance.FindElement(By.CssSelector("div#paymentpage.container form div.row-fluid div.span10")); // var paymentOptionChkBox = paymentOptionDiv.FindElement(By.TagName("span")); // paymentOptionChkBox.Click(); // var confirmBtn = Driver.Instance.FindElement(By.Id("submitPaymentButton")); // confirmBtn.Click(); //} //public static void CheckConfirmAndCapture() //{ // var paymentOptionDiv = Driver.Instance.FindElement(By.CssSelector("div#paymentpage.container form div.row-fluid div.span10")); // var paymentOptionChkBox = paymentOptionDiv.FindElement(By.TagName("span")); // paymentOptionChkBox.Click(); // //click search button // var confirmBtn = Driver.Instance.FindElement(By.Id("submitPaymentButton")); // confirmBtn.Click(); // if (Check3DSPage()) // {} // else if (CheckCardDecline()) // {} // else if (CheckConfirmationMsg()) // { } // else throw new Exception("None of the following outcomes are presented as a result of the booking (3DS Page, Card Decline or Payment Confirmation)"); // NonFunctionalReq.GetScreenShot("Booking Confirmation Page"); //} public static bool Validate3DSPage() { try { //capture the page load time NonFunctionalReq.CaptureTime(() => Driver.Instance.FindElementWithTimeout(By.Id("threedspage"), 40, "3Ds Page is not loaded within 60 Sec"), "3DS Page load time is"); Driver.Instance.SwitchTo().Frame("iframe3DS"); return(true); //Driver.Instance.FindElement(By.Name("continue")).Click(); } catch { return(false); } }
//Select enviorment to run the automation tests public static void Navigate(AdminPanelEnviorment Env) { switch (Env) { case AdminPanelEnviorment.Live: //Capture Page Load Times NonFunctionalReq.CaptureTime(() => Driver.Instance.Navigate().GoToUrl("http://adminpanel/"), "AdminPanel Page load time is"); break; case AdminPanelEnviorment.Test: //Capture Page Load Times NonFunctionalReq.CaptureTime(() => Driver.Instance.Navigate().GoToUrl("http://adminpanel.alpha2.com/"), "AdminPanel Page load time is"); break; } }
public static void ClickFlightAndCapture(int flightNumber) { if (flightNumber < 1) { throw new ArgumentOutOfRangeException("flightNumber", flightNumber, "The flight number must be 1 or higher."); } Logger.AddClickAction("FlightAndCapture", "FlightNumber", flightNumber); SaveSearchGUID(); SaveFlightData(flightNumber); IWebElement flightBookNowBtn = GetAvailableFlightButton(flightNumber); NonFunctionalReq.ExecuteAndRetry(() => flightBookNowBtn.Click(), "Selected flight is Ryanair."); //capture screenshot try { if (HomePage.Data.SearchOption == SearchOption.FlightOnly) { ExtrasPage.WaitForLoad(); //capture screenshot //NonFunctionalReq.GetScreenShot("Hotel Booking Summary Page"); } else if (HomePage.Data.SearchOption == SearchOption.FlightAndHotel) { HotelResultsPage.WaitToLoad(); //capture screenshot //NonFunctionalReq.GetScreenShot("Hotel Booking Summary Page"); } } catch (Exception ex) { if (Driver.Instance.IsElementDisplayedBy(By.CssSelector("div.alert h4"))) { throw new Exception(string.Format("Flight Number {0} is no longer available.", flightNumber)); } if (Driver.Instance.IsElementDisplayedBy(By.Id("search-timeout"))) { throw new Exception(string.Format("Sun Error Page is displayed for Flight Number {0}", flightNumber)); } throw ex; } }
public static void ClickSearchAndCapture() { Logger.AddClickAction("SearchAndCapture"); //click search button GetSearchButton().Click(); //capture the page load time HomePage.Data.SearchTime = NonFunctionalReq.CaptureTime(() => Driver.Instance.FindElementWithTimeout(By.Id("filtersDialog"), 60, "Result page is not displayed within 60 Sec"), "Search Page load time is"); switch (HomePage.Data.SearchOption) { case SearchOption.FlightOnly: //Wait for java script to load FlightResultsPage.WaitToLoad(); //capture screenshot //NonFunctionalReq.GetScreenShot("Hotel Booking Summary Page"); break; case SearchOption.HotelOnly: //Wait for java script to load HotelResultsPage.WaitToLoad(); //capture screenshot //NonFunctionalReq.GetScreenShot("Hotel Booking Summary Page"); break; case SearchOption.FlightAndHotel: //Wait for java script to load FlightResultsPage.WaitToLoad(); //capture screenshot //NonFunctionalReq.GetScreenShot("Hotel Booking Summary Page"); break; } }
internal static void WaitToLoad() { HotelResultsPage.ResetData(); HotelResultsPage.Data.LoadingTime = NonFunctionalReq.CaptureTime(() => Driver.Instance.WaitForAjax(), "Hotel Result Page Rendering Time"); }
internal static void WaitForLoad() { ConfirmationPage.ResetData(); NonFunctionalReq.CaptureTime(() => Driver.Instance.FindElementWithTimeout(By.Id("accordion-Flight"), 60, "Conformation Page not loaded within 60 sec"), "Conformation page load time is"); }
internal static void WaitForLoad() { HotelDetailPage.ResetData(); HotelDetailPage.Data.LoadingTime = NonFunctionalReq.CaptureTime(() => Driver.Instance.FindElementWithTimeout(By.Id("establishmentpage"), 60, "Hotel Details Page not loaded within 60 sec"), "Hotel details page load time is"); }
internal static void WaitToLoad() { FlightResultsPage.ResetData(); //Wait for java script to load FlightResultsPage.Data.LoadingTime = NonFunctionalReq.CaptureTime(() => Driver.Instance.WaitForAjax(), "Flight Result Page Rendering Time"); }
internal static void WaitForLoad() { PaymentPage.ResetData(); NonFunctionalReq.CaptureTime(() => Driver.Instance.FindElementWithTimeout(By.Id("submitPaymentButton"), 60, "Payment Page not loaded within 60 sec"), "Payment page load time is"); }
public static bool AreResultsDisplayed(Extras extras) { switch (extras) { case Extras.HoldLuggage: try { Driver.Instance.FindElementWithTimeout(By.CssSelector("div#extras-transfers.extra div#extrasTransfers.collapse div.results table[style='']"), 0, "No results displayed for Airport extra").Click(); return(true); } catch { return(false); } case Extras.FlightExtra: try { Driver.Instance.FindElementWithTimeout(By.CssSelector("div#extras-transfers.extra div#extrasTransfers.collapse div.results table[style='']"), 0, "No results displayed for Airport extra").Click(); return(true); } catch { return(false); } case Extras.AirportTransfer: try { Driver.Instance.FindElementWithTimeout(By.CssSelector("div#extras-transfers.extra div#extrasTransfers.collapse div.results table[style='']"), 0, "No results were available for Airport Transfer extra").Click(); return(true); } catch { return(false); } case Extras.CarHire: try { Driver.Instance.FindElementWithTimeout(By.CssSelector("div#extras-carhire.extra div#extrasCarHire.in div.results p[style='']"), 0, "Car Hire extra is not avaialable"); return(false); } catch (Exception) { NonFunctionalReq.CaptureTime(() => Driver.Instance.FindElementWithTimeout(By.CssSelector("div#extrasCarHire.in div.results table[style='']"), 30, "No results were available for Car Hire extra in 30 secs"), "Car Hire load time is"); return(true); } case Extras.AirportParking: try { Driver.Instance.FindElementWithTimeout(By.CssSelector("div#extrasAirportParking.in div.results table[style='']"), 0, "No results were available for Airport Parking extra"); return(true); } catch { return(false); } default: return(false); } }
internal static void WaitForLoad() { ExtrasPage.ResetData(); ExtrasPage.Data.LoadingTime = NonFunctionalReq.CaptureTime(() => Driver.Instance.FindElementWithTimeout(By.Id("extraspage"), 60, "Extras Page not loaded within 60 sec"), "Booking Summary page load time is"); }
internal static void WaitForLoad() { AdminPanelPage.ResetData(); NonFunctionalReq.CaptureTime(() => Driver.Instance.FindElementWithTimeout(By.Id("gview_itineraryGrid"), 60, "Conformation Page not loaded within 60 sec"), "Conformation page load time is"); }