public void SelectTreeItemInProjectExplorerGivenPath(string pathItem, RepoItemInfo rootNodeInfo) { pathItem = pathItem.ReplacePathAliases(); Action <TreeItem> actions = (it => (it as Adapter).Focus()); actions += (it => it.ClickWithoutBoundsCheck(new Location(-0.02, 0.5))); TreeItemHelpers.FindNodeInTree(pathItem, rootNodeInfo, actions); return; }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { string path = pathToNodeInProjectExplorer.ReplacePathAliases(); AutomatedSystemTestsRepository myRepository = global::AutomatedSystemTests.AutomatedSystemTestsRepository.Instance; RepoItemInfo rootNodeProject = myRepository.RiskeerMainWindow.ProjectExplorerPanel.TrajectNode.SelfInfo; TreeItem nodeTreeItem = TreeItemHelpers.FindNodeInTree(path, rootNodeProject, (ti) => {}); structureNode = GetStructureTreeItem(nodeTreeItem); }
/// <summary> /// Performs the playback of actions in this module. /// </summary> /// <remarks>You should not call this method directly, instead pass the module /// instance to the <see cref="TestModuleRunner.Run(ITestModule)"/> method /// that will in turn invoke this method.</remarks> void ITestModule.Run() { string path = pathToFolder.ReplacePathAliases(); AutomatedSystemTestsRepository myRepository = global::AutomatedSystemTests.AutomatedSystemTestsRepository.Instance; var rootNodeInfo = myRepository.RiskeerMainWindow.ProjectExplorerPanel.TrajectNode.SelfInfo; Action <TreeItem> actions = (it => (it as Adapter).Focus()); actions += (it => ValidateNodeContainsChildWithName(it, nameOfNode, nodeIsExpectedToBeContained == "true")); TreeItemHelpers.FindNodeInTree(path, rootNodeInfo, actions); return; }
public void SelectTreeItemInMapLayersPanel(string pathItem, RepoItemInfo rootNodeInfo) { Mouse.DefaultMoveTime = 0; Keyboard.DefaultKeyPressTime = 0; Delay.SpeedFactor = 0.0; Action <TreeItem> actions = (it => (it as Adapter).Focus()); actions += (it => it.Click(Location.CenterLeft)); TreeItemHelpers.FindNodeInTree(pathItem, rootNodeInfo, actions); return; }
public void DragAndDropProjectExplorerItemOntoAnotherOne(string pathItemToMove, string pathItemDestination, RepoItemInfo rootNodeInfo) { pathItemToMove = pathItemToMove.ReplacePathAliases(); pathItemDestination = pathItemDestination.ReplacePathAliases(); TreeItem treeitemToMove = TreeItemHelpers.FindNodeInTree(pathItemToMove, rootNodeInfo, (ti) => {}); TreeItem treeItemDestination = TreeItemHelpers.FindNodeInTree(pathItemDestination, rootNodeInfo, (ti) => {}); Delay.Duration(Duration.FromMilliseconds(1000)); Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Down item 'treeitemToMove' at Center."); treeitemToMove.MoveTo(); Mouse.ButtonDown(System.Windows.Forms.MouseButtons.Left); Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Up item 'treeItemDestination' at Center."); treeItemDestination.MoveTo(Duration.FromMilliseconds(1000)); Mouse.ButtonUp(System.Windows.Forms.MouseButtons.Left); }
private void ValidateNodeContainsChildWithName(TreeItem node, string nameOfChild, bool childIsExpected) { var children = node.Children; int numberOfChildrenWithExpectedName = children.Where(ch => TreeItemHelpers.NameOfTreeItem(ch.As <TreeItem>()) == nameOfChild).ToList().Count; if (childIsExpected) { Report.Log(ReportLevel.Info, "Validating that folder '" + pathToFolder + "' contains one node with name '" + nameOfNode + "'."); Validate.IsTrue(numberOfChildrenWithExpectedName == 1); node = children.FirstOrDefault(ch => ch.ToString().Contains(nameOfNode)).As <TreeItem>(); Report.Screenshot(node.Element); } else { Report.Log(ReportLevel.Info, "Validating that folder '" + pathToFolder + "' contains no node with name '" + nameOfNode + "'."); Validate.IsTrue(numberOfChildrenWithExpectedName == 0); } }