Example #1
0
        /// <summary>
        /// A method to Search flights based on the test data
        /// </summary>
        /// <param name="testdata"></param>
        /// <returns>Whether search results appear or not</returns>
        public bool SearchFlights(FlightsTdo testdata)
        {
            //Click oneway radio button
            BrowserContext.ClickElement(ElementIdentifierType.Id, OneWayRadioBtnId);

            //Select origin
            BrowserContext.SendText(ElementIdentifierType.Id, FromAirportCityId, testdata.FromAirportCity);
            var originOptions = BrowserContext.GetWebElement(ElementIdentifierType.Id, FromAutoCompleteULId)
                                .FindElements(By.TagName(ListTag));

            BrowserContext.ClickElement(originOptions.FirstOrDefault());

            //Select to
            BrowserContext.SendText(ElementIdentifierType.Id, ToAirportCityId, testdata.ToAirportCity);
            var destinationOptions = BrowserContext.GetWebElement(ElementIdentifierType.Id, ToAutoCompleteULId)
                                     .FindElements(By.TagName(ListTag));

            BrowserContext.ClickElement(destinationOptions.FirstOrDefault());

            //Set Travel Date
            BrowserContext.ClickElement(ElementIdentifierType.Xpath, UiDatePickerXpath);

            //Search
            BrowserContext.ClickElement(ElementIdentifierType.Id, SearchButtonId);

            //verify that result appears for the provided journey search
            return(BrowserContext.IsElementPresent(By.ClassName(SearchSummaryClass)));
        }
Example #2
0
        public void TestThatResultsAppearForAOneWayJourney()
        {
            //Arrange
            var testdata = new FlightsTdo {
                FromAirportCity = "Bangalore",
                ToAirportCity   = "Delhi"
            };

            var flightsView = new FlightsView();

            //Act
            bool actual = flightsView.SearchFlights(testdata);

            //Assert
            Assert.True(actual, "Search results not found");
        }