示例#1
0
        /// <summary>
        ///     Compare values from two cells
        /// </summary>
        /// <param name="expectedTableData">Expected values</param>
        /// <param name="actualTableData">Actual values</param>
        /// <param name="rowNumber">Row number of cell</param>
        /// <param name="columnNumber">Column number of cell</param>
        private void CompareCellData(
            List <List <string> > expectedTableData,
            List <List <string> > actualTableData,
            int rowNumber,
            int columnNumber)
        {
            var actualValue   = actualTableData[rowNumber][columnNumber].Replace("[comma]", ",");
            var expectedValue = string.Empty;

            try
            {
                expectedValue = expectedTableData[rowNumber][columnNumber].Replace("[comma]", ",");
            }
            catch (ArgumentOutOfRangeException)
            {
                expectedValue = "<UNDEFINED>";
            }

            QAAssert.AreEqual(expectedValue, actualValue, continueOnFailure: true);
            if (!expectedValue.Equals(actualValue))
            {
                Report.Output(
                    Report.Level.Fail,
                    Resources.DataGridDifferentValueMsg,
                    rowNumber,
                    columnNumber,
                    expectedValue,
                    actualValue);

                hasFoundMismatch = true;
            }
        }
示例#2
0
        /// <summary>
        ///     Select this row
        /// </summary>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        public void Select(bool shouldVerify = true)
        {
            ReportAction("Select");
            UIItem.Select();
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyTableRowSelectMsg);
                QAAssert.AreEqual(true, UIItem.IsFocussed, friendlyMessage);
            }
        }
示例#3
0
        /// <summary>
        ///     Unselects a CheckBox
        /// </summary>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        public void UnSelect(bool shouldVerify = true)
        {
            ReportAction("UnSelect");
            UIItem.UnSelect();
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyCheckBoxUnSelectMsg);
                QAAssert.AreEqual(false, UIItem.IsSelected, friendlyMessage);
            }
        }
示例#4
0
        /// <summary>
        ///     UnCheck ListItem and then verify
        /// </summary>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        public void UnCheck(bool shouldVerify = true)
        {
            ReportAction("UnCheck");
            UIItem.UnCheck();
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyListItemUnCheckMsg);
                QAAssert.AreEqual(false, UIItem.Checked, friendlyMessage);
            }
        }
示例#5
0
        /// <summary>
        ///     Compare the row count of two tables.
        /// </summary>
        /// <param name="expectedRowCount">Expected table row count</param>
        /// <param name="actualRowCount">Actual table row count</param>
        private void CompareRowCount(int expectedRowCount, int actualRowCount)
        {
            var rowCountMessage = string.Format(
                Resources.FriendlyDataGridCompareRowCountMsg,
                FriendlyName);

            QAAssert.AreEqual(
                expectedRowCount,
                actualRowCount,
                rowCountMessage,
                true);
        }
示例#6
0
        /// <summary>
        ///     Set the value of the textbox to a value but without the keyboard events
        ///     This will not represent exactly how a user will enter the value but the EnterText method does not support
        ///     Unicode characters
        /// </summary>
        /// <param name="text">Text to enter</param>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        public void SetUnicodeText(string text, bool shouldVerify = true)
        {
            ReportActionValue("EnterText", text);
            UIItem.BulkText = text;
            Thread.Sleep(100);
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyTextBoxSetMsg, text);
                QAAssert.AreEqual(text, UIItem.Text, friendlyMessage);
            }
        }
示例#7
0
        /// <summary>
        ///     Enter text into a TextBox using keyboard and then verify.
        ///     Always try to use this method instead of SetValue() because this a closer
        ///     implementation to how a user would normally set the value of a TextBox.
        /// </summary>
        /// <param name="text">Text to enter</param>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        public void EnterText(string text, bool shouldVerify = true)
        {
            ReportActionValue("EnterText", text);
            UIItem.Enter(text);
            WaitForTextInput(text.Length);
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyTextBoxSetMsg, text);
                QAAssert.AreEqual(text, UIItem.Text, friendlyMessage);
            }
        }
示例#8
0
        /// <summary>
        ///     Set value of a TextBox using automation and then verify.
        ///     Only call this method when EnterText() does not work.
        /// </summary>
        /// <param name="value">Value to set</param>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        public void SetValue(string value, bool shouldVerify = true)
        {
            ReportActionValue("SetValue", value);
            UIItem.SetValue(value);
            Thread.Sleep(100);
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyTextBoxSetMsg, value);
                QAAssert.AreEqual(value, UIItem.Text, friendlyMessage);
            }
        }
示例#9
0
文件: QATab.cs 项目: EXHALE97/GIT-VS
        public void SelectTabPage(string tabTitle, bool shouldVerify = true)
        {
            ReportAction("Select tab ");
            UIItem.SelectTabPage(tabTitle);
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyTabSelectMsg, tabTitle);

                QAAssert.AreEqual(tabTitle, UIItem.SelectedTab.ToString(), friendlyMessage);
            }
        }
示例#10
0
        /// <summary>
        ///     Set value of a popup from a TableCell and then verify
        /// </summary>
        /// <param name="value">Value to click</param>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        public void SetPopupValue(string value, bool shouldVerify = true)
        {
            ReportActionValue("SetPopupValue", value);
            UIItem.Click();
            UIItem.Click();

            var popup = QAWindow.GetModalWindow(SearchCriteria.ByAutomationId(string.Empty).AndByClassName("Popup"), WorkSpace.MainWindow.Window);

            var listItemPopup = QAListItem.Get(SearchCriteria.ByText(value), string.Empty, popup.Window);

            listItemPopup.Click();
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyDataGridCellSetMsg, value);
                QAAssert.AreEqual(Value, value, friendlyMessage);
            }
        }
示例#11
0
        /// <summary>
        ///     Select this row
        /// </summary>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        public void Select(bool shouldVerify = true)
        {
            ReportAction("Select");
            UIItem.Select();
            if (!UIItem.IsSelected)
            {
                RightClick();
                Desktop.Instance.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.ESCAPE);
                Desktop.Instance.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.DOWN);
                Desktop.Instance.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.UP);
            }
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyDataGridRowSelectMsg);
                QAAssert.AreEqual(true, UIItem.IsSelected, friendlyMessage);
            }
        }
示例#12
0
        /// <summary>
        ///     Select item contained inside ComboBox using Automation
        /// </summary>
        /// <param name="itemText">Item text</param>
        /// <param name="shouldVerify">Indicate whether or not to verify</param>
        /// <param name="useReturnForSelection">
        ///     UIItem.Click does not work in all situations,
        ///     for such cases pass the last parameter as true to make sure selection works for those cases
        /// </param>
        public void Select(string itemText, bool shouldVerify = true, bool useReturnForSelection = false)
        {
            ReportAction("Select");
            UIItem.Select(itemText);
            CaptureImage();

            if (shouldVerify)
            {
                var friendlyMessage = ConstructFriendlyMessage(Resources.FriendlyComboBoxSelectMsg, itemText);
                QAAssert.AreEqual(itemText, UIItem.SelectedItemText, friendlyMessage);
            }

            if (useReturnForSelection)
            {
                UIItem.KeyIn(KeyboardInput.SpecialKeys.RETURN);
            }
            else
            {
                UIItem.Click();
            }
        }