public bool SalesIsCorrectlyCalculated(Pants.PantsAttr pants) { var newestLine = CountSalesRecordLines(); var productPrice = int.Parse(_driverInUse.FindElement( By.XPath("//tbody/tr[" + newestLine + "]/td[3]")).Text); var discountPrice = int.Parse(_driverInUse.FindElement( By.XPath("//tbody/tr[" + newestLine + "]/td[4]")).Text); var totalPrice = int.Parse(_driverInUse.FindElement( By.XPath("//tbody/tr[" + newestLine + "]/td[5]")).Text); if (productPrice == pants.ProductPrice) { if (discountPrice == pants.DiscountPrice) { if (totalPrice == pants.TotalPrice) { return(true); } return(false); } return(false); } throw new Exception("Product price for " + pants.ProductName + " does not match spec!"); }
private void SelectPants(Pants.PantsAttr pants) { if (ElementHelper.ValidateElement(_productIdSelector, _productIdSelector.GetAttribute("Name"))) { _productIdSelector.Click(); var selectElement = new SelectElement(_productIdSelector); selectElement.SelectByText(pants.ProductName); } }
public void PressToCreateSales(Pants.PantsAttr pants) { if (ElementHelper.ValidateElement(_customerName, _customerName.GetAttribute("Name"))) { _customerName.SendKeys(pants.CustomerName); } if (ElementHelper.ValidateElement(_createSalesButton, _createSalesButton.GetAttribute("Name"))) { _createSalesButton.Click(); } Thread.Sleep(1500); }
public bool SalesIsCreated(Pants.PantsAttr pants) { var newestLine = CountSalesRecordLines(); var pantType = _driverInUse.FindElement( By.XPath("//tbody/tr[" + newestLine + "]/td[1]")).Text; var customerName = _driverInUse.FindElement( By.XPath("//tbody/tr[" + newestLine + "]/td[2]")).Text; if (pantType.Contains(pants.ProductName) && customerName.Contains(pants.CustomerName)) { return(true); } throw new Exception("Sales record for " + pants.CustomerName + " not found!"); }
public void SelectPantsProduct(Pants.PantsAttr pants) { SelectPants(pants); Thread.Sleep(1500); }
public void InitProductIdSelector(Pants.PantsAttr pants) { SelectPantsProduct(pants); }