Ejemplo n.º 1
0
        public void GetTicketsForAviacompanyTest()
        {
            TestWrapper(() =>
            {
                SearchRequestModel requestModel =
                    SearchRequestCreator.CreateSearchRequestModel();
                var aviacompanyTitle = new MainPage(_webDriver, LoggerConfiguration.Log)
                                       .OpenPage().ClickToAviacompanyButton().AviaCompanyTitle.Text;


                Assert.IsTrue(aviacompanyTitle.Equals("Купить авиабилеты Победа"));
            }, nameof(GetTicketsForAviacompanyTest));
        }
Ejemplo n.º 2
0
 public void MaxPassengersCountTest()
 {
     TestWrapper(() =>
     {
         SearchRequestModel requestModel =
             SearchRequestCreator.CreateSearchRequestModel();
         var passengersCountTest = new MainPage(_webDriver, LoggerConfiguration.Log)
                                   .OpenPage()
                                   .WriteIntoFromField(requestModel.From)
                                   .WriteIntoDestinationField(requestModel.To)
                                   .OpenDepartCalendar().SelectDepartDate(1)
                                   .OpenReturnCalendar().SelectReturnDate(7)
                                   .OpenPassengersControl().AddElderPassengers(10).ApplyPassengers().GetPassengersCount();
         Assert.AreNotEqual("10 пассажиров", passengersCountTest);
     }, nameof(MaxPassengersCountTest));
 }
Ejemplo n.º 3
0
 public void SearchTicketsWithOutReturnDateTest()
 {
     TestWrapper(() =>
     {
         SearchRequestModel requestModel =
             SearchRequestCreator.CreateSearchRequestModel();
         var searchResultPage = new MainPage(_webDriver, LoggerConfiguration.Log)
                                .OpenPage()
                                .WriteIntoFromField(requestModel.From)
                                .WriteIntoDestinationField(requestModel.To)
                                .OpenDepartCalendar().SelectDepartDate(1)
                                .OpenPassengersControl().AddElderPassengers(2).ApplyPassengers()
                                .ClickToSearchButton();
         Assert.IsTrue(requestModel.From.Contains(searchResultPage.FromPlace.Text));
         Assert.IsTrue(requestModel.To.Contains(searchResultPage.DestinationPlace.Text));
     }, nameof(SearchTicketsWithOutReturnDateTest));
 }
Ejemplo n.º 4
0
        public void SearchWithoutDestinationTest()
        {
            TestWrapper(() =>
            {
                SearchRequestModel requestModel =
                    SearchRequestCreator.CreateSearchRequestModel();
                MainPage mainPage = new MainPage(_webDriver, LoggerConfiguration.Log);
                var searchPage    =
                    mainPage
                    .OpenPage()
                    .WriteIntoFromField(requestModel.From)
                    .WriteIntoDestinationField("123")
                    .ClickToSearchButton();

                Assert.AreEqual("", searchPage.DestinationField.Text);
            }, nameof(SearchWithEqualDepartureAndDestinationPlaceTest));
        }
Ejemplo n.º 5
0
        public void SearchWithEqualDepartureAndDestinationPlace()
        {
            TestWrapper(() =>
            {
                SearchRequestModel requestModel =
                    SearchRequestCreator.CreateSearchRequestModelWithEqualFromAndDestinationProps();
                MainPage mainPage    = new MainPage(_webDriver, LoggerConfiguration.Log);
                var searchResultPage =
                    mainPage
                    .OpenPage()
                    .WriteIntoFromField(requestModel.From)
                    .WriteIntoDestinationField(requestModel.To)
                    .ClickToSearchButton();

                Assert.AreEqual(ExpectedErrorText, searchResultPage.ErrorMessage.Text);
            }, nameof(SearchWithEqualDepartureAndDestinationPlace));
        }
Ejemplo n.º 6
0
        public void GetTicketsWithOutDepartDateTest()
        {
            TestWrapper(() =>
            {
                SearchRequestModel requestModel =
                    SearchRequestCreator.CreateSearchRequestModel();
                var searchResultPage = new MainPage(_webDriver, LoggerConfiguration.Log)
                                       .OpenPage()
                                       .WriteIntoFromField(requestModel.From)
                                       .WriteIntoDestinationField(requestModel.To)
                                       .OpenDepartCalendar().SelectDepartDate(1)
                                       .OpenReturnCalendar().CancelDepartDate()
                                       .OpenPassengersControl().SelectBusinessClassTicketType().ApplyPassengers()
                                       .ClickToSearchButton();

                Assert.IsTrue(searchResultPage.AllTicketsWithoutDepartPart());
            }, nameof(GetTicketsWithOutDepartDateTest));
        }
Ejemplo n.º 7
0
        public void SearchTicketsWithWrongFromAndToPlacesTest()
        {
            TestWrapper(() =>
            {
                SearchRequestModel requestModel =
                    SearchRequestCreator.CreateSearchRequestModel();
                var searchResultPage = new MainPage(_webDriver, LoggerConfiguration.Log)
                                       .OpenPage()
                                       .WriteIntoFromField("123")
                                       .WriteIntoDestinationField("789")
                                       .OpenDepartCalendar().SelectDepartDate(1)
                                       .OpenReturnCalendar().SelectReturnDate(5)
                                       .OpenPassengersControl().AddElderPassengers(1).ApplyPassengers()
                                       .ClickToSearchButton();

                Assert.IsTrue(searchResultPage.DestinationPlace.Text.Equals(String.Empty));
            }, nameof(SearchTicketsWithWrongFromAndToPlacesTest));
        }
Ejemplo n.º 8
0
        public void SearchTicketsOnPassedDayTest()
        {
            TestWrapper(() =>
            {
                SearchRequestModel requestModel =
                    SearchRequestCreator.CreateSearchRequestModel();

                Assert.Throws <InvalidOperationException>(() =>
                {
                    var searchResultPage = new MainPage(_webDriver, LoggerConfiguration.Log)
                                           .OpenPage()
                                           .WriteIntoFromField(requestModel.From)
                                           .WriteIntoDestinationField(requestModel.To)
                                           .OpenDepartCalendar().SelectDepartDate(-1)
                                           .OpenReturnCalendar().SelectReturnDate(7)
                                           .OpenPassengersControl().AddElderPassengers(1).ApplyPassengers()
                                           .ClickToSearchButton();
                });
            }, nameof(SearchTicketsOnPassedDayTest));
        }
Ejemplo n.º 9
0
        public void SortResultsByTimeTest()
        {
            TestWrapper(() =>
            {
                SearchRequestModel requestModel =
                    SearchRequestCreator.CreateSearchRequestModel();
                var searchResultPage = new MainPage(_webDriver, LoggerConfiguration.Log)
                                       .OpenPage()
                                       .WriteIntoFromField(requestModel.From)
                                       .WriteIntoDestinationField(requestModel.To)
                                       .OpenDepartCalendar().SelectDepartDate(1)
                                       .OpenReturnCalendar().SelectReturnDate(7)
                                       .OpenPassengersControl().SelectBusinessClassTicketType().ApplyPassengers()
                                       .ClickToSearchButton().OpenSortOptionList().SelectSortByTimeOption();

                var firstTicketTime  = searchResultPage.GetFirstTicketTime();
                var secondTicketTime = searchResultPage.GetSecondTicketTime();

                Assert.IsTrue(firstTicketTime > secondTicketTime || firstTicketTime == secondTicketTime);
            }, nameof(SortResultsByTimeTest));
        }