public void TestTargetPropertiesForExecutable() { EnvDTE.Project project; INodeProfiling profiling; using (new JustMyCodeSetting(false)) using (var app = OpenProfileTestProject(out project, out profiling, null)) { var session = LaunchProcess(app, profiling, NodeExePath, TestData.GetPath(@"TestData\NodejsProfileTest\program.js"), TestData.GetPath(@"TestData\NodejsProfileTest"), String.Empty, false ); while (profiling.IsProfiling) { System.Threading.Thread.Sleep(500); } NodejsPerfTarget perfTarget = null; try { app.OpenNodejsPerformance(); var pyPerf = app.NodejsPerformanceExplorerTreeView; var item = pyPerf.FindItem("program *"); Mouse.MoveTo(item.GetClickablePoint()); Mouse.DoubleClick(System.Windows.Input.MouseButton.Left); perfTarget = new NodejsPerfTarget(app.WaitForDialog()); Assert.AreEqual(NodeExePath, perfTarget.InterpreterPath); Assert.AreEqual("", perfTarget.Arguments); Assert.IsTrue(perfTarget.ScriptName.EndsWith("program.js")); Assert.IsTrue(perfTarget.ScriptName.StartsWith(perfTarget.WorkingDir)); } finally { if (perfTarget != null) { perfTarget.Cancel(); app.WaitForDialogDismissed(); } profiling.RemoveSession(session, true); } } }
public void TestTargetPropertiesForProject() { EnvDTE.Project project; INodeProfiling profiling; using (new JustMyCodeSetting(false)) using (var app = OpenProfileTestProject(out project, out profiling)) { var session = LaunchProject(app, profiling, project, TestData.GetPath("TestData\\NodejsProfileTest"), false); try { while (profiling.IsProfiling) { System.Threading.Thread.Sleep(500); } app.OpenNodejsPerformance(); var pyPerf = app.NodejsPerformanceExplorerTreeView; var item = pyPerf.FindItem("NodejsProfileTest *"); Mouse.MoveTo(item.GetClickablePoint()); Mouse.DoubleClick(System.Windows.Input.MouseButton.Left); var perfTarget = new NodejsPerfTarget(app.WaitForDialog()); Assert.AreEqual("NodejsProfileTest", perfTarget.SelectedProject); perfTarget.Cancel(); app.WaitForDialogDismissed(); } finally { profiling.RemoveSession(session, true); } } }
public void LaunchNodejsProfilingWizard() { EnvDTE.Project project; INodeProfiling profiling; using (new JustMyCodeSetting(false)) using (var app = OpenProfileTestProject(out project, out profiling)) { app.LaunchNodejsProfiling(); // wait for the dialog, set some settings, save them. var perfTarget = new NodejsPerfTarget(app.WaitForDialog()); try { perfTarget.SelectProfileProject(); perfTarget.SelectedProjectComboBox.SelectItem("NodejsProfileTest"); try { perfTarget.Ok(); perfTarget = null; } catch (ElementNotEnabledException) { Assert.Fail("Settings were invalid:\n SelectedProject = {0}", perfTarget.SelectedProjectComboBox.GetSelectedItemName()); } } finally { if (perfTarget != null) { perfTarget.Cancel(); app.WaitForDialogDismissed(); perfTarget = null; } } app.WaitForDialogDismissed(); var session = profiling.GetSession(1); try { Assert.AreNotEqual(null, app.NodejsPerformanceExplorerTreeView.WaitForItem("NodejsProfileTest *")); while (profiling.IsProfiling) { // wait for profiling to finish... System.Threading.Thread.Sleep(500); } } finally { profiling.RemoveSession(session, true); } } }
public void NewProfilingSessionOpenSolution() { EnvDTE.Project project; INodeProfiling profiling; using (new JustMyCodeSetting(false)) using (var app = OpenProfileTestProject(out project, out profiling)) { app.OpenNodejsPerformance(); app.NodejsPerformanceExplorerToolBar.NewPerfSession(); var perf = app.NodejsPerformanceExplorerTreeView.WaitForItem("Performance"); if (perf == null) { var tmpSession = profiling.GetSession(1); if (tmpSession != null) { profiling.RemoveSession(tmpSession, true); } Debug.Fail("failed to find performance session, found " + tmpSession != null ? tmpSession.Name : "<nothing>"); } 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.SelectProfileProject(); perfTarget.SelectedProjectComboBox.SelectItem("NodejsProfileTest"); try { perfTarget.Ok(); perfTarget = null; } catch (ElementNotEnabledException) { Assert.Fail("Settings were invalid:\n SelectedProject = {0}", perfTarget.SelectedProjectComboBox.GetSelectedItemName()); } 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("NodejsProfileTest", perfTarget.SelectedProject); } finally { if (perfTarget != null) { perfTarget.Cancel(); app.WaitForDialogDismissed(); } profiling.RemoveSession(session, true); } } }
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); } } } }