private void OnSave(object sender, RoutedEventArgs e) { SetLoadFolder(); validationData.Clear(); if (!GetValidationFlowFromTree(validationData.flow, Flow_TreeViewItem)) { validationData.flow = null; } else { validationData.SaveFlowData(sLoadFolder); } convertionTreeListItem.Clear(); if (!GetValidationConvertionTreeItemFromTree(convertionTreeListItem)) { convertionTreeListItem = null; } else { ValidationData.SaveConvertionTreeListItemData(sLoadFolder, convertionTreeListItem); validationData.bindingContainer = CreateBindingContainer(); validationData.SaveBindingContainerData(sLoadFolder); } }
public void ValidateByValidationData() { foreach (var item in ValidationData) { if (item.Selector == null) { ValidationErrors.Add(new PageObjectValidationError() { Code = 99, ErrorMessage = string.Format("The element {0} does not have a selector.", item.ElementName) }); continue; } var element = PageBase.WebDriver.FindElement(item.Selector); if (element.IsSelectable()) { var currentValue = element.GetSelectedOptionText(); if (!currentValue.Equals(item.ElementValue)) { ValidationErrors.Add(new PageObjectValidationError() { Code = 1, ErrorMessage = string.Format("The element {0} is not valid. Expected value: {1} / Current value: {2}", item.ElementName, item.ElementValue, currentValue) }); } } else { var currentValue = element.Text; if (!currentValue.Equals(item.ElementValue)) { ValidationErrors.Add(new PageObjectValidationError() { Code = 1, ErrorMessage = string.Format("The element {0} is not valid. Expected value: {1} / Current value: {2}", item.ElementName, item.ElementValue, currentValue) }); } } } ValidationData.Clear(); }