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

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

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

                AutomationWrapper.Select(programPy);

                Keyboard.ControlC();
                Keyboard.ControlV();

                Assert.IsNotNull(window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "Program - Copy.py"));

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

                Assert.IsNotNull(window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "Program - Copy (2).py"));
            }
        }
Esempio n. 2
0
        public void CopyFolderInToSelf()
        {
            using (var app = new PythonVisualStudioApp()) {
                app.OpenProject(@"TestData\HelloWorld2.sln", expectedProjects: 2);

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

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

                try {
                    // Remove the destination folder in case a previous test has
                    // created it.
                    Directory.Delete(TestData.GetPath(@"TestData\HelloWorld2\TestFolder - Copy"), true);
                } catch {
                }

                var subItem = window.FindItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder", "SubItem.py");
                AutomationWrapper.Select(subItem);
                Keyboard.ControlV();

                var item = window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder - Copy", "SubItem.py");
                if (item == null)
                {
                    AutomationWrapper.DumpElement(window.Element);
                    Assert.Fail("Did not find TestFolder - Copy");
                }
            }
        }
Esempio n. 3
0
        public void MoveStartupFile()
        {
            using (var app = new VisualStudioApp())
            {
                var project = app.OpenProject(@"TestData\NodejsProjectData\MoveStartupFile.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 server = window.WaitForItem("Solution 'MoveStartupFile' (1 project)", "HelloWorld", "server.js");
                    var folder = window.WaitForItem("Solution 'MoveStartupFile' (1 project)", "HelloWorld", "TestDir");

                    AutomationWrapper.Select(server);
                    Keyboard.ControlX();

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

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'MoveStartupFile' (1 project)", "HelloWorld", "TestDir", "server.js"));

                    Assert.IsTrue(((string)project.Properties.Item("StartupFile").Value).EndsWith("TestDir\\server.js"));
                }
            }
        }
Esempio n. 4
0
        public void CrossProjectCutPaste()
        {
            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 folderNode = window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder2");
                    AutomationWrapper.Select(folderNode);

                    Keyboard.ControlX();

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

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

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld2' (2 projects)", "HelloWorld", "TestFolder2"));
                    Assert.AreEqual(null, window.WaitForItemRemoved("Solution 'HelloWorld2' (2 projects)", "HelloWorld2", "TestFolder2"));
                }
            }
        }
Esempio n. 5
0
        public void MultiSelectCopyAndPaste()
        {
            using (var app = new VisualStudioApp())
            {
                app.OpenProject(@"TestData\NodejsProjectData\MultiSelectCopyAndPaste.sln");

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

                    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"));
                }
            }
        }
Esempio n. 6
0
        public void CopyPasteFile()
        {
            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 programPy = window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "server.js");

                    AutomationWrapper.Select(programPy);

                    Keyboard.ControlC();
                    Keyboard.ControlV();

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "server - Copy.js"));

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

                    Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "server - Copy (2).js"));
                }
            }
        }
Esempio n. 7
0
        public void CopyPasteFile()
        {
            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 programPy = window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "server.js");

                AutomationWrapper.Select(programPy);

                Keyboard.ControlC();
                Keyboard.ControlV();

                Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "server - Copy.js"));

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

                Assert.AreNotEqual(null, window.WaitForItem("Solution 'HelloWorld' (1 project)", "HelloWorld", "server - Copy (2).js"));
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Moves one or more items in solution explorer using the keyboard to cut and paste.
        /// </summary>
        /// <param name="destination"></param>
        /// <param name="source"></param>
        private static void MoveByKeyboard(AutomationElement destination, params AutomationElement[] source)
        {
            AutomationWrapper.Select(source.First());
            for (int i = 1; i < source.Length; i++)
            {
                AutomationWrapper.AddToSelection(source[i]);
            }

            Keyboard.ControlX();

            AutomationWrapper.Select(destination);
            Keyboard.ControlV();
        }
Esempio n. 9
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"));
                }
            }
        }
Esempio n. 10
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"));
            }
        }
Esempio n. 11
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"));
            }
        }
Esempio n. 12
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");
                }
            }
        }
Esempio n. 13
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"));
            }
        }
Esempio n. 14
0
 public void ControlV()
 {
     Keyboard.ControlV();
 }