diff --git a/Extensions/CodedUIExtension.cs b/Extensions/CodedUIExtension.cs new file mode 100644 index 0000000..a046773 --- /dev/null +++ b/Extensions/CodedUIExtension.cs @@ -0,0 +1,72 @@ + +[assembly: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestExtensionPackage( + "Syncfusion.VisualStudio.Extension", + typeof(Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.Extension))] +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + using Microsoft.VisualStudio.TestTools.UITest.Common; + using Microsoft.VisualStudio.TestTools.UITest.Extension; + using Microsoft.VisualStudio.TestTools.UITesting; + using Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + + internal class Extension : UITestExtensionPackage + { + public override object GetService(Type serviceType) + { + if (serviceType == typeof(UITestPropertyProvider)) + { + if (propertyProvider == null) + { + propertyProvider = new ControlPropertyProviderBase(); + } + return propertyProvider; + } + return null; + } + + public override void Dispose() + { + propertyProvider = null; //throw new NotImplementedException(); + } + + public override string PackageDescription + { + get { return "Coded UI Support"; } + } + + public override string PackageName + { + get { return "VSTT Extension"; } + } + + public override string PackageVendor + { + get { return "Syncfusion"; } + } + + public override Version PackageVersion + { + get { return new Version(1, 0); } + } + + public override Version VSVersion + { + get + { +#if SyncfusionFramework4_5 + return new Version(11, 0); +#else + return new Version(10, 0); +#endif + } + } + private UITestPropertyProvider propertyProvider; + } + + +} diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..deefaa1 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,61 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Syncfusion.VisualStudio.Extension")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Syncfusion")] +[assembly: AssemblyProduct("Syncfusion.VisualStudio.Extension")] +[assembly: AssemblyCopyright("Copyright © Syncfusion 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + +#if SyncfusionFramework4_6 +[assembly: AssemblyVersion("13.4460.0.53")] +#elif SyncfusionFramework4_5_1 +[assembly: AssemblyVersion("13.4451.0.53")] +#elif SyncfusionFramework4_5 +[assembly: AssemblyVersion("12.2450.0.36")] +#else +[assembly: AssemblyVersion("12.2400.0.36")] +#endif +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..e2585b8 --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18449 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..ea3d842 --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.18449 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/PropertyProviders/PropertyProviderBase.cs b/PropertyProviders/PropertyProviderBase.cs new file mode 100644 index 0000000..fc49432 --- /dev/null +++ b/PropertyProviders/PropertyProviderBase.cs @@ -0,0 +1,213 @@ +using Microsoft.VisualStudio.TestTools.UITest.Extension; +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Controls; +using System.Windows; +using Syncfusion.UI.Xaml.Grid; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; + +using System.Windows.Automation; +using System.Diagnostics; +using System.Windows.Automation.Peers; +using Syncfusion.UI.Xaml.Controls.DataPager; +using Microsoft.VisualStudio.TestTools.UITest.Common; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class ControlPropertyProviderBase : UITestPropertyProvider + { + # region Properties + private bool isControlInProvider; + + private string controlIdentifier; + + internal string ControlIdentifier + { + get + { + return this.controlIdentifier; + } + set + { + if (this.controlIdentifier != value) + { + this.controlIdentifier = value; + } + } + } + # endregion + + # region Overrides + + private Dictionary uiControlPropertyProviders; + + protected Dictionary UiControlPropertyProviders + { + get + { + if (this.uiControlPropertyProviders == null) + { + this.uiControlPropertyProviders = new Dictionary(); + this.uiControlPropertyProviders.Add("GridCell", new SfGridCellPropertyProvider()); + this.uiControlPropertyProviders.Add("SfMultiColumnDropDownControl", new SfMultiColumnDropDownContrlPropertyProvider()); + this.uiControlPropertyProviders.Add("SfDataPager", new SfDataPagerPropertyProvider()); + this.uiControlPropertyProviders.Add("SfDataGrid", new SfDataGridPropertyProvider()); + this.uiControlPropertyProviders.Add("DetailsViewDataGrid", new SfDetailsViewDataGridPropertyProvider()); + this.UiControlPropertyProviders.Add("GroupDropArea", new SfGroupDropAreaPropertyProvider()); + this.UiControlPropertyProviders.Add("GroupDropAreaItem", new SfGroupDropAreaItemPropertyProvider()); + this.UiControlPropertyProviders.Add("GridRowHeaderCell", new SfRowHeaderCellPropertyProvider()); + this.UiControlPropertyProviders.Add("GridHeaderCellControl", new SfHeaderCellControlPropertyProvider()); + this.UiControlPropertyProviders.Add("GridStackedHeaderCellControl", new SfStackedHeaderCellControlPropertyProvider()); + this.UiControlPropertyProviders.Add("VirtualizingCellsControl", new SfGridRowPropertyProvider()); + this.UiControlPropertyProviders.Add("TreeGridCell", new SfTreeGridCellPropertyProvider()); + this.UiControlPropertyProviders.Add("SfTreeGrid", new SfTreeGridPropertyProvider()); + this.UiControlPropertyProviders.Add("TreeGridRowControl", new SfTreeGridRowPropertyProvider()); + this.UiControlPropertyProviders.Add("TreeGridHeaderCell", new SfTreeGridHeaderCellPropertyProvider()); + this.UiControlPropertyProviders.Add("TreeGridRowHeaderCell", new SfTreeGridRowHeaderCellPropertyProvider()); + this.UiControlPropertyProviders.Add("TreeGridStackedHeaderCell", new SfTreeGridStackedHeaderCellPropertyProvider()); + } + return this.uiControlPropertyProviders; + } + } + + public override int GetControlSupportLevel(UITestControl uiTestControl) + { + if (!this.isControlInProvider && this.IsSupported(uiTestControl)) + { + return (int)ControlSupport.ControlSpecificSupport; + } + return (int)ControlSupport.NoSupport; + } + + private bool IsSupported(UITestControl uiTestControl) + { + this.ControlIdentifier = this.GetControlIdentifier(uiTestControl); + return this.ControlIdentifier != null && this.UiControlPropertyProviders.Keys.Contains(this.ControlIdentifier); + } + + private string GetControlIdentifier(UITestControl uiTestControl) + { + string result = null; + if (uiTestControl.SearchProperties.Contains("ClassName")) + { + result = uiTestControl.SearchProperties["ClassName"].Split(new char[] + { + '.' + }).LastOrDefault(); + } + else + { + if (uiTestControl.SearchProperties.Contains("AutomationId")) + { + result = uiTestControl.SearchProperties["AutomationId"].Split(new char[]{'_'}).LastOrDefault(); + } + } + return result; + } + + public override UITestPropertyDescriptor GetPropertyDescriptor(UITestControl uiTestControl, string propertyName) + { + this.isControlInProvider = true; + UITestPropertyDescriptor result; + try + { + Dictionary propertiesMap = this.UiControlPropertyProviders[this.ControlIdentifier].GetUIControlPropertiesMap(); + if (propertiesMap.ContainsKey(propertyName)) + { + result = propertiesMap[propertyName]; + } + else + { + result = null; + } + } + finally + { + this.isControlInProvider = false; + } + return result; + } + + public override string GetPropertyForAction(UITestControl uiTestControl, UITestAction action) + { + throw new NotSupportedException(); + } + + public override string[] GetPropertyForControlState(UITestControl uiTestControl, ControlStates uiState, out bool[] stateValues) + { + stateValues = null; + return null; + } + + public override ICollection GetPropertyNames(UITestControl uiTestControl) + { + this.isControlInProvider = true; + ICollection result; + try + { + if (this.IsSupported(uiTestControl)) + { + result = this.UiControlPropertyProviders[this.ControlIdentifier].GetUIControlPropertiesMap().Keys; + } + else + { + result = null; + } + } + finally + { + this.isControlInProvider = false; + } + return result; + } + + public override Type GetPropertyNamesClassType(UITestControl uiTestControl) + { + return this.UiControlPropertyProviders[this.ControlIdentifier].SpecializedType.GetMember("PropertyNames").GetType(); + } + + public override object GetPropertyValue(UITestControl uiTestControl, string propertyName) + { + //WPF-25220 ControlIdentifier must not null to avoid exception "Value Cannot be Null; Parameter Name Key" + if (this.ControlIdentifier!=null &&((uiTestControl != null) || this.UiControlPropertyProviders.ContainsKey(this.ControlIdentifier))) + return this.UiControlPropertyProviders[this.ControlIdentifier].GetUIControlPropertyValue(uiTestControl, propertyName); + throw new NotSupportedException(); + } + + public override Type GetSpecializedClass(UITestControl uiTestControl) + { + return this.UiControlPropertyProviders[this.ControlIdentifier].SpecializedType; + } + + public override void SetPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + this.UiControlPropertyProviders[this.ControlIdentifier].SetUIControlPropertyValue(uiTestControl, propertyName, value); + } + + public override string[] GetPredefinedSearchProperties(Type specializedClass) + { + return new string[] + { + UITestControl.PropertyNames.ControlType + }; + // throw new NotImplementedException(); + } + + # endregion + } + + public interface IUIControlPropertyProvider + { + Type SpecializedType + { + get; + } + Dictionary GetUIControlPropertiesMap(); + object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName); + void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value); + } +} diff --git a/PropertyProviders/PropertyProviderHelper.cs b/PropertyProviders/PropertyProviderHelper.cs new file mode 100644 index 0000000..3b55b3e --- /dev/null +++ b/PropertyProviders/PropertyProviderHelper.cs @@ -0,0 +1,55 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + internal static class PropertyProviderHelper + { + internal static int FindIndex(string propertyName, Dictionary Properties) + { + int index = 0; + foreach (var item in Properties) + { + if (item.Key == propertyName) + return index; + index++; + } + return -1; + } + + internal static object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, Dictionary Properties) + { + if (Properties.ContainsKey(propertyName)) + { + AutomationElement automationElement = uiTestControl.NativeElement as AutomationElement; + AutomationElement.AutomationElementInformation current = automationElement.Current; + if (current.ItemStatus.Equals(string.Empty)) + { + throw new NotSupportedException(); + } + AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + + return array[PropertyProviderHelper.FindIndex(propertyName, Properties)]; + } + else if (propertyName == "ClassName") + { + AutomationElement automationElement = uiTestControl.NativeElement as AutomationElement; + AutomationElement.AutomationElementInformation current = automationElement.Current; + return current.ClassName; + } + + throw new NotSupportedException(); + + } + + } +} diff --git a/PropertyProviders/SfDataGridPropertyProvider.cs b/PropertyProviders/SfDataGridPropertyProvider.cs new file mode 100644 index 0000000..e1b58ee --- /dev/null +++ b/PropertyProviders/SfDataGridPropertyProvider.cs @@ -0,0 +1,78 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class SfDataGridPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary dataGridPropertiesMap; + public Dictionary DataGridPropertiesMap + { + get + { + if (this.dataGridPropertiesMap == null) + { + this.dataGridPropertiesMap = this.GetUIControlPropertiesMap(); + } + return this.dataGridPropertiesMap; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfDataGrid); } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, DataGridPropertiesMap); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfDataGrid.PropertyNames.RowCount, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataGrid.PropertyNames.ColumnCount, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataGrid.PropertyNames.SelectionMode, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataGrid.PropertyNames.SelectionUnit, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataGrid.PropertyNames.SelectedIndex, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataGrid.PropertyNames.SelectedItemCount, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + return dictionary; + } + } +} diff --git a/PropertyProviders/SfDataPagerPropertyProvider.cs b/PropertyProviders/SfDataPagerPropertyProvider.cs new file mode 100644 index 0000000..a0d9ed2 --- /dev/null +++ b/PropertyProviders/SfDataPagerPropertyProvider.cs @@ -0,0 +1,87 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class SfDataPagerPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary dataPagerPropertiesMap; + public Dictionary DataPagerPropertiesMap + { + get + { + if (this.dataPagerPropertiesMap == null) + { + this.dataPagerPropertiesMap = this.GetUIControlPropertiesMap(); + } + return this.dataPagerPropertiesMap; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get + { + return typeof(WpfSfDataPager); + } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, DataPagerPropertiesMap); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + //uiTestControl.SearchProperties.Add(UITestControl.PropertyNames.ControlType, ControlType.Group.FriendlyName); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfDataPager.PropertyNames.AccentBackground, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataPager.PropertyNames.AccentForeground, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataPager.PropertyNames.AutoEllipsisMode, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataPager.PropertyNames.AutoEllipsisText, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataPager.PropertyNames.DisplayMode, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataPager.PropertyNames.EnableGridPaging, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataPager.PropertyNames.NumericButtonCount, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataPager.PropertyNames.Orientation, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataPager.PropertyNames.PageCount, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataPager.PropertyNames.PageSize, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDataPager.PropertyNames.UseOnDemandPaging, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + } +} diff --git a/PropertyProviders/SfDetailsViewDataGridPropertyProvider.cs b/PropertyProviders/SfDetailsViewDataGridPropertyProvider.cs new file mode 100644 index 0000000..adba055 --- /dev/null +++ b/PropertyProviders/SfDetailsViewDataGridPropertyProvider.cs @@ -0,0 +1,79 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class SfDetailsViewDataGridPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary detailsViewDataGridPropertiesMap; + public Dictionary DetailsViewDataGridPropertiesMap + { + get + { + if (this.detailsViewDataGridPropertiesMap == null) + { + this.detailsViewDataGridPropertiesMap = this.GetUIControlPropertiesMap(); + } + return this.detailsViewDataGridPropertiesMap; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfDetailsViewDataGrid); } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, DetailsViewDataGridPropertiesMap); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfDetailsViewDataGrid.PropertyNames.RowCount, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDetailsViewDataGrid.PropertyNames.ColumnCount, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDetailsViewDataGrid.PropertyNames.SelectionMode, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDetailsViewDataGrid.PropertyNames.SelectionUnit, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDetailsViewDataGrid.PropertyNames.SelectedIndex, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfDetailsViewDataGrid.PropertyNames.SelectedItemCount, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + return dictionary; + } + } +} diff --git a/PropertyProviders/SfGridCellPropertyProvider.cs b/PropertyProviders/SfGridCellPropertyProvider.cs new file mode 100644 index 0000000..232a262 --- /dev/null +++ b/PropertyProviders/SfGridCellPropertyProvider.cs @@ -0,0 +1,101 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class SfGridCellPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary dataGridCellProperties; + public Dictionary DataGridCellProperties + { + get + { + if (dataGridCellProperties == null) + { + dataGridCellProperties = GetUIControlPropertiesMap(); + } + return dataGridCellProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get + { + return typeof(WpfSfGridCell); + } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + if (propertyName == "FriendlyName") + { + AutomationElement automationElement = uiTestControl.NativeElement as AutomationElement; + AutomationElement.AutomationElementInformation current = automationElement.Current; + if (current.ItemStatus.Equals(string.Empty)) + { + throw new NotSupportedException(); + } + AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.RemoveEmptyEntries); + + return array[0]; + } + else if (propertyName == "Name") + return null; + else + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, DataGridCellProperties); + + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfGridCell.PropertyNames.CellValue, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfGridCell.PropertyNames.FormattedValue, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfGridCell.PropertyNames.RowIndex, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfGridCell.PropertyNames.ColumnIndex, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfGridCell.PropertyNames.ColumnName, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfGridCell.PropertyNames.HeaderText, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + } +} diff --git a/PropertyProviders/SfGridRowPropertyProvider.cs b/PropertyProviders/SfGridRowPropertyProvider.cs new file mode 100644 index 0000000..e421dc7 --- /dev/null +++ b/PropertyProviders/SfGridRowPropertyProvider.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Automation; +using Microsoft.VisualStudio.TestTools.UITesting; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class SfGridRowPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary dataGridRowProperties; + public Dictionary DataGridRowProperties + { + get + { + if (dataGridRowProperties == null) + { + dataGridRowProperties = GetUIControlPropertiesMap(); + } + return dataGridRowProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get + { + return typeof(WpfSfRow); + } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, DataGridRowProperties); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfRow.PropertyNames.RowIndex, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfRow.PropertyNames.RowType, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfRow.PropertyNames.IsSelected, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + + + } +} diff --git a/PropertyProviders/SfGroupDropAreaItemPropertyProvider.cs b/PropertyProviders/SfGroupDropAreaItemPropertyProvider.cs new file mode 100644 index 0000000..138b2f3 --- /dev/null +++ b/PropertyProviders/SfGroupDropAreaItemPropertyProvider.cs @@ -0,0 +1,74 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class SfGroupDropAreaItemPropertyProvider:IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary groupDropAreaItemProperties; + public Dictionary GroupDropAreaItemProperties + { + get + { + if (groupDropAreaItemProperties == null) + { + groupDropAreaItemProperties = GetUIControlPropertiesMap(); + } + return groupDropAreaItemProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfGroupDropAreaItem); } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, GroupDropAreaItemProperties); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfGroupDropAreaItem.PropertyNames.GroupName, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfGroupDropAreaItem.PropertyNames.SortDirection, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + } +} diff --git a/PropertyProviders/SfGroupDropAreaPropertyProvider.cs b/PropertyProviders/SfGroupDropAreaPropertyProvider.cs new file mode 100644 index 0000000..26d6013 --- /dev/null +++ b/PropertyProviders/SfGroupDropAreaPropertyProvider.cs @@ -0,0 +1,74 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class SfGroupDropAreaPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary groupDropAreaProperties; + public Dictionary GroupDropAreaProperties + { + get + { + if (groupDropAreaProperties == null) + { + groupDropAreaProperties = GetUIControlPropertiesMap(); + } + return groupDropAreaProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfGroupDropArea); } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, GroupDropAreaProperties); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfGroupDropArea.PropertyNames.IsExpanded, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfGroupDropArea.PropertyNames.GroupDropAreaText, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + } +} diff --git a/PropertyProviders/SfHeaderCellControlPropertyProvider.cs b/PropertyProviders/SfHeaderCellControlPropertyProvider.cs new file mode 100644 index 0000000..05e2d07 --- /dev/null +++ b/PropertyProviders/SfHeaderCellControlPropertyProvider.cs @@ -0,0 +1,80 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class SfHeaderCellControlPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary headerCellProperties; + public Dictionary HeaderCellControlProperties + { + get + { + if (headerCellProperties == null) + { + headerCellProperties = GetUIControlPropertiesMap(); + } + return headerCellProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfHeaderCellControl); } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, HeaderCellControlProperties); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfHeaderCellControl.PropertyNames.ColumnName, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfHeaderCellControl.PropertyNames.HeaderText, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfHeaderCellControl.PropertyNames.IsFilterApplied, new UITestPropertyDescriptor(typeof(bool), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfHeaderCellControl.PropertyNames.FilterIconVisiblity, new UITestPropertyDescriptor(typeof(Visibility), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfHeaderCellControl.PropertyNames.SortDirection, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfHeaderCellControl.PropertyNames.SortNumberVisibility, new UITestPropertyDescriptor(typeof(Visibility), UITestPropertyAttributes.Readable)); + + return dictionary; + } + } +} diff --git a/PropertyProviders/SfMultiColumnDropDownContrlPropertyProvider.cs b/PropertyProviders/SfMultiColumnDropDownContrlPropertyProvider.cs new file mode 100644 index 0000000..1c1c405 --- /dev/null +++ b/PropertyProviders/SfMultiColumnDropDownContrlPropertyProvider.cs @@ -0,0 +1,83 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class SfMultiColumnDropDownContrlPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary multicolumnPropertiesMap; + public Dictionary MultiColumnPropertiesMap + { + get + { + if (this.multicolumnPropertiesMap == null) + { + this.multicolumnPropertiesMap = this.GetUIControlPropertiesMap(); + } + return this.multicolumnPropertiesMap; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfMultiColumnDropDownControl); } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, MultiColumnPropertiesMap); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfMultiColumnDropDownControl.PropertyNames.AllowAutoComplete, new UITestPropertyDescriptor(typeof(bool), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfMultiColumnDropDownControl.PropertyNames.AllowNullInput, new UITestPropertyDescriptor(typeof(bool), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfMultiColumnDropDownControl.PropertyNames.AllowImmediatePopup, new UITestPropertyDescriptor(typeof(bool), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfMultiColumnDropDownControl.PropertyNames.AllowIncrementalFiltering, new UITestPropertyDescriptor(typeof(bool), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfMultiColumnDropDownControl.PropertyNames.AllowCaseSensitiveFiltering, new UITestPropertyDescriptor(typeof(bool), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfMultiColumnDropDownControl.PropertyNames.AllowSpinOnMouseWheel, new UITestPropertyDescriptor(typeof(bool), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfMultiColumnDropDownControl.PropertyNames.DisplayMember, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfMultiColumnDropDownControl.PropertyNames.IsDropDownOpen, new UITestPropertyDescriptor(typeof(bool), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfMultiColumnDropDownControl.PropertyNames.SelectedIndex, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfMultiColumnDropDownControl.PropertyNames.ValueMember, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + + } +} diff --git a/PropertyProviders/SfRowHeaderCellPropertyProvider.cs b/PropertyProviders/SfRowHeaderCellPropertyProvider.cs new file mode 100644 index 0000000..e240d40 --- /dev/null +++ b/PropertyProviders/SfRowHeaderCellPropertyProvider.cs @@ -0,0 +1,75 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class SfRowHeaderCellPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary rowHeaderProperties; + public Dictionary RowHeaderProperties + { + get + { + if (rowHeaderProperties == null) + { + rowHeaderProperties = GetUIControlPropertiesMap(); + } + return rowHeaderProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfRowHeaderCell); } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, RowHeaderProperties); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfRowHeaderCell.PropertyNames.RowIndex, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfRowHeaderCell.PropertyNames.State, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfRowHeaderCell.PropertyNames.RowErrorMessage, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + } +} diff --git a/PropertyProviders/SfStackedHeaderCellControlPropertyProvider.cs b/PropertyProviders/SfStackedHeaderCellControlPropertyProvider.cs new file mode 100644 index 0000000..9af6dbc --- /dev/null +++ b/PropertyProviders/SfStackedHeaderCellControlPropertyProvider.cs @@ -0,0 +1,74 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class SfStackedHeaderCellControlPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary headerCellProperties; + public Dictionary HeaderCellControlProperties + { + get + { + if (headerCellProperties == null) + { + headerCellProperties = GetUIControlPropertiesMap(); + } + return headerCellProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfStackedHeaderCellControl); } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, HeaderCellControlProperties); + } + + /// + /// Set the Property Value + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfStackedHeaderCellControl.PropertyNames.ColumnName, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + } +} diff --git a/PropertyProviders/SfTreeGridCellPropertyProvider.cs b/PropertyProviders/SfTreeGridCellPropertyProvider.cs new file mode 100644 index 0000000..22f294f --- /dev/null +++ b/PropertyProviders/SfTreeGridCellPropertyProvider.cs @@ -0,0 +1,105 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Automation; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// To provide custom properties for TreeGridCell. + /// + public class SfTreeGridCellPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary treeGridCellProperties; + public Dictionary TreeGridCellProperties + { + get + { + if (treeGridCellProperties == null) + { + treeGridCellProperties = GetUIControlPropertiesMap(); + } + return treeGridCellProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get + { + return typeof(WpfSfTreeGridCell); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfTreeGridCell.PropertyNames.CellValue, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridCell.PropertyNames.FormattedValue, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridCell.PropertyNames.RowIndex, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridCell.PropertyNames.ColumnIndex, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridCell.PropertyNames.ColumnName, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridCell.PropertyNames.HeaderText, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + if (propertyName == "FriendlyName") + { + AutomationElement automationElement = uiTestControl.NativeElement as AutomationElement; + AutomationElement.AutomationElementInformation current = automationElement.Current; + if (current.ItemStatus.Equals(string.Empty)) + { + throw new NotSupportedException(); + } + AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.RemoveEmptyEntries); + + return array[0]; + } + else if (propertyName == "Name") + return null; + else + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, TreeGridCellProperties); + + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + } +} diff --git a/PropertyProviders/SfTreeGridHeaderCellPropertyProvider.cs b/PropertyProviders/SfTreeGridHeaderCellPropertyProvider.cs new file mode 100644 index 0000000..2b09bc1 --- /dev/null +++ b/PropertyProviders/SfTreeGridHeaderCellPropertyProvider.cs @@ -0,0 +1,81 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// To provide custom properties for TreeGridHeaderCell. + /// + public class SfTreeGridHeaderCellPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary treeGridHeaderCellProperties; + public Dictionary TreeGridHeaderCellProperties + { + get + { + if (treeGridHeaderCellProperties == null) + { + treeGridHeaderCellProperties = GetUIControlPropertiesMap(); + } + return treeGridHeaderCellProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfTreeGridHeaderCell); } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, TreeGridHeaderCellProperties); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfTreeGridHeaderCell.PropertyNames.ColumnName, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridHeaderCell.PropertyNames.HeaderText, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridHeaderCell.PropertyNames.SortDirection, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridHeaderCell.PropertyNames.SortNumberVisibility, new UITestPropertyDescriptor(typeof(Visibility), UITestPropertyAttributes.Readable)); + + return dictionary; + } + } +} diff --git a/PropertyProviders/SfTreeGridPropertyProvider.cs b/PropertyProviders/SfTreeGridPropertyProvider.cs new file mode 100644 index 0000000..37b272f --- /dev/null +++ b/PropertyProviders/SfTreeGridPropertyProvider.cs @@ -0,0 +1,81 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// To provide custom properties for SfTreeGrid. + /// + public class SfTreeGridPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary treeGridPropertiesMap; + public Dictionary TreeGridPropertiesMap + { + get + { + if (this.treeGridPropertiesMap == null) + { + this.treeGridPropertiesMap = this.GetUIControlPropertiesMap(); + } + return this.treeGridPropertiesMap; + } + } + + #endregion + + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfTreeGrid); } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfTreeGrid.PropertyNames.RowCount, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGrid.PropertyNames.ColumnCount, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGrid.PropertyNames.SelectionMode, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGrid.PropertyNames.SelectedIndex, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGrid.PropertyNames.SelectedItemCount, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + return dictionary; + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, TreeGridPropertiesMap); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + } +} diff --git a/PropertyProviders/SfTreeGridRowHeaderCellPropertyProvider.cs b/PropertyProviders/SfTreeGridRowHeaderCellPropertyProvider.cs new file mode 100644 index 0000000..72128df --- /dev/null +++ b/PropertyProviders/SfTreeGridRowHeaderCellPropertyProvider.cs @@ -0,0 +1,78 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// To provide custom properties for TreeGridRowHeaderCell. + /// + public class SfTreeGridRowHeaderCellPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary treeGridRowHeaderProperties; + public Dictionary TreeGridRowHeaderProperties + { + get + { + if (treeGridRowHeaderProperties == null) + { + treeGridRowHeaderProperties = GetUIControlPropertiesMap(); + } + return treeGridRowHeaderProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfTreeGridRowHeaderCell); } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, TreeGridRowHeaderProperties); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfTreeGridRowHeaderCell.PropertyNames.RowIndex, new UITestPropertyDescriptor(typeof(int), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridRowHeaderCell.PropertyNames.State, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridRowHeaderCell.PropertyNames.RowErrorMessage, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + } +} diff --git a/PropertyProviders/SfTreeGridRowPropertyProvider.cs b/PropertyProviders/SfTreeGridRowPropertyProvider.cs new file mode 100644 index 0000000..936692f --- /dev/null +++ b/PropertyProviders/SfTreeGridRowPropertyProvider.cs @@ -0,0 +1,81 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// To provide custom properties for TreeGridRowControlBase. + /// + public class SfTreeGridRowPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary treeGridRowProperties; + public Dictionary TreeGridRowProperties + { + get + { + if (treeGridRowProperties == null) + { + treeGridRowProperties = GetUIControlPropertiesMap(); + } + return treeGridRowProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get + { + return typeof(WpfSfTreeGridRow); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfTreeGridRow.PropertyNames.RowIndex, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridRow.PropertyNames.RowType, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + dictionary.Add(WpfSfTreeGridRow.PropertyNames.IsSelected, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, TreeGridRowProperties); + } + + /// + /// Set the PropertyValue + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + } +} diff --git a/PropertyProviders/SfTreeGridStackedHeaderCellPropertyProvider.cs b/PropertyProviders/SfTreeGridStackedHeaderCellPropertyProvider.cs new file mode 100644 index 0000000..c8cebaa --- /dev/null +++ b/PropertyProviders/SfTreeGridStackedHeaderCellPropertyProvider.cs @@ -0,0 +1,76 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// To provide custom properties for TreeGridStackedHeaderCell. + /// + public class SfTreeGridStackedHeaderCellPropertyProvider : IUIControlPropertyProvider + { + #region Get the custom Properties + + private Dictionary treeGridStackedHeaderCellProperties; + public Dictionary TreeGridStackedHeaderCellProperties + { + get + { + if (treeGridStackedHeaderCellProperties == null) + { + treeGridStackedHeaderCellProperties = GetUIControlPropertiesMap(); + } + return treeGridStackedHeaderCellProperties; + } + } + + #endregion + + /// + /// Get the type of control + /// + public Type SpecializedType + { + get { return typeof(WpfSfTreeGridStackedHeaderCell); } + } + + /// + /// Get the Property value + /// + /// UITestControl + /// PropertyName + /// object + public object GetUIControlPropertyValue(UITestControl uiTestControl, string propertyName) + { + return PropertyProviderHelper.GetUIControlPropertyValue(uiTestControl, propertyName, TreeGridStackedHeaderCellProperties); + } + + /// + /// Set the Property Value + /// + /// UiTestControl + /// PropertyName + /// value + public void SetUIControlPropertyValue(UITestControl uiTestControl, string propertyName, object value) + { + if (uiTestControl != null) + { + uiTestControl.SetProperty(propertyName, value); + } + } + + /// + /// Invokes to get the list of UIControl proeprties + /// + /// Dictionary + public Dictionary GetUIControlPropertiesMap() + { + Dictionary dictionary = new Dictionary(); + dictionary.Add(WpfSfTreeGridStackedHeaderCell.PropertyNames.ColumnName, new UITestPropertyDescriptor(typeof(string), UITestPropertyAttributes.Readable)); + return dictionary; + } + } +} diff --git a/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2010.csproj b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2010.csproj new file mode 100644 index 0000000..12272f4 --- /dev/null +++ b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2010.csproj @@ -0,0 +1,161 @@ + + + + + Debug + AnyCPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B} + Library + Properties + Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension + Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension + v4.0 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + + AnyCPU + true + full + false + bin\Debug\ + TRACE;DEBUG;SyncfusionFramework4_0; + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE;SyncfusionFramework4_0; + prompt + 4 + + + + + + + False + C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll + + + False + C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll + + + False + C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.TestTools.UITest.Common.dll + + + False + C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.TestTools.UITest.Extension.dll + + + False + C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.TestTools.UITesting.dll + + + False + C:\Program Files (x86)\Syncfusion\Essential Studio\12.2.0.36\precompiledassemblies\12.2.0.36\4.0\Syncfusion.Data.WPF.dll + + + False + C:\Program Files (x86)\Syncfusion\Essential Studio\12.2.0.36\precompiledassemblies\12.2.0.36\4.0\Syncfusion.SfGrid.WPF.dll + + + + + + + + + + + + 4.0 + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + + + + + + + + + + Code + + + + Code + + + + + + + + + + + + + + + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + \ No newline at end of file diff --git a/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2010.sln b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2010.sln new file mode 100644 index 0000000..1ac00b6 --- /dev/null +++ b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2010.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2010", "Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2010.csproj", "{F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2012.csproj b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2012.csproj new file mode 100644 index 0000000..b1c48c9 --- /dev/null +++ b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2012.csproj @@ -0,0 +1,160 @@ + + + + + Debug + AnyCPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B} + Library + Properties + Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension + Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + + AnyCPU + true + full + false + bin\Debug\ + TRACE;DEBUG;SyncfusionFramework4_5; + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE;SyncfusionFramework4_5; + prompt + 4 + + + + + + + False + C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.CodedUITestFramework.dll + + + False + C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll + + + False + C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.TestTools.UITest.Common.dll + + + False + C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.TestTools.UITest.Extension.dll + + + False + C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.TestTools.UITesting.dll + + + False + C:\Program Files (x86)\Syncfusion\Essential Studio\12.2.0.36\precompiledassemblies\12.2.0.36\4.0\Syncfusion.Data.WPF.dll + + + False + C:\Program Files (x86)\Syncfusion\Essential Studio\12.2.0.36\precompiledassemblies\12.2.0.36\4.0\Syncfusion.SfGrid.WPF.dll + + + + + + + + + + + + 4.0 + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + + + + + + + + Code + + + + Code + + + + + + + + + + + + + + + + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + \ No newline at end of file diff --git a/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2012.sln b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2012.sln new file mode 100644 index 0000000..7c58437 --- /dev/null +++ b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2012.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2012", "Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2012.csproj", "{F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2013.csproj b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2013.csproj new file mode 100644 index 0000000..af7c5a5 --- /dev/null +++ b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2013.csproj @@ -0,0 +1,146 @@ + + + + + Debug + AnyCPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B} + Library + Properties + Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension + Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension + v4.5.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + + AnyCPU + true + full + false + bin\Debug\ + TRACE;DEBUG;SyncfusionFramework4_5_1; + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE;SyncfusionFramework4_5_1; + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4.0 + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + + + + + + + + + + + + + + + + Code + + + + Code + + + + + + + + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + \ No newline at end of file diff --git a/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2013.sln b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2013.sln new file mode 100644 index 0000000..c5ddaff --- /dev/null +++ b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2013.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2013", "Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2013.csproj", "{F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2015.csproj b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2015.csproj new file mode 100644 index 0000000..7b0963a --- /dev/null +++ b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2015.csproj @@ -0,0 +1,146 @@ + + + + + Debug + AnyCPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B} + Library + Properties + Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension + Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension + v4.6 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + + AnyCPU + true + full + false + bin\Debug\ + TRACE;DEBUG;SyncfusionFramework4_6; + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE;SyncfusionFramework4_6; + prompt + 4 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 4.0 + + + + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + + + + + + + + + + + + + + + + Code + + + + Code + + + + + + + + + + + + + + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + \ No newline at end of file diff --git a/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2015.sln b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2015.sln new file mode 100644 index 0000000..8aecd6a --- /dev/null +++ b/Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2015.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 14.00 +# Visual Studio 2015 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2015", "Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension.WPF_2015.csproj", "{F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F6FE31A1-6C4D-4C70-9EF4-14E7BFD1690B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/WpfControlsClass/WpfSfDataGrid.cs b/WpfControlsClass/WpfSfDataGrid.cs new file mode 100644 index 0000000..9a8d11f --- /dev/null +++ b/WpfControlsClass/WpfSfDataGrid.cs @@ -0,0 +1,139 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class WpfSfDataGrid : WpfControl + { + public new abstract class PropertyNames + { + public static readonly string RowCount = "RowCount"; + public static readonly string ColumnCount = "ColumnCount"; + public static readonly string SelectionMode = "SelectionMode"; + public static readonly string SelectionUnit = "SelectionUnit"; + public static readonly string SelectedIndex = "SelectedIndex"; + public static readonly string SelectedItemCount ="SelectedItemCount"; + + } + + public WpfSfDataGrid() + : this(null) + { + } + public WpfSfDataGrid(UITestControl parent) + : base(parent) + { + } + + #region private fields + + private string rowCount; + private string columnCount; + private string selectionMode; + private string selectionUnit; + private string selectedIndex; + private string selectedItemCount; + + #endregion + + #region public properties + + /// + /// Gets or Sets cell RowCount + /// + public virtual string RowCount + { + get + { + return rowCount; + } + set + { + rowCount = value; + } + + } + + /// + /// Gets or Sets the ColumnCount + /// + public virtual string ColumnCount + { + get + { + return columnCount; + } + set + { + columnCount = value; + } + } + + /// + /// Gets or Sets the SelectionMode + /// + public virtual string SelectionMode + { + get + { + return selectionMode; + } + set + { + selectionMode = value; + } + } + + /// + /// Gets or Sets the SelectionUnit + /// + public virtual string SelectionUnit + { + get + { + return selectionUnit; + } + set + { + selectionUnit = value; + } + } + + /// + /// Gets or Sets the SelectedIndex + /// + public virtual string SelectedIndex + { + get + { + return selectedIndex; + } + set + { + selectedIndex = value; + } + } + + /// + /// Gets or Sets the SelectedItemCount + /// + public virtual string SelectedItemCount + { + get + { + return selectedItemCount; + } + set + { + selectedItemCount = value; + } + } + + #endregion + + } +} diff --git a/WpfControlsClass/WpfSfDataPager.cs b/WpfControlsClass/WpfSfDataPager.cs new file mode 100644 index 0000000..6a2a50a --- /dev/null +++ b/WpfControlsClass/WpfSfDataPager.cs @@ -0,0 +1,215 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class WpfSfDataPager:WpfControl + { + public new abstract class PropertyNames + { + public static readonly string AccentBackground = "AccentBackground"; + public static readonly string AccentForeground = "AccentForeground"; + public static readonly string AutoEllipsisMode = "AutoEllipsisMode"; + public static readonly string AutoEllipsisText = "AutoEllipsisText"; + public static readonly string DisplayMode = "DisplayMode"; + public static readonly string EnableGridPaging = "EnableGridPaging"; + public static readonly string NumericButtonCount = "NumericButtonCount"; + public static readonly string Orientation = "Orientation"; + public static readonly string PageCount = "PageCount"; + public static readonly string PageSize = "PageSize"; + public static readonly string UseOnDemandPaging = "UseOnDemandPaging"; + } + + public WpfSfDataPager() + : this(null) + { + } + public WpfSfDataPager(UITestControl parent) + : base(parent) + { + } + + #region private fields + private string accentBackground; + private string accentForeground; + private string autoEllipsisMode; + private string autoEllipsisText; + private string displayMode; + private string enableGridPaging; + private string numericButtonCount; + private string orientation; + private string pageCount; + private string pageSize; + private string useOnDemandPaging; + #endregion + + #region public properties + public virtual string AccentBackground + { + get + { + return accentBackground; + } + set + { + accentBackground = value; + } + } + + /// + /// Get or Set AccentForeground + /// + public virtual string AccentForeground + { + get + { + return accentForeground; + } + set + { + accentForeground = value; + } + } + + /// + /// Get or Set AutoEllipsisMode + /// + public virtual string AutoEllipsisMode + { + get + { + return autoEllipsisMode; + } + set + { + autoEllipsisMode = value; + } + } + + /// + /// Get or Set AutoEllipsisText + /// + public virtual string AutoEllipsisText + { + get + { + return autoEllipsisText; + } + set + { + autoEllipsisText = value; + } + } + + /// + /// Get or Set DisplayMode + /// + public virtual string DisplayMode + { + get + { + return displayMode; + } + set + { + displayMode = value; + } + } + + /// + /// Get or Set EnableGridPaging + /// + public virtual string EnableGridPaging + { + get + { + return enableGridPaging; + } + set + { + enableGridPaging = value; + } + } + + /// + /// Get or Set NumericButtonCount + /// + public virtual string NumericButtonCount + { + get + { + return numericButtonCount; + } + set + { + numericButtonCount = value; + } + } + + /// + /// Get or Set Orientation + /// + public virtual string Orientation + { + get + { + return orientation; + } + set + { + orientation = value; + } + } + + /// + /// Get or Set PageCount + /// + public virtual string PageCount + { + get + { + return pageCount; + } + set + { + pageCount = value; + } + } + + /// + /// Get or Set PageSize + /// + public virtual string PageSize + { + get + { + return pageSize; + } + set + { + pageSize = value; + } + } + + /// + /// Get or Set UseOnDemandPaging + /// + public virtual string UseOnDemandPaging + { + get + { + return useOnDemandPaging; + } + set + { + useOnDemandPaging = value; + } + } + #endregion + } + +} diff --git a/WpfControlsClass/WpfSfDetailsViewDataGrid.cs b/WpfControlsClass/WpfSfDetailsViewDataGrid.cs new file mode 100644 index 0000000..bb01b7c --- /dev/null +++ b/WpfControlsClass/WpfSfDetailsViewDataGrid.cs @@ -0,0 +1,136 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class WpfSfDetailsViewDataGrid:WpfControl + { + + public new abstract class PropertyNames + { + public static readonly string RowCount = "RowCount"; + public static readonly string ColumnCount = "ColumnCount"; + public static readonly string SelectionMode = "SelectionMode"; + public static readonly string SelectionUnit = "SelectionUnit"; + public static readonly string SelectedIndex = "SelectedIndex"; + public static readonly string SelectedItemCount = "SelectedItemCount"; + + } + + public WpfSfDetailsViewDataGrid() + { + } + public WpfSfDetailsViewDataGrid(UITestControl control) + : base(control) + { + } + #region private fields + + private string rowCount; + private string columnCount; + private string selectionMode; + private string selectionUnit; + private string selectedIndex; + private string selectedItemCount; + + #endregion + + #region public properties + /// + /// Gets or Sets cell RowCount + /// + public virtual string RowCount + { + get + { + return rowCount; + } + set + { + rowCount = value; + } + + } + + /// + /// Gets or Sets the ColumnCount + /// + public virtual string ColumnCount + { + get + { + return columnCount; + } + set + { + columnCount = value; + } + } + + /// + /// Gets or Sets the SelectionMode + /// + public virtual string SelectionMode + { + get + { + return selectionMode; + } + set + { + selectionMode = value; + } + } + + /// + /// Gets or Sets the SelectionUnit + /// + public virtual string SelectionUnit + { + get + { + return selectionUnit; + } + set + { + selectionUnit = value; + } + } + + /// + /// Gets or Sets the SelectedIndex + /// + public virtual string SelectedIndex + { + get + { + return selectedIndex; + } + set + { + selectedIndex = value; + } + } + + /// + /// Gets or Sets the SelectedItemCount + /// + public virtual string SelectedItemCount + { + get + { + return selectedItemCount; + } + set + { + selectedItemCount = value; + } + } + + #endregion + } +} diff --git a/WpfControlsClass/WpfSfGridCell.cs b/WpfControlsClass/WpfSfGridCell.cs new file mode 100644 index 0000000..b5eac37 --- /dev/null +++ b/WpfControlsClass/WpfSfGridCell.cs @@ -0,0 +1,305 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using Microsoft.VisualStudio.TestTools.UITest.Extension; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class WpfSfGridCell : WpfControl + { + #region abstract class + + public new abstract class PropertyNames + { + public static readonly string CellValue = "CellValue"; + public static readonly string FormattedValue = "FormattedValue"; + public static readonly string RowIndex = "RowIndex"; + public static readonly string ColumnIndex = "ColumnIndex"; + public static readonly string ColumnName = "ColumnName"; + public static readonly string HeaderText = "HeaderText"; + } + + #endregion + + #region ctor + + public WpfSfGridCell() + { + } + public WpfSfGridCell(UITestControl control) + : base(control) + { + } + + #endregion + + #region private fields + + private string cellValue; + private string formattedVlaue; + private string rowIndex; + private string columnIndex; + private string columnName; + private string headerText; + private bool isFound = false; + + #endregion + + #region public properties + /// + /// Gets or Sets cell value + /// + public virtual string CellValue + { + get + { + if (!this.isFound) + this.Find(); + return cellValue; + } + set + { + cellValue = value; + } + + } + + /// + /// Gets or Sets the formattedvalue + /// + public virtual string FormattedValue + { + get + { + if (!this.isFound) + this.Find(); + return formattedVlaue; + } + set + { + formattedVlaue = value; + } + } + + /// + /// Gets or Sets the rowindex + /// + public virtual string RowIndex + { + get + { + if (!this.isFound) + this.Find(); + return rowIndex; + } + set + { + rowIndex = value; + } + } + + /// + /// Gets or Sets the columnindex + /// + public virtual string ColumnIndex + { + get + { + if (!this.isFound) + this.Find(); + return columnIndex; + } + set + { + columnIndex = value; + } + } + + /// + /// Gets or Sets the columnname + /// + public virtual string ColumnName + { + get + { + if (!this.isFound) + this.Find(); + return columnName; + } + set + { + columnName = value; + } + } + + /// + /// Gets or Sets the Header Text of GridColumn + /// + public virtual string HeaderText + { + get + { + if (!this.isFound) + this.Find(); + return headerText; + } + set + { + headerText = value; + } + } + #endregion + + #region override methods + + public override void Find() + { + //create UITestControl from current instance + UITestControl control = new UITestControl(); + control.CopyFrom(this); + //get the search properties from grid cell instance + var properties = control.SearchProperties.ToList(); + + var cellProperties = new List(); + cellProperties.Add("CellValue"); + cellProperties.Add("FormattedValue"); + cellProperties.Add("RowIndex"); + cellProperties.Add("ColumnIndex"); + cellProperties.Add("ColumnName"); + cellProperties.Add("HeaderText"); + + bool isContainProperty = false; + foreach (var property in properties) + { + if (cellProperties.Contains(property.PropertyName)) + { + isContainProperty = true; + break; + } + } + + if (isContainProperty) + { + // throw exception if properties are not enough to search a control + if (properties.Count < 2 && (properties[0].PropertyName != "CellValue" && properties[0].PropertyName != "FormattedValue")) + throw new UITestException("Not Enough Properties to find a control"); + + // get the collection of child elements from sfgrid container + UITestControlCollection rowsCollection = control.Container.GetChildren(); + //bool flag = false; + foreach (UITestControl row in rowsCollection) + { + if (row.ClassName == "Uia.VirtualizingCellsControl") + { + UITestControlCollection collection = row.GetChildren(); + foreach (UITestControl child in collection) + { + // check child is grid cell + if (child.ClassName == "Uia.GridCell") + { + Dictionary childPropertiesDictonary = new Dictionary(); + System.Windows.Automation.AutomationElement automationElement = child.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + continue; + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + + // assign the properties values to corresponding variable for condition checking + childPropertiesDictonary.Add("CellValue", array[0]); + childPropertiesDictonary.Add("FormattedValue", array[1]); + childPropertiesDictonary.Add("RowIndex", array[2]); + childPropertiesDictonary.Add("ColumnIndex", array[3]); + childPropertiesDictonary.Add("ColumnName", array[4]); + childPropertiesDictonary.Add("HeaderText", array[5]); + + // set flag to true if all property values are match to child control + foreach (var item in properties) + { + if (childPropertiesDictonary.Keys.Contains(item.PropertyName)) + { + if (childPropertiesDictonary[item.PropertyName] == item.PropertyValue) + isFound = true; + else + { + isFound = false; + break; + } + } + + } + + // here this condition check is used for finding exact gridcell from its given proerty values + if (isFound) + { + //set the corresponding cell values to its properties. + this.cellValue = array[0]; + this.formattedVlaue = array[1]; + this.rowIndex = array[2]; + this.columnIndex = array[3]; + this.columnName = array[4]; + this.headerText = array[5]; + // copy the found cell as this instance + this.CopyFrom(child); + + childPropertiesDictonary = null; + break; + } + } + } + + if (isFound) + break; + } + } + if (!isFound) + throw new UITestException("Not Maching control for this sepecific property"); + } + else + { + base.Find(); + System.Windows.Automation.AutomationElement automationElement = this.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + throw new UITestException("Not Maching control for this sepecific property"); + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + if (array.Count() != 0) + { + this.cellValue = array[0]; + this.formattedVlaue = array[1]; + this.rowIndex = array[2]; + this.columnIndex = array[3]; + this.columnName = array[4]; + } + else + { + throw new UITestException("Not Maching control for this sepecific property"); + } + } + } + #endregion + + public new bool TryFind() + { + try + { + this.Find(); + return true; + } + catch (UITestException) + { + return false; + } + + } + + } +} diff --git a/WpfControlsClass/WpfSfGroupDropArea.cs b/WpfControlsClass/WpfSfGroupDropArea.cs new file mode 100644 index 0000000..71f4758 --- /dev/null +++ b/WpfControlsClass/WpfSfGroupDropArea.cs @@ -0,0 +1,63 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class WpfSfGroupDropArea:WpfControl + { + public new abstract class PropertyNames + { + public static readonly string IsExpanded = "IsExpanded"; + public static readonly string GroupDropAreaText = "GroupDropAreaText"; + } + public WpfSfGroupDropArea() + { + } + public WpfSfGroupDropArea(UITestControl control) + : base(control) + { + } + + #region private fields + private string isExpanded; + private string groupDropAreaText; + #endregion + + #region public properties + /// + /// Gets or Sets cell IsExpanded + /// + public virtual string IsExpanded + { + get + { + return isExpanded; + } + set + { + isExpanded = value; + } + + } + + /// + /// Gets or Sets the GroupDropAreaText + /// + public virtual string GroupDropAreaText + { + get + { + return groupDropAreaText; + } + set + { + groupDropAreaText = value; + } + } + #endregion + } +} diff --git a/WpfControlsClass/WpfSfGroupDropAreaItem.cs b/WpfControlsClass/WpfSfGroupDropAreaItem.cs new file mode 100644 index 0000000..1086513 --- /dev/null +++ b/WpfControlsClass/WpfSfGroupDropAreaItem.cs @@ -0,0 +1,63 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class WpfSfGroupDropAreaItem:WpfControl + { + public new abstract class PropertyNames + { + public static readonly string GroupName = "GroupName"; + public static readonly string SortDirection = "SortDirection"; + } + public WpfSfGroupDropAreaItem() + { + } + public WpfSfGroupDropAreaItem(UITestControl control) + : base(control) + { + } + + #region private fields + private string groupName; + private string sortDirection; + #endregion + + #region public properties + /// + /// Gets or Sets cell GroupName + /// + public virtual string GroupName + { + get + { + return groupName; + } + set + { + groupName = value; + } + + } + + /// + /// Gets or Sets the SortDirection + /// + public virtual string SortDirection + { + get + { + return sortDirection; + } + set + { + sortDirection = value; + } + } + #endregion + } +} diff --git a/WpfControlsClass/WpfSfHeaderCellControl.cs b/WpfControlsClass/WpfSfHeaderCellControl.cs new file mode 100644 index 0000000..6e4e104 --- /dev/null +++ b/WpfControlsClass/WpfSfHeaderCellControl.cs @@ -0,0 +1,310 @@ +using Microsoft.VisualStudio.TestTools.UITest.Extension; +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class WpfSfHeaderCellControl : WpfControl + { + #region abstract class + public new abstract class PropertyNames + { + public static readonly string ColumnName = "ColumnName"; + public static readonly string HeaderText = "HeaderText"; + public static readonly string IsFilterApplied = "IsFilterApplied"; + public static readonly string FilterIconVisiblity = "FilterIconVisiblity"; + public static readonly string SortDirection = "SortDirection"; + public static readonly string SortNumberVisibility = "SortNumberVisibility"; + } + #endregion + + #region ctor + + public WpfSfHeaderCellControl() + { + } + public WpfSfHeaderCellControl(UITestControl control) + : base(control) + { + } + + #endregion + + #region private fields + + private string columnName; + private string headerText; + private string isFilterApplied; + private string filterIconVisiblity; + private string sortDirection; + private string sortNumberVisibility; + private bool isFound = false; + + #endregion + + #region public properties + + /// + /// Gets or Sets Column Name + /// + public virtual string ColumnName + { + get + { + if (!this.isFound) + this.Find(); + return columnName; + } + set + { + columnName = value; + } + + } + + /// + /// Gets or Sets Header Text of GridColumn + /// + public virtual string HeaderText + { + get + { + if (!this.isFound) + this.Find(); + return headerText; + } + set + { + headerText = value; + } + + } + + /// + /// Gets or Sets is Filter Applied + /// + public virtual string IsFilterApplied + { + get + { + if (!this.isFound) + this.Find(); + return isFilterApplied; + } + set + { + isFilterApplied = value; + } + + } + + /// + /// Gets or Sets Filter Icon Visibility + /// + public virtual string FilterIconVisiblity + { + get + { + if (!this.isFound) + this.Find(); + return filterIconVisiblity; + } + set + { + filterIconVisiblity = value; + } + + } + + /// + /// Gets or Sets sort Direction + /// + public virtual string SortDirection + { + get + { + if (!this.isFound) + this.Find(); + return sortDirection; + } + set + { + sortDirection = value; + } + + } + + /// + /// Gets or Sets sort Direction + /// + public virtual string SortNumberVisibility + { + get + { + if (!this.isFound) + this.Find(); + return sortDirection; + } + set + { + sortDirection = value; + } + + } + + #endregion + + #region override methods + + public override void Find() + { + //create UITestControl from current instance + UITestControl control = new UITestControl(); + control.CopyFrom(this); + //get the search properties from grid cell instance + var properties = control.SearchProperties.ToList(); + + var headerCellProperties = new List(); + headerCellProperties.Add("ColumnName"); + headerCellProperties.Add("HeaderText"); + headerCellProperties.Add("IsFilterApplied"); + headerCellProperties.Add("FilterIconVisiblity"); + headerCellProperties.Add("SortDirection"); + headerCellProperties.Add("SortNumberVisibility"); + + bool isContainProperty = false; + foreach (var property in properties) + { + if (headerCellProperties.Contains(property.PropertyName)) + { + isContainProperty = true; + break; + } + } + + if (isContainProperty) + { + // throw exception if properties are not enough to search a control + if (properties.Count < 1 || properties.Where(p => p.PropertyName == "ColumnName").Count() < 1) + throw new UITestException("Not Enough Properties to find a control"); + + // get the collection of child elements from sfgrid container + UITestControlCollection rowCollection = control.Container.GetChildren(); + //bool flag = false; + foreach (UITestControl row in rowCollection) + { + if (row.ClassName == "Uia.HeaderRowControl") + { + UITestControlCollection collection = row.GetChildren(); + + foreach (UITestControl child in collection) + { + // check child is grid cell + if (child.ClassName == "Uia.GridHeaderCellControl") + { + Dictionary childPropertiesDictonary = new Dictionary(); + System.Windows.Automation.AutomationElement automationElement = child.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + continue; + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + + // assign the properties values to corresponding variable for condition checking + childPropertiesDictonary.Add("ColumnName", array[0]); + childPropertiesDictonary.Add("HeaderText", array[1]); + childPropertiesDictonary.Add("IsFilterApplied", array[2]); + childPropertiesDictonary.Add("FilterIconVisiblity", array[3]); + childPropertiesDictonary.Add("SortDirection", array[4]); + childPropertiesDictonary.Add("SortNumberVisibility", array[5]); + + // set flag to true if all property values are match to child control + foreach (var item in properties) + { + if (childPropertiesDictonary.Keys.Contains(item.PropertyName)) + { + if (childPropertiesDictonary[item.PropertyName] == item.PropertyValue) + isFound = true; + else + { + isFound = false; + break; + } + } + + } + + // here this condition check is used for finding exact gridcell from its given proerty values + if (isFound) + { + //set the corresponding cell values to its properties. + this.columnName = array[0]; + this.headerText = array[1]; + this.isFilterApplied = array[2]; + this.filterIconVisiblity = array[3]; + this.sortDirection = array[4]; + this.sortNumberVisibility = array[5]; + // copy the found cell as this instance + this.CopyFrom(child); + + childPropertiesDictonary = null; + break; + } + } + } + if (isFound) + break; + } + } + if (!isFound) + throw new UITestException("Not Maching control for this sepecific property"); + } + else + { + base.Find(); + System.Windows.Automation.AutomationElement automationElement = this.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + throw new UITestException("Not Maching control for this sepecific property"); + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + if (array.Count() != 0) + { + this.columnName = array[0]; + this.headerText = array[1]; + this.isFilterApplied = array[2]; + this.filterIconVisiblity = array[3]; + this.sortDirection = array[4]; + this.sortNumberVisibility = array[5]; + } + else + { + throw new UITestException("Not Maching control for this sepecific property"); + } + } + } + #endregion + + public new bool TryFind() + { + try + { + this.Find(); + return true; + } + catch (UITestException) + { + return false; + } + + } + } +} diff --git a/WpfControlsClass/WpfSfMultiColumnDropDownControl.cs b/WpfControlsClass/WpfSfMultiColumnDropDownControl.cs new file mode 100644 index 0000000..684acda --- /dev/null +++ b/WpfControlsClass/WpfSfMultiColumnDropDownControl.cs @@ -0,0 +1,204 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class WpfSfMultiColumnDropDownControl : WpfControl + { + public new abstract class PropertyNames + { + public static readonly string AllowAutoComplete = "AllowAutoComplete"; + public static readonly string AllowNullInput = "AllowNullInput"; + public static readonly string AllowImmediatePopup = "AllowImmediatePopup"; + public static readonly string AllowIncrementalFiltering = "AllowIncrementalFiltering"; + public static readonly string AllowCaseSensitiveFiltering = "AllowCaseSensitiveFiltering"; + public static readonly string AllowSpinOnMouseWheel = "AllowSpinOnMouseWheel"; + public static readonly string DisplayMember = "DisplayMember"; + public static readonly string IsDropDownOpen = "IsDropDownOpen"; + public static readonly string SelectedIndex = "SelectedIndex"; + public static readonly string ValueMember = "ValueMember"; + } + public WpfSfMultiColumnDropDownControl() + { + } + public WpfSfMultiColumnDropDownControl(UITestControl control) + : base(control) + { + } + + #region private fields + + private string allowAutoComplete; + private string allowNullInput; + private string allowImmediatePopup; + private string allowIncrementalFiltering; + private string allowCaseSensitiveFiltering; + private string allowSpinOnMouseWheel; + private string displayMember; + private string isDropDownOpen; + private string selectedIndex; + private string valueMember; + + #endregion + + + #region public properties + + /// + /// Get or Set AllowAutoComplete + /// + public virtual string AllowAutoComplete + { + get + { + return allowAutoComplete; + } + set + { + allowAutoComplete = value; + } + } + + /// + /// Get or Set AllowNullInput + /// + public virtual string AllowNullInput + { + get + { + return allowNullInput; + } + set + { + allowNullInput = value; + } + } + + /// + /// Get or Set AllowImmediatePopup + /// + public virtual string AllowImmediatePopup + { + get + { + return allowImmediatePopup; + } + set + { + allowImmediatePopup = value; + } + } + + /// + /// Get or Set AllowIncrementalFiltering + /// + public virtual string AllowIncrementalFiltering + { + get + { + return allowIncrementalFiltering; + } + set + { + allowIncrementalFiltering = value; + } + } + + /// + /// Get or Set AllowCaseSensitiveFiltering + /// + public virtual string AllowCaseSensitiveFiltering + { + get + { + return allowCaseSensitiveFiltering; + } + set + { + allowCaseSensitiveFiltering = value; + } + } + + /// + /// Get or Set AllowSpinOnMouseWheel + /// + public virtual string AllowSpinOnMouseWheel + { + get + { + return allowSpinOnMouseWheel; + } + set + { + allowSpinOnMouseWheel = value; + } + } + + /// + /// Get or Set DisplayMember + /// + public virtual string DisplayMember + { + get + { + return displayMember; + } + set + { + displayMember = value; + } + } + + /// + /// Get or Set IsDropDownOpen + /// + public virtual string IsDropDownOpen + { + get + { + return isDropDownOpen; + } + set + { + isDropDownOpen = value; + } + } + + /// + /// Get or Set SelectedIndex + /// + public virtual string SelectedIndex + { + get + { + return selectedIndex; + } + set + { + selectedIndex = value; + } + } + + /// + /// Get or Set ValueMember + /// + public virtual string ValueMember + { + get + { + return valueMember; + } + set + { + valueMember = value; + } + } + + #endregion + } + +} diff --git a/WpfControlsClass/WpfSfRow.cs b/WpfControlsClass/WpfSfRow.cs new file mode 100644 index 0000000..800c08c --- /dev/null +++ b/WpfControlsClass/WpfSfRow.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.VisualStudio.TestTools.UITest.Extension; +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class WpfSfRow : WpfControl + { + public new abstract class PropertyNames + { + public static readonly string RowIndex = "RowIndex"; + public static readonly string RowType = "RowType"; + public static readonly string IsSelected = "IsSelected"; + } + + public WpfSfRow() + { + } + public WpfSfRow(UITestControl control) + : base(control) + { + } + + #region private fields + + private string rowIndex; + private string rowType; + private string isSelected; + + #endregion + + #region public properties + /// + /// Get or Set the RowIndex + /// + public virtual string RowIndex + { + get + { + return rowIndex; + } + set + { + rowIndex = value; + } + + } + + /// + /// Get or Set the RowType + /// + public virtual string RowType + { + get + { + return rowType; + } + set + { + rowType = value; + } + } + + /// + /// Get or Set the IsSelected + /// + public virtual string IsSelected + { + get + { + return isSelected; + } + set + { + isSelected = value; + } + + } + #endregion + } +} diff --git a/WpfControlsClass/WpfSfRowHeaderCell.cs b/WpfControlsClass/WpfSfRowHeaderCell.cs new file mode 100644 index 0000000..66acd87 --- /dev/null +++ b/WpfControlsClass/WpfSfRowHeaderCell.cs @@ -0,0 +1,84 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class WpfSfRowHeaderCell:WpfControl + { + public new abstract class PropertyNames + { + public static readonly string RowIndex = "RowIndex"; + public static readonly string State = "State"; + public static readonly string RowErrorMessage = "RowErrorMessage"; + } + public WpfSfRowHeaderCell() + { + } + public WpfSfRowHeaderCell(UITestControl control) + : base(control) + { + } + + #region private fields + + private string rowIndex; + private string state; + private string rowErrorMessage; + + #endregion + + #region public properties + + /// + /// Get or Set the RowIndex + /// + public virtual string RowIndex + { + get + { + return rowIndex; + } + set + { + rowIndex = value; + } + + } + + /// + /// Get or Set the State + /// + public new virtual string State + { + get + { + return state; + } + set + { + state = value; + } + } + + /// + /// Get or Set the RowErrorMessage + /// + public virtual string RowErrorMessage + { + get + { + return rowErrorMessage; + } + set + { + rowErrorMessage = value; + } + + } + #endregion + } +} diff --git a/WpfControlsClass/WpfSfStackedHeaderCellControl.cs b/WpfControlsClass/WpfSfStackedHeaderCellControl.cs new file mode 100644 index 0000000..9afe78f --- /dev/null +++ b/WpfControlsClass/WpfSfStackedHeaderCellControl.cs @@ -0,0 +1,190 @@ +using Microsoft.VisualStudio.TestTools.UITest.Extension; +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + public class WpfSfStackedHeaderCellControl : WpfControl + { + #region abstract class + public new abstract class PropertyNames + { + public static readonly string ColumnName = "ColumnName"; + } + #endregion + + #region ctor + + public WpfSfStackedHeaderCellControl() + { + } + public WpfSfStackedHeaderCellControl(UITestControl control) + : base(control) + { + } + + #endregion + + #region private fields + + private string columnName; + private bool isFound = false; + + #endregion + + #region public properties + + /// + /// Gets or Sets Column Name + /// + public virtual string ColumnName + { + get + { + if (!this.isFound) + this.Find(); + return columnName; + } + set + { + columnName = value; + } + } + + #endregion + #region override methods + + public override void Find() + { + //create UITestControl from current instance + UITestControl control = new UITestControl(); + control.CopyFrom(this); + //get the search properties from grid cell instance + var properties = control.SearchProperties.ToList(); + + var headerCellProperties = new List(); + headerCellProperties.Add("ColumnName"); + + bool isContainProperty = false; + foreach (var property in properties) + { + if (headerCellProperties.Contains(property.PropertyName)) + { + isContainProperty = true; + break; + } + } + + if (isContainProperty) + { + // throw exception if properties are not enough to search a control + if (properties.Count < 1 || properties.Where(p => p.PropertyName == "ColumnName").Count() < 1) + throw new UITestException("Not Enough Properties to find a control"); + + // get the collection of child elements from sfgrid container + UITestControlCollection rowCollection = control.Container.GetChildren(); + //bool flag = false; + foreach (UITestControl row in rowCollection) + { + if (row.ClassName == "Uia.HeaderRowControl") + { + UITestControlCollection collection = row.GetChildren(); + + foreach (UITestControl child in collection) + { + // check child is grid cell + if (child.ClassName == "Uia.GridStackedHeaderCellControl") + { + Dictionary childPropertiesDictonary = new Dictionary(); + System.Windows.Automation.AutomationElement automationElement = child.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + continue; + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + + // assign the properties values to corresponding variable for condition checking + childPropertiesDictonary.Add("ColumnName", array[0]); + + // set flag to true if all property values are match to child control + foreach (var item in properties) + { + if (childPropertiesDictonary.Keys.Contains(item.PropertyName)) + { + if (childPropertiesDictonary[item.PropertyName] == item.PropertyValue) + isFound = true; + else + { + isFound = false; + break; + } + } + + } + + // here this condition check is used for finding exact gridcell from its given proerty values + if (isFound) + { + //set the corresponding cell values to its properties. + this.columnName = array[0]; + + // copy the found cell as this instance + this.CopyFrom(child); + + childPropertiesDictonary = null; + break; + } + } + } + if (isFound) + break; + } + } + if (!isFound) + throw new UITestException("Not Maching control for this sepecific property"); + } + else + { + base.Find(); + System.Windows.Automation.AutomationElement automationElement = this.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + throw new UITestException("Not Maching control for this sepecific property"); + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + if (array.Count() != 0) + { + this.columnName = array[0]; + } + else + { + throw new UITestException("Not Maching control for this sepecific property"); + } + } + } + #endregion + + public new bool TryFind() + { + try + { + this.Find(); + return true; + } + catch (UITestException) + { + return false; + } + + } + } +} diff --git a/WpfControlsClass/WpfSfTreeGrid.cs b/WpfControlsClass/WpfSfTreeGrid.cs new file mode 100644 index 0000000..54650d1 --- /dev/null +++ b/WpfControlsClass/WpfSfTreeGrid.cs @@ -0,0 +1,130 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// Provides ability to locate SfTreeGrid control in UI + /// + public class WpfSfTreeGrid : WpfControl + { + #region ProeprtyNames + public new abstract class PropertyNames + { + public static readonly string RowCount = "RowCount"; + public static readonly string ColumnCount = "ColumnCount"; + public static readonly string SelectionMode = "SelectionMode"; + public static readonly string SelectedIndex = "SelectedIndex"; + public static readonly string SelectedItemCount = "SelectedItemCount"; + + } + #endregion + + #region Constructor + public WpfSfTreeGrid() + : this(null) + { + } + public WpfSfTreeGrid(UITestControl parent) + : base(parent) + { + } + #endregion + + #region private fields + + private string rowCount; + private string columnCount; + private string selectionMode; + private string selectedIndex; + private string selectedItemCount; + + #endregion + + #region public properties + + /// + /// Gets or Sets cell RowCount + /// + public virtual string RowCount + { + get + { + return rowCount; + } + set + { + rowCount = value; + } + + } + + /// + /// Gets or Sets the ColumnCount + /// + public virtual string ColumnCount + { + get + { + return columnCount; + } + set + { + columnCount = value; + } + } + + /// + /// Gets or Sets the SelectionMode + /// + public virtual string SelectionMode + { + get + { + return selectionMode; + } + set + { + selectionMode = value; + } + } + + /// + /// Gets or Sets the SelectedIndex + /// + public virtual string SelectedIndex + { + get + { + return selectedIndex; + } + set + { + selectedIndex = value; + } + } + + /// + /// Gets or Sets the SelectedItemCount + /// + public virtual string SelectedItemCount + { + get + { + return selectedItemCount; + } + set + { + selectedItemCount = value; + } + } + + #endregion + + } +} diff --git a/WpfControlsClass/WpfSfTreeGridCell.cs b/WpfControlsClass/WpfSfTreeGridCell.cs new file mode 100644 index 0000000..15fd5e9 --- /dev/null +++ b/WpfControlsClass/WpfSfTreeGridCell.cs @@ -0,0 +1,315 @@ +using Microsoft.VisualStudio.TestTools.UITest.Extension; +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// Provides ability to locate TreeGridCell in UI + /// + public class WpfSfTreeGridCell : WpfControl + { + #region abstract class + + public new abstract class PropertyNames + { + public static readonly string CellValue = "CellValue"; + public static readonly string FormattedValue = "FormattedValue"; + public static readonly string RowIndex = "RowIndex"; + public static readonly string ColumnIndex = "ColumnIndex"; + public static readonly string ColumnName = "ColumnName"; + public static readonly string HeaderText = "HeaderText"; + } + + #endregion + + #region ctor + + public WpfSfTreeGridCell() + { + } + public WpfSfTreeGridCell(UITestControl control) + : base(control) + { + } + + #endregion + + #region private fields + + private string cellValue; + private string formattedVlaue; + private string rowIndex; + private string columnIndex; + private string columnName; + private string headerText; + private bool isFound = false; + + #endregion + + #region public properties + /// + /// Gets or Sets cell value + /// + public virtual string CellValue + { + get + { + if (!this.isFound) + this.Find(); + return cellValue; + } + set + { + cellValue = value; + } + + } + + /// + /// Gets or Sets the formattedvalue + /// + public virtual string FormattedValue + { + get + { + if (!this.isFound) + this.Find(); + return formattedVlaue; + } + set + { + formattedVlaue = value; + } + } + + /// + /// Gets or Sets the rowindex + /// + public virtual string RowIndex + { + get + { + if (!this.isFound) + this.Find(); + return rowIndex; + } + set + { + rowIndex = value; + } + } + + /// + /// Gets or Sets the columnindex + /// + public virtual string ColumnIndex + { + get + { + if (!this.isFound) + this.Find(); + return columnIndex; + } + set + { + columnIndex = value; + } + } + + /// + /// Gets or Sets the columnname + /// + public virtual string ColumnName + { + get + { + if (!this.isFound) + this.Find(); + return columnName; + } + set + { + columnName = value; + } + } + + /// + /// Gets or Sets the Header Text of GridColumn + /// + public virtual string HeaderText + { + get + { + if (!this.isFound) + this.Find(); + return headerText; + } + set + { + headerText = value; + } + } + #endregion + + #region override methods + + /// + /// To find a TreeGridCell. + /// + public override void Find() + { + //create UITestControl from current instance + UITestControl control = new UITestControl(); + control.CopyFrom(this); + //get the search properties from grid cell instance + var properties = control.SearchProperties.ToList(); + + var cellProperties = new List(); + cellProperties.Add("CellValue"); + cellProperties.Add("FormattedValue"); + cellProperties.Add("RowIndex"); + cellProperties.Add("ColumnIndex"); + cellProperties.Add("ColumnName"); + cellProperties.Add("HeaderText"); + + bool isContainProperty = false; + foreach (var property in properties) + { + if (cellProperties.Contains(property.PropertyName)) + { + isContainProperty = true; + break; + } + } + + if (isContainProperty) + { + // throw exception if properties are not enough to search a control + if (properties.Count < 2 && (properties[0].PropertyName != "CellValue" && properties[0].PropertyName != "FormattedValue")) + throw new UITestException("Not Enough Properties to find a control"); + + // get the collection of child elements from SfTreeGrid container + UITestControlCollection rowsCollection = control.Container.GetChildren(); + foreach (UITestControl row in rowsCollection) + { + if (row.ClassName == "Uia.TreeGridRowControl") + { + UITestControlCollection collection = row.GetChildren(); + foreach (UITestControl child in collection) + { + // check child is TreeGrid cell + if (child.ClassName == "Uia.TreeGridCell") + { + Dictionary childPropertiesDictonary = new Dictionary(); + System.Windows.Automation.AutomationElement automationElement = child.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + continue; + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + + // assign the properties values to corresponding variable for condition checking + childPropertiesDictonary.Add("CellValue", array[0]); + childPropertiesDictonary.Add("FormattedValue", array[1]); + childPropertiesDictonary.Add("RowIndex", array[2]); + childPropertiesDictonary.Add("ColumnIndex", array[3]); + childPropertiesDictonary.Add("ColumnName", array[4]); + childPropertiesDictonary.Add("HeaderText", array[5]); + + // set flag to true if all property values are match to child control + foreach (var item in properties) + { + if (childPropertiesDictonary.Keys.Contains(item.PropertyName)) + { + if (childPropertiesDictonary[item.PropertyName] == item.PropertyValue) + isFound = true; + else + { + isFound = false; + break; + } + } + + } + + // here this condition check is used for finding exact gridcell from its given proerty values + if (isFound) + { + //set the corresponding cell values to its properties. + this.cellValue = array[0]; + this.formattedVlaue = array[1]; + this.rowIndex = array[2]; + this.columnIndex = array[3]; + this.columnName = array[4]; + this.headerText = array[5]; + // copy the found cell as this instance + this.CopyFrom(child); + + childPropertiesDictonary = null; + break; + } + } + } + + if (isFound) + break; + } + } + if (!isFound) + throw new UITestException("Not Maching control for this sepecific property"); + } + else + { + base.Find(); + System.Windows.Automation.AutomationElement automationElement = this.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + throw new UITestException("Not Maching control for this sepecific property"); + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + if (array.Count() != 0) + { + this.cellValue = array[0]; + this.formattedVlaue = array[1]; + this.rowIndex = array[2]; + this.columnIndex = array[3]; + this.columnName = array[4]; + this.headerText = array[5]; + } + else + { + throw new UITestException("Not Maching control for this sepecific property"); + } + } + } + #endregion + + /// + /// Method to find specific TreeGridCell. + /// + /// true, if cell is found, otherwise false. + public new bool TryFind() + { + try + { + this.Find(); + return true; + } + catch (UITestException) + { + return false; + } + + } + } +} diff --git a/WpfControlsClass/WpfSfTreeGridHeaderCell.cs b/WpfControlsClass/WpfSfTreeGridHeaderCell.cs new file mode 100644 index 0000000..3e4988b --- /dev/null +++ b/WpfControlsClass/WpfSfTreeGridHeaderCell.cs @@ -0,0 +1,272 @@ +using Microsoft.VisualStudio.TestTools.UITest.Extension; +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// Provides ability to locate TreeGridHeaderCell in UI + /// + public class WpfSfTreeGridHeaderCell : WpfControl + { + #region abstract class + public new abstract class PropertyNames + { + public static readonly string ColumnName = "ColumnName"; + public static readonly string HeaderText = "HeaderText"; + public static readonly string SortDirection = "SortDirection"; + public static readonly string SortNumberVisibility = "SortNumberVisibility"; + } + #endregion + + #region ctor + + public WpfSfTreeGridHeaderCell() + { + } + public WpfSfTreeGridHeaderCell(UITestControl control) + : base(control) + { + } + + #endregion + + #region private fields + + private string columnName; + private string headerText; + private string sortDirection; + private string sortNumberVisibility; + private bool isFound = false; + + #endregion + + #region public properties + + /// + /// Gets or Sets Column Name + /// + public virtual string ColumnName + { + get + { + if (!this.isFound) + this.Find(); + return columnName; + } + set + { + columnName = value; + } + + } + + /// + /// Gets or Sets Header Text of TreeGridColumn + /// + public virtual string HeaderText + { + get + { + if (!this.isFound) + this.Find(); + return headerText; + } + set + { + headerText = value; + } + + } + + /// + /// Gets or Sets sort Direction + /// + public virtual string SortDirection + { + get + { + if (!this.isFound) + this.Find(); + return sortDirection; + } + set + { + sortDirection = value; + } + + } + + /// + /// Gets or Sets sort Direction + /// + public virtual string SortNumberVisibility + { + get + { + if (!this.isFound) + this.Find(); + return sortDirection; + } + set + { + sortDirection = value; + } + + } + + #endregion + + #region override methods + /// + /// To Find TreeGridHeaderCell. + /// + public override void Find() + { + //create UITestControl from current instance + UITestControl control = new UITestControl(); + control.CopyFrom(this); + //get the search properties from grid cell instance + var properties = control.SearchProperties.ToList(); + + var headerCellProperties = new List(); + headerCellProperties.Add("ColumnName"); + headerCellProperties.Add("HeaderText"); + headerCellProperties.Add("SortDirection"); + headerCellProperties.Add("SortNumberVisibility"); + + bool isContainProperty = false; + foreach (var property in properties) + { + if (headerCellProperties.Contains(property.PropertyName)) + { + isContainProperty = true; + break; + } + } + + if (isContainProperty) + { + // throw exception if properties are not enough to search a control + if (properties.Count < 1 || properties.Where(p => p.PropertyName == "ColumnName").Count() < 1) + throw new UITestException("Not Enough Properties to find a control"); + + // get the collection of child elements from sftreeGrid container + UITestControlCollection rowCollection = control.Container.GetChildren(); + //bool flag = false; + foreach (UITestControl row in rowCollection) + { + if (row.ClassName == "Uia.TreeGridHeaderRowControl") + { + UITestControlCollection collection = row.GetChildren(); + + foreach (UITestControl child in collection) + { + // check child is grid cell + if (child.ClassName == "Uia.TreeGridHeaderCell") + { + Dictionary childPropertiesDictonary = new Dictionary(); + System.Windows.Automation.AutomationElement automationElement = child.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + continue; + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + + // assign the properties values to corresponding variable for condition checking + childPropertiesDictonary.Add("ColumnName", array[0]); + childPropertiesDictonary.Add("HeaderText", array[1]); + childPropertiesDictonary.Add("SortDirection", array[2]); + childPropertiesDictonary.Add("SortNumberVisibility", array[3]); + + // set flag to true if all property values are match to child control + foreach (var item in properties) + { + if (childPropertiesDictonary.Keys.Contains(item.PropertyName)) + { + if (childPropertiesDictonary[item.PropertyName] == item.PropertyValue) + isFound = true; + else + { + isFound = false; + break; + } + } + + } + + // here this condition check is used for finding exact gridcell from its given proerty values + if (isFound) + { + //set the corresponding cell values to its properties. + this.columnName = array[0]; + this.headerText = array[1]; + this.sortDirection = array[2]; + this.sortNumberVisibility = array[3]; + // copy the found cell as this instance + this.CopyFrom(child); + + childPropertiesDictonary = null; + break; + } + } + } + if (isFound) + break; + } + } + if (!isFound) + throw new UITestException("Not Maching control for this sepecific property"); + } + else + { + base.Find(); + System.Windows.Automation.AutomationElement automationElement = this.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + throw new UITestException("Not Maching control for this sepecific property"); + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + if (array.Count() != 0) + { + this.columnName = array[0]; + this.headerText = array[1]; + this.sortDirection = array[2]; + this.sortNumberVisibility = array[3]; + } + else + { + throw new UITestException("Not Maching control for this sepecific property"); + } + } + } + #endregion + + /// + /// Method to find specific TreeGridHeaderCell. + /// + /// true, if cell is found, otherwise false. + public new bool TryFind() + { + try + { + this.Find(); + return true; + } + catch (UITestException) + { + return false; + } + + } + } +} diff --git a/WpfControlsClass/WpfSfTreeGridRow.cs b/WpfControlsClass/WpfSfTreeGridRow.cs new file mode 100644 index 0000000..4815f13 --- /dev/null +++ b/WpfControlsClass/WpfSfTreeGridRow.cs @@ -0,0 +1,90 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// Provides ability to locate TreeGridRowControl in UI. + /// + public class WpfSfTreeGridRow : WpfControl + { + #region PropertyNames + public new abstract class PropertyNames + { + public static readonly string RowIndex = "RowIndex"; + public static readonly string RowType = "RowType"; + public static readonly string IsSelected = "IsSelected"; + } + #endregion + + public WpfSfTreeGridRow() + { + } + public WpfSfTreeGridRow(UITestControl control) + : base(control) + { + } + + #region private fields + + private string rowIndex; + private string rowType; + private string isSelected; + + #endregion + + #region public properties + /// + /// Get or Set the RowIndex + /// + public virtual string RowIndex + { + get + { + return rowIndex; + } + set + { + rowIndex = value; + } + + } + + /// + /// Get or Set the RowType + /// + public virtual string RowType + { + get + { + return rowType; + } + set + { + rowType = value; + } + } + + /// + /// Get or Set the IsSelected + /// + public virtual string IsSelected + { + get + { + return isSelected; + } + set + { + isSelected = value; + } + + } + #endregion + } +} diff --git a/WpfControlsClass/WpfSfTreeGridRowHeaderCell.cs b/WpfControlsClass/WpfSfTreeGridRowHeaderCell.cs new file mode 100644 index 0000000..4eed02b --- /dev/null +++ b/WpfControlsClass/WpfSfTreeGridRowHeaderCell.cs @@ -0,0 +1,88 @@ +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// Provides ability to locate TreeGridRowHeaderCell in UI. + /// + public class WpfSfTreeGridRowHeaderCell : WpfControl + { + public new abstract class PropertyNames + { + public static readonly string RowIndex = "RowIndex"; + public static readonly string State = "State"; + public static readonly string RowErrorMessage = "RowErrorMessage"; + } + public WpfSfTreeGridRowHeaderCell() + { + } + public WpfSfTreeGridRowHeaderCell(UITestControl control) + : base(control) + { + } + + #region private fields + + private string rowIndex; + private string state; + private string rowErrorMessage; + + #endregion + + #region public properties + + /// + /// Get or Set the RowIndex + /// + public virtual string RowIndex + { + get + { + return rowIndex; + } + set + { + rowIndex = value; + } + + } + + /// + /// Get or Set the State + /// + public new virtual string State + { + get + { + return state; + } + set + { + state = value; + } + } + + /// + /// Get or Set the RowErrorMessage + /// + public virtual string RowErrorMessage + { + get + { + return rowErrorMessage; + } + set + { + rowErrorMessage = value; + } + + } + #endregion + } +} diff --git a/WpfControlsClass/WpfSfTreeGridStackedHeaderCell.cs b/WpfControlsClass/WpfSfTreeGridStackedHeaderCell.cs new file mode 100644 index 0000000..5f63e89 --- /dev/null +++ b/WpfControlsClass/WpfSfTreeGridStackedHeaderCell.cs @@ -0,0 +1,200 @@ +using Microsoft.VisualStudio.TestTools.UITest.Extension; +using Microsoft.VisualStudio.TestTools.UITesting; +using Microsoft.VisualStudio.TestTools.UITesting.WpfControls; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Syncfusion.VisualStudio.TestTools.UITest.SfGridExtension +{ + /// + /// Provides ability to locate TreeGridStackedHeaderCell control in UI + /// + public class WpfSfTreeGridStackedHeaderCell : WpfControl + { + #region abstract class + public new abstract class PropertyNames + { + public static readonly string ColumnName = "ColumnName"; + } + #endregion + + #region ctor + + public WpfSfTreeGridStackedHeaderCell() + { + } + public WpfSfTreeGridStackedHeaderCell(UITestControl control) + : base(control) + { + } + + #endregion + + #region private fields + + private string columnName; + private bool isFound = false; + + #endregion + + #region public properties + + /// + /// Gets or Sets Column Name + /// + public virtual string ColumnName + { + get + { + if (!this.isFound) + this.Find(); + return columnName; + } + set + { + columnName = value; + } + } + + #endregion + #region override methods + + /// + /// To find TreeGridStackedHeaderCell. + /// + public override void Find() + { + //create UITestControl from current instance + UITestControl control = new UITestControl(); + control.CopyFrom(this); + //get the search properties from grid cell instance + var properties = control.SearchProperties.ToList(); + + var headerCellProperties = new List(); + headerCellProperties.Add("ColumnName"); + + bool isContainProperty = false; + foreach (var property in properties) + { + if (headerCellProperties.Contains(property.PropertyName)) + { + isContainProperty = true; + break; + } + } + + if (isContainProperty) + { + // throw exception if properties are not enough to search a control + if (properties.Count < 1 || properties.Where(p => p.PropertyName == "ColumnName").Count() < 1) + throw new UITestException("Not Enough Properties to find a control"); + + // get the collection of child elements from SfTreeGrid container + UITestControlCollection rowCollection = control.Container.GetChildren(); + //bool flag = false; + foreach (UITestControl row in rowCollection) + { + if (row.ClassName == "Uia.TreeGridHeaderRowControl") + { + UITestControlCollection collection = row.GetChildren(); + + foreach (UITestControl child in collection) + { + // check child is treegrid stackedHeaderCell + if (child.ClassName == "Uia.TreeGridStackedHeaderCell") + { + Dictionary childPropertiesDictonary = new Dictionary(); + System.Windows.Automation.AutomationElement automationElement = child.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + continue; + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + + // assign the properties values to corresponding variable for condition checking + childPropertiesDictonary.Add("ColumnName", array[0]); + + // set flag to true if all property values are match to child control + foreach (var item in properties) + { + if (childPropertiesDictonary.Keys.Contains(item.PropertyName)) + { + if (childPropertiesDictonary[item.PropertyName] == item.PropertyValue) + isFound = true; + else + { + isFound = false; + break; + } + } + + } + + // here this condition check is used for finding exact gridcell from its given proerty values + if (isFound) + { + //set the corresponding cell values to its properties. + this.columnName = array[0]; + + // copy the found cell as this instance + this.CopyFrom(child); + + childPropertiesDictonary = null; + break; + } + } + } + if (isFound) + break; + } + } + if (!isFound) + throw new UITestException("Not Maching control for this sepecific property"); + } + else + { + base.Find(); + System.Windows.Automation.AutomationElement automationElement = this.NativeElement as System.Windows.Automation.AutomationElement; + if (automationElement == null) + throw new UITestException("Not Maching control for this sepecific property"); + System.Windows.Automation.AutomationElement.AutomationElementInformation current2 = automationElement.Current; + string[] array = current2.ItemStatus.Split(new string[] + { + "#" + }, StringSplitOptions.None); + if (array.Count() != 0) + { + this.columnName = array[0]; + } + else + { + throw new UITestException("Not Maching control for this sepecific property"); + } + } + } + #endregion + + /// + /// Method to find specific TreeGridStackedHeaderCell. + /// + /// true, if cell is found, otherwise false. + public new bool TryFind() + { + try + { + this.Find(); + return true; + } + catch (UITestException) + { + return false; + } + + } + } +}