示例#1
0
        public void MyTestInitialize()
        {
            App = ApplicationUnderTest.Launch(@"D:\Projects\Sample\Project_Telerik\Project_Telerik\bin\Debug\Project_Telerik.exe");
            var window = new WpfWindow();

            window.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.Name, "Telerik UI for WPF Trial"));
            window.Find();
            window.SetFocus();
            Keyboard.SendKeys(window, "{F4}", ModifierKeys.Alt);
        }
        private Point StartRecordingButtonPoint()
        {
            // Get the Studio
            WpfWindow theStudio = new WpfWindow();

            theStudio.SearchProperties.Add(new PropertyExpression(WpfWindow.PropertyNames.ClassName, "HwndWrapper", PropertyExpressionOperator.Contains));
            theStudio.SearchProperties.Add(new PropertyExpression(WpfWindow.PropertyNames.Name, "Warewolf", PropertyExpressionOperator.Contains));

            theStudio.Find();

            return(new Point(theStudio.BoundingRectangle.Right - 50, theStudio.Top + 35));
        }
    public static WpfWindow GetWindow(this WpfWindow parent, string windowTitle)
    {
        var modalWindow = new WpfWindow
        {
            SearchProperties =
            {
                { UITestControl.PropertyNames.Name, windowTitle }
            }
        };

        modalWindow.Find();
        return(modalWindow);
    }
        private Point StartRecordingButtonPoint()
        {
            // Get the Studio
            WpfWindow theStudio = new WpfWindow();

            theStudio.SearchProperties.Add(new PropertyExpression(WpfWindow.PropertyNames.ClassName, "HwndWrapper", PropertyExpressionOperator.Contains));
            theStudio.SearchProperties.Add(new PropertyExpression(WpfWindow.PropertyNames.Name, "Warewolf", PropertyExpressionOperator.Contains));

            theStudio.Find();

            return new Point(theStudio.BoundingRectangle.Right - 50, theStudio.Top + 35);

        }
示例#5
0
        public static WpfWindow GetWindow(this WpfWindow parent, string windowTitle, bool exactMatch = false)
        {
            PropertyExpressionOperator expressionOperator = exactMatch
                                                                ? PropertyExpressionOperator.EqualTo
                                                                : PropertyExpressionOperator.Contains;
            var modalWindow = new WpfWindow
            {
                SearchProperties =
                {
                    { UITestControl.PropertyNames.Name, windowTitle, expressionOperator }
                }
            };

            modalWindow.Find();
            return(modalWindow);
        }
        public static WpfWindow GetWindow(this WpfWindow parent, string windowTitle, bool exactMatch = false)
        {
            PropertyExpressionOperator expressionOperator = exactMatch
                                                                ? PropertyExpressionOperator.EqualTo
                                                                : PropertyExpressionOperator.Contains;
            var modalWindow = new WpfWindow
                {
                    SearchProperties =
                        {
                            {UITestControl.PropertyNames.Name, windowTitle, expressionOperator}
                        }
                };

            modalWindow.Find();
            return modalWindow;
        }
示例#7
0
        public void CodedUITestMethod1()
        {
            System.Threading.Thread.Sleep(1000);
            var mainWindow = new WpfWindow();

            mainWindow.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "Main_Window"));
            mainWindow.Find();
            var btn = new WpfButton();

            btn.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "btn_AddShape"));
            btn.Find();
            btn.WaitForControlReady();
            btn.GetClickablePoint();

            Mouse.Click(mainWindow, new Point(btn.Top + 20, btn.Left + 20));
            //Mouse.Click(new Point(btn.BoundingRectangle.X + btn.BoundingRectangle.Width / 2, btn.BoundingRectangle.Y + btn.BoundingRectangle.Height / 2));
            //Mouse.Click(new Point(btn.GetClickablePoint().X, btn.GetClickablePoint().Y));
            var diagram = new WpfWindow();

            diagram.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "diagram"));
            diagram.Find();
            diagram.WaitForControlReady();
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
        }
        // Intellisense Box
        public UITestControl GetIntellisenseItem(int id)
        {
            // Get the Studio
            WpfWindow theStudio = new WpfWindow();
            theStudio.SearchProperties[UITestControl.PropertyNames.Name] = TestBase.GetStudioWindowName();
            theStudio.SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.ClassName, "HwndWrapper", PropertyExpressionOperator.Contains));
            theStudio.WindowTitles.Add(TestBase.GetStudioWindowName());
            theStudio.Find();

            UITestControl itelliList = new UITestControl(theStudio);
            itelliList.SearchProperties[WpfControl.PropertyNames.AutomationId] = "PART_ItemList";
            itelliList.Find();

            var itelliListItem = itelliList.GetChildren()[id];
            return itelliListItem;
            //PART_ItemList
        }