예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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);
                }
            }
        }