static public void TestCase1(IWebDriver driver) { // Test Data string Username = "******"; string Password = "******"; bool OneWay = true; string CityFrom = "Sydney"; string CityTo = "London"; string Class = "First"; string FirstName = "James"; string LastName = "Smith"; string CCNum = "12345678"; int DepartureFlightNum = 362; int ArrivalFlightNum = 630; LoginPage LoginPage = new LoginPage(driver); FlightFinderPage FlightFinderPage = new FlightFinderPage(driver); SelectFlightPage SelectFlightPage = new SelectFlightPage(driver); BookFlightPage BookFlightPage = new BookFlightPage(driver); FlightCongirmationPage FlightConfirmationPage = new FlightCongirmationPage(driver); driver.Navigate().GoToUrl("http://newtours.demoaut.com/"); LoginPage.Login(Username, Password); FlightFinderPage.FindFlights(OneWay, CityFrom, CityTo, Class); SelectFlightPage.SelectFlightNumbers(DepartureFlightNum, ArrivalFlightNum); BookFlightPage.EnterDetails(FirstName, LastName, CCNum); FlightConfirmationPage.VerifyDepartureDetails(CityFrom, CityTo, DepartureFlightNum, Class); FlightConfirmationPage.VerifyArrivalDetails(CityTo, CityFrom, ArrivalFlightNum, Class); }
public void LaunchBrowser() { driver = Utils.Utils.OpenBrowser("http://newtours.demoaut.com/mercurypurchase.php", "chrome"); loginPage = new LoginPage(driver); findFlightPage = new FindFlightPage(driver); selectFlightPage = new SelectFlightPage(driver); bookFlightPage = new BookFlightPage(driver); confirmationPage = new ConfirmationPage(driver); }
public void SearchWithoutEnteringInformationTest() { HomePage homePage = new HomePage(driver); SelectFlightPage selectFlightsPage = homePage .AcceptCookie() .ClickTicketsSearchButton(); Assert.AreEqual(homePage.GetToErrorMessageText(), ERROR_TEXT_IF_ENTERED_INCORRECTLY); }
public void TicketSearchWithoutCityOfArrival() { HomePage homePage = new HomePage(); SelectFlightPage selectFlightPage = homePage .EnterDepartureCity(new RouteCreator().WithAllProperties()) .ChooseOneWayRoute() .OpenCalendar() .ChooseDepartDate(new RouteCreator().WithAllProperties()) .ClickSearchButton(); Assert.AreEqual(url, DriverSingleton.GetDriver().Url); }
public void EnterTheSamePointOfDepartureAndArrival() { HomePage homePage = new HomePage(driver); SelectFlightPage selectFlightPage = homePage .ClearDepartureCity() .InputDepartureCity("Moscow") .InputArrivalCity("Moscow") .ClickOneWayLabel() .InputLeaveDate("12/24") .ClickTicketsSearchButton(); Assert.AreEqual(ERROR_TEXT_WHEN_ENTERING_SAME_CITY_OF_DEPARTURE_AND_ARRIVAL, homePage.GetErrorMessage()); }
public void EnterTheSamePointOfDepartureAndArrival() { HomePage homePage = new HomePage(); SelectFlightPage selectFlightPage = homePage .EnterDepartureCity(new RouteCreator().WithAllProperties()) .EnterArrivalCity(new RouteCreator().WithAllProperties()) .ChooseOneWayRoute() .OpenCalendar() .ChooseDepartDate(new RouteCreator().WithAllProperties()) .ClickSearchButton(); Assert.AreEqual(ErrorMessage.ERROR_TEXT_IF_ENTERED_SAME_CITIES, homePage.GetErrorMessage(ErrorMessage.ERROR_TEXT_IF_ENTERED_SAME_CITIES)); }
public void SearchingTicketForOneAdultAndTwoInfants() { HomePage homePage = new HomePage(driver); SelectFlightPage selectFlightPage = homePage .ClearDepartureCity() .InputDepartureCity("Auckland") .InputArrivalCity("Sydney") .ClickOneWayLabel() .ClickAddInfantsButton() .InputLeaveDate("12/24") .ClickTicketsSearchButton(); Assert.AreEqual(ERROR_TEXT_WHEN_SEARCHING_TICKET_FOR_ONE_ADULT_AND_TWO_INFANTS, homePage.GetSecondErrorMessage()); }
public void SearchForTicketFromUnspecifiedTheDateOfDeparture() { RouteCreator routeCreator = new RouteCreator(); HomePage homePage = new HomePage(driver); SelectFlightPage selectFlightPage = homePage .AcceptCookie() .EnterDepartureCity(routeCreator.WithAllProperties()) .EnterArrivalCity(routeCreator.WithAllProperties()) .SelectOneWayRoute() .EnterOneWayLeaveDate(routeCreator.WithEmptyLeaveData()) .ClickTicketsSearchButton(); Assert.AreEqual(ERROR_TEXT_IF_ENTERED_INCORRECTLY, homePage.GetLeaveDateErrorMessageText()); }
public void SearchingTicketForOneAdultAndTwoInfants() { RouteCreator routeCreator = new RouteCreator(); HomePage homePage = new HomePage(driver); SelectFlightPage selectFlightPage = homePage .AcceptCookie() .EnterDepartureCity(routeCreator.WithAllProperties()) .EnterArrivalCity(routeCreator.WithAllProperties()) .SelectOneWayRoute() .EnterOneWayLeaveDate(routeCreator.WithAllProperties()) .ClickAddInfantsButton(2) .ClickTicketsSearchButton(); Assert.AreEqual(ERROR_TEXT_WHEN_SEARCHING_TICKET_FOR_ONE_ADULT_AND_TWO_INFANTS, homePage.GetPaxCountsErrorMessageText()); }
public void TicketSearchForOneAdultAndOneChildWithoutIndicatingHisAge() { HomePage homePage = new HomePage(); SelectFlightPage selectFlightPage = homePage .EnterDepartureCity(new RouteCreator().WithAllProperties()) .EnterArrivalCity(new RouteCreator().WithAllProperties()) .ChooseOneWayRoute() .OpenCalendar() .ChooseDepartDate(new RouteCreator().WithAllProperties()) .OpenPassengerInformation() .AddChildPassengers(1) .ClickDoneButton() .ClickSearchButton(); Assert.AreEqual(ErrorMessage.ERROR_TEXT_IF_NOT_SPECIFIED_AGE_OF_CHILD, homePage.GetErrorMessage(ErrorMessage.ERROR_TEXT_IF_NOT_SPECIFIED_AGE_OF_CHILD)); }
public void TicketSearchForOneAdultAndTwoChildrenUnderTwoYearsOld() { HomePage homePage = new HomePage(); SelectFlightPage selectFlightPage = homePage .EnterDepartureCity(new RouteCreator().WithAllProperties()) .EnterArrivalCity(new RouteCreator().WithAllProperties()) .ChooseOneWayRoute() .OpenCalendar() .ChooseDepartDate(new RouteCreator().WithAllProperties()) .OpenPassengerInformation() .AddChildPassengers(2) .SetAllAge("1") .ClickDoneButton() .ClickSearchButton(); Assert.AreEqual(ErrorMessage.ERROR_TEXT_IF_ONE_ADULT_AND_TWO_CHILDREN, homePage.GetErrorMessage(ErrorMessage.ERROR_TEXT_IF_ONE_ADULT_AND_TWO_CHILDREN)); }