Ejemplo n.º 1
0
        public void AddNewFolder()
        {
            using (var app = new PythonVisualStudioApp()) {
                var project = app.OpenProject(@"TestData\HelloWorld.sln");

                app.OpenSolutionExplorer().SelectProject(project);

                app.ExecuteCommand("Project.NewFolder");
                Keyboard.Type("MyNewFolder");
                Keyboard.PressAndRelease(Key.Enter);

                app.OpenSolutionExplorer().WaitForChildOfProject(project, "MyNewFolder");
            }
        }
Ejemplo n.º 2
0
        public virtual void RegressionImportMultipleModules()
        {
            using (var interactive = Prepare(addNewLineAtEndOfFullyTypedWord: true)) {
                Keyboard.Type("import ");

                using (var sh = interactive.WaitForSession <ICompletionSession>()) {
                    Assert.IsNotNull(sh.Session.SelectedCompletionSet, "No selected completion set");
                    var names   = sh.Session.SelectedCompletionSet.Completions.Select(c => c.DisplayText).ToList();
                    var nameset = new HashSet <string>(names);

                    Assert.AreEqual(names.Count, nameset.Count, "Module names were duplicated");
                }
            }
        }
Ejemplo n.º 3
0
        public void CopyPasteRenameFile()
        {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\CopyPasteRenameProject\CopyPasteRenameProject.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    var window = app.OpenSolutionExplorer();

                    var jsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameJavaScript", "app.js");

                    AutomationWrapper.Select(jsFile);

                    Keyboard.ControlC();
                    Keyboard.ControlV();
                    var copiedJsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameJavaScript", "app - Copy.js");
                    Assert.AreNotEqual(null, copiedJsFile);

                    AutomationWrapper.Select(copiedJsFile);

                    Keyboard.PressAndRelease(Key.F2);
                    System.Threading.Thread.Sleep(100);

                    Keyboard.Type("renamed");
                    Keyboard.PressAndRelease(Key.Enter);

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameJavaScript", "renamed.js"));


                    var tsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameProjectTypeScript", "app.ts");

                    AutomationWrapper.Select(tsFile);

                    Keyboard.ControlC();
                    Keyboard.ControlV();
                    var copiedTsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameProjectTypeScript", "app - Copy.ts");
                    Assert.AreNotEqual(null, copiedTsFile);

                    AutomationWrapper.Select(copiedTsFile);

                    Keyboard.PressAndRelease(Key.F2);
                    System.Threading.Thread.Sleep(100);

                    Keyboard.Type("renamed");
                    Keyboard.PressAndRelease(Key.Enter);

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameProjectTypeScript", "renamed.ts"));
                }
            }
        }
        public virtual void IPythonSimpleSignatureHelp()
        {
            using (var interactive = PrepareIPython()) {
                Assert.IsNotNull(interactive);

                interactive.SubmitCode("def f(): pass");
                interactive.WaitForText(">def f(): pass", ">");

                Keyboard.Type("f(");

                using (var sh = interactive.WaitForSession <ISignatureHelpSession>()) {
                    Assert.AreEqual("<no docstring>", sh.Session.SelectedSignature.Documentation);
                }
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Moves one or more items in solution explorer to the destination using the mouse.
        /// </summary>
        private static void MoveByMouse(AutomationElement destination, params AutomationElement[] source)
        {
            SelectItemsForDragAndDrop(source);

            try {
                try {
                    Keyboard.Press(Key.LeftShift);
                    Mouse.MoveTo(destination.GetClickablePoint());
                } finally {
                    Mouse.Up(MouseButton.Left);
                }
            } finally {
                Keyboard.Release(Key.LeftShift);
            }
        }
Ejemplo n.º 6
0
        public void CloseParenCommits()
        {
            using (var solution = BasicProject.Generate().ToVs()) {
                var server = solution.OpenItem("Require", "server.js");
                Keyboard.Type("require(");

                using (var completionSession = server.WaitForSession <ICompletionSession>()) {
                    Assert.AreEqual(1, completionSession.Session.CompletionSets.Count);

                    Keyboard.Type("ht)");

                    server.WaitForText("require('http')");
                }
            }
        }
Ejemplo n.º 7
0
        public void UserModuleInFolder()
        {
            using (var solution = BasicProject.Generate().ToVs()) {
                var server = solution.OpenItem("Require", "server.js");
                Keyboard.Type("require(");

                using (var completionSession = server.WaitForSession <ICompletionSession>()) {
                    Assert.AreEqual(1, completionSession.Session.CompletionSets.Count);

                    Keyboard.Type("./Some\t)");

                    server.WaitForText("require('./SomeFolder/baz.js')");
                }
            }
        }
Ejemplo n.º 8
0
        public void RequireAfterSemiColon()
        {
            using (var solution = BasicProject.Generate().ToVs()) {
                var server = solution.OpenItem("Require", "server.js");
                Keyboard.Type("f(x);\rrequire(");

                using (var completionSession = server.WaitForSession <ICompletionSession>()) {
                    Assert.AreEqual(1, completionSession.Session.CompletionSets.Count);

                    Keyboard.Type("ht\t)");

                    server.WaitForText("f(x);\r\nrequire('http')");
                }
            }
        }
Ejemplo n.º 9
0
        public void CopyPasteRenameFile()
        {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\CopyPasteRenameProject\CopyPasteRenameProject.sln");

                app.OpenSolutionExplorer();
                var window = app.SolutionExplorerTreeView;

                var jsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameJavaScript", "app.js");

                AutomationWrapper.Select(jsFile);

                Keyboard.ControlC();
                Keyboard.ControlV();
                var copiedJsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameJavaScript", "app - Copy.js");
                Assert.AreNotEqual(null, copiedJsFile);

                AutomationWrapper.Select(copiedJsFile);

                Keyboard.PressAndRelease(Key.F2);
                System.Threading.Thread.Sleep(100);

                Keyboard.Type("renamed");
                Keyboard.PressAndRelease(Key.Enter);

                Assert.AreNotEqual(null, window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameJavaScript", "renamed.js"));


                var tsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameProjectTypeScript", "app.ts");

                AutomationWrapper.Select(tsFile);

                Keyboard.ControlC();
                Keyboard.ControlV();
                var copiedTsFile = window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameProjectTypeScript", "app - Copy.ts");
                Assert.AreNotEqual(null, copiedTsFile);

                AutomationWrapper.Select(copiedTsFile);

                Keyboard.PressAndRelease(Key.F2);
                System.Threading.Thread.Sleep(100);

                Keyboard.Type("renamed");
                Keyboard.PressAndRelease(Key.Enter);

                Assert.AreNotEqual(null, window.WaitForItem("Solution 'CopyPasteRenameProject' (2 projects)", "CopyPasteRenameProjectTypeScript", "renamed.ts"));
            }
        }
Ejemplo n.º 10
0
        public void AddNewFolderNested()
        {
            using (var app = new VisualStudioApp())
            {
                var project = app.OpenProject(@"TestData\NodejsProjectData\HelloWorld.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false))
                {
                    var window = app.OpenSolutionExplorer();

                    // find server.js, send copy & paste, verify copy of file is there
                    var projectNode = window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld");
                    AutomationWrapper.Select(projectNode);

                    Keyboard.PressAndRelease(Key.F10, Key.LeftCtrl, Key.LeftShift);
                    Keyboard.PressAndRelease(Key.D);
                    Keyboard.PressAndRelease(Key.Right);
                    Keyboard.PressAndRelease(Key.D);
                    Keyboard.Type("FolderX");
                    Keyboard.PressAndRelease(Key.Enter);

                    var folderNode = window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "FolderX");

                    Assert.AreNotEqual(null, folderNode, "failed to find folder X");

                    AutomationWrapper.Select(folderNode);

                    Keyboard.PressAndRelease(Key.F10, Key.LeftCtrl, Key.LeftShift);
                    Keyboard.PressAndRelease(Key.D);
                    Keyboard.PressAndRelease(Key.Right);
                    Keyboard.PressAndRelease(Key.D);
                    Keyboard.Type("FolderY");
                    Keyboard.PressAndRelease(Key.Enter);

                    var innerFolderNode = window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "FolderX", "FolderY");

                    Assert.AreNotEqual(null, innerFolderNode, "failed to find folder Y");

                    AutomationWrapper.Select(innerFolderNode);

                    var newItem = project.ProjectItems.Item("FolderX").Collection.Item("FolderY").Collection.AddFromFile(
                        TestData.GetPath(@"TestData\DebuggerProject\BreakpointBreakOn.js")
                        );

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "FolderX", "FolderY", "BreakpointBreakOn.js"), "failed to find added file");
                }
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Move item to a folder that has a symbolic link.  Verify we cannot move 
        /// ourselves to ourselves and that moves are reflected in both the folder and its symbolic link.
        /// NOTE: Because of symbolic link creation, this test must be run as administrator.
        /// </summary>
        private void MoveFileFromFolderToLinkedFolder(MoveDelegate mover)
        {
            foreach (var projectType in ProjectTypes)
            {
                var projectDefs = new[] {
                    new ProjectDefinition("MoveLinkedFolder",
                        projectType,
                        ItemGroup(
                            Content("textfile.txt", "text file contents"),
                            Folder("Folder"),
                            Content("Folder\\FileInFolder.txt", "File inside of linked folder..."),
                            SymbolicLink("FolderLink", "Folder")
                        )
                    )
                };

                using (var solution = SolutionFile.Generate("MoveLinkedFolder", projectDefs).ToVs())
                {
                    mover(
                        solution,
                        solution.FindItem("MoveLinkedFolder", "FolderLink"),
                        solution.FindItem("MoveLinkedFolder", "Folder", "FileInFolder.txt")
                    );

                    // Say okay to the error that pops up since we can't move to ourselves.
                    solution.WaitForDialog();
                    Keyboard.Type(Key.Enter);

                    solution.WaitForDialogDismissed();

                    // Verify that after the dialog our files are still present.
                    solution.AssertFileExists("MoveLinkedFolder", "FolderLink", "FileInFolder.txt");
                    solution.AssertFileExists("MoveLinkedFolder", "Folder", "FileInFolder.txt");

                    // Now move the text file in the root.  Expect it to move and be in both.
                    mover(
                        solution,
                        solution.FindItem("MoveLinkedFolder", "FolderLink"),
                        solution.FindItem("MoveLinkedFolder", "textfile.txt")
                    );

                    solution.AssertFileExists("MoveLinkedFolder", "FolderLink", "textfile.txt");
                    solution.AssertFileExists("MoveLinkedFolder", "Folder", "textfile.txt");
                }
            }
        }
Ejemplo n.º 12
0
        public virtual void Comments()
        {
            using (var interactive = Prepare()) {
                const string code = "# fob";
                Keyboard.Type(code + "\r");

                interactive.WaitForText(">" + code, ".");

                const string code2 = "# oar";
                Keyboard.Type(code2 + "\r");

                interactive.WaitForText(">" + code, "." + code2, ".");

                Keyboard.Type("\r");
                interactive.WaitForText(">" + code, "." + code2, ".", ">");
            }
        }
Ejemplo n.º 13
0
        public void RequireAfterComma()
        {
            using (new OptionHolder("TextEditor", "Node.js", "BraceCompletion", false)) {
                using (var solution = BasicProject.Generate().ToVs()) {
                    var server = solution.OpenItem("Require", "server.js");
                    Keyboard.Type("f(a, require(");

                    using (var completionSession = server.WaitForSession <ICompletionSession>()) {
                        Assert.AreEqual(1, completionSession.Session.CompletionSets.Count);

                        Keyboard.Type("ht\t)");

                        server.WaitForText("f(a, require('http')");
                    }
                }
            }
        }
Ejemplo n.º 14
0
        public void CopyFolderOnToSelf()
        {
            using (var app = new VisualStudioApp()) {
                app.OpenProject(@"TestData\NodejsProjectData\HelloWorld2.sln", expectedProjects: 2);
                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    var window = app.OpenSolutionExplorer();

                    var folder = window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder");
                    AutomationWrapper.Select(folder);

                    Keyboard.ControlC();
                    AutomationWrapper.Select(folder);
                    Keyboard.ControlV();

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder - Copy"));
                }
            }
        }
Ejemplo n.º 15
0
        public void SubmodulesFiles()
        {
            var project = Project("RequireSubmodules",
                                  Compile("server", ""),
                                  Folder("mymod"),
                                  Compile("mymod\\index", ""),
                                  Compile("mymod\\quox", "")
                                  );

            using (var solution = project.Generate().ToVs()) {
                var server = solution.OpenItem("RequireSubmodules", "server.js");

                server.MoveCaret(1, 1);

                Keyboard.Type("require('./mymod/q\t");
                server.WaitForText("require('./mymod/quox.js')");
            }
        }
Ejemplo n.º 16
0
        public void CopyFolderOnToSelf()
        {
            using (var app = new VisualStudioApp()) {
                app.OpenProject(@"TestData\NodejsProjectData\HelloWorld2.sln", expectedProjects: 2);

                app.OpenSolutionExplorer();
                var window = app.SolutionExplorerTreeView;

                var folder = window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder");
                AutomationWrapper.Select(folder);

                Keyboard.ControlC();
                AutomationWrapper.Select(folder);
                Keyboard.ControlV();

                Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder - Copy"));
            }
        }
Ejemplo n.º 17
0
        public void RequireKeyboardCompletionBraceCompletionOff()
        {
            using (new OptionHolder("TextEditor", "Node.js", "BraceCompletion", false)) {
                using (var solution = BasicProject.Generate().ToVs()) {
                    var server = solution.OpenItem("Require", "server.js");
                    Keyboard.Type("require(ad");
                    WaitForCompletionSessionAndCommit(server);

                    server.WaitForText("require('addons'");

                    Keyboard.Backspace(20);

                    Keyboard.Type("require('ad");
                    WaitForCompletionSessionAndCommit(server);

                    server.WaitForText("require('addons");

                    Keyboard.Backspace(20);

                    Keyboard.Type("require(\"ad");
                    WaitForCompletionSessionAndCommit(server);

                    server.WaitForText("require(\"addons");

                    Keyboard.Backspace(20);

                    TypeRequireStatementAndSelectModuleName(false, server);
                    Keyboard.Type("ad");
                    WaitForCompletionSessionAndCommit(server);

                    server.WaitForText("require('addons')");

                    Keyboard.PressAndRelease(Key.Right);
                    Keyboard.PressAndRelease(Key.Right);
                    Keyboard.Backspace(20);

                    TypeRequireStatementAndSelectModuleName(true, server);
                    Keyboard.Type("ad");
                    WaitForCompletionSessionAndCommit(server);

                    server.WaitForText("require(\"addons\")");
                }
            }
        }
Ejemplo n.º 18
0
        public void SubmodulesFiles2()
        {
            var project = Project("RequireSubmodules",
                                  Compile("server", ""),
                                  Folder("mymod"),
                                  Compile("mymod\\quox", "")
                                  );

            using (new OptionHolder("TextEditor", "Node.js", "BraceCompletion", false)) {
                using (var solution = project.Generate().ToVs()) {
                    var server = solution.OpenItem("RequireSubmodules", "server.js");

                    server.MoveCaret(1, 1);

                    Keyboard.Type("require('./mymod/q\t)");
                    server.WaitForText("require('./mymod/quox.js')");
                }
            }
        }
Ejemplo n.º 19
0
        public virtual void NoSnippets()
        {
            // https://pytools.codeplex.com/workitem/2945 is the reason for
            // disabling snippets; https://pytools.codeplex.com/workitem/2947 is
            // where we will re-enable them when they work properly.
            using (var interactive = Prepare()) {
                int spaces    = interactive.TextView.Options.GetOptionValue(DefaultOptions.IndentSizeOptionId);
                int textWidth = interactive.CurrentPrimaryPrompt.Length + 3;

                int totalChars = spaces;
                while (totalChars < textWidth)
                {
                    totalChars += spaces;
                }

                Keyboard.Type("def\t");
                interactive.WaitForText(">def" + new string(' ', totalChars - textWidth));
            }
        }
Ejemplo n.º 20
0
        public void DjangoIncludeInProject(PythonVisualStudioApp app)
        {
            app.OpenProject(@"TestData\DjangoApplication.sln");

            app.OpenSolutionExplorer();
            var window = app.SolutionExplorerTreeView;

            app.Dte.ExecuteCommand("Project.ShowAllFiles"); // start showing all

            var folderNode = window.WaitForItem("Solution 'DjangoApplication' (1 project)", "DjangoApplication", "Folder");

            Mouse.MoveTo(folderNode.GetClickablePoint());
            Mouse.Click(MouseButton.Right);

            Keyboard.Type("j");                             // Exclude from Project
            app.Dte.ExecuteCommand("Project.ShowAllFiles"); // stop showing all

            Assert.IsNull(window.WaitForItemRemoved("Solution 'DjangoApplication' (1 project)", "DjangoApplication", "notinproject.py"));
            Assert.IsNotNull(window.WaitForItem("Solution 'DjangoApplication' (1 project)", "DjangoApplication", "Folder", "test.py"));
        }
Ejemplo n.º 21
0
        public void DeleteLockedFolder()
        {
            using (var app = new VisualStudioApp())
            {
                var project = app.OpenProject(@"TestData\NodejsProjectData\DeleteLockedFolder.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false))
                {
                    var window = app.OpenSolutionExplorer();

                    var folderNode = window.WaitForItem("Solution 'DeleteLockedFolder' (1 project)", "DeleteLockedFolder", "Folder");
                    AutomationWrapper.Select(folderNode);

                    var psi = new ProcessStartInfo(
                        Path.Combine(Environment.GetEnvironmentVariable("WINDIR"), "system32", "cmd.exe"));
                    psi.WorkingDirectory = Path.Combine(Environment.CurrentDirectory, @"TestData\NodejsProjectData\DeleteLockedFolder\Folder");
                    psi.CreateNoWindow   = true;
                    psi.UseShellExecute  = false;
                    using (var process = System.Diagnostics.Process.Start(psi))
                    {
                        try
                        {
                            //Ensure the other process started and has time to lock the file
                            System.Threading.Thread.Sleep(1000);
                            Keyboard.Type(Key.Delete);
                            app.WaitForDialog();
                            Keyboard.Type(Key.Enter);
                            System.Threading.Thread.Sleep(500);

                            VisualStudioApp.CheckMessageBox("The process cannot access the file 'Folder' because it is being used by another process.");
                        }
                        finally
                        {
                            process.Kill();
                        }
                    }

                    Assert.IsNotNull(window.FindItem("Solution 'DeleteLockedFolder' (1 project)", "DeleteLockedFolder", "Folder"));
                }
            }
        }
Ejemplo n.º 22
0
        public void RenameItemsTest()
        {
            using (var app = new PythonVisualStudioApp()) {
                var project = app.OpenProject(@"TestData\RenameItemsTestUI.sln");

                var window = app.OpenSolutionExplorer();

                // find Program.py, send copy & paste, verify copy of file is there
                var node = window.FindChildOfProject(project, "Program.py");

                // rename once, cancel renaming to existing file....
                node.Select();
                Keyboard.PressAndRelease(Key.F2);
                System.Threading.Thread.Sleep(100);
                Keyboard.PressAndRelease(Key.A, Key.LeftCtrl);

                Keyboard.Type("NewName.txt");
                System.Threading.Thread.Sleep(100);
                Keyboard.PressAndRelease(Key.Enter);

                IntPtr dialog = app.WaitForDialog();

                VisualStudioApp.CheckMessageBox(MessageBoxButton.Cancel, "file name extension");

                // rename again, don't cancel...
                node.Select();
                Keyboard.PressAndRelease(Key.F2);
                System.Threading.Thread.Sleep(100);
                Keyboard.PressAndRelease(Key.A, Key.LeftCtrl);

                Keyboard.Type("NewName.txt");
                System.Threading.Thread.Sleep(100);
                Keyboard.PressAndRelease(Key.Enter);

                dialog = app.WaitForDialog();

                VisualStudioApp.CheckMessageBox(MessageBoxButton.Yes, "file name extension");

                Assert.IsNotNull(window.WaitForChildOfProject(project, "NewName.txt"));
            }
        }
Ejemplo n.º 23
0
        public void RenameProjectToExisting()
        {
            using (var app = new VisualStudioApp())
            {
                var project = app.OpenProject(@"TestData\NodejsProjectData\RenameProjectTestUI.sln");

                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false))
                {
                    var window = app.OpenSolutionExplorer();

                    // find server.js, send copy & paste, verify copy of file is there
                    var projectNode = window.WaitForItem("Solution 'RenameProjectTestUI' (1 project)", "HelloWorld");

                    // rename once, cancel renaming to existing file....
                    AutomationWrapper.Select(projectNode);
                    Keyboard.PressAndRelease(Key.F2);
                    System.Threading.Thread.Sleep(100);

                    Keyboard.Type("HelloWorldExisting");
                    Keyboard.PressAndRelease(Key.Enter);

                    IntPtr dialog = app.WaitForDialog();

                    VisualStudioApp.CheckMessageBox("HelloWorldExisting.njsproj", "overwrite");

                    // rename again, don't cancel...
                    AutomationWrapper.Select(projectNode);
                    Keyboard.PressAndRelease(Key.F2);
                    System.Threading.Thread.Sleep(100);

                    Keyboard.Type("HelloWorldExisting");
                    Keyboard.PressAndRelease(Key.Enter);

                    dialog = app.WaitForDialog();

                    VisualStudioApp.CheckMessageBox(MessageBoxButton.Yes, "HelloWorldExisting.njsproj", "overwrite");

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'RenameProjectTestUI' (1 project)", "HelloWorldExisting"));
                }
            }
        }
Ejemplo n.º 24
0
        public void AddNewFolderLongPathTooLongCancelEdit()
        {
            using (var app = new VisualStudioApp()) {
                var project = OpenLongFileNameProject(app, 21);

                app.OpenSolutionExplorer();
                var window = app.SolutionExplorerTreeView;

                // find server.js, send copy & paste, verify copy of file is there
                var projectNode = window.WaitForItem("Solution 'LongFileNames' (1 project)", "LFN");
                AutomationWrapper.Select(projectNode);

                Keyboard.PressAndRelease(Key.F10, Key.LeftCtrl, Key.LeftShift);
                Keyboard.PressAndRelease(Key.D);
                Keyboard.PressAndRelease(Key.Right);
                Keyboard.PressAndRelease(Key.D);
                Keyboard.PressAndRelease(Key.Escape);

                VisualStudioApp.CheckMessageBox("The filename or extension is too long.");
            }
        }
Ejemplo n.º 25
0
        public void RenameProjectToExisting()
        {
            using (var app = new PythonVisualStudioApp()) {
                var project = app.OpenProject(@"TestData\RenameProjectTestUI.sln");

                app.OpenSolutionExplorer();
                var window = app.SolutionExplorerTreeView;

                // find Program.py, send copy & paste, verify copy of file is there
                var projectNode = window.FindItem("Solution 'RenameProjectTestUI' (1 project)", "HelloWorld");

                // rename once, cancel renaming to existing file....
                AutomationWrapper.Select(projectNode);
                Keyboard.PressAndRelease(Key.F2);
                System.Threading.Thread.Sleep(100);

                Keyboard.Type("HelloWorldExisting");
                System.Threading.Thread.Sleep(100);
                Keyboard.PressAndRelease(Key.Enter);

                IntPtr dialog = app.WaitForDialog();

                VisualStudioApp.CheckMessageBox("HelloWorldExisting.pyproj", "overwrite");

                // rename again, don't cancel...
                AutomationWrapper.Select(projectNode);
                Keyboard.PressAndRelease(Key.F2);
                System.Threading.Thread.Sleep(100);

                Keyboard.Type("HelloWorldExisting");
                System.Threading.Thread.Sleep(100);
                Keyboard.PressAndRelease(Key.Enter);

                dialog = app.WaitForDialog();

                VisualStudioApp.CheckMessageBox(MessageBoxButton.Yes, "HelloWorldExisting.pyproj", "overwrite");

                Assert.IsNotNull(window.WaitForItem("Solution 'RenameProjectTestUI' (1 project)", "HelloWorldExisting"));
            }
        }
Ejemplo n.º 26
0
        public void RemoveItem()
        {
            using (var app = new VisualStudioApp())
            {
                // close any projects before switching source control...
                app.Dte.Solution.Close();

                app.SelectSourceControlProvider("Test Source Provider");
                foreach (var projectType in ProjectTypes)
                {
                    var testDef = SourceControlProject(projectType);

                    using (var solution = testDef.Generate())
                    {
                        TestSccProvider.DocumentEvents.Clear();

                        var project  = app.OpenProject(solution.Filename);
                        var window   = app.OpenSolutionExplorer();
                        var fileName = "Program" + projectType.CodeExtension;
                        var program  = window.WaitForChildOfProject(project, fileName);

                        program.Select();

                        Keyboard.Type(Key.Delete);
                        app.WaitForDialog();
                        VisualStudioApp.CheckMessageBox(MessageBoxButton.Ok, "will be deleted permanently");
                        app.WaitForDialogDismissed();

                        window.WaitForChildOfProjectRemoved(project, fileName);

                        var projectDir = Path.GetDirectoryName(project.FullName);

                        AssertDocumentEvents(projectDir,
                                             OnQueryRemoveFiles(fileName),
                                             OnAfterRemoveFiles(fileName)
                                             );
                    }
                }
            }
        }
Ejemplo n.º 27
0
        public void CutPaste()
        {
            using (var app = new VisualStudioApp()) {
                app.OpenProject(@"TestData\NodejsProjectData\HelloWorld2.sln", expectedProjects: 2);

                app.OpenSolutionExplorer();
                var window = app.SolutionExplorerTreeView;

                var subItem = window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder", "SubItem.js");
                AutomationWrapper.Select(subItem);

                Keyboard.ControlX();

                var projectNode = window.FindItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2");

                AutomationWrapper.Select(projectNode);
                Keyboard.ControlV();

                Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "SubItem.js"));
                Assert.AreEqual(null, window.WaitForItemRemoved("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder", "SubItem.js"));
            }
        }
Ejemplo n.º 28
0
        public void CutPaste()
        {
            using (var app = new VisualStudioApp()) {
                app.OpenProject(@"TestData\NodejsProjectData\HelloWorld2.sln", expectedProjects: 2);
                using (new NodejsOptionHolder(NodejsPackage.Instance.GeneralOptionsPage, "ShowBrowserAndNodeLabels", false)) {
                    var window = app.OpenSolutionExplorer();

                    var subItem = window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder", "SubItem.js");
                    AutomationWrapper.Select(subItem);

                    Keyboard.ControlX();

                    var projectNode = window.FindItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2");

                    AutomationWrapper.Select(projectNode);
                    Keyboard.ControlV();

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "SubItem.js"));
                    Assert.AreEqual(null, window.WaitForItemRemoved("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder", "SubItem.js"));
                }
            }
        }
Ejemplo n.º 29
0
        public void MultiSelectCopyAndPaste()
        {
            using (var app = new PythonVisualStudioApp()) {
                app.OpenProject(@"TestData\DebuggerProject.sln");

                app.OpenSolutionExplorer();
                var window = app.SolutionExplorerTreeView;

                var  files       = new[] { "BreakAllTest.py", "BreakpointTest.py", "BreakpointTest2.py" };
                bool anySelected = false;
                foreach (var f in files)
                {
                    var node = window.FindItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject", f);
                    Assert.IsNotNull(node, f + " not found in DebuggerProject");
                    if (anySelected)
                    {
                        ((SelectionItemPattern)node.GetCurrentPattern(SelectionItemPattern.Pattern)).AddToSelection();
                    }
                    else
                    {
                        node.Select();
                        anySelected = true;
                    }
                }
                Keyboard.ControlC();

                var projectNode = window.FindItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject");

                AutomationWrapper.Select(projectNode);
                Keyboard.ControlV();

                foreach (var f in files.Select(f => f.Remove(f.LastIndexOf('.')) + " - Copy" + f.Substring(f.LastIndexOf('.'))))
                {
                    Assert.IsNotNull(
                        window.WaitForItem("Solution 'DebuggerProject' (1 project)", "DebuggerProject", f),
                        f + " not found after copying");
                }
            }
        }
Ejemplo n.º 30
0
        public void DjangoMultiSelectContextMenu(PythonVisualStudioApp app)
        {
            app.OpenProject(@"TestData\DjangoApplication.sln");

            app.OpenSolutionExplorer();
            var window = app.SolutionExplorerTreeView;

            var manageNode = window.FindItem("Solution 'DjangoApplication' (1 project)", "DjangoApplication", "manage.py");

            Mouse.MoveTo(manageNode.GetClickablePoint());
            Mouse.Click(MouseButton.Left);

            Keyboard.Press(Key.LeftShift);
            Keyboard.PressAndRelease(Key.Down);
            Keyboard.Release(Key.LeftShift);

            Mouse.MoveTo(manageNode.GetClickablePoint());
            Mouse.Click(MouseButton.Right);

            Keyboard.Type("j"); // Exclude from Project
            Assert.IsNull(window.WaitForItemRemoved("Solution 'DjangoApplication' (1 project)", "DjangoApplication", "manage.py"));
        }