/// <summary> /// Adds the new tier price. /// </summary> /// <param name="tierPricingModel">The tier pricing model.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">tierPricingModel</exception> public virtual TierPricesComponent AddNewTierPrice( TierPriceModel tierPricingModel) { if (tierPricingModel == null) { throw new ArgumentNullException(nameof(tierPricingModel)); } var cachedWindowHandle = WrappedDriver.CurrentWindowHandle; var cachedWindowHandles = WrappedDriver.WindowHandles; AddNewTierPriceElement.Click(); WrappedDriver .Wait(TimeSpan.FromSeconds(10)) .Until(d => d.WindowHandles.Count > cachedWindowHandles.Count); // Switch to new window. var newHandle = WrappedDriver.WindowHandles .Except(cachedWindowHandles) .First(); WrappedDriver.SwitchTo().Frame(newHandle); // Load the StartDate/EndDate components. StartDateComponent.Load(); EndDateComponent.Load(); // Enter values. QuantityElement.SetValue(tierPricingModel.Quantity); PriceElement.SetValue(tierPricingModel.Price); StoreElement.SelectByText(tierPricingModel.Store); CustomerRoleElement.SelectByText(tierPricingModel.CustomerRole); StartDateComponent.SetValue(tierPricingModel.StartDate); EndDateComponent.SetValue(tierPricingModel.EndDate); // Save. var saveEl = SaveElement; // Cache this to avoid extra lookups. saveEl.Click(); WrappedDriver .Wait(TimeSpan.FromSeconds(10)) .Until(d => saveEl.IsStale()); // Switch back to the original handle. WrappedDriver.SwitchTo().Frame(cachedWindowHandle); return(this); }
/// <summary> /// Sets the price. /// </summary> /// <param name="price">The price.</param> /// <returns></returns> public virtual PricesComponent SetPrice(decimal price) { PriceElement.SetValue(price); return(this); }