예제 #1
0
        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);
        }