public void CodedUITestMethod1() { var mainWindow = GetMainWindow(); var btn = new WpfButton(mainWindow); btn.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "btn_AddShape")); btn.Find(); btn.WaitForControlReady(); Mouse.Click(btn); var diagram = new WpfCustom(mainWindow); diagram.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "diagram")); diagram.Find(); diagram.WaitForControlReady(); var element = new WpfCustom(diagram); element.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "CustomElement_1")); element.Find(); element.WaitForControlReady(); var itemsControl = new WpfList(element); itemsControl.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "itemsC")); //The CodedUI can't find the ItemsControl itemsControl.Find(); itemsControl.WaitForControlReady(); var items = itemsControl.Items.OfType <WpfListItem>().ToArray(); string[] s = items.Select(x => x.AutomationId).ToArray(); s.Should().BeEquivalentTo("ItemA", "ItemB", "ItemC", "ItemD", "ItemE", "ItemF", "ItemG", "ItemH"); }
public void CodedUITestMethod1() { var mainWindow = GetMainWindow(); var btn = new WpfButton(mainWindow); btn.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "btn_AddShape")); btn.Find(); btn.WaitForControlReady(); Mouse.Click(btn); var diagram = new WpfCustom(mainWindow); diagram.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "diagram")); diagram.Find(); diagram.WaitForControlReady(); var element = new WpfCustom(diagram); element.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "CustomElement_1")); element.Find(); element.WaitForControlReady(); var itemsControl = new WpfList(element); itemsControl.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "itemsC")); //The CodedUI can't find the ItemsControl itemsControl.Find(); itemsControl.WaitForControlReady(); string[] s = itemsControl.Items.GetValuesOfControls(); }
private WpfButton FeedbackWindow_CancelButton() { WpfButton theButton = new WpfButton(GetFeedbackWindow()); theButton.SearchProperties[WpfButton.PropertyNames.AutomationId] = "FeebackView_Cancel"; theButton.Find(); return theButton; }
private WpfButton FeedbackWindow_CancelButton() { WpfButton theButton = new WpfButton(GetFeedbackWindow()); theButton.SearchProperties[WpfButton.PropertyNames.AutomationId] = "FeebackView_Cancel"; theButton.Find(); return(theButton); }
private WpfButton FeedbackWindow_OpenDefaultEmailButton() { var feedbackWindow = GetFeedbackWindow(); var children = feedbackWindow.GetChildren(); foreach (var child in children) { if (child.GetProperty("AutomationId").ToString() == "FeebackView_Send") { return(child as WpfButton); } } WpfButton theButton = new WpfButton(feedbackWindow); theButton.SearchProperties[WpfButton.PropertyNames.AutomationId] = "FeebackView_Send"; theButton.Find(); return(theButton); }
public void CodedUITestMethod1() { System.Threading.Thread.Sleep(1000); var mainWindow = new WpfWindow(); mainWindow.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "Main_Window")); mainWindow.Find(); var btn = new WpfButton(); btn.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "btn_AddShape")); btn.Find(); btn.WaitForControlReady(); btn.GetClickablePoint(); Mouse.Click(mainWindow, new Point(btn.Top + 20, btn.Left + 20)); //Mouse.Click(new Point(btn.BoundingRectangle.X + btn.BoundingRectangle.Width / 2, btn.BoundingRectangle.Y + btn.BoundingRectangle.Height / 2)); //Mouse.Click(new Point(btn.GetClickablePoint().X, btn.GetClickablePoint().Y)); var diagram = new WpfWindow(); diagram.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "diagram")); diagram.Find(); diagram.WaitForControlReady(); // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items. }
private WpfButton FeedbackWindow_OpenDefaultEmailButton() { var feedbackWindow = GetFeedbackWindow(); var children = feedbackWindow.GetChildren(); foreach(var child in children) { if(child.GetProperty("AutomationId").ToString() == "FeebackView_Send") { return child as WpfButton; } } WpfButton theButton = new WpfButton(feedbackWindow); theButton.SearchProperties[WpfButton.PropertyNames.AutomationId] = "FeebackView_Send"; theButton.Find(); return theButton; }