public override ObjectDescriptor GetDescriptor() { ObjectDescriptor descriptor = new ObjectDescriptor(); descriptor.Type = NodeType.Selenium; descriptor.Name = this.NodeName; descriptor.Description = this.Description; IdentifyPropertyGroup item = new IdentifyPropertyGroup(); item.Properties = _properties; item.Properties[WebControlKeys.Type] = _type; descriptor.SetItem <IdentifyPropertyGroup>(item); CachedPropertyGroup cachedGroup = GetContext <CachedPropertyGroup>(); if (cachedGroup != null) { descriptor.SetItem <CachedPropertyGroup>(cachedGroup); } foreach (ITestObject to in Children) { ObjectDescriptor childDescriptor = to.GetDescriptor(); descriptor.Children.Add(childDescriptor); childDescriptor.Parent = descriptor; } return(descriptor); }
public void ObjectDescriptor_PropertyGroup() { ObjectDescriptor descriptor = new ObjectDescriptor(); descriptor.Properties.Add("property1", "value1"); IdentifyPropertyGroup identifyGroup = new IdentifyPropertyGroup(); identifyGroup.Properties.Add("property3", "value3"); identifyGroup.Properties.Add("property4", "value4"); descriptor.SetItem <IdentifyPropertyGroup>(identifyGroup); CachedPropertyGroup cachedGroup = new CachedPropertyGroup(); cachedGroup.Properties.Add("property5", "value5"); cachedGroup.Properties.Add("property6", "value6"); cachedGroup.Properties.Add("imageFile", "testImageFile.png"); descriptor.SetItem <CachedPropertyGroup>(cachedGroup); string serializedObject = JsonUtil.SerializeObject(descriptor); Debug.WriteLine(serializedObject); Assert.IsTrue(serializedObject.IndexOf("property6") > 0); Assert.IsTrue(serializedObject.IndexOf("value6") > 0); Assert.IsTrue(serializedObject.IndexOf("testImageFile.png") > 0); Assert.IsTrue(serializedObject.IndexOf("imageFile") > 0); //TODO check the serialized JSON content; }
public override ObjectDescriptor GetDescriptor() { ObjectDescriptor descriptor = base.GetDescriptor(); descriptor.Type = NodeType.VirtualControl; IdentifyPropertyGroup item = new IdentifyPropertyGroup(); item.Properties = new Dictionary <string, string>(); item.Properties[UIAControlKeys.BoundingRectangle] = RectToString(_rect); descriptor.SetItem(item); return(descriptor); }
public override ObjectDescriptor GetDescriptor() { ObjectDescriptor descriptor = new ObjectDescriptor(); descriptor.Type = NodeType.UIAControl; descriptor.Name = this.NodeName; descriptor.Description = this.Description; if (_relation != null) { descriptor.SetItem <VisualRelationPropertyItem>(_relation); } IdentifyPropertyGroup item = new IdentifyPropertyGroup(); item.Properties = _properties; item.Properties[ControlKeys.Type] = _type.ControlTypeToString(); descriptor.SetItem <IdentifyPropertyGroup>(item); CachedPropertyGroup cachedGroup = GetContext <CachedPropertyGroup>(); if (cachedGroup != null) { descriptor.SetItem <CachedPropertyGroup>(cachedGroup); } foreach (ITestObject to in Children) { ObjectDescriptor childDescriptor = to.GetDescriptor(); descriptor.Children.Add(childDescriptor); childDescriptor.Parent = descriptor; } return(descriptor); }
public void PropertyItemTest() { ObjectDescriptor descriptor = new ObjectDescriptor(); descriptor.Name = "Button"; VisualRelationPropertyItem item = descriptor.GetItem <VisualRelationPropertyItem>(); Assert.AreEqual(null, item); item = new VisualRelationPropertyItem() { Left = "aaa", Right = "bbb" }; descriptor.SetItem(item); string result = JsonUtil.SerializeObject(descriptor); Debug.WriteLine(result); }