Esempio n. 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)));
        }
Esempio n. 2
0
        /// <summary>
        /// A method to search hotels
        /// </summary>
        /// <param name="testdata"></param>
        /// <returns>Whether search results appear or not</returns>
        public bool SearchHotels(HotelsTdo testdata)
        {
            BrowserContext.ClickElement(_hotelLink);
            BrowserContext.WaitFor(1000);
            BrowserContext.SendText(_localityTextBox, testdata.Locality);
            var localities = BrowserContext.GetWebElement(ElementIdentifierType.Id, LocalityUlId)
                             .FindElements(By.TagName(ListTag));

            BrowserContext.ClickElement(localities[1]);
            BrowserContext.SelectElementFromDropDown(_travellerSelection, SelectBy.Text, testdata.TravellerSelection);
            BrowserContext.ClickElement(_searchButton);

            return(BrowserContext.IsElementPresent(ElementIdentifierType.ClassName, SearchSummaryClass));
        }