Ejemplo n.º 1
0
        public void SaveAs()
        {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\NodejsProjectData\SaveAsUI.sln");

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

                // open and edit the file
                var folderNode = solutionTree.WaitForItem("Solution 'SaveAsUI' (1 project)", "HelloWorld", "server.js");
                folderNode.SetFocus();
                Keyboard.PressAndRelease(Key.Enter);

                var item   = project.ProjectItems.Item("server.js");
                var window = item.Open();
                window.Activate();

                var selection = ((TextSelection)window.Selection);
                selection.SelectAll();
                selection.Delete();

                // save under a new file name
                var    saveDialog = app.SaveAs();
                string oldName    = saveDialog.FileName;
                saveDialog.FileName = "Program2.js";
                saveDialog.Save();

                Assert.AreNotEqual(null, solutionTree.WaitForItem("Solution 'SaveAsUI' (1 project)", "HelloWorld", "Program2.js"));
            }
        }
Ejemplo n.º 2
0
 public void Save() {
     WaitForInputIdle();
     // The Save button on this dialog is broken and so UIA cannot invoke
     // it (though somehow Inspect is able to...). We use the keyboard
     // instead.
     WaitForClosed(DefaultTimeout, () => Keyboard.PressAndRelease(Key.S, Key.LeftAlt));
 }
Ejemplo n.º 3
0
        public void AddNewFolderNested()
        {
            using (var app = new PythonVisualStudioApp()) {
                var project = app.OpenProject(@"TestData\HelloWorld.sln");

                app.OpenSolutionExplorer().SelectProject(project);

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

                var folderNode = app.OpenSolutionExplorer().WaitForChildOfProject(project, "FolderX");
                folderNode.Select();

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

                var innerFolderNode = app.OpenSolutionExplorer().WaitForChildOfProject(project, "FolderX", "FolderY");
                innerFolderNode.Select();

                var newItem = project.ProjectItems.Item("FolderX").ProjectItems.Item("FolderY").ProjectItems.AddFromFile(
                    TestData.GetPath(@"TestData\DebuggerProject\BreakpointTest.py")
                    );

                app.OpenSolutionExplorer().WaitForChildOfProject(project, "FolderX", "FolderY", "BreakpointTest.py");
            }
        }
Ejemplo n.º 4
0
        public void MultiSelectCopyAndPaste()
        {
            using (var app = new VisualStudioApp()) {
                app.OpenProject(@"TestData\NodejsProjectData\MultiSelectCopyAndPaste.sln");

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

                var folderNode = window.WaitForItem("Solution 'MultiSelectCopyAndPaste' (1 project)", "MultiSelectCopyAndPaste", "server.js");
                Mouse.MoveTo(folderNode.GetClickablePoint());
                Mouse.Click();

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

                var projectNode = window.WaitForItem("Solution 'MultiSelectCopyAndPaste' (1 project)", "MultiSelectCopyAndPaste");

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

                Assert.AreNotEqual(null, window.WaitForItem("Solution 'MultiSelectCopyAndPaste' (1 project)", "MultiSelectCopyAndPaste", "server - Copy.js"));
                Assert.AreNotEqual(null, window.WaitForItem("Solution 'MultiSelectCopyAndPaste' (1 project)", "MultiSelectCopyAndPaste", "server2 - Copy.js"));
                Assert.AreNotEqual(null, window.WaitForItem("Solution 'MultiSelectCopyAndPaste' (1 project)", "MultiSelectCopyAndPaste", "server3 - Copy.js"));
            }
        }
Ejemplo n.º 5
0
        public void AddNewFolderLongPathBoundary()
        {
            using (var app = new VisualStudioApp()) {
                var project = OpenLongFileNameProject(app, 24);

                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.Type("01234567891");
                Keyboard.PressAndRelease(Key.Enter);

                Assert.AreNotEqual(null, window.WaitForItem("Solution 'LongFileNames' (1 project)", "LFN", "01234567891"));

                var projectLoc  = Path.GetDirectoryName(project.FullName);
                var checkedPath = Path.Combine(projectLoc, "LongFileNames", "01234567891");

                Assert.IsTrue(Directory.Exists(checkedPath), checkedPath + " does not exist");
            }
        }
Ejemplo n.º 6
0
        public void AddNewFolder()
        {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\NodejsProjectData\HelloWorld.sln");

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

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

                var startingDirs = new HashSet <string>(Directory.GetDirectories(@"TestData\NodejsProjectData\HelloWorld"), StringComparer.OrdinalIgnoreCase);
                Keyboard.PressAndRelease(Key.F10, Key.LeftCtrl, Key.LeftShift);
                Keyboard.PressAndRelease(Key.D);
                Keyboard.PressAndRelease(Key.Right);
                Keyboard.PressAndRelease(Key.D);
                Keyboard.Type("MyNewFolder");
                var curDirs = new HashSet <string>(Directory.GetDirectories(@"TestData\NodejsProjectData\HelloWorld"), StringComparer.OrdinalIgnoreCase);
                Assert.IsTrue(curDirs.IsSubsetOf(startingDirs) && startingDirs.IsSubsetOf(curDirs), "new directory created" + String.Join(", ", curDirs) + " vs. " + String.Join(", ", startingDirs));

                Keyboard.PressAndRelease(Key.Enter);

                Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "MyNewFolder"));

                Assert.IsTrue(Directory.Exists(@"TestData\NodejsProjectData\HelloWorld\MyNewFolder"));
            }
        }
Ejemplo n.º 7
0
        public void Close()
        {
#if DEV12_OR_LATER
            GetSearchBox().SetFocus();
            Keyboard.PressAndRelease(System.Windows.Input.Key.Escape);
#else
            ClickButtonByAutomationId("cancelButton");
#endif
        }
Ejemplo n.º 8
0
        public void AddNewFolder(PythonVisualStudioApp app)
        {
            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.º 9
0
        public void RequireKeyboardCompletionBraceCompletionOn()
        {
            using (new OptionHolder("TextEditor", "Node.js", "BraceCompletion", true)) {
                using (var solution = BasicProject.Generate().ToVs()) {
                    var server = solution.OpenItem("Require", "server.js");
                    Keyboard.Type("require(ad");
                    WaitForCompletionSessionAndCommit(server);

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

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

                    Keyboard.Backspace(20);

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

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

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

                    Keyboard.Backspace(20);

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

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

                    Keyboard.Type("\")");
                    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.º 10
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"));
                }
            }
        }
Ejemplo n.º 11
0
        public void Close()
        {
#if DEV12_OR_LATER
            try {
                GetSearchBox().SetFocus();
            } catch (InvalidOperationException ex) {
                Trace.TraceError("Failed to set focus on search box");
                Trace.TraceError(ex.ToString());
            }
            Keyboard.PressAndRelease(System.Windows.Input.Key.Escape);
#else
            ClickButtonByAutomationId("cancelButton");
#endif
        }
Ejemplo n.º 12
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.º 13
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.º 14
0
        /// <summary>
        /// Types the specified text.
        /// </summary>
        /// <param name="text">The text to type.</param>
        public static void Type(string text)
        {
            foreach (char c in text)
            {
                // We get the vKey value for the character via a Win32 API. We then use bit masks to pull the
                // upper and lower bytes to get the shift state and key information. We then use WPF KeyInterop
                // to go from the vKey key info into a System.Windows.Input.Key data structure. This work is
                // necessary because Key doesn't distinguish between upper and lower case, so we have to wrap
                // the key type inside a shift press/release if necessary.
                switch (c)
                {
                case '←': Type(Key.Left); break;

                case '→': Type(Key.Right); break;

                case '↑': Type(Key.Up); break;

                case '↓': Type(Key.Down); break;

                case '\r': Type(Key.Enter); break;

                case CtrlSpace:
                    Keyboard.PressAndRelease(Key.Space, Key.LeftCtrl);
                    break;

                case OneSecondDelay:
                    System.Threading.Thread.Sleep(1000);
                    break;

                default:
                    int  vKeyValue    = NativeMethods.VkKeyScan(c);
                    bool keyIsShifted = (vKeyValue & NativeMethods.VKeyShiftMask) == NativeMethods.VKeyShiftMask;
                    Key  key          = KeyInterop.KeyFromVirtualKey(vKeyValue & NativeMethods.VKeyCharMask);

                    if (keyIsShifted)
                    {
                        Type(key, new Key[] { Key.LeftShift });
                    }
                    else
                    {
                        Type(key);
                    }
                    break;
                }
            }
            System.Threading.Thread.Sleep(250);
        }
Ejemplo n.º 15
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.º 16
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.º 17
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.º 18
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.º 19
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"));
        }
Ejemplo n.º 20
0
        public void AddNewFolderLongPathTooLong()
        {
            using (var app = new VisualStudioApp()) {
                var project = OpenLongFileNameProject(app, 24);

                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 '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.Type("012345678912");
                    Keyboard.PressAndRelease(Key.Enter);

                    VisualStudioApp.CheckMessageBox("The filename or extension is too long.");
                }
            }
        }
Ejemplo n.º 21
0
 public void PressAndRelease(Key key, params Key[] modifier)
 {
     Keyboard.PressAndRelease(key, modifier);
 }
Ejemplo n.º 22
0
 public void Add()
 {
     WaitForClosed(DefaultTimeout, () => Keyboard.PressAndRelease(Key.A, Key.LeftAlt));
 }
Ejemplo n.º 23
0
        public void RenameItemsTest()
        {
            using (var app = new VisualStudioApp())
            {
                var project = app.OpenProject(@"TestData\NodejsProjectData\RenameItemsTestUI.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 'RenameItemsTestUI' (1 project)", "HelloWorld", "server.js");

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

                    Keyboard.Type("NewName.txt");
                    Keyboard.Type(Key.Delete);  // delete extension left at end
                    Keyboard.Type(Key.Delete);
                    Keyboard.Type(Key.Delete);
                    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...
                    AutomationWrapper.Select(projectNode);
                    Keyboard.PressAndRelease(Key.F2);
                    System.Threading.Thread.Sleep(100);

                    Keyboard.Type("NewName.txt");
                    Keyboard.Type(Key.Delete);  // delete extension left at end
                    Keyboard.Type(Key.Delete);
                    Keyboard.Type(Key.Delete);
                    System.Threading.Thread.Sleep(100);
                    Keyboard.PressAndRelease(Key.Enter);

                    dialog = app.WaitForDialog();

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

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'RenameItemsTestUI' (1 project)", "HelloWorld", "NewName.txt"));

                    var subJs = window.WaitForItem("Solution 'RenameItemsTestUI' (1 project)", "HelloWorld", "Sub1", "Sub2", "Foo.js");
                    Assert.IsNotNull(subJs);

                    var sub1 = window.FindItem("Solution 'RenameItemsTestUI' (1 project)", "HelloWorld", "Sub1");
                    AutomationWrapper.Select(sub1);
                    Keyboard.PressAndRelease(Key.F2);
                    System.Threading.Thread.Sleep(100);

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

                    for (int i = 0; i < 20; i++)
                    {
                        try
                        {
                            if (project.GetIsFolderExpanded("FolderName"))
                            {
                                break;
                            }
                        }
                        catch (ArgumentException)
                        {
                        }
                        System.Threading.Thread.Sleep(100);
                    }

                    Assert.IsTrue(project.GetIsFolderExpanded("FolderName"));
                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'RenameItemsTestUI' (1 project)", "HelloWorld", "FolderName", "Sub2", "Foo.js"));
                }
            }
        }