private static INodeProfileSession LaunchProcess( VisualStudioApp app, INodeProfiling profiling, string interpreterPath, string filename, string directory, string arguments, bool openReport ) { return LaunchSession(app, () => profiling.LaunchProcess( interpreterPath, filename, directory, String.Empty, openReport ), directory ); }
private static void WaitForReport(INodeProfiling profiling, INodeProfileSession session, out INodePerformanceReport report, NodejsVisualStudioApp app, out AutomationElement child) { while (profiling.IsProfiling) { System.Threading.Thread.Sleep(500); } report = session.GetReport(1); var filename = report.Filename; Assert.IsTrue(filename.Contains("NodejsProfileTest")); app.OpenNodejsPerformance(); var pyPerf = app.NodejsPerformanceExplorerTreeView; Assert.AreNotEqual(null, pyPerf); var item = pyPerf.FindItem("NodejsProfileTest *", "Reports"); child = item.FindFirst(System.Windows.Automation.TreeScope.Descendants, Condition.TrueCondition); var childName = child.GetCurrentPropertyValue(AutomationElement.NameProperty) as string; Assert.IsTrue(childName.StartsWith("NodejsProfileTest")); AutomationWrapper.EnsureExpanded(child); }
private static INodeProfileSession LaunchProject( VisualStudioApp app, INodeProfiling profiling, EnvDTE.Project project, string directory, bool openReport ) { return LaunchSession(app, () => profiling.LaunchProject(project, openReport), directory); }
private NodejsVisualStudioApp OpenProfileTestProject( out EnvDTE.Project project, out INodeProfiling profiling, string projectFile = NodejsProfileTest ) { var app = new NodejsVisualStudioApp(); try { profiling = (INodeProfiling)app.Dte.GetObject("NodejsProfiling"); // no sessions yet Assert.IsNull(profiling.GetSession(1)); if (string.IsNullOrEmpty(projectFile)) { project = null; } else { project = app.OpenProject(projectFile); } var res = app; app = null; return res; } finally { if (app != null) { app.Dispose(); } } }
private static NodejsVisualStudioApp WaitForReport(INodeProfiling profiling, INodeProfileSession session, NodejsVisualStudioApp app, out string reportFilename) { while (profiling.IsProfiling) { System.Threading.Thread.Sleep(100); } var report = session.GetReport(1); var filename = report.Filename; Assert.IsTrue(filename.Contains("NodejsProfileTest")); app.OpenNodejsPerformance(); var pyPerf = app.NodejsPerformanceExplorerTreeView; Assert.AreNotEqual(null, pyPerf); var item = pyPerf.FindItem("NodejsProfileTest *", "Reports"); var child = item.FindFirst(System.Windows.Automation.TreeScope.Descendants, Condition.TrueCondition); var childName = child.GetCurrentPropertyValue(AutomationElement.NameProperty) as string; reportFilename = report.Filename; Assert.IsTrue(childName.StartsWith("NodejsProfileTest")); child.SetFocus(); Keyboard.PressAndRelease(System.Windows.Input.Key.Delete); return app; }