public void TestMultipleSessions2() { EnvDTE.Project project; INodeProfiling profiling; using (new JustMyCodeSetting(false)) using (var app = OpenProfileTestProject(out project, out profiling, null)) { app.OpenNodejsPerformance(); app.NodejsPerformanceExplorerToolBar.NewPerfSession(); var perf = app.NodejsPerformanceExplorerTreeView.WaitForItem("Performance *"); Debug.Assert(perf != null); app.NodejsPerformanceExplorerToolBar.NewPerfSession(); perf = app.NodejsPerformanceExplorerTreeView.WaitForItem("Performance *"); Debug.Assert(perf != null); var session = profiling.GetSession(1); Assert.AreNotEqual(session, null); NodejsPerfTarget perfTarget = null; try { Mouse.MoveTo(perf.GetClickablePoint()); Mouse.DoubleClick(System.Windows.Input.MouseButton.Left); // wait for the dialog, set some settings, save them. perfTarget = new NodejsPerfTarget(app.WaitForDialog()); perfTarget.SelectProfileScript(); perfTarget.InterpreterPath = NodeExePath; perfTarget.ScriptName = TestData.GetPath(@"TestData\NodejsProfileTest\program.js"); try { perfTarget.Ok(); perfTarget = null; } catch (ElementNotEnabledException) { Assert.Fail("Settings were invalid:\n ScriptName = {0}\n", perfTarget.ScriptName); } app.WaitForDialogDismissed(); perf = app.NodejsPerformanceExplorerTreeView.WaitForItem("Performance *"); Mouse.MoveTo(perf.GetClickablePoint()); Mouse.Click(System.Windows.Input.MouseButton.Right); Keyboard.Type("S"); SavePerfFile(TestData.GetPath(@"TestData\NodejsProfileTest"), app); SavePerfFile(TestData.GetPath(@"TestData\NodejsProfileTest"), app); var item = app.NodejsPerformanceExplorerTreeView.WaitForItem("Performance *", "Reports"); AutomationElement child = null; for (int i = 0; i < 20; i++) { child = item.FindFirst(System.Windows.Automation.TreeScope.Descendants, Condition.TrueCondition); if (child != null) { break; } System.Threading.Thread.Sleep(100); } Assert.IsNotNull(child, "node not added"); } finally { if (perfTarget != null) { perfTarget.Cancel(); app.WaitForDialogDismissed(); } profiling.RemoveSession(session, true); profiling.RemoveSession(profiling.GetSession(1), true); } } }
public void NewProfilingSession() { using (new JustMyCodeSetting(false)) { using (var app = new NodejsVisualStudioApp()) { app.Dte.Solution.Close(false); app.OpenNodejsPerformance(); app.NodejsPerformanceExplorerToolBar.NewPerfSession(); var profiling = (INodeProfiling)app.Dte.GetObject("NodejsProfiling"); var perf = app.NodejsPerformanceExplorerTreeView.WaitForItem("Performance *"); Debug.Assert(perf != null); var session = profiling.GetSession(1); Assert.AreNotEqual(session, null); NodejsPerfTarget perfTarget = null; try { Mouse.MoveTo(perf.GetClickablePoint()); Mouse.DoubleClick(System.Windows.Input.MouseButton.Left); // wait for the dialog, set some settings, save them. perfTarget = new NodejsPerfTarget(app.WaitForDialog()); perfTarget.SelectProfileScript(); perfTarget.InterpreterPath = NodeExePath; perfTarget.ScriptName = TestData.GetPath(@"TestData\NodejsProfileTest\program.js"); try { perfTarget.Ok(); perfTarget = null; } catch (ElementNotEnabledException) { Assert.Fail("Settings were invalid:\n ScriptName = {0}\n", perfTarget.ScriptName); } app.WaitForDialogDismissed(); Mouse.MoveTo(perf.GetClickablePoint()); Mouse.DoubleClick(System.Windows.Input.MouseButton.Left); // re-open the dialog, verify the settings perfTarget = new NodejsPerfTarget(app.WaitForDialog()); //Assert.AreEqual("Python 2.6", perfTarget.SelectedInterpreter); Assert.AreEqual(TestData.GetPath(@"TestData\NodejsProfileTest\program.js"), perfTarget.ScriptName); } finally { if (perfTarget != null) { perfTarget.Cancel(); app.WaitForDialogDismissed(); } profiling.RemoveSession(session, true); } } } }