private bool ValidateResourceExists(string resourceName, string folderName, string serverName = "localhost") { try { EnterExplorerSearchText(resourceName); Playback.Wait(1000); UITestControl theControl = null; if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty) { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, resourceName); } else { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, resourceName); } if (theControl == null) { return(false); } return(true); } catch (Exception) { return(false); } }
public void RightClickHelp(string serverName, string folderName, string projectName) { UITestControl theControl = null; if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty) { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName); } else { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName); } Point p = new Point(theControl.BoundingRectangle.X + 50, theControl.BoundingRectangle.Y + 5); Mouse.Move(p); Thread.Sleep(500); Mouse.Click(MouseButtons.Right, ModifierKeys.None, p); Thread.Sleep(500); Mouse.Click(MouseButtons.Right, ModifierKeys.None, p); Thread.Sleep(500); Keyboard.SendKeys("{Down}"); Keyboard.SendKeys("{Down}"); Keyboard.SendKeys("{Down}"); Keyboard.SendKeys("{Down}"); Keyboard.SendKeys("{Down}"); Keyboard.SendKeys("{Down}"); Keyboard.SendKeys("{Down}"); Keyboard.SendKeys("{Down}"); Keyboard.SendKeys("{Down}"); Keyboard.SendKeys("{Enter}"); }
/// <summary> /// Drags the resource from the explorer to the active tab. /// </summary> /// <param name="tabToDropOnto">The tab to drop the resource onto.</param> /// <param name="resourceName">The name of the resource.</param> /// <param name="categoryName">The name of the category.</param> /// <param name="serviceType">Type of the service.</param> /// <param name="serverName">Name of the server (Will default to "localhost").</param> /// <param name="pointToDragTo">The point to drop the resource on the designer (Will default to just below the start node).</param> /// <param name="overrideDblClickBehavior">if set to <c>true</c> [override double click behavior].</param> public UITestControl DragResourceOntoWorkflowDesigner(UITestControl tabToDropOnto, string resourceName, string categoryName, string serverName = "localhost", Point pointToDragTo = new Point()) { if (pointToDragTo.X == 0 && pointToDragTo.Y == 0) { pointToDragTo = WorkflowDesignerUIMap.GetStartNodeBottomAutoConnectorPoint(tabToDropOnto); } EnterExplorerSearchText(resourceName); UITestControl theControl = null; if (categoryName != "Unassigned" && categoryName != string.Empty) { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, categoryName, resourceName); } else { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, resourceName); } Mouse.StartDragging(theControl); Playback.Wait(20); Mouse.StopDragging(pointToDragTo); Playback.Wait(100); UITestControl resourceOnDesignSurface = WorkflowDesignerUIMap.FindControlByAutomationId(tabToDropOnto, resourceName); int counter = 0; while (resourceOnDesignSurface == null && counter < 5) { Playback.Wait(1000); resourceOnDesignSurface = WorkflowDesignerUIMap.FindControlByAutomationId(tabToDropOnto, resourceName); Playback.Wait(500); counter++; } return(resourceOnDesignSurface); }
public void DragActivityOnDropPoint(ToolType toolType) { UITestControl dropPoint = VisualTreeWalker.GetChildByAutomationIdPath(Activity, "SmallViewContent", "DropPoint"); var boundingRectangle = dropPoint.BoundingRectangle; ToolboxUIMap.DragControlToWorkflowDesigner(toolType, new Point(boundingRectangle.X + 10, boundingRectangle.Y + 10)); }
/// <summary> /// Navigates to a Workflow Item in the Explorer, Right Clicks it, and clicks Properties /// </summary> /// <param name="serverName">The name of the server (EG: localhost)</param> /// <param name="serviceType">The name of the service (EG: WORKFLOWS)</param> /// <param name="folderName">The name of the folder (AKA: Category - EG: BARNEY (Or CODEDUITESTCATEGORY for the CodedUI Test Default))</param> /// <param name="projectName">The name of the project (EG: MyWorkflow)</param> public void RightClickProperties(string serverName, string folderName, string projectName) { UITestControl theControl = null; if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty) { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName); } else { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName); } Point p = new Point(theControl.BoundingRectangle.X + 50, theControl.BoundingRectangle.Y + 5); Mouse.Move(p); Playback.Wait(500); Mouse.Click(MouseButtons.Right, ModifierKeys.None, p); Playback.Wait(1500); Mouse.Click(MouseButtons.Right, ModifierKeys.None, p); Playback.Wait(1500); SendKeys.SendWait("{UP}"); Playback.Wait(100); SendKeys.SendWait("{ENTER}"); Playback.Wait(100); }
public void RightClickDeleteResource(string resourceName, string categoryName, string serverName) { EnterExplorerSearchText(resourceName); UITestControl theControl = null; if (categoryName != "Unassigned" && categoryName != string.Empty) { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, categoryName, resourceName); } else { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, resourceName); } Point p = new Point(theControl.BoundingRectangle.X + 100, theControl.BoundingRectangle.Y + 5); Mouse.Move(p); Playback.Wait(500); Mouse.Click(MouseButtons.Right, ModifierKeys.None, p); Playback.Wait(1000); SendKeys.SendWait("{DOWN}"); Playback.Wait(100); SendKeys.SendWait("{DOWN}"); Playback.Wait(100); SendKeys.SendWait("{DOWN}"); Playback.Wait(100); SendKeys.SendWait("{DOWN}"); Playback.Wait(100); SendKeys.SendWait("{ENTER}"); PopupDialogUIMap.WaitForDialog(); Playback.Wait(100); var confirmationDialog = UIBusinessDesignStudioWindow.GetChildren()[0]; var yesButton = confirmationDialog.GetChildren().FirstOrDefault(c => c.FriendlyName == "Yes"); Mouse.Click(yesButton, new Point(10, 10)); }
public void RightClickDeployProject(string folderName, string projectName, string serverName = "localhost") { UITestControl theControl = null; if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty) { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName); } else { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName); } Point p = new Point(theControl.BoundingRectangle.X + 50, theControl.BoundingRectangle.Y + 5); Mouse.Move(p); Mouse.Click(MouseButtons.Right, ModifierKeys.None, p); Thread.Sleep(1500); Mouse.Click(MouseButtons.Right, ModifierKeys.None, p); Thread.Sleep(1500); SendKeys.SendWait("{DOWN}"); Thread.Sleep(100); SendKeys.SendWait("{DOWN}"); Thread.Sleep(100); SendKeys.SendWait("{ENTER}"); // Add some focus, and dleay to make sure everything is fine Thread.Sleep(2500); Mouse.Click(new Point(Screen.PrimaryScreen.WorkingArea.Width - 10, Screen.PrimaryScreen.WorkingArea.Height / 2)); Thread.Sleep(2500); }
public void DoubleClickOpenProject(string serverName, string folderName, string projectName, int waitAmt = 0) { UITestControl theControl = null; if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty) { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName); } else { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName); } if (theControl != null) { Point p = new Point(theControl.BoundingRectangle.X + 60, theControl.BoundingRectangle.Y + 7); Playback.Wait(50); Mouse.Click(p); Playback.Wait(150); try { Mouse.DoubleClick(p); // ReSharper disable EmptyGeneralCatchClause } catch // ReSharper restore EmptyGeneralCatchClause { // this darn double click keeps bombing out ;) } Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.AllThreads; theControl.WaitForControlReady(); Playback.PlaybackSettings.WaitForReadyLevel = WaitForReadyLevel.UIThreadOnly; Playback.Wait(waitAmt); } }
public UITestControl GetActivity() { UITestControl control = VisualTreeWalker.GetChildByAutomationIdPath(Activity, "SmallViewContent", "DropPoint"); var uiTestControl = control.GetChildren()[0]; return(uiTestControl.FriendlyName == "Drop Activity Here" ? null : uiTestControl); }
/// <summary> /// Rights the click rename project. /// </summary> /// <param name="resourceName"></param> /// <param name="serviceType">Type of the service.</param> /// <param name="categoryName"></param> /// <param name="newName"></param> /// <param name="serverName"></param> public void RightClickRenameResource(string resourceName, string categoryName, string newName, string serverName = "localhost") { EnterExplorerSearchText(resourceName); UITestControl theControl = null; if (categoryName != "Unassigned" && categoryName != string.Empty) { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, categoryName, resourceName); } else { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, resourceName); } Point p = new Point(theControl.BoundingRectangle.X + 100, theControl.BoundingRectangle.Y + 5); Mouse.Move(p); Mouse.Click(MouseButtons.Right, ModifierKeys.None, p); Playback.Wait(500); SendKeys.SendWait("{DOWN}"); Playback.Wait(50); SendKeys.SendWait("{DOWN}"); Playback.Wait(50); SendKeys.SendWait("{DOWN}"); Playback.Wait(50); SendKeys.SendWait("{ENTER}"); Playback.Wait(50); SendKeys.SendWait(newName); Playback.Wait(50); SendKeys.SendWait("{TAB}"); Playback.Wait(150); SendKeys.SendWait("{TAB}"); }
private List <UITestControl> GetDataGridRowChildList(int rowNumber, ViewType viewType) { UITestControl childByAutomationIDPath = VisualTreeWalker.GetChildByAutomationIdPath(GetView(viewType), "Table"); List <UITestControl> uiTestControlCollection = childByAutomationIDPath.GetChildren().Where(c => c.ControlType == ControlType.Row).ToList(); return(uiTestControlCollection[rowNumber].GetChildren().ToList()); }
public WpfTree GetSourceNavigationTree() { var activeTab = TabManagerUIMap.GetActiveTab(); var deployUserControl = GetDeployUserControl(activeTab); return(VisualTreeWalker.GetChildByAutomationIdPath(deployUserControl, "SourceNavigationView", "Navigation") as WpfTree); }
/// <summary> /// DebugWindowExists /// </summary> /// public WpfRow GetRow(int row) { var debugWindow = GetDebugWindow(); debugWindow.WaitForControlEnabled(); var inputGrid = VisualTreeWalker.GetChildByAutomationIdPath(debugWindow, "TabItems", "UI_InputDataTab_AutoID", "DataListInputs"); return(inputGrid.GetChildren()[row] as WpfRow); }
public string GetStatus() { UITestControl statusRadioButton = VisualTreeWalker.GetChildByAutomationIdPath(_activeTab, _enabledRadioButtonAutoIds); if (statusRadioButton.IsSelected()) { return("Enabled"); } return("Disabled"); }
public List <UITestControl> GetInputMappingRows() { UITestControl table = VisualTreeWalker.GetChildByAutomationIdPath(Activity, "LargeView", "Table"); if (table == null) { return(new List <UITestControl>()); } UITestControlCollection tableChildren = table.GetChildren(); List <UITestControl> rows = tableChildren.Where(c => c.ControlType == ControlType.Row).ToList(); return(rows); }
private WpfText GetTitleLabel(string autoId) { UITestControlCollection uiTestControlCollection = StudioWindow.GetChildren(); var tryGetDialog = uiTestControlCollection[0]; UITestControl childByAutomationIDPath = VisualTreeWalker.GetChildByAutomationIdPath(tryGetDialog, autoId); WpfText wpfText = childByAutomationIDPath as WpfText; if (wpfText != null) { return(wpfText); } throw new Exception("Could not find the " + autoId + " label."); }
public bool ServiceExists(string serverName, string folderName, string projectName) { UITestControl theControl = null; if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty) { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName); } else { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName); } return(theControl != null && theControl.Exists); }
public List <string> GetActivityList() { List <string> activityNames = new List <string>(); WpfTable table = VisualTreeWalker.GetChildByAutomationIdPath(Activity, "SmallViewContent", "InitialFocusElement") as WpfTable; if (table != null) { var uiTestControlCollection = table.Rows; foreach (var control in uiTestControlCollection) { activityNames.Add(control.Name); } } return(activityNames); }
public UITestControl ClickRibbonMenuItem(string itemName, int waitAmt = 100) { var control = VisualTreeWalker.GetChildByAutomationIdPath(StudioWindow, itemName); if (control == null) { var message = string.Format("Resource with name : [{0}] was not found", itemName); throw new Exception(message); } control.WaitForControlEnabled(); var p = new Point(control.BoundingRectangle.X + 5, control.BoundingRectangle.Y + 5); Mouse.Click(p); Playback.Wait(waitAmt); return(control); }
/// <summary> /// Drags the control automatic workflow designer. /// </summary> /// <param name="serverName">Name of the server.</param> /// <param name="serviceType">Type of the service.</param> /// <param name="folderName">Name of the folder.</param> /// <param name="projectName">Name of the project.</param> /// <param name="p">The application.</param> /// <param name="overrideDblClickBehavior">if set to <c>true</c> [override double click behavior].</param> public void DragControlToWorkflowDesigner(string serverName, string serviceType, string folderName, string projectName, Point p) { UITestControl theControl = null; if (folderName != "Unassigned" && folderName != "UNASSIGNED" && folderName != string.Empty) { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, folderName, projectName); } else { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, projectName); } Mouse.StartDragging(theControl); Playback.Wait(20); Mouse.StopDragging(p); Playback.Wait(100); }
/// <summary> /// Clicks the server information server DDL. /// </summary> /// <param name="serverName">Name of the server.</param> public void ClickServerInServerDDL(string serverName, bool ingoredEnabled = true) { // Get the base control UITestControl ddlBase = GetServerDDL(); //Wait for the connect control to be ready int counter = 0; while (!ddlBase.Enabled && counter < 30) { Playback.Wait(2000); counter++; } if (!ddlBase.Enabled) { throw new Exception("The connect control drop down is still disabled after 1 minute wait."); } // Click it to expand it Mouse.Click(ddlBase, new Point(10, 10)); Playback.Wait(500); var item = VisualTreeWalker.GetChildByAutomationIdPath(ddlBase, "U_UI_ExplorerServerCbx_AutoID_" + serverName); Mouse.Click(item, new Point(5, 5)); if (ingoredEnabled) { //Wait for the connect control to be ready int afterCounter = 0; while (!ddlBase.Enabled && afterCounter < 10) { Playback.Wait(2000); afterCounter++; } if (!ddlBase.Enabled) { throw new Exception("The connect control drop down is still disabled after 10 sec wait."); } } }
public void ChooseDestinationServer(UITestControl theTab, string serverName) { UITestControl destinationServerList = GetDestinationServerList(theTab); //Wait for the connect control to be ready int counter = 0; while (!destinationServerList.Enabled && counter < 5) { Playback.Wait(2000); counter++; } if (!destinationServerList.Enabled) { throw new Exception("The connect control drop down is still disabled after 10 sec wait."); } // Click it to expand it Mouse.Click(destinationServerList, new Point(10, 10)); Playback.Wait(500); var item = VisualTreeWalker.GetChildByAutomationIdPath(destinationServerList, "UI_DestinationServercbx_AutoID_" + serverName); Mouse.Click(item, new Point(5, 5)); //Wait for the connect control to be ready int afterCounter = 0; while (!destinationServerList.Enabled && afterCounter < 5) { Playback.Wait(2000); afterCounter++; } if (!destinationServerList.Enabled) { throw new Exception("The connect control drop down is still disabled after 10 sec wait."); } }
private void DoubleClickResource(string resourceName, string categoryName, string serverName) { EnterExplorerSearchText(resourceName); UITestControl theControl = null; //Ensure explorer tree GetExplorerTree(); if (categoryName != "Unassigned" && categoryName != string.Empty) { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, categoryName, resourceName); } else { theControl = VisualTreeWalker.GetChildByAutomationIdPath(_explorerTree, serverName, resourceName); } Playback.Wait(100); Mouse.DoubleClick(theControl, new Point(theControl.BoundingRectangle.X, theControl.BoundingRectangle.Y + 200)); Playback.Wait(5000); if (serverName != "localhost") { Playback.Wait(5000); } }
public static UITestControl GetChildByAutomationIDPath(this UITestControl parent, params string[] automationIDs) { return(VisualTreeWalker.GetChildByAutomationIdPath(parent, automationIDs)); }
private UITestControl GetRecordsetVariables() { return(VisualTreeWalker.GetChildByAutomationIdPath(_variableExplorer, "UI_VariableTreeView_AutoID").GetChildren()[1]); }
public void EnterTextIntoComment(string textToEnter) { UITestControl textbox = VisualTreeWalker.GetChildByAutomationIdPath(Activity, "SmallViewContent", "InitialFocusElement"); textbox.EnterText(textToEnter); }
public void ClickNewTaskButton() { UITestControl newButton = VisualTreeWalker.GetChildByAutomationIdPath(_activeTab, _newButtonAutoIds); newButton.Click(); }
public string GetWorkflowName() { UITestControl workflowNameTextbox = VisualTreeWalker.GetChildByAutomationIdPath(_activeTab, _workflowNameTextBoxAutoIds); return(workflowNameTextbox.GetText()); }
public string GetUsername() { UITestControl usernameTextbox = VisualTreeWalker.GetChildByAutomationIdPath(_activeTab, _usernameTextboxAutoIds); return(usernameTextbox.GetText()); }
public bool GetRunAsap() { UITestControl runAsapCheckbox = VisualTreeWalker.GetChildByAutomationIdPath(_activeTab, _runAsapCheckboxAutoIds); return(runAsapCheckbox.IsChecked()); }