Пример #1
0
        public void MultipleCustomFiltersOnTwoColumns()
        {
            var firstColumn  = "Integer";
            var secondColumn = "IntegerNullable";

            this.navigator.AllTypesDataPage().GoTo();
            var table           = new TableElement("table", this.driver);
            var filterContainer = new CustomFilterContainer(this.driver, "#custom-filters-container");

            filterContainer.Gt(firstColumn, "5");
            filterContainer.Lt(firstColumn, "70");
            filterContainer.Gte(secondColumn, "20");
            filterContainer.Lte(secondColumn, "50");

            table.ClickSortButton(firstColumn);
            var resultFirstColumnValues = table.GetColumnRowValuesUntilAny(firstColumn).Select(x => int.Parse(x));

            Assert.IsTrue(resultFirstColumnValues.All(x => 5 < x && x < 70));

            table.ClickSortButton(firstColumn);
            resultFirstColumnValues = table.GetColumnRowValuesUntilAny(firstColumn).Select(x => int.Parse(x));
            Assert.IsTrue(resultFirstColumnValues.All(x => 5 < x && x < 70));

            table.ClickSortButton(secondColumn);
            var resultsecondColumnValues = table.GetColumnRowValuesUntilAny(secondColumn).Select(x => int.Parse(x));

            Assert.IsTrue(resultsecondColumnValues.All(x => 20 <= x && x <= 50));

            table.ClickSortButton(firstColumn);
            resultsecondColumnValues = table.GetColumnRowValuesUntilAny(secondColumn).Select(x => int.Parse(x));
            Assert.IsTrue(resultsecondColumnValues.All(x => 20 <= x && x <= 50));
        }
Пример #2
0
        public void MultipleCustomFiltersOnSameColumn()
        {
            var column = "Integer";

            this.navigator.AllTypesDataPage().GoTo();
            var table           = new TableElement("table", this.driver);
            var filterContainer = new CustomFilterContainer(this.driver, "#custom-filters-container");

            filterContainer.Gt(column, "5");
            filterContainer.Lt(column, "10");

            table.ClickSortButton(column);
            Thread.Sleep(GlobalConstants.GlobalThreadSleep);
            var resultColumnValues = table.GetColumnRowValuesUntilAny(column).Select(x => int.Parse(x));

            Assert.IsTrue(resultColumnValues.All(x => 5 < x && x < 10));

            table.ClickSortButton(column);
            Thread.Sleep(GlobalConstants.GlobalThreadSleep);
            resultColumnValues = table.GetColumnRowValuesUntilAny(column).Select(x => int.Parse(x));
            Assert.IsTrue(resultColumnValues.All(x => 5 < x && x < 10));
        }
Пример #3
0
        public void SingleRangeConditionShouldWorkProperly(Expression <Func <AllTypesModel, IComparable> > selector, Func <string, IComparable> parseFunc, RangeOperationTypesEnum operationType, Func <object, string> inputFormat = null)
        {
            this.navigator.AllTypesDataPage().GoTo();

            var colName         = this.GetColumnName(selector);
            var filterValue     = this.GetRandomValue(selector.Compile());
            var table           = new TableElement("table", this.driver);
            var filterContainer = new CustomFilterContainer(this.driver, "#custom-filters-container");

            inputFormat = inputFormat ?? new Func <object, string>(x => x.ToString());
            switch (operationType)
            {
            case RangeOperationTypesEnum.gt:
                filterContainer.Gt(colName, inputFormat(filterValue));
                break;

            case RangeOperationTypesEnum.gte:
                filterContainer.Gte(colName, inputFormat(filterValue));
                break;

            case RangeOperationTypesEnum.lt:
                filterContainer.Lt(colName, inputFormat(filterValue));
                break;

            case RangeOperationTypesEnum.lte:
                filterContainer.Lte(colName, inputFormat(filterValue));
                break;

            case RangeOperationTypesEnum.eq:
                filterContainer.Eq(colName, inputFormat(filterValue));
                break;

            default:
                break;
            }

            Thread.Sleep(GlobalConstants.GlobalThreadSleep);
            var columnFilteredValues = table.GetColumnRowValuesUntilAny(colName);
            var parsedValues         = columnFilteredValues.Select(parseFunc);

            Assert.IsNotEmpty(parsedValues);
            var filterparsedValue = parseFunc(filterValue.ToString());

            switch (operationType)
            {
            case RangeOperationTypesEnum.gt:
                Assert.IsTrue(parsedValues.All(x => x.CompareTo(filterparsedValue) > 0));
                break;

            case RangeOperationTypesEnum.gte:
                Assert.IsTrue(parsedValues.All(x => x.CompareTo(filterparsedValue) >= 0));
                break;

            case RangeOperationTypesEnum.lt:
                Assert.IsTrue(parsedValues.All(x => x.CompareTo(filterparsedValue) < 0));
                break;

            case RangeOperationTypesEnum.lte:
                Assert.IsTrue(parsedValues.All(x => x.CompareTo(filterparsedValue) <= 0));
                break;

            case RangeOperationTypesEnum.eq:
                Assert.IsTrue(parsedValues.All(x => x.CompareTo(filterparsedValue) == 0));
                break;

            default:
                break;
            }
        }