Пример #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 CheckoutLogin()
        {
            CheckoutPageObjects cpo = new CheckoutPageObjects();

            cpo.UsernameInput.SendKeys("wddot");
            cpo.PasswordInput.SendKeys("wddot");
            cpo.LoginButton.Click();
            Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Delivery Address"));
        }
Пример #3
0
        public static void FillInDeliveryAddressAndProceed()
        {
            CheckoutPageObjects cpo = new CheckoutPageObjects();

            Thread.Sleep(1000);
            cpo.ScrollViewport();
            cpo.DeliveryAddress1.SendKeys(Config.AddressInfo.ShippingAddress.StreetAddShipping.StreetAdd);
            cpo.DeliveryCity.SendKeys(Config.AddressInfo.ShippingAddress.CityShipping.City);
            cpo.DeliveryCounty.SendKeys(Config.AddressInfo.ShippingAddress.CountyShipping.County);
            cpo.ProceedToCheckoutButton.Click();
            Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Secure Payment"));
        }
Пример #4
0
        public static void NavigateToJuicePlusWebsite()
        {
            LandingPageObjects  lan = new LandingPageObjects();
            CheckoutPageObjects cpo = new CheckoutPageObjects();

            Driver.WebDriver.Navigate().GoToUrl("https://sculpt.staging.juiceplus.com/ie/en");
            lan.CookieAlertAcceptButton.Click();
            Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Healthy Living Made Easier"));

            //WebDriverWait waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30));
            //Login lpo = new Login();
            //waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("[alt='/content/ie/juiceplus/en/portal/dashboard']")));
            //lpo.JuicePlusSiteLink.Click();
        }
Пример #5
0
        public static void EnterInvalidPaymentInfoAndConfirmOrder()
        {
            IJavaScriptExecutor js             = ((IJavaScriptExecutor)Driver.WebDriver);
            WebDriverWait       waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30));
            CheckoutPageObjects cpo            = new CheckoutPageObjects();

            Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Secure Payment"));
            waitForElement.Until(ExpectedConditions.ElementIsVisible(By.Name("payment.cardNumber")));
            Thread.Sleep(500);
            cpo.PaymentCCNumberTextbox.SendKeys("1234 5678 9012 3456");
            cpo.PaymentCCExpirationDateTextbox.SendKeys(CreditCardInfo.CCExpDate.VisaCCExpDate.VisaCCExpDateValid);
            cpo.PaymentCVVTextbox.SendKeys(CreditCardInfo.CreditCardCCV.VisaCCV.VisaCCVValid);
            js.ExecuteScript("arguments[0].click();", cpo.TOSAcceptCheckbox);
            js.ExecuteScript("arguments[0].click();", cpo.ConfirmOrderButton);
            Assert.IsTrue(Driver.WebDriver.PageSource.Contains("This field has the wrong pattern"));
        }
Пример #6
0
        public static void EnterPaymentInfoAndConfirmOrder()
        {
            IJavaScriptExecutor js             = ((IJavaScriptExecutor)Driver.WebDriver);
            WebDriverWait       waitForElement = new WebDriverWait(Driver.WebDriver, TimeSpan.FromSeconds(30));
            CheckoutPageObjects cpo            = new CheckoutPageObjects();

            Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Secure Payment"));
            waitForElement.Until(ExpectedConditions.ElementIsVisible(By.Name("payment.cardNumber")));
            Thread.Sleep(500);
            cpo.PaymentCCNumberTextbox.SendKeys(CreditCardInfo.CreditCardNumber.VisaCCNum.ccnumberValid);
            cpo.PaymentCCExpirationDateTextbox.SendKeys(CreditCardInfo.CCExpDate.VisaCCExpDate.VisaCCExpDateValid);
            cpo.PaymentCVVTextbox.SendKeys(CreditCardInfo.CreditCardCCV.VisaCCV.VisaCCVValid);
            js.ExecuteScript("arguments[0].click();", cpo.TOSAcceptCheckbox);
            js.ExecuteScript("arguments[0].click();", cpo.ConfirmOrderButton);
            waitForElement.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".m-checkout-confirmation__title")));
            Assert.IsTrue(Driver.WebDriver.PageSource.Contains("Thank you! Your order is confirmed."));
        }