Ejemplo n.º 1
0
        public void AutomateVS()
        {
            //ApplicationUnderTest app = ApplicationUnderTest.Launch(@"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe");
            WinWindow mainwindow = new WinWindow();

            mainwindow.SearchProperties.Add(WinWindow.PropertyNames.Name, "Start Page - Microsoft Visual Studio");
            WinMenuBar mainmenubar = new WinMenuBar(mainwindow);

            //mainmenubar.SearchProperties.Add(WinMenuBar.PropertyNames.Name, "MenuBar");
            //WinMenuItem filemenuitem = new WinMenuItem(mainmenubar);
            //filemenuitem.SearchProperties.Add(WinMenuItem.PropertyNames.Name, "File");
            //Mouse.Click(filemenuitem);
            //Thread.Sleep(1000);

            //WpfMenuItem newMenuItem = new WpfMenuItem(filemenuitem);
            //newMenuItem.SearchProperties.Add(WpfMenuItem.PropertyNames.Name, "New");
            //newMenuItem.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);
            ////Mouse.Hover(newMenuItem);

            //WpfMenuItem newProject = new WpfMenuItem(newMenuItem);
            //newProject.SearchProperties.Add(WpfMenuItem.PropertyNames.Name, "Project...");
            //newProject.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);
            //Mouse.Click(newProject);

            //WpfWindow newprojectwindow = new WpfWindow(mainwindow);
            //newprojectwindow.SearchProperties.Add(WinWindow.PropertyNames.Name, "New Project");
            //newprojectwindow.DrawHighlight();
            //WpfControl installedDatagrid = new WpfControl(newprojectwindow);

            //installedDatagrid.SearchProperties[WpfControl.PropertyNames.ControlType] = "DataItem";
            //installedDatagrid.SearchProperties[WpfControl.PropertyNames.AutomationId] = "Installed";
            //WpfExpander expand = new WpfExpander(installedDatagrid);
            //WpfTree installedTreeView = new WpfTree(expand);
            //installedTreeView.SearchProperties.Add(WpfTree.PropertyNames.AutomationId, "Installed");

            ////installedTreeView.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);
            //installedTreeView.DrawHighlight();
            //WpfTreeItem tempTreeItem = new WpfTreeItem(installedTreeView);
            //tempTreeItem.SearchProperties.Add(WpfTreeItem.PropertyNames.AutomationId, "Templates");
            ////tempTreeItem.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);
            //tempTreeItem.DrawHighlight();

            //WpfTreeItem visualCtreeItem = new WpfTreeItem(tempTreeItem);
            //visualCtreeItem.SearchProperties.Add(WpfTreeItem.PropertyNames.AutomationId, "Visual C#");
            ////visualCtreeItem.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);
            //visualCtreeItem.DrawHighlight();
            //expand.Expanded = true;
            //WpfTreeItem testTreeItem = new WpfTreeItem(visualCtreeItem);

            //testTreeItem.SearchProperties.Add(WpfTreeItem.PropertyNames.AutomationId, "Test");
            ////testTreeItem.SearchConfigurations.Add(SearchConfiguration.ExpandWhileSearching);
            //testTreeItem.DrawHighlight();

            //Mouse.Click(testTreeItem);

            //WpfButton okbutton = new WpfButton(newprojectwindow);
            //okbutton.SearchProperties.Add(WpfButton.PropertyNames.Name, "OK");
            //Mouse.Click(okbutton);

            WpfWindow MainWindow1 = new WpfWindow();

            MainWindow1.SearchProperties.Add(WinWindow.PropertyNames.Name, "CodedUITestProject6 - Microsoft Visual Studio");

            MainWindow1.DrawHighlight();


            WinWindow Generatetest = new WinWindow();

            Generatetest.SearchProperties.Add(WinWindow.PropertyNames.Name, "Generate Code for Coded UI Test");
            // Generatetest.SearchProperties.Add(WinWindow.PropertyNames.ClassName, "Generate Code for Coded UI Test");
            //"WindowsForms10.Window", PropertyExpressionOperator.Contains


            // WpfButton OkButton = new WpfButton(Generatetest);
            // OkButton.SearchProperties.Add(WpfButton.PropertyNames.AutomationId, "CancelButton");


            //// this.UIMap.RecordedMethod2();
            // Mouse.Click(OkButton);


            WpfButton TestExplorerTab = new WpfButton(MainWindow1);

            //  TestExplorerTab.SearchProperties.Add(WpfButton.PropertyNames.AutomationId, "Text");
            TestExplorerTab.SearchProperties.Add(WpfButton.PropertyNames.Name, "Test Explorer");
            // TestExplorerTab.DrawHighlight();
            // Mouse.Click(TestExplorerTab);

            WpfPane TextExplorerpane = new WpfPane(MainWindow1);

            TextExplorerpane.SearchProperties.Add(WpfControl.PropertyNames.AutomationId, "PART_HwndHost");
            //TextExplorerpane.SearchProperties[WpfControl.PropertyNames.ClassName] = "Uia.SearchControl";
            // TextExplorerpane.SearchProperties.Add(WpfControl.PropertyNames.Name, "Test Explorer");
            //var controls=TextExplorerpane.FindMatchingControls();

            //TextExplorerpane.DrawHighlight();
            WpfCustom customsearch = new WpfCustom(TextExplorerpane);

            customsearch.SearchProperties.Add(WpfCustom.PropertyNames.AutomationId, "SearchControl");

            WpfText TestExplorerSearchText = new WpfText(customsearch);
            //TestExplorerSearchText.SearchProperties.Add(WpfText.PropertyNames.AutomationId, "PART_SearchBox");
            var controls = TestExplorerSearchText.FindMatchingControls();

            TestExplorerSearchText.DrawHighlight();
            Mouse.Click(TestExplorerSearchText);
        }
 public NewProjectWindow(UITestControl parent)
 {
     newprojectwindow = new WpfWindow(parent);
     newprojectwindow.SearchProperties.Add(WpfWindow.PropertyNames.Name, "New Project");
     newprojectwindow.DrawHighlight();
 }