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); }
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()); }
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()); }
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); }
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); }
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()); }
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()); }