예제 #1
0
        /// <summary>
        /// 尋找DataGridView 裡的NumericUpDown Cell控制項
        /// </summary>
        /// <param name="dataGridViewName">DatGridView的AccessibleName</param>
        /// <param name="rowIndex">Row的Index,從0開始</param>
        /// <param name="columnIndex">Column的Index,從0開始</param>
        /// <param name="direct">欲按的NumericUpDown的增加或減少鍵(增加=NumericDirect.UP,減少=NumericDirect.DOWN)(</param>
        public static void ClickNumericUpDownButtonInDataGridView(string dataGridViewName, int rowIndex, int columnIndex, NumericDirect direct, int times)
        {
            const int HALF_BUTTON_WIDTH           = 8;
            const int SPINBUTTON_HEIGHT_FINE_TUNE = 3;

            WinTable  table             = Robot.FindWinControl(typeof(WinTable), dataGridViewName, _root) as WinTable;
            WinRow    row               = table.Rows[rowIndex] as WinRow;
            WinCell   cell              = row.Cells[columnIndex] as WinCell;
            Rectangle boundingRectangle = cell.BoundingRectangle;
            int       halfHeightOfCell  = cell.BoundingRectangle.Height / 2;
            int       upperPartYOffset  = halfHeightOfCell - SPINBUTTON_HEIGHT_FINE_TUNE;
            int       lowerPartYOffset  = halfHeightOfCell + SPINBUTTON_HEIGHT_FINE_TUNE;

            switch (direct)
            {
            case NumericDirect.UP:
                Mouse.Click(new Point(boundingRectangle.X + boundingRectangle.Width - HALF_BUTTON_WIDTH, boundingRectangle.Y + upperPartYOffset));
                break;

            case NumericDirect.DOWN:
                Mouse.Click(new Point(boundingRectangle.X + boundingRectangle.Width - HALF_BUTTON_WIDTH, boundingRectangle.Y + lowerPartYOffset));
                break;
            }

            for (int i = 0; i < times + 1; i++)
            {
                Mouse.Click();
            }
            Keyboard.SendKeys("{Enter}");
        }
예제 #2
0
        /// <summary>
        /// Always filter by first column first, it will refresh grid
        /// </summary>
        public static void FilterGrid(int columnNumber, string filterValue)
        {
            var searchRow = new WinRow(WindowCabinet());
            searchRow.SearchProperties[UITestControl.PropertyNames.Instance] = "1";
            columnNumber = columnNumber - 1;

            if (columnNumber == 0)
            {
                columnNumber = 1;
                var filterCell = new WinCell(searchRow);
                filterCell.SearchProperties[UITestControl.PropertyNames.Instance] = columnNumber.ToString();
                //Filter row control not supported correctly by Coded UI 2012, that why I'm doing this
                Keyboard.SendKeys(WindowCabinet(), "{F5}");
                Keyboard.SendKeys(filterCell, "{Up}");
                Keyboard.SendKeys("{Tab}");
                Keyboard.SendKeys("{Tab}", (ModifierKeys.Shift));
                Keyboard.SendKeys(filterValue);
            }
            else
            {
                var filterCell = new WinCell(searchRow);
                filterCell.SearchProperties[UITestControl.PropertyNames.Instance] = columnNumber.ToString();
                //Filter row control not supported correctly by Coded UI 2012, that why I'm doing this
                Keyboard.SendKeys(filterCell, "{Up}");
                Keyboard.SendKeys("{Tab}");
                Keyboard.SendKeys(filterValue);
            }
        }
예제 #3
0
 private WinCell FindCellByColumnName(string columnName, WinRow row)
 {
     _cell = new WinCell(row);
     _cell.SearchProperties.Add(new PropertyExpression(UITestControl.PropertyNames.Name,
                                                       columnName, PropertyExpressionOperator.Contains));
     return(_cell);
 }
예제 #4
0
        public static void ClickButtonInDataGridView(string dataGridViewName, int rowIndex, int columnIndex)
        {
            WinTable table = Robot.FindWinControl(typeof(WinTable), dataGridViewName, _root) as WinTable;
            WinRow   row   = table.Rows[rowIndex] as WinRow;
            WinCell  cell  = row.Cells[columnIndex] as WinCell;

            Mouse.Click(cell);
        }
예제 #5
0
        private static WinCell GetWinCell(string uiTitle, string uiType)
        {
            var htmlcontrolWin = new WinCell(Window.Locate(uiTitle, uiType));
            var htmlControlWin = htmlcontrolWin;

            htmlControlWin.TechnologyName = TechnologyNameWin;
            return(htmlControlWin);
        }
예제 #6
0
        /// <summary>
        /// 測試一DataGridView裡的NumericUpDown Cell的值
        /// </summary>
        /// <param name="dataGridViewName">DataGridView 的 AccesibleName</param>
        /// <param name="rowIndex">NumericUpDown cell所在的row index </param>
        /// <param name="columnIndex">NumericUpDown cell 所在的 column index</param>
        /// <param name="value">欲測值</param>
        public static void AssertDataGridViewNumericUpDownCellValue(string dataGridViewName, int rowIndex, int columnIndex, int value)
        {
            WinTable table = Robot.FindWinControl(typeof(WinTable), dataGridViewName, _root) as WinTable;
            WinRow   row   = table.Rows[rowIndex] as WinRow;
            WinCell  cell  = row.Cells[columnIndex] as WinCell;

            Assert.AreEqual(cell.Value, value.ToString());
        }
예제 #7
0
        /// <summary>
        /// Assert the specific data grid view's cell
        /// </summary>
        /// <param name="name">The data grid view's name</param>
        /// <param name="rowIndex">row index</param>
        /// <param name="columnIndex">column index</param>
        /// <param name="expectedValue">expected value you want to assert</param>
        /// <exception cref="Exception">If the control is not found</exception>
        public static void AssertGridViewCell(string name, int rowIndex, int columnIndex, string expectedValue)
        {
            WinTable gridView = (WinTable)Robot.FindWinControl(typeof(WinTable), name, _root);
            WinRow   row      = (WinRow)gridView.Rows[rowIndex];
            WinCell  cell     = (WinCell)row.Cells[columnIndex];

            Assert.AreEqual(expectedValue, cell.GetProperty("Value").ToString());
        }
예제 #8
0
파일: Robot.cs 프로젝트: MOONYAN/POS
        public static void ClickDeleteButtonInDataGridView(string dataGridViewName, int rowIndex, int columnIndex)
        {
            WinWindow sec = Robot.FindWinControl(typeof(WinWindow), "CustomerSideForm", null) as WinWindow;
            //
            WinTable table = Robot.FindWinControl(typeof(WinTable), dataGridViewName, sec) as WinTable;
            WinRow   row   = table.Rows[rowIndex] as WinRow;
            WinCell  cell  = row.Cells[columnIndex] as WinCell;

            Mouse.Click(cell);
        }
예제 #9
0
        /// <summary>
        /// Assert DataGridView所選Cell顯示的顏色(請勿讓Cell反白,否則可能會錯誤)
        /// </summary>
        /// <param name="dataGridViewName">DataGridView的AccessibleName</param>
        /// <param name="rowIndex">Row的Index,以0開始</param>
        /// <param name="columnIndex">Column的Index,以0開始</param>
        /// <param name="color">待測顏色</param>
        public static void AssertCellColor(string dataGridViewName, int rowIndex, int columnIndex, Color color)
        {
            WinTable table      = (WinTable)Robot.FindWinControl(typeof(WinTable), dataGridViewName, _root);
            WinRow   row        = (WinRow)table.Rows[rowIndex];
            WinCell  cell       = (WinCell)row.Cells[columnIndex];
            Image    image      = cell.CaptureImage();
            Bitmap   bitmap     = new Bitmap(image);
            Color    pixelColor = bitmap.GetPixel(image.Width / 2, image.Height / 2);

            Assert.AreEqual(pixelColor.ToArgb(), color.ToArgb());
        }
예제 #10
0
        public static void SetDataGridViewQuantity(string name, string index, string qty)
        {
            WinTable table   = (WinTable)Robot.FindWinControl(typeof(WinTable), name, _root);
            WinRow   _Winrow = new WinRow(table);

            _Winrow.SearchProperties.Add(WinRow.PropertyNames.RowIndex, index);
            _Winrow.Find();
            UITestControlCollection collection = _Winrow.GetChildren();
            WinCell cell = collection[4] as WinCell;

            cell.Value = qty;
        }
예제 #11
0
        public static void AssertDataGridViewValue(string name, string row, string col, string key)
        {
            WinTable table   = (WinTable)Robot.FindWinControl(typeof(WinTable), name, _root);
            WinRow   _Winrow = new WinRow(table);

            _Winrow.SearchProperties.Add(WinRow.PropertyNames.RowIndex, row);
            _Winrow.Find();
            UITestControlCollection collection = _Winrow.GetChildren();
            WinCell cell = collection[int.Parse(col)] as WinCell;

            Assert.AreEqual(key, cell.Value);
        }
예제 #12
0
        /// <summary>
        /// Choses book from list and clicks edit.
        /// </summary>
        public void EditBook()
        {
            #region Variable Declarations
            WinCell   uIŚwiatdyskuCell = this.UIBrowseBooksMozillaFiWindow.UIItemGroup.UIŚwiatdyskuCell;
            WinCustom uIItemCustom     = this.UIBrowseBooksMozillaFiWindow.UIBrowseBooksDocument.UIItemCustom;
            #endregion

            // Click 'Świat dysku' cell
            Mouse.Click(uIŚwiatdyskuCell, new Point(176, 22));

            // Click custom control
            Mouse.Click(uIItemCustom, new Point(22, 28));
        }
        /// <summary>
        /// Sets the data grid view cell.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="rowIndex">Index of the row.</param>
        /// <param name="cellIndex">Index of the cell.</param>
        /// <param name="value">The value.</param>
        public static void SetDataGridViewCell(string name, string rowIndex, int cellIndex, string value)
        {
            WinTable table   = ( WinTable )Robot.FindWinControl(typeof(WinTable), name, _root);
            WinRow   _Winrow = new WinRow(table);

            _Winrow.SearchProperties.Add(WinRow.PropertyNames.RowIndex, rowIndex);
            _Winrow.Find();
            UITestControlCollection collection = _Winrow.GetChildren();
            WinCell cell = collection[cellIndex] as WinCell;

            cell.Value = value;
            Keyboard.SendKeys("{Enter}");
        }
예제 #14
0
        /// <summary>
        /// AssertMethod1 - Используйте "AssertMethod1ExpectedValues" для передачи параметров в этот метод.
        /// </summary>
        public void AssertMethod1()
        {
            #region Variable Declarations
            WinCell uIМоревРусланЕвгеньевиCell = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UI_registryGridClient.UIResultTableTable.UIResultTableстрока7Row.UIМоревРусланЕвгеньевиCell;
            WinRow  uIResultTableстрока7Row    = this.UIКвазарЖурналфлюорогрWindow.UIЖурналфлюорографичесWindow.UI_registryGridClient.UIResultTableTable.UIResultTableстрока7Row;
            #endregion

            // Убедитесь, что свойство Value "Морев Руслан Евгеньевич" ячейка равняется "Морев Руслан Евгеньевич"
            Assert.AreEqual(this.AssertMethod1ExpectedValues.UIМоревРусланЕвгеньевиCellValue, uIМоревРусланЕвгеньевиCell.Value, "нет морячка");

            // Убедитесь, что свойство Name "ResultTable строка 7" строка равняется "ResultTable строка 7"
            Assert.AreEqual(this.AssertMethod1ExpectedValues.UIResultTableстрока7RowName, uIResultTableстрока7Row.Name, "не все строки");
        }
예제 #15
0
        /// <summary>
        /// Checks book details
        /// </summary>
        public void SeeBookDetailsMethod()
        {
            #region Variable Declarations
            WinCell   uIItem19350720Cell = this.UIBrowseBooksMozillaFiWindow.UIItemGroup.UIItem19350720Cell;
            WinCustom uIItemCustom1      = this.UIBrowseBooksMozillaFiWindow.UIBrowseBooksDocument.UIItemCustom1;
            #endregion

            // Click '1935-07-20' cell
            Mouse.Click(uIItem19350720Cell, new Point(205, 5));

            // Click custom control
            Mouse.Click(uIItemCustom1, new Point(14, 25));
        }
        /// <summary>
        /// Asserts the index of the data grid view by.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="index">The index.</param>
        /// <param name="data">The data.</param>
        public static void AssertDataGridViewByIndex(string name, string index, string[] data)
        {
            WinTable table   = ( WinTable )Robot.FindWinControl(typeof(WinTable), name, _root);
            WinRow   _Winrow = new WinRow(table);

            _Winrow.SearchProperties.Add(WinRow.PropertyNames.RowIndex, index);
            _Winrow.Find();
            UITestControlCollection collection = _Winrow.GetChildren();

            for (int i = 0; i < collection.Count; i++)
            {
                WinCell cell = collection[i] as WinCell;
                Assert.AreEqual(data[i], cell.Value);
            }
        }
예제 #17
0
        public static void OpenMenuInFilmHireGrid(string cellValue, string rowNumber = "Row 1")
        {
            var rowWithCell = new WinRow(WindowFilmHire());
            rowWithCell.SearchProperties[UITestControl.PropertyNames.Name] = rowNumber;

            var cellToInteract = new WinCell(rowWithCell);
            cellToInteract.SearchProperties[WinCell.PropertyNames.Value] = cellValue;

            var menuWindow = new WinWindow();
            menuWindow.SearchProperties[WinWindow.PropertyNames.AccessibleName] = "DropDown";

            var menu = new WinMenu(menuWindow);
            menu.SearchProperties[UITestControl.PropertyNames.Name] = "DropDown";

            var menuItem = new WinMenuItem(menu);
            menuItem.SearchProperties[UITestControl.PropertyNames.Name] = "Contract Details...";

            Mouse.Click(cellToInteract, MouseButtons.Right);
            Mouse.Click(menuItem);
        }
예제 #18
0
        /// <summary>
        /// Modifies a book
        /// </summary>
        public void EditBook()
        {
            #region Variable Declarations
            WinCell   uIItem19350720Cell = this.UIBrowseBooksMozillaFiWindow.UIItemGroup.UIItem19350720Cell;
            WinEdit   uIEditBookEdit     = this.UIBrowseBooksMozillaFiWindow.UIBrowseBooksDocument.UIEditBookEdit;
            WinEdit   uITitleEdit        = this.UIBrowseBooksMozillaFiWindow.UIBrowseBooksDocument.UITitleEdit;
            WinCustom uIItemCustom       = this.UIBrowseBooksMozillaFiWindow.UIBrowseBooksDocument.UIItemCustom;
            #endregion

            // Click '1935-07-20' cell
            Mouse.Click(uIItem19350720Cell, new Point(160, 15));

            // Click 'Edit Book' text box
            Mouse.Click(uIEditBookEdit, new Point(20, 2));

            // Type 'Przyroda - Liceum' in 'Title' text box
            uITitleEdit.Text = this.EditBookParams.UITitleEditText;

            // Click custom control numbered 2 in 'Browse Books' document
            Mouse.Click(uIItemCustom, new Point(13, 22));
        }
예제 #19
0
        public static void VerifyCellExistsInFilmHireGrid(bool shouldExist, List<string> cellValues,
            string rowNumber = "Row 1", string instanse = "1")
        {
            foreach (var cellValue in cellValues)
            {
                var rowWithCell = new WinRow(WindowFilmHire());
                rowWithCell.SearchProperties[UITestControl.PropertyNames.Name] = rowNumber;

                var cellToVerify = new WinCell(rowWithCell);
                cellToVerify.SearchProperties[WinCell.PropertyNames.Value] = cellValue;
                cellToVerify.SearchProperties[WinCell.PropertyNames.Instance] = instanse;

                if (shouldExist == true)
                {
                    Assert.AreEqual(cellValue, cellToVerify.Value);
                }
                else
                {
                    // Use only once in each test , because it is very slow
                    Assert.IsTrue(cellToVerify.WaitForControlNotExist(Playback.PlaybackSettings.SearchTimeout), cellValue + "Exists");
                }
            }
        }
예제 #20
0
        /// <summary>
        /// RecordedMethod1 - Use 'RecordedMethod1Params' to pass parameters into this method.
        /// </summary>
        public void RecordedMethod1()
        {
            #region Variable Declarations
            WinEdit     uISearchByNonMaskEdit          = this.UISelectPatientWindow.UISearchByNonMaskWindow.UISearchByNonMaskEdit;
            WinCell     uIBrentCell                    = this.UISelectPatientWindow.UIUltraGridWindow.UIUltraGridTable.UIEntityCollection1rowRow.UIBrentCell;
            WinButton   uIOKButton                     = this.UISelectPatientWindow.UIOKWindow.UIOKButton;
            WinCheckBox uIDoNotShowThisAlertAgCheckBox = this.UIFamilyAlertCrosbyBreWindow.UIDoNotShowThisAlertAgWindow.UIDoNotShowThisAlertAgCheckBox;
            WinButton   uIOKButton1                    = this.UIFamilyAlertCrosbyBreWindow.UIOKWindow.UIOKButton;
            WinMenuItem uIEnterPaymentMenuItem         = this.UIDentrixLedgerCrosbyBWindow.UIApplicationMenuBar.UITransactionMenuItem.UIEnterPaymentMenuItem;
            WinButton   uIPaymentSettingsButton        = this.UIEnterPaymentWindow.UIPaymentSettingsWindow.UIPaymentSettingsButton;
            WinMenuItem uIDentrixPaySetupMenuItem      = this.UIItemWindow.UIDropDownMenu.UIDentrixPaySetupMenuItem;
            WinButton   uISetupUpdateDeviceConButton   = this.UIDentrixPaySetupWindow.UISetupUpdateDeviceConWindow.UISetupUpdateDeviceConButton;
            WinButton   uIOKButton2                    = this.UIDentrixPayWindow.UIOKWindow.UIOKButton;
            WinButton   uIOKButton3                    = this.UISetuporUpdateDeviceCWindow.UIOKWindow.UIOKButton;
            WinButton   uIOKButton4                    = this.UIDentrixPaySetupWindow.UIOKWindow.UIOKButton;
            WinButton   uICancelButton                 = this.UIEnterPaymentWindow.UICancelWindow.UICancelButton;
            WinMenuItem uIExitMenuItem                 = this.UIDentrixLedgerCrosbyBWindow.UIApplicationMenuBar.UIFileMenuItem.UIExitMenuItem;
            #endregion

            // Launch '%ProgramFiles%\Dentrix\Ledger.exe'
            ApplicationUnderTest uIDentrixLedgerCrosbyBWindow = ApplicationUnderTest.Launch(this.RecordedMethod1Params.UIDentrixLedgerCrosbyBWindowExePath, this.RecordedMethod1Params.UIDentrixLedgerCrosbyBWindowAlternateExePath);

            // Type 'crosby' in 'searchByNonMask' text box
            uISearchByNonMaskEdit.Text = this.RecordedMethod1Params.UISearchByNonMaskEditText;

            // Click 'Brent' cell
            Mouse.Click(uIBrentCell, new Point(20, 4));

            // Click 'OK' button
            Mouse.Click(uIOKButton, new Point(37, 6));

            if (
                this.UIFamilyAlertCrosbyBreWindow.Exists

                )
            {
                // Select '&Do Not Show This Alert Again Today' check box
                uIDoNotShowThisAlertAgCheckBox.Checked = this.RecordedMethod1Params.UIDoNotShowThisAlertAgCheckBoxChecked;

                // Click 'OK' button
                Mouse.Click(uIOKButton1, new Point(27, 9));
            }



            // Click 'Transaction' -> 'Enter Payment...' menu item
            Mouse.Click(uIEnterPaymentMenuItem, new Point(50, 18));

            // Click 'Payment Settings' button
            Mouse.Click(uIPaymentSettingsButton, new Point(50, 12));

            // Click 'Dentrix Pay Setup' menu item
            Mouse.Click(uIDentrixPaySetupMenuItem, new Point(50, 12));

            // Click 'Setup/Update Device Connected to this PC' button
            Mouse.Click(uISetupUpdateDeviceConButton, new Point(108, 7));

            // Click 'OK' button
            Mouse.Click(uIOKButton2, new Point(45, 8));

            // Adding a pause for the device to connect
            this.UISetuporUpdateDeviceCWindow.WaitForControlExist();

            // Click 'OK' button
            Mouse.Click(uIOKButton3, new Point(43, 7));

            // Adding a pause for the device to connect
            this.UISetuporUpdateDeviceCWindow.WaitForControlNotExist();

            // Click 'OK' button
            Mouse.Click(uIOKButton4, new Point(23, 15));

            // Click 'Cancel' button
            Mouse.Click(uICancelButton, new Point(25, 11));

            // Click 'File' -> 'Exit' menu item
            Mouse.Click(uIExitMenuItem, new Point(70, 16));
        }
예제 #21
0
        // Trying to find cell with specific text in the whole grid, works for all cabinets
        public static void VerifyCellExistsInCabinetGrid(bool shouldExist, List<string> cellValues)
        {
            foreach (var cellValue in cellValues)
            {
                var cellToVerify = new WinCell(WindowCabinet());
                cellToVerify.SearchProperties[WinCell.PropertyNames.Value] = cellValue;

                if (shouldExist == true)
                {
                    Assert.AreEqual(cellValue, cellToVerify.Value);
                }
                else
                {
                    // Use only once in each test , because it is very slow
                    Assert.IsTrue(cellToVerify.WaitForControlNotExist(Playback.PlaybackSettings.SearchTimeout), cellValue + "Exists");
                }
            }
        }
예제 #22
0
 private void FindJournal(string journalName)
 {
     FindRegistrationJournals();
     _journalCell = new WinCell(_mainTree);
     _journalCell.SearchProperties["Value"] = journalName;
 }
예제 #23
0
 private void FindRegistrationJournals()
 {
     FindDocsCell();
     _registrationJournalsCell = new WinCell(_mainTree);
     _registrationJournalsCell.SearchProperties["Value"] = "Журналы регистрации";
 }
예제 #24
0
 private void FindDocsCell()
 {
     _docsCell = new WinCell(_mainTree);
     _docsCell.SearchProperties[WinCell.PropertyNames.Value] = "Документы";
 }
예제 #25
0
 private void FindFile(string name)
 {
     _file = new WinCell(_docCardFilesTab);
     _file.SearchProperties[WinCell.PropertyNames.Value] = name;
 }
예제 #26
0
        // Open gird item for cabinet (should be opened only one cabinet in one time)
        public static void OpenGridItem(string gridItemText)
        {
            var cell = new WinCell(WindowCabinet());
            cell.SearchProperties[WinCell.PropertyNames.Value] = gridItemText;
            cell.SearchProperties[WinCell.PropertyNames.Instance] = "1";

            Mouse.DoubleClick(cell);
        }
        public WinCell GetCUITDataCell(WinWindow w, string searchBy, string searchValue, int index)
        {
            Console.WriteLine("Inside function GetCUITDataCell");
            WinCell GetCUITDataCell = new WinCell(w);
            Playback.Initialize();
            try
            {

                switch (searchBy.Trim().ToLower())
                {
                    case "text":
                        {
                            if (index == -1)
                            {
                                GetCUITDataCell.SearchProperties[WinCell.PropertyNames.Name] = searchValue;
                            }
                            else
                            {
                                GetCUITDataCell.SearchProperties.Add(WinCell.PropertyNames.Name, searchValue);
                                UITestControlCollection editCollection = GetCUITDataCell.FindMatchingControls();
                                GetCUITDataCell = (WinCell)editCollection[index];

                            }
                            break;
                        }
                    case "regulartext":
                        {
                            if (index == -1)
                            {
                                GetCUITDataCell.SearchProperties.Add(WinCell.PropertyNames.Name, searchValue, PropertyExpressionOperator.Contains);
                                UITestControlCollection editCollection = GetCUITDataCell.FindMatchingControls();
                                GetCUITDataCell = (WinCell)editCollection[0];
                            }
                            else
                            {
                                GetCUITDataCell.SearchProperties.Add(WinCell.PropertyNames.Name, searchValue, PropertyExpressionOperator.Contains);
                                UITestControlCollection editCollection = GetCUITDataCell.FindMatchingControls();
                                GetCUITDataCell = (WinCell)editCollection[index];

                            }
                            break;
                        }

                    case "automationid":
                        {
                            if (index == -1)
                            {
                                GetCUITDataCell.SearchProperties.Add(WinCell.PropertyNames.ControlName, searchValue);
                                UITestControlCollection editCollection = GetCUITDataCell.FindMatchingControls();
                                GetCUITDataCell = (WinCell)editCollection[0];
                            }
                            else
                            {
                                GetCUITDataCell.SearchProperties.Add(WinCell.PropertyNames.ControlName, searchValue);
                                UITestControlCollection editCollection = GetCUITDataCell.FindMatchingControls();
                                GetCUITDataCell = (WinCell)editCollection[index];
                            }
                            break;
                        }

                    default:
                        throw new Exception(_error);
                }
                Playback.Cleanup();
                Console.WriteLine("Found Data Cell and exiting function GetCUITDataCell");
                return GetCUITDataCell;

            }
            catch (Exception e)
            {
                var st = new StackTrace(e, true);
                var testFrame = st.GetFrame(0);
                for (int i = 0; i < st.FrameCount; i++)
                {
                    testFrame = st.GetFrame(i);
                    if (testFrame.GetFileName() != null)
                    {
                        if (testFrame.GetFileName().ToString().Contains("CUITFramework.cs") == true)
                        {
                            break;
                        }
                    }

                }
                // Get the top stack frame
                var frame = testFrame;
                // Get the line number from the stack frame
                var line = frame.GetFileLineNumber();
                logTofile(_eLogPtah, "Error in GetCUITEdit and in line: " + line);
                throw new Exception(_error + "CUITRButton:" + System.Environment.NewLine + e.Message);
            }
        }
예제 #28
0
        /// <summary>
        /// Testiranje unosa, azuriranja i brisanja artikla u formi pregled artikla
        /// </summary>
        public void PregledArtikla()
        {
            #region Variable Declarations
            WinEdit     uITxtKorImeEdit          = this.UIPrijavaWindow.UITxtKorImeWindow.UITxtKorImeEdit;
            WinEdit     uITxtLozinkaEdit         = this.UIPrijavaWindow.UITxtLozinkaWindow.UITxtLozinkaEdit;
            WinButton   uIPrijavaButton          = this.UIPrijavaWindow.UIPrijavaWindow1.UIPrijavaButton;
            WinButton   uIArtikliButton          = this.UICvjećarnaWindow.UIArtikliWindow.UIArtikliButton;
            WinEdit     uITxtVrstaEdit           = this.UICvjećarnaWindow.UIPregledartiklaWindow.UITxtVrstaWindow.UITxtVrstaEdit;
            WinButton   uISpremiButton           = this.UICvjećarnaWindow.UIPregledartiklaWindow.UISpremiWindow.UISpremiButton;
            WinButton   uIOKButton               = this.UIOKWindow.UIOKButton;
            WinButton   uIUnosnovogartiklaButton = this.UICvjećarnaWindow.UIPregledartiklaWindow.UIUnosnovogartiklaWindow.UIUnosnovogartiklaButton;
            WinComboBox uITipartiklaComboBox     = this.UICvjećarnaWindow.UIPregledartiklaWindow.UICmboxTipArtiklaWindow.UITipartiklaComboBox;
            WinEdit     uITxtNazivEdit           = this.UICvjećarnaWindow.UIPregledartiklaWindow.UINazivartiklaWindow.UITxtNazivEdit;
            WinEdit     uITxtCijenaEdit          = this.UICvjećarnaWindow.UIPregledartiklaWindow.UIUnesitecijenuuknWindow.UITxtCijenaEdit;
            WinEdit     uITxtKolicinaEdit        = this.UICvjećarnaWindow.UIPregledartiklaWindow.UIUnesitekoličinuWindow.UITxtKolicinaEdit;
            WinButton   uIDodajButton            = this.UICvjećarnaWindow.UIPregledartiklaWindow.UIDodajWindow.UIDodajButton;
            WinClient   uIPregledartiklaClient   = this.UICvjećarnaWindow.UIPregledartiklaWindow.UIPregledartiklaClient;
            WinCell     uIProba12345678Cell      = this.UICvjećarnaWindow.UIPregledartiklaWindow.UIArtikliDataGridViewWindow.UIDataGridViewTable.UIRow29Row.UIProba12345678Cell;
            WinButton   uIPovratakButton         = this.UICvjećarnaWindow.UIPregledartiklaWindow.UIPovratakWindow.UIPovratakButton;
            WinButton   uIUrediartikleButton     = this.UICvjećarnaWindow.UIPregledartiklaWindow.UIUrediartikleWindow.UIUrediartikleButton;
            WinButton   uIAžurirajButton         = this.UICvjećarnaWindow.UIPregledartiklaWindow.UIDodajWindow.UIAžurirajButton;
            WinWindow   uIItemWindow             = this.UICvjećarnaWindow.UIPregledartiklaWindow.UIArtikliDataGridViewWindow.UIDataGridViewTable.UIItemWindow;
            WinButton   uIBrišiButton            = this.UICvjećarnaWindow.UIPregledartiklaWindow.UIBrišiWindow.UIBrišiButton;
            WinButton   uIYesButton              = this.UIProvjeraWindow.UIYesWindow.UIYesButton;
            #endregion

            // Type 'vkovacic' in 'txtKorIme' text box
            uITxtKorImeEdit.Text = this.PregledArtiklaParams.UITxtKorImeEditText;

            // Type '{Tab}' in 'txtKorIme' text box
            Keyboard.SendKeys(uITxtKorImeEdit, this.PregledArtiklaParams.UITxtKorImeEditSendKeys, ModifierKeys.None);

            // Type '********' in 'txtLozinka' text box
            Keyboard.SendKeys(uITxtLozinkaEdit, this.PregledArtiklaParams.UITxtLozinkaEditSendKeys, true);

            // Click 'Prijava' button
            Mouse.Click(uIPrijavaButton, new Point(43, 29));

            // Click 'Artikli' button
            Mouse.Click(uIArtikliButton, new Point(47, 34));

            // Type 'Proba' in 'txtVrsta' text box
            uITxtVrstaEdit.Text = this.PregledArtiklaParams.UITxtVrstaEditText;

            // Click 'Spremi' button
            Mouse.Click(uISpremiButton, new Point(37, 16));

            // Click 'OK' button
            Mouse.Click(uIOKButton, new Point(28, 16));

            // Type 'Proba1' in 'txtVrsta' text box
            uITxtVrstaEdit.Text = this.PregledArtiklaParams.UITxtVrstaEditText1;

            // Click 'Spremi' button
            Mouse.Click(uISpremiButton, new Point(55, 16));

            // Click 'Unos novog artikla' button
            Mouse.Click(uIUnosnovogartiklaButton, new Point(76, 54));

            // Select 'Cvijece' in 'Tip artikla:' combo box
            uITipartiklaComboBox.SelectedItem = this.PregledArtiklaParams.UITipartiklaComboBoxSelectedItem;

            // Type 'Proba12345678' in 'txtNaziv' text box
            uITxtNazivEdit.Text = this.PregledArtiklaParams.UITxtNazivEditText;

            // Type '10' in 'txtCijena' text box
            uITxtCijenaEdit.Text = this.PregledArtiklaParams.UITxtCijenaEditText;

            // Type '15' in 'txtKolicina' text box
            uITxtKolicinaEdit.Text = this.PregledArtiklaParams.UITxtKolicinaEditText;

            // Click 'Dodaj' button
            Mouse.Click(uIDodajButton, new Point(36, 32));

            // Click 'Pregled artikla' client
            Mouse.Click(uIPregledartiklaClient, new Point(1169, 575));

            // Click 'Proba12345678' cell
            Mouse.Click(uIProba12345678Cell, new Point(41, 14));

            // Click 'Povratak' button
            Mouse.Click(uIPovratakButton, new Point(40, 24));

            // Click 'Pregled artikla' client
            Mouse.Click(uIPregledartiklaClient, new Point(1155, 567));

            // Click 'Proba12345678' cell
            Mouse.Click(uIProba12345678Cell, new Point(36, 9));

            // Click 'Uredi artikle' button
            Mouse.Click(uIUrediartikleButton, new Point(71, 52));

            // Type 'Ambrozija' in 'txtNaziv' text box
            uITxtNazivEdit.Text = this.PregledArtiklaParams.UITxtNazivEditText1;

            // Click 'Ažuriraj' button
            Mouse.Click(uIAžurirajButton, new Point(26, 29));

            // Move window to 'Pregled artikla' client
            uIPregledartiklaClient.EnsureClickable(new Point(1167, 456));
            Mouse.StartDragging(uIItemWindow, new Point(17, 73));
            Mouse.StopDragging(uIPregledartiklaClient, new Point(1167, 456));

            // Click 'Povratak' button
            Mouse.Click(uIPovratakButton, new Point(28, 22));

            // Click 'Pregled artikla' client
            Mouse.Click(uIPregledartiklaClient, new Point(1170, 567));

            // Click 'Proba12345678' cell
            Mouse.Click(uIProba12345678Cell, new Point(50, 13));

            // Click 'Briši' button
            Mouse.Click(uIBrišiButton, new Point(101, 26));

            // Click '&Yes' button
            Mouse.Click(uIYesButton, new Point(54, 11));
        }
예제 #29
0
        /// <summary>
        /// Тест функций пользователя
        ///1. Просмотр списка шаблонов поиска
        ///2. Добавление/редактирование/удаление шаблонов поиска
        ///3. Поиск по ключевым словам
        ///4. Поиск по формату файла
        ///5. Просмотр списка файлов в системе
        /// </summary>
        public void SystemTest1()
        {
            #region Variable Declarations
            WinEdit      uITxtRegExpEdit               = this.UIForm1Window.UITxtRegExpWindow.UITxtRegExpEdit;
            WinComboBox  uICmbActionComboBox           = this.UIForm1Window.UICmbActionWindow.UICmbActionComboBox;
            WinComboBox  uICmbCompareComboBox          = this.UIForm1Window.UICmbCompareWindow.UICmbCompareComboBox;
            WinButton    uIДобавитьButton              = this.UIForm1Window.UIДобавитьWindow.UIДобавитьButton;
            WinButton    uIОКButton                    = this.UIОКWindow.UIОКButton;
            WinButton    uIЗаполнитьButton             = this.UIForm1Window.UIЗаполнитьWindow.UIЗаполнитьButton;
            WinComboBox  uICmbPatternsComboBox         = this.UIForm1Window.UICmbPatternsWindow.UICmbPatternsComboBox;
            WinEdit      uITxtNewRegExpEdit            = this.UIForm1Window.UITxtNewRegExpWindow.UITxtNewRegExpEdit;
            WinComboBox  uIИзменитьСравниватьсComboBox = this.UIForm1Window.UICmbNewCompareWindow.UIИзменитьСравниватьсComboBox;
            WinComboBox  uICmbNewActionComboBox        = this.UIForm1Window.UICmbNewActionWindow.UICmbNewActionComboBox;
            WinButton    uIОбновитьButton              = this.UIForm1Window.UIОбновитьWindow.UIОбновитьButton;
            WinButton    uIУдалитьButton               = this.UIForm1Window.UIУдалитьWindow.UIУдалитьButton;
            WinEdit      uITxtKeywordsEdit             = this.UIForm1Window.UITxtKeywordsWindow.UITxtKeywordsEdit;
            WinButton    uIПоискпоключевымсловаButton  = this.UIForm1Window.UIПоискпоключевымсловаWindow.UIПоискпоключевымсловаButton;
            WinCell      uIGitCell        = this.UIForm1Window.UIDataGridView1Window.UIDataGridViewTable.UIСтрока1Row.UIGitCell;
            WinRowHeader uIItemRowHeader  = this.UIForm1Window.UIDataGridView1Window.UIDataGridViewTable.UIСтрока1Row.UIItemRowHeader;
            WinCheckBox  uIDocCheckBox    = this.UIForm1Window.UIDocWindow.UIDocCheckBox;
            WinCheckBox  uIDocxCheckBox   = this.UIForm1Window.UIDocxWindow.UIDocxCheckBox;
            WinButton    uIПоискButton    = this.UIForm1Window.UIПоискWindow.UIПоискButton;
            WinButton    uIВсефайлыButton = this.UIForm1Window.UIВсефайлыWindow.UIВсефайлыButton;
            WinButton    uIЗакрытьButton  = this.UIForm1Window.UIForm1TitleBar.UIЗакрытьButton;
            #endregion

            // Последнее действие мыши не записано.

            // Тип "test" в "txtRegExp" надпись
            uITxtRegExpEdit.Text = this.SystemTest1Params.UITxtRegExpEditText;

            // Выберите "Включить" в "cmbAction" поле со списком
            uICmbActionComboBox.SelectedItem = this.SystemTest1Params.UICmbActionComboBoxSelectedItem;

            // Выберите "Абсолютный путь" в "cmbCompare" поле со списком
            uICmbCompareComboBox.SelectedItem = this.SystemTest1Params.UICmbCompareComboBoxSelectedItem;

            // Щелкните "Добавить" кнопка
            Mouse.Click(uIДобавитьButton, new Point(45, 9));

            // Щелкните "ОК" кнопка
            Mouse.Click(uIОКButton, new Point(24, 13));

            // Щелкните "Заполнить" кнопка
            Mouse.Click(uIЗаполнитьButton, new Point(30, 8));

            // Выберите "test | Включить | Абсолютный путь" в "cmbPatterns" поле со списком
            uICmbPatternsComboBox.SelectedItem = this.SystemTest1Params.UICmbPatternsComboBoxSelectedItem;

            // Тип "test1" в "txtNewRegExp" надпись
            uITxtNewRegExpEdit.Text = this.SystemTest1Params.UITxtNewRegExpEditText;

            // Выберите "Имя файла" в "Изменить Сравнивать с" поле со списком
            uIИзменитьСравниватьсComboBox.SelectedItem = this.SystemTest1Params.UIИзменитьСравниватьсComboBoxSelectedItem;

            // Щелкните "txtNewRegExp" надпись
            Mouse.Click(uITxtNewRegExpEdit, new Point(58, 4));

            // Выберите "Исключить" в "cmbNewAction" поле со списком
            uICmbNewActionComboBox.SelectedItem = this.SystemTest1Params.UICmbNewActionComboBoxSelectedItem;

            // Щелкните "Обновить" кнопка
            Mouse.Click(uIОбновитьButton, new Point(55, 9));

            // Щелкните "ОК" кнопка
            Mouse.Click(uIОКButton, new Point(49, 12));

            // Щелкните "Заполнить" кнопка
            Mouse.Click(uIЗаполнитьButton, new Point(44, 8));

            // Выберите "test1 | Имя файла | Исключить" в "cmbPatterns" поле со списком
            uICmbPatternsComboBox.SelectedItem = this.SystemTest1Params.UICmbPatternsComboBoxSelectedItem1;

            // Щелкните "Удалить" кнопка
            Mouse.Click(uIУдалитьButton, new Point(65, 14));

            // Щелкните "ОК" кнопка
            Mouse.Click(uIОКButton, new Point(22, 8));

            // Тип "git" в "txtKeywords" надпись
            uITxtKeywordsEdit.Text = this.SystemTest1Params.UITxtKeywordsEditText;

            // Щелкните "Поиск по ключевым словам" кнопка
            Mouse.Click(uIПоискпоключевымсловаButton, new Point(43, 18));

            // Щелкните "Git" ячейка
            Mouse.Click(uIGitCell, new Point(31, 8));

            // Щелкните заголовок строки
            Mouse.Click(uIItemRowHeader, new Point(29, 10));

            // Выбор ".doc" флажок
            uIDocCheckBox.Checked = this.SystemTest1Params.UIDocCheckBoxChecked;

            // Выбор ".docx" флажок
            uIDocxCheckBox.Checked = this.SystemTest1Params.UIDocxCheckBoxChecked;

            // Щелкните "Поиск" кнопка
            Mouse.Click(uIПоискButton, new Point(39, 10));

            // Щелкните "Все файлы" кнопка
            Mouse.Click(uIВсефайлыButton, new Point(33, 11));

            // Щелкните "Закрыть" кнопка
            Mouse.Click(uIЗакрытьButton, new Point(20, 10));
        }