Example #1
0
        public void ChooseTextFieldItem(string fieldName, string fieldValue)
        {
            var control = new WebDriverDropDownTextBoxEditText(Driver, Waiter, "dropDownTextBox editText");

            control.SelectValue(fieldName.ToLower());

            var textField = new WebDriverTextField(Driver, Waiter, "div.armcontrol#clone" + _cloneNumber + " input[type='text']", true);

            _cloneNumber++;

            textField.SetValue(fieldValue);
        }
        public WebDriverNewAuditTypeConfigDialog(IWebDriver driver, WebDriverWait waiter, string id)
            : base(driver, waiter, "div#" + id)
        {
            Record        = new WebDriverDropDown(driver, waiter, "ACV_Record");
            Configuration = new WebDriverTextField(driver, waiter, "ACV_Configuration");

            Table = new FieldConfigurationTableControl(driver, waiter, id);

            OkButton     = new WebDriverButton(driver, waiter, "ACV_OK_btn");
            SaveButton   = new WebDriverButton(driver, waiter, "ACV_Save_btn");
            NewButton    = new WebDriverButton(driver, waiter, "ACV_New_btn");
            DeleteButton = new WebDriverButton(driver, waiter, "ACV_Delete_btn");
            CancelButton = new WebDriverButton(driver, waiter, "ACV_Cancel_btn");
            HelpButton   = new WebDriverButton(driver, waiter, "ACV_Help_btn");
        }
Example #3
0
        public void SelectFilterOperatorWithOwnerCriteria(string operatorToSelect, string ownerPrefixToEnter, string operatorOwnerCriteriaToSelect)
        {
            var operators        = Driver.FindElements(By.CssSelector("tr.filter-criteria td.operator div.dropDownTextBox"));
            var operatorDropDown = operators.Last();

            operatorDropDown.Click();

            var operatorMenus = Driver.FindElements(By.CssSelector("tr.filter-criteria td.operator div.b-m-mpanel[key='cmroot']"));
            var operatorMenu  = operatorMenus.Last();

            bool operatorFound = false;

            var operatorOptions = operatorMenu.FindElements(By.CssSelector("div.b-m-item"));

            foreach (var operatorOption in operatorOptions)
            {
                if (operatorOption.FindElement(By.CssSelector("span")).Text.Equals(operatorToSelect))
                {
                    operatorFound = true;
                    operatorOption.FindElement(By.CssSelector("div.b-m-ibody")).Click();
                    break;
                }
            }

            if (!operatorFound)
            {
                Assert.Fail("Operator: " + operatorToSelect + " not found");
            }

            var operatorCriteriaFields = Driver.FindElements(By.CssSelector("div.armcontrol[id^='clone']"));
            var operatorCriteriaField  = operatorCriteriaFields.Last();
            var cloneId = operatorCriteriaField.GetAttribute("id");
            var filterOperatorCriteriaTextField = new WebDriverTextField(Driver, Waiter, "div.armcontrol[id='" + cloneId + "'] input[type='text']", true);

            filterOperatorCriteriaTextField.SetValue(operatorOwnerCriteriaToSelect);
        }
        public void SetHeaderFilter(string fieldName, string value)
        {
            //filter button
            var filterSelectorString = "td.grid-icon-show-filter-row";

            //Wait until Filter button is visible on page
            Waiter.Until(x => x.FindElement(By.CssSelector(filterSelectorString)).Displayed);

            //If the text box is not visible on the screen already click on the filter button
            if (
                !Driver.FindElement(By.CssSelector(string.Format("input[type='text']#{0}_search_{1}", Id, fieldName)))
                .Displayed)
            {
                Element.FindElement(By.CssSelector(filterSelectorString)).Click();
            }

            bool searchBoxVisible = false;

            for (var i = 0; i < 30; i++)
            {
                Thread.Sleep(1000);
                var searchBoxes =
                    Driver.FindElements(By.CssSelector(string.Format("input[type='text']#{0}_search_{1}", Id, fieldName)));
                if (searchBoxes.Count > 0 && Driver.FindElement(By.CssSelector(string.Format("input[type='text']#{0}_search_{1}", Id, fieldName))).Displayed)
                {
                    searchBoxVisible = true;
                    break;
                }
            }

            if (!searchBoxVisible)
            {
                Assert.Fail(
                    "Was waiting for the Filter Header Search Text Box to become visible in the Desktop but it DID NOT");
            }

            //filter text box
            var textBox = new WebDriverTextField(Driver, Waiter,
                                                 string.Format("input[type='text']#{0}_search_{1}", Id, fieldName), true);

            textBox.SetValue(value);

            textBox.Enter();

            WaitUntilUiSpinnerIsNotDisplayed();

            // Wait until the Clear Filters And Refresh Icon Appears before continuing
            // In some grids (e.g. the Evaluation Grid, the grid refreshes more than once
            // so we cannot use a standard Wait.Until statement because the element
            // we are waiting for is no longer present after the grid has refreshed
            // so never becomes available therefore we have to check for new ones
            // each time
            Driver.WaitForAjaxToComplete();
            bool clearFiltersAndRefreshIconAppeared = false;

            for (var i = 0; i < 30; i++)
            {
                Thread.Sleep(1000);
                var clearFiltersAndRefreshIcons = Driver.FindElements(By.CssSelector("td.grid-icon-clear-filter"));
                if (clearFiltersAndRefreshIcons.Count > 0)
                {
                    clearFiltersAndRefreshIconAppeared = true;
                    break;
                }
            }

            if (!clearFiltersAndRefreshIconAppeared)
            {
                Assert.Fail(
                    "After searching in the grid, was waiting for the Clear Filters And Refresh Icon to appear, but it DID NOT");
            }

            //Element will now be stale, so reload
            WaitUntilUiSpinnerIsNotDisplayed();
        }