예제 #1
0
        public static void CheckoutWithCartItemsVisa()
        {
            try
            {
                IJavaScriptExecutor         js             = ((IJavaScriptExecutor)Driver.WebDriver);
                WebDriverWait               waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30));
                NavigationHeaderPageObjects nav            = new NavigationHeaderPageObjects();
                ChewablesPageObjects        cpo            = new ChewablesPageObjects();
                //waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter")));
                //nav.CheckoutButton.Click();
                ////waitForElement.Until(ExpectedConditions.ElementIsVisible(By.XPath("//span[.='Proceed to checkout']")));
                //Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Your Cart"));
                //CartPageObjects cpo = new CartPageObjects();
                //cpo.ProceedToCheckoutButton.Click();
                waitForElement.Until(ExpectedConditions.ElementIsVisible(By.XPath("//span[.='Checkout as guest']")));
                Assert.IsTrue(Driver.WebDriver.PageSource.Contains("New to Juice Plus+?"));
                CheckoutPageObjects cop = new CheckoutPageObjects();
                cop.CheckoutAsGuestButton.Click();
                Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Billing Address"));
                Thread.Sleep(500);
                cop.FirstNameShippingTextbox.SendKeys(AddressInfo.ShippingAddress.FirstNameShipping.FirstName);
                cop.LastNameShippingTextbox.SendKeys(AddressInfo.ShippingAddress.LastNameShipping.LastName);
                cop.DaytimePhoneNumberShippingTextbox.SendKeys(AddressInfo.ShippingAddress.PrimaryPhoneShipping.PrimaryPhone);
                cop.AlternatePhoneNumberShippingTextbox.SendKeys(AddressInfo.ShippingAddress.AlternatePhoneShipping.AlternatePhone);
                cop.EmailShippingTextbox.SendKeys(AddressInfo.ShippingAddress.EmailShipping.Email);
                cop.StreetAddressDeliveryTextbox.SendKeys(AddressInfo.ShippingAddress.StreetAddShipping.StreetAdd);
                cop.OptionalStreetAddressDeliveryTextbox.SendKeys(AddressInfo.ShippingAddress.OptionalStreetShipping.OptionalStreet);
                cop.CityDeliveryTextbox.SendKeys(AddressInfo.ShippingAddress.CityShipping.City);
                cop.CountyDeliveryTextbox.SendKeys(AddressInfo.ShippingAddress.CountyShipping.County);
                js.ExecuteScript("arguments[0].click();", cop.ReferringRepNoRadioButton);

                /*js.ExecuteScript("arguments[0].click();", cop.ReferringRepYesRadioButton);
                 * cop.ReferringRepNameIdTextbox.SendKeys("IR002626");
                 * //Actions action = new Actions(Driver.WebDriver);
                 * //action.MoveToElement(cop.ReferringRepNameTextbox).Perform();*/
                cpo.ScrollViewport();

                /* waitForElement.Until(ExpectedConditions.ElementIsVisible(By.XPath("//span[contains(.,'Martin Deegan')]")));
                 * Thread.Sleep(3000);
                 * cop.ReferringRepNameTextbox.Click();*/
                cop.ProceedToCheckoutButton.Click();
                Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Secure Payment"));
                waitForElement.Until(ExpectedConditions.ElementIsVisible(By.Name("payment.cardNumber")));
                Thread.Sleep(500);
                cop.PaymentCCNumberTextbox.SendKeys(CreditCardInfo.CreditCardNumber.VisaCCNum.ccnumberValid);
                cop.PaymentCCExpirationDateTextbox.SendKeys(CreditCardInfo.CCExpDate.VisaCCExpDate.VisaCCExpDateValid);
                cop.PaymentCVVTextbox.SendKeys(CreditCardInfo.CreditCardCCV.VisaCCV.VisaCCVValid);
                js.ExecuteScript("arguments[0].click();", cop.TOSAcceptCheckbox);
                js.ExecuteScript("arguments[0].click();", cop.ConfirmOrderButton);
                waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-checkout-confirmation__title")));
                Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Thank you! Your order is confirmed."));
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e);
            }
        }
예제 #2
0
 public static void NavCartIconClick()
 {
     try
     {
         NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects();
         nav.CartIconCounter.Click();
         //Assert.IsTrue(Driver.WebDriver.PageSource.Contains("You have no itmes in your cart."));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #3
0
 public static void NavNewsletterClick()
 {
     try
     {
         NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects();
         nav.NewsletterLink.Click();
         Assert.IsTrue(Driver.WebDriver.PageSource.Contains(""));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #4
0
 public static void NavLoginButtonClick()
 {
     try
     {
         NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects();
         nav.LoginButton.Click();
         //Assert.IsTrue(Driver.WebDriver.PageSource.Contains(""));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #5
0
 public static void NavSearchIconClick()
 {
     try
     {
         NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects();
         nav.SearchIcon.Click();
         Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Juice Plus+ Capsules"));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #6
0
        public static void CheckoutWithItems()
        {
            NavigationHeaderPageObjects nav  = new NavigationHeaderPageObjects();
            CartPageObjects             carp = new CartPageObjects();
            WebDriverWait waitForElement     = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30));

            waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter")));
            nav.CartIconCounter.Click();
            waitForElement.Until(ExpectedConditions.ElementIsVisible(By.XPath("//span[@class='m-product-count-container__flyout-content m-flyout__content js-m-flyout__content m-flyout__content--attached m-flyout__content--dropdown']//span[@class='a-button__inner']")));
            nav.CheckoutButton.Click();
            Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Your Cart"));
            carp.NavigateToProceedToCheckoutAndClick();
            Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Login"));
        }
예제 #7
0
 public static void NavigateOurProductsCompleteClick()
 {
     try
     {
         NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects();
         //Actions action = new Actions(Driver.WebDriver);
         //action.MoveToElement(nav.OurProductsNavLink).Perform();
         nav.OurProductsNavLink.Click();
         nav.OurProductsCompleteLink.Click();
         Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Complete"));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #8
0
 public static void NavigateOurCommunityGoBeyondClick()
 {
     try
     {
         NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects();
         //Actions action = new Actions(Driver.WebDriver);
         //action.MoveToElement(nav.OurCommunityNavLink).Perform();
         nav.OurCommunityNavLink.Click();
         nav.OurCommunityGoBeyondLink.Click();
         Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Let's Go Beyond"));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #9
0
 public static void NavigateLiveBetterOneSimpleChangeClick()
 {
     try
     {
         NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects();
         //Actions action = new Actions(Driver.WebDriver);
         //action.MoveToElement(nav.LiveBetterNavLink).Perform();
         nav.LiveBetterNavLink.Click();
         nav.LiveBetterOneSimpleChangeLink.Click();
         Assert.IsTrue(Driver.WebDriver.PageSource.Contains("One Simple Change"));
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
     }
 }
예제 #10
0
        public static void AddOmegaBlendToCart()
        {
            WebDriverWait waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30));

            NavigationActions.NavigateOurProductsOmegaClick();
            OmegaPageObjects opo  = new OmegaPageObjects();
            CartPageObjects  carp = new CartPageObjects();

            try
            {
                try
                {
                    Assert.IsFalse(Driver.WebDriver.PageSource.Contains("£"));
//                    Assert.IsTrue(Driver.WebDriver.PageSource.Contains("€"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                LandingPageObjects lan = new LandingPageObjects();
                Thread.Sleep(1000);
                lan.CookieAlertAcceptButton.Click();
                Task.Delay(500).Wait(1500);
                opo.ScrollViewport();
                OmegaOrderPageObjects oopo = new OmegaOrderPageObjects();
                var NumOfProducts          = oopo.NumOfProductOrder.GetAttribute("value");
                try
                {
                    Assert.That(NumOfProducts, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);;
                }

                oopo.IncrementArrowOrder.Click();
                var incrProductCount = oopo.NumOfProductOrder.GetAttribute("value");
                Thread.Sleep(500);

                try
                {
                    Assert.That(incrProductCount, Is.EqualTo("2"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                oopo.DecrementArrowOrder.Click();
                var decrProductCount = oopo.NumOfProductOrder.GetAttribute("value");
                try
                {
                    Assert.That(decrProductCount, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                oopo.AddToCartOrder.Click();
                NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects();
                Thread.Sleep(1000);
                var NumInCart = nav.CartIconCounter.Text;
                Console.WriteLine(NumInCart);
                try
                {
                    Assert.That(NumInCart, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                nav.CartIconCounter.Click();

                waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter")));
                nav.CheckoutButton.Click();
                carp.NavigateToProceedToCheckoutAndClick();
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e);
            }
        }
예제 #11
0
        public static void AddSOROUpliftToCart()
        {
            try
            {
                WebDriverWait waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30));
                NavigationActions.NavigateOurProductsOmegaClick();
                UpliftPageObjects upo = new UpliftPageObjects();
                try
                {
                    Assert.IsFalse(Driver.WebDriver.PageSource.Contains("£"));
                    Assert.IsTrue(Driver.WebDriver.PageSource.Contains("€"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                LandingPageObjects lan = new LandingPageObjects();
                lan.CookieAlertAcceptButton.Click();
                Task.Delay(500).Wait(1500);
                upo.ScrollViewport();
                UpliftOrderPageObjects uopo = new UpliftOrderPageObjects();
                var NumOfProducts           = uopo.NumOfProductOrder.GetAttribute("value");
                try
                {
                    Assert.That(NumOfProducts, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);;
                }

                uopo.IncrementArrowOrder.Click();
                var incrProductCount = uopo.NumOfProductOrder.GetAttribute("value");
                Thread.Sleep(500);

                try
                {
                    Assert.That(incrProductCount, Is.EqualTo("2"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                uopo.DecrementArrowOrder.Click();
                var decrProductCount = uopo.NumOfProductOrder.GetAttribute("value");
                try
                {
                    Assert.That(decrProductCount, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                uopo.AddToCartOrder.Click();
                NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects();
                Thread.Sleep(1000);
                var NumInCart = nav.CartIconCounter.Text;
                Console.WriteLine(NumInCart);
                try
                {
                    Assert.That(NumInCart, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                nav.CartIconCounter.Click();
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e);
            }
        }
예제 #12
0
        public static void AddUpliftInstallmentPayCapsulePayInFullRecurringToCart()
        {
            try
            {
                WebDriverWait waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30));
                NavigationActions.NavigateOurProductsUpliftClick();
                UpliftPageObjects upo = new UpliftPageObjects();
                try
                {
                    Assert.IsFalse(Driver.WebDriver.PageSource.Contains("£"));
//                    Assert.IsTrue(Driver.WebDriver.PageSource.Contains("€"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                LandingPageObjects lan = new LandingPageObjects();
                Thread.Sleep(1000);
                lan.CookieAlertAcceptButton.Click();
                Task.Delay(500).Wait(1500);
                upo.ScrollViewport();
                UpliftOrderPageObjects uopo = new UpliftOrderPageObjects();
                var NumOfProducts           = uopo.NumOfProductOrder.GetAttribute("value");
                try
                {
                    Assert.That(NumOfProducts, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);;
                }

                uopo.IncrementArrowOrder.Click();
                var incrProductCount = uopo.NumOfProductOrder.GetAttribute("value");
                Thread.Sleep(500);

                try
                {
                    Assert.That(incrProductCount, Is.EqualTo("2"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                uopo.DecrementArrowOrder.Click();
                var decrProductCount = uopo.NumOfProductOrder.GetAttribute("value");
                try
                {
                    Assert.That(decrProductCount, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                uopo.AddToCartOrder.Click();
                NavigationHeaderPageObjects nav = new NavigationHeaderPageObjects();
                Thread.Sleep(1000);
                var NumInCart = nav.CartIconCounter.Text;
                Console.WriteLine(NumInCart);
                try
                {
                    Assert.That(NumInCart, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                nav.CartIconCounter.Click();
                waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter")));
                nav.CheckoutButton.Click();


                CartPageObjects carp = new CartPageObjects();

                carp.PayInInstallments.Click();

                NavigationActions.NavigateOurProductsCapsulesClick();
                CapsulesPageObjects caps = new CapsulesPageObjects();
                try
                {
                    Assert.IsFalse(Driver.WebDriver.PageSource.Contains("£"));
                    Assert.IsTrue(Driver.WebDriver.PageSource.Contains("€"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);;
                }

                caps.ClickVegetablesAndFruitCapsuleShopNow();
                CapsulesOrderPageObjects cpo = new CapsulesOrderPageObjects();
                try
                {
                    Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Fruit & Vegetable Blend Capsules"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }

                caps.ScrollViewport();
                try
                {
                    Assert.That(NumOfProducts, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);;
                }

                cpo.IncrementArrowOrderCapsules.Click();
                Thread.Sleep(500);
                try
                {
                    Assert.That(incrProductCount, Is.EqualTo("2"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);;
                }

                cpo.DecrementArrowOrderCapsules.Click();

                try
                {
                    Assert.That(decrProductCount, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);;
                }

                cpo.AddToCartOrderCapsules.Click();
                Thread.Sleep(1000);
                Console.WriteLine(NumInCart);
                try
                {
                    Assert.That(NumInCart, Is.EqualTo("1"));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
                Thread.Sleep(500);
                nav.CartIconCounter.Click();
                waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-icon-badge__counter")));
                nav.CheckoutButton.Click();
                carp.NavigateToProceedToCheckoutAndClick();
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(e);
            }
        }