|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + * contributor license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright ownership. |
| 5 | + * The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + * (the "License"); you may not use this file except in compliance with |
| 7 | + * the License. You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + * |
| 17 | + */ |
| 18 | + |
| 19 | +import { DataLakeUtils } from '../../support/utils/datalake/DataLakeUtils'; |
| 20 | +import { DataLakeWidgetTableUtils } from '../../support/utils/datalake/DataLakeWidgetTableUtils'; |
| 21 | +import { DataLakeFilterConfig } from '../../support/model/DataLakeFilterConfig'; |
| 22 | +import { AdapterBuilder } from '../../support/builder/AdapterBuilder'; |
| 23 | +import { ConnectBtns } from '../../support/utils/connect/ConnectBtns'; |
| 24 | +import { ConnectUtils } from '../../support/utils/connect/ConnectUtils'; |
| 25 | +import { FileManagementUtils } from '../../support/utils/FileManagementUtils'; |
| 26 | + |
| 27 | +describe('Validate that filter works for numerical dimension property', () => { |
| 28 | + beforeEach('Setup Test', () => { |
| 29 | + cy.initStreamPipesTest(); |
| 30 | + |
| 31 | + FileManagementUtils.addFile( |
| 32 | + 'datalake/filterNumericalStringProperties.csv', |
| 33 | + ); |
| 34 | + const adapterInput = AdapterBuilder.create('File_Stream') |
| 35 | + .setName('Test Adapter') |
| 36 | + .setTimestampProperty('timestamp') |
| 37 | + .addDimensionProperty('dimensionKey') |
| 38 | + .setStoreInDataLake() |
| 39 | + .setFormat('csv') |
| 40 | + .addFormatInput('input', ConnectBtns.csvDelimiter(), ';') |
| 41 | + .addFormatInput('checkbox', ConnectBtns.csvHeader(), 'check') |
| 42 | + .build(); |
| 43 | + ConnectUtils.testAdapter(adapterInput); |
| 44 | + }); |
| 45 | + |
| 46 | + it('Perform Test', () => { |
| 47 | + DataLakeUtils.goToDatalake(); |
| 48 | + DataLakeUtils.createAndEditDataView(); |
| 49 | + |
| 50 | + // create table widget and select time range |
| 51 | + const startDate = new Date(1737029442000); |
| 52 | + const endDate = new Date(1742220659000); |
| 53 | + |
| 54 | + DataLakeUtils.clickOrderBy('descending'); |
| 55 | + |
| 56 | + DataLakeUtils.openVisualizationConfig(); |
| 57 | + DataLakeUtils.selectVisualizationType('Table'); |
| 58 | + DataLakeUtils.selectTimeRange(startDate, endDate); |
| 59 | + cy.wait(1000); |
| 60 | + |
| 61 | + // validate data in table |
| 62 | + DataLakeWidgetTableUtils.checkAmountOfRows(2); |
| 63 | + |
| 64 | + // select filter for tag |
| 65 | + DataLakeUtils.selectDataConfig(); |
| 66 | + var filterConfig = new DataLakeFilterConfig('dimensionKey', '1.0', '='); |
| 67 | + DataLakeUtils.dataConfigAddFilter(filterConfig); |
| 68 | + |
| 69 | + // validate data in table is filtered |
| 70 | + DataLakeWidgetTableUtils.checkAmountOfRows(1); |
| 71 | + |
| 72 | + // remove filter |
| 73 | + DataLakeUtils.dataConfigRemoveFilter(); |
| 74 | + |
| 75 | + DataLakeUtils.selectDataConfig(); |
| 76 | + |
| 77 | + filterConfig = new DataLakeFilterConfig('v1', '20', '='); |
| 78 | + DataLakeUtils.dataConfigAddFilter(filterConfig); |
| 79 | + |
| 80 | + // validate data in table is filtered |
| 81 | + DataLakeWidgetTableUtils.checkAmountOfRows(1); |
| 82 | + |
| 83 | + // remove filter |
| 84 | + DataLakeUtils.dataConfigRemoveFilter(); |
| 85 | + |
| 86 | + // validate data again |
| 87 | + DataLakeWidgetTableUtils.checkAmountOfRows(2); |
| 88 | + }); |
| 89 | +}); |
0 commit comments