public void SetUp() { Driver = Actions.InitializeDriver(); hotelItem = new HotelDetailsPage(Driver); wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(30)); hotelImageNumber = 1; forwardPressTimes = 0; previousPressTimes = 0; js = Driver as IJavaScriptExecutor; }
public void TestAddToWishListWhileLogin() { TestLoginForm testSignUpForm = new TestLoginForm(); testSignUpForm.PartialInitializer(Driver); testSignUpForm.PartialLoginFunction(Driver); Thread.Sleep(1000); NavigateTo.NavigateToItemOnHotelSearch(Driver); hotelInfo = new HotelDetailsPage(Driver); Thread.Sleep(1000); //get the name of the current hotel detail item HotelName = hotelInfo.HotelNameTitle.Text; Console.WriteLine(HotelName); //click on the add to wishlist hotelInfo.AddToWishListButton.Click(); Thread.Sleep(3000); try { // Check the presence of alert alertHandler = Driver.SwitchTo().Alert(); //print to console the alert message Console.WriteLine(alertHandler.Text); // if present consume the alert alertHandler.Accept(); } catch (NoAlertPresentException ex) { Console.Write(ex.Message); } //navigate back to account NavigateTo.NavigateBackToProfileWhenLogin(Driver); Thread.Sleep(3000); //load the wishlist profile.WishList.Click(); Thread.Sleep(3000); //get the name of the current hotel profile //change the name to uppercase HotelNameOnWishList = profile.ItemFromWishList.Text.ToUpper(); //Assert that both are the same names Assert.AreEqual(HotelName, HotelNameOnWishList); Thread.Sleep(2000); }
public void TestAddToWishListWithoutLogin() { NavigateTo.NavigateToItemOnHotelSearch(Driver); hotelInfo = new HotelDetailsPage(Driver); Thread.Sleep(3000); //click on the add to wishlist hotelInfo.AddToWishListButton.Click(); Thread.Sleep(3000); //get the text from the pop up window alertMessage = Driver.SwitchTo().Alert().Text; //testing purpose Console.WriteLine(alertMessage); Assert.AreEqual(ReturnedErrorMessages.InvalidAddingToWishlistWithoutLogin.message, alertMessage); }
public void Initializer() { Driver = Actions.InitializeDriver(); NavigateTo.NavigateToItemOnHotelSearch(Driver); hotelItem = new HotelDetailsPage(Driver); }