Beispiel #1
0
        public void CodedUITestMethod1()
        {
            var mainWindow = GetMainWindow();

            var btn = new WpfButton(mainWindow);

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

            var diagram = new WpfCustom(mainWindow);

            diagram.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "diagram"));
            diagram.Find();
            diagram.WaitForControlReady();

            var element = new WpfCustom(diagram);

            element.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "CustomElement_1"));
            element.Find();
            element.WaitForControlReady();

            var itemsControl = new WpfList(element);

            itemsControl.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "itemsC"));

            //The CodedUI can't find the ItemsControl
            itemsControl.Find();
            itemsControl.WaitForControlReady();
            var items = itemsControl.Items.OfType <WpfListItem>().ToArray();

            string[] s = items.Select(x => x.AutomationId).ToArray();
            s.Should().BeEquivalentTo("ItemA", "ItemB", "ItemC", "ItemD", "ItemE", "ItemF", "ItemG", "ItemH");
        }
        public void CodedUITestMethod1()
        {
            var mainWindow = GetMainWindow();

            var btn = new WpfButton(mainWindow);

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

            var diagram = new WpfCustom(mainWindow);

            diagram.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "diagram"));
            diagram.Find();
            diagram.WaitForControlReady();

            var element = new WpfCustom(diagram);

            element.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "CustomElement_1"));
            element.Find();
            element.WaitForControlReady();

            var itemsControl = new WpfList(element);

            itemsControl.SearchProperties.Add(new PropertyExpression(WpfControl.PropertyNames.AutomationId, "itemsC"));

            //The CodedUI can't find the ItemsControl
            itemsControl.Find();
            itemsControl.WaitForControlReady();
            string[] s = itemsControl.Items.GetValuesOfControls();
        }
Beispiel #3
0
        /// <summary>
        /// RecordedMethod3 - Use 'RecordedMethod3Params' to pass parameters into this method.
        /// </summary>
        public void RecordedMethod3()
        {
            #region Variable Declarations
            WpfEdit uITbxFilterEdit = this.UIMainWindowWindow.UIItemCustom.UITbxFilterEdit;
            WpfList uILstItemsList = this.UIMainWindowWindow.UIItemCustom.UILstItemsList;
            #endregion

            // Type 'infection' in 'tbxFilter' text box
            uITbxFilterEdit.Text = this.RecordedMethod3Params.UITbxFilterEditText;

            // Last action on list item was not recorded because the control does not have any good identification property.

            // Last action on list item was not recorded because the control does not have any good identification property.

            // Last action on list item was not recorded because the control does not have any good identification property.

            // Last action on list item was not recorded because the control does not have any good identification property.

            // Last action on list item was not recorded because the control does not have any good identification property.

            // Last action on list item was not recorded because the control does not have any good identification property.

            // Right-Click 'lstItems' list box
            Mouse.Click(uILstItemsList, MouseButtons.Right, ModifierKeys.None, new Point(234, 169));

            // Right-Click 'lstItems' list box
            Mouse.Click(uILstItemsList, MouseButtons.Right, ModifierKeys.None, new Point(235, 169));
        }
Beispiel #4
0
        /// <summary>
        ///     Tells if a List is empty or not.
        /// </summary>
        public static bool IsEmpty(this WpfList list)
        {
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }

            return(list.Items.Count == 0);
        }
        /// <summary>
        /// AssertList_True - Use 'AssertList_TrueExpectedValues' to pass parameters into this method.
        /// </summary>
        public void AssertList_True()
        {
            #region Variable Declarations
            WpfList uILbxAgentsList = this.UILagerkingWindow.UILbxAgentsList;
            #endregion

            // Verify that the 'SelectedItemsAsString' property of 'lbxAgents' list box contains 'lagerking.Product'
            StringAssert.Contains(uILbxAgentsList.SelectedItemsAsString, this.AssertList_TrueExpectedValues.UILbxAgentsListSelectedItemsAsString);
        }
Beispiel #6
0
        /// <summary>
        /// AssertMethod1 - Use 'AssertMethod1ExpectedValues' to pass parameters into this method.
        /// </summary>
        public void AssertMethod1()
        {
            #region Variable Declarations
            WpfList uILstItemsList = this.UIMainWindowWindow.UIItemCustom.UILstItemsList;
            #endregion

            // Verify that the 'SelectedItemsAsString' property of 'lstItems' list box equals 'Place of acquisition'
            Assert.AreEqual(this.AssertMethod1ExpectedValues.UILstItemsListSelectedItemsAsString, uILstItemsList.SelectedItemsAsString);
        }
        private UITestControlCollection GetAllGameListItems()
        {
            var gamesList = new WpfList(App);

            gamesList.SearchProperties.Add(WpfList.PropertyNames.AutomationId, "GamesListBox");

            var ctl = new WpfListItem(gamesList);

            return(ctl.FindMatchingControls());
        }
        private WpfListItem FindGameListItem(string gameDescription)
        {
            var gamesList = new WpfList(App);

            gamesList.SearchProperties.Add(WpfList.PropertyNames.AutomationId, "GamesListBox");

            var ctl = new WpfListItem(gamesList);

            ctl.SearchProperties.Add(WpfListItem.PropertyNames.Name, gameDescription, PropertyExpressionOperator.Contains);
            return(ctl);
        }
Beispiel #9
0
        public static List <string> GetListOfItems(WpfList control)
        {
            UITestControlCollection items =
                control.GetProperty("Items") as
                UITestControlCollection;

            List <string> values = new List <string>();

            foreach (WinListItem item in items)
            {
                values.Add(item.DisplayText);
            }

            return(values);
        }
Beispiel #10
0
        public static void SelectAnotherValue(WpfList control)
        {
            var currentValue = UIMapListBoxUtility.GetSelectedValue(control);

            var allValues = UIMapListBoxUtility.GetListOfItems(control);

            string newValue = null;

            foreach (string item in allValues)
            {
                if (item != currentValue)
                {
                    newValue = item;
                }
            }

            control.SelectedItemsAsString = newValue;
        }
Beispiel #11
0
        /// <summary>
        /// RecordedMethod2 - Use 'RecordedMethod2Params' to pass parameters into this method.
        /// </summary>
        public void RecordedMethod2()
        {
            #region Variable Declarations
            WpfList   uINamesList            = this.UIExpenseItWindow.UINamesList;
            WpfButton uIViewButton           = this.UIExpenseItWindow.UIViewButton;
            WpfCell   uIDocumentprintingCell = this.UIExpenseItWindow.UIExpensereportTable.UIDataGridRowRow.UIDocumentprintingCell;
            WpfEdit   uIItemEdit             = this.UIExpenseItWindow.UIExpensereportTable.UIDataGridRowRow.UIDocumentprintingCell.UIItemEdit;
            #endregion

            // Launch 'C:\workspace\WalkthroughFirstWPFApp\csharp\bin\Debug\netcoreapp3.1\ExpenseIt9.exe'
            ApplicationUnderTest uIExpenseItWindow = ApplicationUnderTest.Launch(this.RecordedMethod2Params.UIExpenseItWindowExePath, this.RecordedMethod2Params.UIExpenseItWindowAlternateExePath);

            // Select 'Lisa' in 'Names' list box
            uINamesList.SelectedItemsAsString = this.RecordedMethod2Params.UINamesListSelectedItemsAsString;

            // Click 'View' button
            Mouse.Click(uIViewButton, new Point(54, 18));

            // Type 'printing' in 'Document printing' cell
            uIDocumentprintingCell.Value = this.RecordedMethod2Params.UIDocumentprintingCellValue;

            // Type '{Back}{Enter}' in text box
            Keyboard.SendKeys(uIItemEdit, this.RecordedMethod2Params.UIItemEditSendKeys, ModifierKeys.None);
        }
Beispiel #12
0
        /// <summary>
        /// RecordedMethod1 - Use 'RecordedMethod1Params' to pass parameters into this method.
        /// </summary>
        public void RecordedMethod1()
        {
            #region Variable Declarations
            WinListItem uIExpenseIt9exeShortcuListItem = this.UIProgramManagerWindow.UIDesktopList.UIExpenseIt9exeShortcuListItem;
            WpfText     uIMikeText         = this.UIExpenseItWindow.UINamesList.UIMikeListItem.UISystemXmlXmlAttributText.UIMikeText;
            WpfButton   uIViewButton       = this.UIExpenseItWindow.UIViewButton;
            WpfCell     uIItem50Cell       = this.UIExpenseItWindow.UIExpensereportTable.UIDataGridRowRow.UIItem50Cell;
            WpfCell     uIItem50Cell1      = this.UIExpenseItWindow.UIExpensereportTable.UIDataGridRowRow1.UIItem50Cell;
            WpfWindow   uIExpenseItWindow1 = this.UIExpenseItWindow;
            WpfEdit     uIItemEdit         = this.UIExpenseItWindow.UIExpensereportTable.UIDataGridRowRow1.UIItem50Cell.UIItemEdit;
            WpfButton   uIBackButton       = this.UIExpenseItWindow.UIBackButton;
            WpfText     uIJohnText         = this.UIExpenseItWindow.UINamesList1.UIJohnListItem.UISystemXmlXmlAttributText.UIJohnText;
            WpfList     uINamesList1       = this.UIExpenseItWindow.UINamesList1;
            WpfButton   uIForwardButton    = this.UIExpenseItWindow.UIForwardButton;
            WpfList     uINamesList2       = this.UIExpenseItWindow.UINamesList2;
            WpfButton   uIViewButton1      = this.UIExpenseItWindow.UIViewButton1;
            WpfText     uIItem50Text       = this.UIExpenseItWindow.UIExpensereportTable1.UIDataGridRowRow.UIItem50Cell.UIItem50Text;
            #endregion

            // Click 'ExpenseIt9.exe - Shortcut' list item
            Mouse.Click(uIExpenseIt9exeShortcuListItem, new Point(28, 30));

            // Launch 'C:\workspace\WalkthroughFirstWPFApp\csharp\bin\Debug\netcoreapp3.1\ExpenseIt9.exe'
            ApplicationUnderTest uIExpenseItWindow = ApplicationUnderTest.Launch(this.RecordedMethod1Params.UIExpenseItWindowExePath, this.RecordedMethod1Params.UIExpenseItWindowAlternateExePath);

            // Click 'Mike' label
            Mouse.Click(uIMikeText, new Point(21, 8));

            // Click 'View' button
            Mouse.Click(uIViewButton, new Point(60, 12));

            // Type '589' in '50' cell
            uIItem50Cell.Value = this.RecordedMethod1Params.UIItem50CellValue;

            // Type '111' in '50' cell
            uIItem50Cell1.Value = this.RecordedMethod1Params.UIItem50CellValue1;

            // Click 'ExpenseIt' window
            Mouse.Click(uIExpenseItWindow1, new Point(396, 260));

            // Type '{Enter}' in text box
            Keyboard.SendKeys(uIItemEdit, this.RecordedMethod1Params.UIItemEditSendKeys, ModifierKeys.None);

            // Click 'Back' button
            Mouse.Click(uIBackButton, new Point(11, 14));

            // Click 'John' label
            Mouse.Click(uIJohnText, new Point(15, 9));

            // Select 'Lisa' in 'Names' list box
            uINamesList1.SelectedItemsAsString = this.RecordedMethod1Params.UINamesList1SelectedItemsAsString;

            // Click 'Forward' button
            Mouse.Click(uIForwardButton, new Point(9, 10));

            // Click 'Back' button
            Mouse.Click(uIBackButton, new Point(11, 16));

            // Select 'Mike' in 'Names' list box
            uINamesList2.SelectedItemsAsString = this.RecordedMethod1Params.UINamesList2SelectedItemsAsString;

            // Click 'Forward' button
            Mouse.Click(uIForwardButton, new Point(15, 11));

            // Click 'Back' button
            Mouse.Click(uIBackButton, new Point(9, 18));

            // Click 'View' button
            Mouse.Click(uIViewButton1, new Point(37, 7));

            // Click '50' label
            Mouse.Click(uIItem50Text, new Point(14, 8));

            // Click 'Back' button
            Mouse.Click(uIBackButton, new Point(15, 11));

            // Click 'Forward' button
            Mouse.Click(uIForwardButton, new Point(7, 12));

            // Click 'Back' button
            Mouse.Click(uIBackButton, new Point(10, 12));
        }
        private UITestControlCollection GetAllGameListItems()
        {
            var gamesList = new WpfList(App);
            gamesList.SearchProperties.Add(WpfList.PropertyNames.AutomationId, "GamesListBox");

            var ctl = new WpfListItem(gamesList);
            return ctl.FindMatchingControls();
        }
        private WpfListItem FindGameListItem(string gameDescription)
        {
            var gamesList = new WpfList(App);
            gamesList.SearchProperties.Add(WpfList.PropertyNames.AutomationId, "GamesListBox");

            var ctl = new WpfListItem(gamesList);
            ctl.SearchProperties.Add(WpfListItem.PropertyNames.Name, gameDescription, PropertyExpressionOperator.Contains);
            return ctl;
        }
Beispiel #15
0
 public static string GetSelectedValue(WpfList control)
 {
     return(control.SelectedItemsAsString);
 }