public Double CalculateLineTotal(ShoppingCartBO shoppingCartBO)
        {
            var priceUnit = Convert.ToDouble(LblPriceUnit(shoppingCartBO).Text.Remove(0, 1));
            var qty       = Convert.ToDouble(TxtQuantity(shoppingCartBO).GetAttribute("value"));

            return(priceUnit * qty);
        }
 public void UpdateQuantity(ShoppingCartBO shoppingCartBO)
 {
     TxtQuantity(shoppingCartBO).Clear();
     TxtQuantity(shoppingCartBO).SendKeys(shoppingCartBO.Quantity);
     BtnUpdate(shoppingCartBO).Click();
     wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
     wait.Until(ExpectedConditions.ElementIsVisible(successfullyUpdated));
 }
        public void EstimateShippingAndTaxes_WrongCountry(ShoppingCartBO shoppingCartBO)
        {
            BtnEstimateShippingTaxes.Click();
            wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            wait.Until(ExpectedConditions.ElementIsVisible(country));
            var selectCountry = new SelectElement(DdlCountry);

            selectCountry.SelectByText(shoppingCartBO.WrongCountry);
            BtnGetQuotes.Click();
            wait.Until(ExpectedConditions.ElementIsVisible(errorCountry));
        }
        public void EstimateShippingAndTaxes_WrongRegion(ShoppingCartBO shoppingCartBO)
        {
            BtnEstimateShippingTaxes.Click();
            wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            wait.Until(ExpectedConditions.ElementIsVisible(country));
            var selectCountry = new SelectElement(DdlCountry);

            selectCountry.SelectByText(shoppingCartBO.Country);
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1);
            var selectRegion = new SelectElement(DdlRegion);

            selectRegion.SelectByText(shoppingCartBO.WrongRegion);
            BtnGetQuotes.Click();
            wait.Until(ExpectedConditions.ElementIsVisible(errorRegion));
        }
        public void EstimateShippingAndTaxes(ShoppingCartBO shoppingCartBO)
        {
            BtnEstimateShippingTaxes.Click();
            wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            wait.Until(ExpectedConditions.ElementIsVisible(country));
            var selectCountry = new SelectElement(DdlCountry);

            selectCountry.SelectByText(shoppingCartBO.Country);
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1);
            var selectRegion = new SelectElement(DdlRegion);

            selectRegion.SelectByText(shoppingCartBO.Region);
            TxtPostcode.SendKeys(shoppingCartBO.Postcode);
            BtnGetQuotes.Click();
            wait.Until(ExpectedConditions.ElementIsVisible(shippingMethod));
            ChbShippingMethod.Click();
            wait.Until(ExpectedConditions.ElementToBeClickable(applyShipping));
            BtnApplyShipping.Click();
        }
 public void AddToCartFirstProduct(ShoppingCartBO shoppingCartBO)
 {
     BtnAddToCart(shoppingCartBO).Click();
     wait.Until(ExpectedConditions.ElementIsVisible(successfullyAdded));
     Thread.Sleep(1000);
 }
 private IWebElement BtnAddToCart(ShoppingCartBO shoppingCartBO) => LstProducts
 .FirstOrDefault(element => element.Text.Contains(shoppingCartBO.ProductName))
 .FindElement(addToCart);
 private IWebElement LblTotal(ShoppingCartBO shoppingCartBO) => LstCartProducts
 .FirstOrDefault(element => element.Text.Contains(shoppingCartBO.ProductName))
 .FindElement(total);
 private IWebElement LblPriceUnit(ShoppingCartBO shoppingCartBO) => LstCartProducts
 .FirstOrDefault(element => element.Text.Contains(shoppingCartBO.ProductName))
 .FindElement(unitPrice);
 private IWebElement BtnRemove(ShoppingCartBO shoppingCartBO) => LstCartProducts
 .FirstOrDefault(element => element.Text.Contains(shoppingCartBO.ProductName))
 .FindElement(remove);
 private IWebElement TxtQuantity(ShoppingCartBO shoppingCartBO) => LstCartProducts
 .FirstOrDefault(element => element.Text.Contains(shoppingCartBO.ProductName))
 .FindElement(quantity);
 public Double GetTotal(ShoppingCartBO shoppingCartBO)
 {
     return(Convert.ToDouble(LblTotal(shoppingCartBO).Text.Remove(0, 1)));
 }
 public void RemoveProduct(ShoppingCartBO shoppingCartBO)
 {
     BtnRemove(shoppingCartBO).Click();
     wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
     wait.Until(ExpectedConditions.ElementIsVisible(emptyCart));
 }