public void TicketBookingForPassengerWhoIsLessThanTwelveYearsOld() { RouteCreator routeCreator = new RouteCreator(); PassengerCreator passengerCreator = new PassengerCreator(); HomePage homePage = new HomePage(driver); PassengerDetailsPage passengerDetailsPage = homePage .AcceptCookie() .EnterDepartureCity(routeCreator.WithAllProperties()) .EnterArrivalCity(routeCreator.WithAllProperties()) .SelectOneWayRoute() .EnterOneWayLeaveDate(routeCreator.WithAllProperties()) .ClickTicketsSearchButton() .SelectFlight() .ClickContinueButton() .ChooseTitle() .EnterFirstName(passengerCreator.WithAllProperties()) .EnterFamilyName(passengerCreator.WithAllProperties()) .ChooseDayOfBirth(passengerCreator.WithAllProperties()) .ChooseMonthOfBirth(passengerCreator.WithAllProperties()) .ChooseYearOfBirth(passengerCreator.WithInvalidYearOfBirth()) .ChooseLandline(passengerCreator.WithAllProperties()) .EnterMobilePhone(passengerCreator.WithAllProperties()) .EnterEmail(passengerCreator.WithAllProperties()) .ChooseCountry(passengerCreator.WithAllProperties()) .ClickContinueButton(); Assert.AreEqual(ERROR_TEXT_WHEN_PASSENGER_IS_LESS_THAN_TWELVE_YEARS_OLD, passengerDetailsPage.GetDateOfBirthErrorMessageText()); }
public void TicketBookingForPassengerWithInvalidEmail() { RouteCreator routeCreator = new RouteCreator(); PassengerCreator passengerCreator = new PassengerCreator(); HomePage homePage = new HomePage(driver); PassengerDetailsPage passengerDetailsPage = homePage .AcceptCookie() .EnterDepartureCity(routeCreator.WithAllProperties()) .EnterArrivalCity(routeCreator.WithAllProperties()) .SelectOneWayRoute() .EnterOneWayLeaveDate(routeCreator.WithAllProperties()) .ClickTicketsSearchButton() .SelectFlight() .ClickContinueButton() .ChooseTitle() .EnterFirstName(passengerCreator.WithAllProperties()) .EnterFamilyName(passengerCreator.WithAllProperties()) .ChooseDayOfBirth(passengerCreator.WithAllProperties()) .ChooseMonthOfBirth(passengerCreator.WithAllProperties()) .ChooseYearOfBirth(passengerCreator.WithAllProperties()) .ChooseLandline(passengerCreator.WithAllProperties()) .EnterMobilePhone(passengerCreator.WithAllProperties()) .EnterEmail(passengerCreator.WithInvalidEmail()) .ChooseCountry(passengerCreator.WithAllProperties()) .ClickContinueButton(); Assert.AreEqual(ERROR_TEXT_WHEN_INVALID_EMAIL, passengerDetailsPage.GetEmailErrorMessageText()); }
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 TrueRouteDate() { ListTicketsPage listTicketsPage = new MainPage(DriverSingleton.GetDriver()) .InputRouteDateAndClickSearch(RouteCreator.WithAllProperties()); Assert.AreNotEqual("0", listTicketsPage.CountRoute.Text); }
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 SearchForIdenticalCitiesTest() { MainPage mainPage = new MainPage(DriverSingleton.GetDriver()) .OpenPage() .ChooseIdenticalDepartureAndArrivalCity(RouteCreator.WithAllProperties()) .ClickSearchButton(); Assert.AreEqual("Source and Destination can not be same", mainPage.GetTextError()); }
public void FillRoute() { route = RouteCreator.WithAllProperties(); DepartureCity.SendKeys(route.DepartureCity); ArrivalCity.SendKeys(route.ArrivalCity); Body.Click(2); CalendarInput.Click(); GetTomorrow().Click(); }
public void FindTicketWithoutIndicateSeat() { TypeTrainPage typeTrainPage = new MainPage(Driver) .InputRouteDateAndClickSearch(RouteCreator.WithAllProperties()) .ClickBuyFirstTicket() .ClickTypeTrain(); Assert.AreEqual("Необходимо выбрать 1 место", typeTrainPage.TextException.Text); }
public void FindTicketWithFailBithDate() { UserInformationPage userInformationPage = new MainPage(Driver) .InputRouteDateAndClickSearch(RouteCreator.WithAllProperties()) .ClickBuyFirstTicket() .ChoseSeatAndClickUserInformation(); Assert.IsTrue(userInformationPage.WriteFailDate(UserCreator.WithFailBirthDay())); }
public void TestToVerifyTheIssuanceOfSearchResult() { MakeScreenshotWhenFail(() => { new HomePage(Driver) .InputValueInTheSearchBar(RouteCreator.WithAllProperties(), Driver); Assert.IsTrue(new SearchResultPage(Driver).IsDisplaySearchResult()); }); }
public void SearchWithYsterdayDate() { var route = RouteCreator.WithAllProperties(); BookingTrainTicketsPage home = new BookingTrainTicketsPage(Driver) .GoToPage(StartPage) .InputArrivalCity(route); Assert.IsFalse(home.IsPrevDataClickable()); }
public void FlightsReturnDateIsNotEnabledWhenSearchBookFlightsOnTheOneWay() { RouteCreator routeCreator = new RouteCreator(); HomePage homePage = new HomePage(driver) .AcceptCookie() .EnterArrivalCity(routeCreator.WithAllProperties()) .SelectOneWayRoute(); Assert.IsFalse(homePage.FlightsReturnDateIsEnabled()); }
public void GetTicketWithoutUserInformation() { UserInformationPage userInformationPage = new MainPage(Driver) .InputRouteDateAndClickSearch(RouteCreator.WithAllProperties()) .ClickBuyFirstTicket() .ChoseSeatAndClickUserInformation() .ClickWithoutInforamtion(); Assert.IsTrue(userInformationPage.IsDisplayFailBirthDate()); }
public void TrueRouteDate() { Driver.Navigate().GoToUrl("https://zhd.online"); MakeScreenshotWhenFail(() => { ListTicketsPage listTicketsPage = new MainPage(DriverSingleton.GetDriver()) .InputRouteDateAndClickSearch(RouteCreator.WithAllProperties()); Assert.AreNotEqual("0", listTicketsPage.CountRoute.Text); }); }
public void PayForTicketWithoutInformationAboutCard() { PayPage payPage = new MainPage(Driver) .InputRouteDateAndClickSearch(RouteCreator.WithAllProperties()) .ClickBuyFirstTicket() .ChoseSeatAndClickUserInformation() .WriteUserInformationAndClickSubmit(UserCreator.WithAllProperties()) .ClickButtonNext(); Assert.IsTrue(payPage.IsVisibleErrorField()); }
public void SearchWithAllFieldsAreFull() { var route = RouteCreator.WithAllProperties(); SearchingTrainResultsPage search = new BookingTrainTicketsPage(Driver) .GoToPage(StartPage) .InputArrivalCity(route) .InputDepartureDate() .GoToSearchingTrainResultsPage() .Search(); Assert.AreEqual(ErrorTextForSearchWithAllFieldsAreFullResult, search.SearchWithAllFieldsAreFullResult.Text); }
public void TestToVerifyTheIssuanceOfSearchResult() { Logger.InitLogger(); Logger.Log.Info("Start ToVerifyTheIssuanceOfSearchResult unit test."); MakeScreenshotWhenFail(() => { new HomePage(Driver) .InputValueInTheSearchBar(RouteCreator.WithAllProperties(), Driver); Assert.IsTrue(new SearchResultPage(Driver).IsDisplaySearchResult()); }); Logger.Log.Info($"Test complete successfully\n"); }
public void FindTicketWithoutIndicateSeat() { MakeScreenshotWhenFail(() => { Driver.Navigate().GoToUrl("https://zhd.online"); TypeTrainPage typeTrainPage = new MainPage(Driver) .InputRouteDateAndClickSearch(RouteCreator.WithAllProperties()) .ClickBuyFirstTicket() .ClickTypeTrain(); Assert.AreEqual("Необходимо выбрать 1 место", typeTrainPage.TextException.Text); }); }
public void TicketForFewAdultPeople() { Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); mainPage = new MainPage(Driver) .InputStationsAndSeacrh(RouteCreator.WithAllProperties()) .OpenCloseAdditionalCriterias() .OpenListAdultsAndSelect("2") .OpenCloseAdditionalCriterias() .Search(); Assert.IsNotNull(Driver.FindElements(By.XPath("//strong[contains(text(),'2')]"))); }
public void TicketsByChoosingDepartureTime() { Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); mainPage = new MainPage(Driver) .InputStationsAndSeacrh(RouteCreator.WithAllProperties()) .OpenCloseAdditionalCriterias() .SetHours("21") .Search(); webTable = new WebTable(); Assert.IsTrue(webTable.CheckHours("//div[contains(@class,'opDepartTime')]", "21")); }
public void FirstCLassTickets() { Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); mainPage = new MainPage(Driver) .InputStationsAndSeacrh(RouteCreator.WithAllProperties()) .OpenCloseAdditionalCriterias() .SwitchStandardClass() .OpenCloseAdditionalCriterias() .Search(); webTable = new WebTable(); Assert.IsTrue(webTable.CheckTravelClass("//a[contains(@class,'op-listened')]", " First Class Anytime")); }
public void TicketsWithoutAdditionalProperties() { Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10); mainPage = new MainPage(Driver) .InputStationsAndSeacrh(RouteCreator.WithAllProperties()) .SetDateDeparture() .Search(); webTable = new WebTable(); Assert.IsTrue(webTable.CheckElementsFromDepartureAndArrival("//span[contains(@class,'opFromSection')]", "London Blackfriars ", "Manchester Piccadilly ")); }
public void BookTicketPersonalInformationTest() { BookPage bookPage = new MainPage(DriverSingleton.GetDriver()) .OpenPage() .ChooseDepartureCity(RouteCreator.WithAllProperties()) .ChooseArrivalCity(RouteCreator.Empty()) .ClickSearchButton() .ClickBookButton(RouteCreator.Empty()) .ClickContunue() .ClickSkipButton(); Assert.AreEqual("Please enter the travellers details", bookPage.GetNotice()); }
public void BookTicketWithoutDetalesTest() { BookPage bookPage = new MainPage(DriverSingleton.GetDriver()) .OpenPage() .ChooseDepartureCity(RouteCreator.WithAllProperties()) .ChooseArrivalCity(RouteCreator.Empty()) .ClickSearchButton() .ClickBookButton(RouteCreator.WithAllProperties()) .ClickContunue() .ClickProccedToPayButton(); Assert.AreEqual("Please enter traveller details to proceed.", bookPage.GetError()); }
public void NotLeaveSixPassengers() { var route = RouteCreator.WithAllProperties(); SearchingTrainResultsPage search = new BookingTrainTicketsPage(Driver) .GoToPage(StartPage) .InputArrivalCity(route) .InputDepartureDate() .GoToSearchingTrainResultsPage() .Search() .ChooseTrainClick() .AdultPlusClick(6); Assert.AreEqual(MaxAdultsValue, search.PassangersNumber[0].GetAttribute("value")); }
public void LeaveChildWithoutParents() { var route = RouteCreator.WithAllProperties(); SearchingTrainResultsPage search = new BookingTrainTicketsPage(Driver) .GoToPage(StartPage) .InputArrivalCity(route) .InputDepartureDate() .GoToSearchingTrainResultsPage() .Search() .ChooseTrainClick() .ChildPlusClick() .AdultMinusClick(); Assert.IsTrue(search.check()); }
public void FindTrainWithoutDate() { #region TestData const string NoDateError = "Это поле необходимо заполнить"; #endregion Route route = RouteCreator.WithAllProperties(); MainPage findTrainWithoutDate = new MainPage(Driver); findTrainWithoutDate .FillFieldFrom(route) .Submit(); Assert.AreEqual(findTrainWithoutDate.CheckWithoutDateError(), NoDateError); }
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 CantChooseTwoSeatsForOnePasenger() { var route = RouteCreator.WithAllProperties(); var errorMessage = ErrorsCreator.WithAllPropertiesErrors(); SearchingTrainResultsPage search = new BookingTrainTicketsPage(Driver) .GoToPage(StartPage) .InputArrivalCity(route) .InputDepartureDate() .GoToSearchingTrainResultsPage() .Search() .ChooseTrainClick() .PlaceToSitClick(2); Assert.AreEqual(errorMessage.ErrorMessage, search.errorToolTip.Text); }