Пример #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));
        }
        public void ExpectToAddAdditionalDataFromOnActionExecutedEvent()
        {
            navigator.OnDataExecutedEventTestsPage().GoTo();
            var table        = new TableElement("table", this.driver);
            var actualValues = table.GetColumnRowValuesUntilAny("Test");

            var expectedValues = Enumerable.Range(1, 10).Select(x => x.ToString());

            Assert.IsTrue(expectedValues.SequenceEqual(actualValues));
        }
Пример #3
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));
        }
        public void FilterByColumnShouldWorkProperlyForDateTimes(Expression <Func <AllTypesModel, object> > selector, ComparissonTypesEnum comparissonType)
        {
            string columnName = this.GetColumnName(selector);

            this.navigator.AllTypesDataPage().GoTo();
            var inputId        = "column-search-" + columnName.Replace(' ', '-');
            var table          = new TableElement("table", this.driver);
            var filterValueObj = this.GetRandomValue(selector.Compile());
            var filterValueDT  = comparissonType == ComparissonTypesEnum.DateTime ? (DateTime)filterValueObj : ((DateTimeOffset)filterValueObj).DateTime;

            Thread.Sleep(GlobalConstants.GlobalThreadSleep);
            table.TypeInInput($"#{inputId}", filterValueDT.ToString("r"));
            var columnValues = table.GetColumnRowValuesUntilAny(columnName);

            this.AssertColumnValues(columnValues, filterValueObj, comparissonType);
        }
        public void FilterByColumnShouldWorkProperlyForNonDateTimes(Expression <Func <AllTypesModel, object> > selector, ComparissonTypesEnum comparissonType)
        {
            string columnName = this.GetColumnName(selector);

            if (selector.ToString().ToLower().Contains("nestedmodel"))
            {
                columnName = "Nested Model " + columnName;
            }

            this.navigator.AllTypesDataPage().GoTo();
            var inputId     = "column-search-" + columnName.Replace(' ', '-');
            var table       = new TableElement("table", this.driver);
            var filterValue = this.GetRandomValue(selector.Compile());

            table.TypeInInput($"#{inputId}", filterValue.ToString());
            var columnValues = table.GetColumnRowValuesUntilAny(columnName);

            this.AssertColumnValues(columnValues, filterValue, comparissonType);
        }
        public void FilterByMultipleColumnShouldWorkProperly(string testCase, Expression <Func <AllTypesModel, object> >[] selectors)
        {
            this.navigator.AllTypesDataPage().GoTo();

            string firstColumnName = this.GetColumnName(selectors.First());
            var    firstInputId    = "column-search-" + firstColumnName.Replace(' ', '-');
            var    table           = new TableElement("table", this.driver);
            var    filterValue     = this.GetRandomValue(selectors.First().Compile());

            table.TypeInInput($"#{firstInputId}", filterValue.ToString());

            string secondColumnName   = this.GetColumnName(selectors.Last());
            var    secondColumnValues = table.GetColumnRowValuesUntilAny(secondColumnName);
            var    secondFilterValue  = secondColumnValues.First();
            var    secondInputId      = "column-search-" + secondColumnName.Replace(' ', '-');

            table.TypeInInput($"#{secondInputId}", secondFilterValue);

            var columnValues = table.GetColumnRowValues(firstColumnName);

            this.AssertColumnValues(columnValues, filterValue, ComparissonTypesEnum.Equal);
            columnValues = table.GetColumnRowValues(secondColumnName);
            this.AssertColumnValues(columnValues, secondFilterValue, ComparissonTypesEnum.Equal);
        }
Пример #7
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;
            }
        }