/// <summary> /// Drags a control from the Toolbox to the Workflow /// </summary> /// <param name="toolName">The name of the control you to drag - Eg: Assign, Calculate, Etc</param> /// <param name="tabToDropOnto">The tab on which to drop the control</param> /// <param name="pointToDragTo">The point you wish to drop the control</param> /// <param name="getDroppedActivity">Get and return the dropped control</param> public UITestControl DragControlToWorkflowDesigner(ToolType tool, UITestControl tabToDropOnto, Point pointToDragTo = new Point(), bool getDroppedActivity = true) { UITestControl theControl = FindToolboxItemByAutomationId(tool); theControl.WaitForControlEnabled(); if (pointToDragTo.X == 0 && pointToDragTo.Y == 0) { UITestControl theStartButton = WorkflowDesignerUIMap.FindStartNode(tabToDropOnto); pointToDragTo = new Point(theStartButton.BoundingRectangle.X, theStartButton.BoundingRectangle.Y + 200); } Mouse.StartDragging(theControl, MouseButtons.Left); Playback.Wait(20); Mouse.StopDragging(pointToDragTo); Playback.Wait(100); UITestControl resourceOnDesignSurface = null; if (getDroppedActivity) { resourceOnDesignSurface = WorkflowDesignerUIMap.FindControlByAutomationId(tabToDropOnto, tool.ToString()); int counter = 0; while (resourceOnDesignSurface == null && counter < 5) { Playback.Wait(1000); resourceOnDesignSurface = WorkflowDesignerUIMap.FindControlByAutomationId(tabToDropOnto, tool.ToString()); Playback.Wait(500); counter++; } } return(resourceOnDesignSurface); }
public void DragASwitchIntoForEachExpectNotAddedToForEach() { // Create the workflow RibbonUIMap.CreateNewWorkflow(); // Get some variables UITestControl theTab = TabManagerUIMap.GetActiveTab(); UITestControl theStartButton = WorkflowDesignerUIMap.FindControlByAutomationId(theTab, "Start"); Point workflowPoint1 = new Point(theStartButton.BoundingRectangle.X, theStartButton.BoundingRectangle.Y + 200); Point requiredPoint = WorkflowDesignerUIMap.GetPointUnderStartNode(theTab); requiredPoint.Offset(20, 20); // Drag a ForEach onto the Workflow ToolboxUIMap.DragControlToWorkflowDesigner(ToolType.ForEach, workflowPoint1, "For Each"); // Open the toolbox, and drag the control onto the Workflow ToolboxUIMap.DragControlToWorkflowDesigner(ToolType.Switch, requiredPoint); // Cancel Decision Wizard if (WizardsUIMap.TryWaitForWizard(3000)) { KeyboardCommands.SendTab(); KeyboardCommands.SendTab(); KeyboardCommands.SendEnter(100); Assert.Fail("Got dropped ;("); } }
// 05/11 - Failure is Intermittent ;) public void DecisionWizard_Save_WhenMouseUsedToSelect2ndAnd3rdInputFields_FieldDataSavedCorrectly() { //------------Setup for test-------------------------- RibbonUIMap.CreateNewWorkflow(); var theTab = TabManagerUIMap.GetActiveTab(); //------------Execute Test--------------------------- VariablesUIMap.EnterTextIntoScalarName(0, "VariableName"); var pt = WorkflowDesignerUIMap.GetPointUnderStartNode(theTab); ToolboxUIMap.DragControlToWorkflowDesigner(ToolType.Decision, pt); WizardsUIMap.WaitForWizard(); Assert.AreEqual("Decision Flow", WizardsUIMap.GetLeftTitleText()); _decisionWizardUiMap.SendTabs(5, 500); _decisionWizardUiMap.SelectMenuItem(17, 100); // select between ;) _decisionWizardUiMap.SendTabs(11, 500); _decisionWizardUiMap.GetFirstIntellisense("[[V", false, new Point(100, 120)); _decisionWizardUiMap.SendTabs(2, 500); _decisionWizardUiMap.GetFirstIntellisense("[[V", false, new Point(400, 120)); _decisionWizardUiMap.SendTabs(1, 500); _decisionWizardUiMap.GetFirstIntellisense("[[V", false, new Point(600, 120)); _decisionWizardUiMap.SendTabs(6, 500); KeyboardCommands.SendEnter(); //------------Assert Results------------------------- const string expected = "If [[VariableName]] Is Between [[VariableName]] and [[VariableName]]"; var getDecision = WorkflowDesignerUIMap.FindControlByAutomationId(theTab, "FlowDecisionDesigner"); getDecision.WaitForControlEnabled(); var getDecisionText = getDecision.GetChildren()[0] as WpfEdit; if (getDecisionText != null) { var displayValue = getDecisionText.Text; Assert.AreEqual(expected, displayValue, "Decision intellisense doesnt work when using the mouse to select intellisense results"); } else { Assert.Fail("Null decision"); } }
public void Decision_Intellisense_KeyboardSelect_DecisionTitleUpdatesCorrectly() { RibbonUIMap.CreateNewWorkflow(); UITestControl theTab = TabManagerUIMap.GetActiveTab(); VariablesUIMap.ClickScalarVariableName(0); SendKeys.SendWait("VariableName"); ToolboxUIMap.DragControlToWorkflowDesigner(ToolType.Decision, WorkflowDesignerUIMap.GetPointUnderStartNode(theTab)); Playback.Wait(5000); //------------Execute Test--------------------------- _decisionWizardUiMap.SendTabs(5, 1000); _decisionWizardUiMap.SelectMenuItem(17, 2000); _decisionWizardUiMap.SendTabs(11, 1000); //First field _decisionWizardUiMap.GetFirstIntellisense("[[V"); _decisionWizardUiMap.SendTabs(2, 1000); //Second field _decisionWizardUiMap.GetFirstIntellisense("[[V"); _decisionWizardUiMap.SendTabs(1, 1000); //Third field _decisionWizardUiMap.GetFirstIntellisense("[[V"); _decisionWizardUiMap.SendTabs(6, 1000); //Wait for wizard to close KeyboardCommands.SendEnter(1500); // Assert Decision Title Updates Correctly const string Expected = "If [[VariableName]] Is Between [[VariableName]] and [[VariableName]]"; var getDecision = WorkflowDesignerUIMap.FindControlByAutomationId(theTab, "FlowDecisionDesigner"); var getDecisionText = getDecision.GetChildren()[0] as WpfEdit; if (getDecisionText != null) { var displayValue = getDecisionText.Text; Assert.AreEqual(Expected, displayValue, "Decision intellisense doesnt work when using the keyboard to select intellisense results"); } else { Assert.Fail(); } }
public void CopyDecisionsWithContextMenuAndPasteExpectedNoWizardsDisplayed() { //Initialize Clipboard.SetText(" "); RibbonUIMap.CreateNewWorkflow(); UITestControl theTab = TabManagerUIMap.GetActiveTab(); //Drag on two decisions ToolboxUIMap.DragControlToWorkflowDesigner(ToolType.Decision, WorkflowDesignerUIMap.GetPointUnderStartNode(theTab)); WizardsUIMap.WaitForWizard(); _decisionWizardUiMap.HitDoneWithKeyboard(); var newPoint = WorkflowDesignerUIMap.GetPointUnderStartNode(theTab); newPoint.Y = newPoint.Y + 200; var clickPoint = new Point(newPoint.X, newPoint.Y); ToolboxUIMap.DragControlToWorkflowDesigner(ToolType.Decision, newPoint); WizardsUIMap.WaitForWizard(7000); _decisionWizardUiMap.HitDoneWithKeyboard(); //Rubber-band select them var startDragPoint = WorkflowDesignerUIMap.GetPointUnderStartNode(theTab); startDragPoint.X = startDragPoint.X - 100; startDragPoint.Y = startDragPoint.Y - 100; Mouse.Move(startDragPoint); newPoint.X = newPoint.X + 100; newPoint.Y = newPoint.Y + 100; Mouse.StartDragging(); Mouse.StopDragging(newPoint); startDragPoint.X = startDragPoint.X + 150; startDragPoint.Y = startDragPoint.Y + 150; Mouse.Click(MouseButtons.Right, ModifierKeys.None, clickPoint); var designSurface = WorkflowDesignerUIMap.GetFlowchartDesigner(theTab); SendKeys.SendWait("{DOWN}{DOWN}{ENTER}"); Mouse.Click(designSurface); SendKeys.SendWait("^v"); UITestControl uIItemImage = DatabaseServiceWizardUIMap.UIBusinessDesignStudioWindow.GetChildren()[0].GetChildren()[0]; // Assert Assert.AreEqual("System Menu Bar", uIItemImage.FriendlyName); }