예제 #1
0
        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);
        }
예제 #2
0
 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);
 }
예제 #3
0
        public void SearchWithoutEnteringInformationTest()
        {
            HomePage         homePage          = new HomePage(driver);
            SelectFlightPage selectFlightsPage = homePage
                                                 .AcceptCookie()
                                                 .ClickTicketsSearchButton();

            Assert.AreEqual(homePage.GetToErrorMessageText(), ERROR_TEXT_IF_ENTERED_INCORRECTLY);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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());
        }
예제 #6
0
        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));
        }
예제 #7
0
        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());
        }
예제 #8
0
        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());
        }
예제 #9
0
        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());
        }
예제 #10
0
        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));
        }
예제 #11
0
        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));
        }