public void AddCustomCostAdjustmentDefaults(CostAdjustmentsData costAdjustmentsData) { ClickElement(_btnAdd); PopulateCostAdjustmentFields(costAdjustmentsData); ClickElement(_btnDialogAdd); Assert.IsTrue(IsSingleSuccessToastNotificationShown()); }
private IWebElement GetCostAdjustmentRowCheckBox(CostAdjustmentsData costAdjustmentsData) { var rowXpath = BuildCostAdjustmentRowXpath(costAdjustmentsData); var row = _grdCostAdjustmentsTable.FindElement(By.XPath(rowXpath)); return(row.FindElement(By.ClassName("checkbox-component-icon"))); }
public bool DoesCustomCostAdjustmentExist(CostAdjustmentsData costAdjustmentsData) { EnsureMandatoryValuesAreProvided(costAdjustmentsData); var rowXpath = BuildCostAdjustmentRowXpath(costAdjustmentsData); return(IsElementPresent(By.XPath(rowXpath))); }
public void EditCostAdjustmentDefaults(CostAdjustmentsData costAdjustmentsData) { SelectCostAdjustmentRow(costAdjustmentsData); ClickElement(_btnEdit); PopulateCostAdjustmentFields(costAdjustmentsData); ClickElement(_btnDialogSave); Assert.IsTrue(IsSingleSuccessToastNotificationShown()); DismissAllToastNotifications(); UnselectCostAdjustmentRow(costAdjustmentsData); }
private string BuildCostAdjustmentRowXpath(CostAdjustmentsData costAdjustmentsData) { var dash = "—"; var client = costAdjustmentsData.Client; var country = costAdjustmentsData.Country; var publisher = costAdjustmentsData.Publisher; if (client == Default) { client = country = publisher = dash; } return($"//div[contains(@class,'ag__row ag__row--is-body')][contains(.,'{client}') and contains(.,'{country}') and contains(.,'{publisher}') and contains(.,'{costAdjustmentsData.Adjustment}')]"); }
private void PopulateCostAdjustmentFields(CostAdjustmentsData costAdjustmentsData) { if (!string.IsNullOrEmpty(costAdjustmentsData.Client) && costAdjustmentsData.Client != Default) { ClearInputAndTypeValue(_ddlClient, costAdjustmentsData.Client); ClearInputAndTypeValueIfRequired(_ddlCountry, costAdjustmentsData.Country); ClearInputAndTypeValueIfRequired(_ddlPublisher, costAdjustmentsData.Publisher); ClearInputAndTypeValue(_ddlAdjustment, costAdjustmentsData.Adjustment); } ClearInputAndTypeValueIfRequired(_txtVendorRate, costAdjustmentsData.VendorRate); SetReactCheckBoxState(_chkAllowUserOverrideVendorRate, costAdjustmentsData.AllowUserOverrideVendorRate); if (_txtClientRate.Enabled) { ClearInputAndTypeValueIfRequired(_txtClientRate, costAdjustmentsData.ClientRate); SetReactCheckBoxState(_chkAllowUserOverrideClientRate, costAdjustmentsData.AllowUserOverrideClientRate); } }
private void EnsureMandatoryValuesAreProvided(CostAdjustmentsData costAdjustmentsData) { var dataErrorFound = false; var clientDataErrors = new StringBuilder(); clientDataErrors.Append("The feature file " + FeatureContext.FeatureInfo.Title + " has the following data issues:"); if (string.IsNullOrWhiteSpace(costAdjustmentsData.Client)) { dataErrorFound = true; clientDataErrors.Append("\n- Client was not set"); } if (string.IsNullOrWhiteSpace(costAdjustmentsData.Adjustment)) { dataErrorFound = true; clientDataErrors.Append("\n- Adjustment was not set"); } if (dataErrorFound) { throw new ArgumentException(clientDataErrors.ToString()); } }
private void UnselectCostAdjustmentRow(CostAdjustmentsData costAdjustmentsData) { var rowCheckBox = GetCostAdjustmentRowCheckBox(costAdjustmentsData); SetReactCheckBoxState(rowCheckBox, false); }