コード例 #1
0
        public void RouteHaveSeats()
        {
            #region TestData
            string numSeat = "45";
            bool   hasSeats;
            #endregion
            Route             route             = RouteCreator.WithAllProperties();
            GdTicketsHomePage gdTicketsHomePage = new GdTicketsHomePage();

            SearchResultsPage searchResultsPage = gdTicketsHomePage
                                                  .FillFieldDeparture(route)
                                                  .FillFieldArrive(route)
                                                  .OpenDepartCalendar()
                                                  .ChoiceDepartureDate(route)
                                                  .GoToSearchResult();

            searchResultsPage.ChoiceFirstTrain();
            string strNumber = searchResultsPage.GetNumberFreeSeats();
            int    number    = int.Parse(strNumber);
            if (number > 0)
            {
                hasSeats = true;
            }
            else
            {
                hasSeats = false;
            }

            Assert.IsTrue(hasSeats);
        }
コード例 #2
0
        public void FindTicketWithEmptyFieldDepartureDate()
        {
            #region TestData
            const string expectedErrorMessage = "This field is mandatory";
            #endregion

            Route             route = RouteCreator.WithAllProperties();
            GdTicketsHomePage page  = new GdTicketsHomePage(webDriver);
            page
            .FillFieldDeparture(route)
            .FillFieldArrive(route)
            .SearchClick();

            Assert.AreEqual(expectedErrorMessage, page.getErrorMessage());
        }
コード例 #3
0
        public void FindTicketWithEmptyFieldDepartureDate()
        {
            var homepage = new GdTicketsHomePage(webDriver);

            #region TestData
            const string departureCityText    = "Киев";
            const string arriveCityText       = "Харьков-Пасс";
            const string expectedErrorMessage = "Это поле необходимо заполнить";
            #endregion

            homepage.ChoiceDepartureCity(departureCityText);
            homepage.ChoiceArriveCity(arriveCityText);
            homepage.searchButton.Click();

            Assert.AreEqual(expectedErrorMessage, homepage.getErrorMessage());
        }
コード例 #4
0
        public void CheckCorrectnessRoute()
        {
            Route             route             = RouteCreator.WithAllProperties();
            GdTicketsHomePage gdTicketsHomePage = new GdTicketsHomePage();

            SearchResultsPage searchResultsPage = gdTicketsHomePage
                                                  .FillFieldDeparture(route)
                                                  .FillFieldArrive(route)
                                                  .OpenDepartCalendar()
                                                  .ChoiceDepartureDate(route)
                                                  .GoToSearchResult();

            string trip = route.DepartureCity + "-" + route.ArrivalCity;

            bool pageIsResultsPage = searchResultsPage.GetTrip().Contains(trip);


            Assert.IsTrue(pageIsResultsPage);
        }
コード例 #5
0
        public void OpenSearchResultPage()
        {
            #region TestData
            string searchResultsPageUrl = "https://gd.tickets.ua/en/search/results";
            #endregion

            Route             route = RouteCreator.WithAllProperties();
            GdTicketsHomePage page  = new GdTicketsHomePage();

            SearchResultsPage searchResultsPage =
                page
                .FillFieldDeparture(route)
                .FillFieldArrive(route)
                .OpenDepartCalendar()
                .ChoiceDepartureDate(route)
                .GoToSearchResult();
            bool pageIsResultsPage = searchResultsPage.GetUrl().Contains(searchResultsPageUrl);
            Assert.IsTrue(pageIsResultsPage);
        }
コード例 #6
0
        public void BuyChildrenTicketIfAdult()
        {
            #region TestData
            string error = "Please specify a valid date in the format DD/MM/YYYY";
            Route  route = RouteCreator.WithAllProperties();
            User   user  = UserCreator.WithAllProperties();
            #endregion

            GdTicketsHomePage gdTicketsHomePage = new GdTicketsHomePage();

            SearchResultsPage searchResultsPage = gdTicketsHomePage
                                                  .FillFieldDeparture(route)
                                                  .FillFieldArrive(route)
                                                  .OpenDepartCalendar()
                                                  .ChoiceDepartureDate(route)
                                                  .GoToSearchResult()
                                                  .ChoiceFirstTrain()
                                                  .ChoiceChildTo14YearsAndWriteData(user);

            Assert.AreEqual(error, searchResultsPage.GetDateError());
        }
コード例 #7
0
        public void FindTicketWithYeasterdayDate()
        {
            var homepage = new GdTicketsHomePage(webDriver);

            #region TestData
            const string departureCityText    = "Киев";
            const string arriveCityText       = "Харьков-Пасс";
            const string expectedErrorMessage = "Это поле необходимо заполнить";
            int          yesterday            = DateTime.Now.Day - 1;
            #endregion

            homepage.ChoiceDepartureCity(departureCityText);
            homepage.ChoiceArriveCity(arriveCityText);
            homepage.OpenCalendar();
            var dates = homepage.GetCalendarDates();
            var day   = dates.FirstOrDefault(d => d.Text.Equals(yesterday.ToString()));
            day.Click();
            homepage.searchButton.Click();

            Assert.AreEqual(expectedErrorMessage, homepage.getErrorMessage());
        }