Browse Source

test: year column filters

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5306/head
Raju Udava 2 years ago
parent
commit
95dff4a229
  1. 6
      tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts
  2. 3
      tests/playwright/setup/xcdb-records.ts
  3. 11
      tests/playwright/tests/filters.spec.ts

6
tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts

@ -90,6 +90,11 @@ export class ToolbarFilterPage extends BasePage {
if (value) {
let fillFilter: any = null;
switch (dataType) {
case UITypes.Year:
await this.get().locator('.nc-filter-value-select').click();
await this.rootPage.locator(`.ant-picker-dropdown:visible`);
await this.rootPage.locator(`.ant-picker-cell-inner:has-text("${value}")`).click();
break;
case UITypes.Date:
if (opSubType === 'exact date') {
await this.get().locator('.nc-filter-value-select').click();
@ -104,7 +109,6 @@ export class ToolbarFilterPage extends BasePage {
});
await this.toolbar.parent.dashboard.waitForLoaderToDisappear();
await this.toolbar.parent.waitLoading();
break;
}
break;
case UITypes.Duration:

3
tests/playwright/setup/xcdb-records.ts

@ -41,6 +41,7 @@ const rowMixedValue = (column: ColumnType, index: number) => {
const decimals = [33.3, 456.34, 333.3, null, 267.5674, 34.0, 8754.0, 3234.547, 44.2647, 33.98, null];
const duration = [60, 120, 180, 3600, 3660, 3720, null, 3780, 60, 120, null];
const rating = [0, 1, 2, 3, null, 0, 4, 5, 0, 1, null];
const years = [2023, null, 1956, 2023, 1967, 2024, 1954, 1924, 2044, 1923, null];
// Array of random sample email strings (not more than 100 characters)
const emails = [
@ -131,6 +132,8 @@ const rowMixedValue = (column: ColumnType, index: number) => {
return singleSelect[index % singleSelect.length];
case UITypes.MultiSelect:
return multiSelect[index % multiSelect.length];
case UITypes.Year:
return years[index % years.length];
default:
return `test-${index}`;
}

11
tests/playwright/tests/filters.spec.ts

@ -13,6 +13,7 @@ let records: Record<string, any>;
const skipList = {
Number: ['is null', 'is not null'],
Year: ['is null', 'is not null'],
Decimal: ['is null', 'is not null'],
Percent: ['is null', 'is not null'],
Currency: ['is null', 'is not null'],
@ -255,6 +256,11 @@ test.describe('Filter Tests: Numerical', () => {
title: 'Rating',
uidt: UITypes.Rating,
},
{
column_name: 'Year',
title: 'Year',
uidt: UITypes.Year,
},
];
try {
@ -274,6 +280,7 @@ test.describe('Filter Tests: Numerical', () => {
Percent: rowMixedValue(columns[4], i),
Duration: rowMixedValue(columns[5], i),
Rating: rowMixedValue(columns[6], i),
Year: rowMixedValue(columns[7], i),
};
rowAttributes.push(row);
}
@ -308,6 +315,10 @@ test.describe('Filter Tests: Numerical', () => {
test('Filter: Duration', async () => {
await numBasedFilterTest('Duration', '00:01', '01:03');
});
test('Filter: Year', async () => {
await numBasedFilterTest('Year', '2023', '2024');
});
});
// Text based filters

Loading…
Cancel
Save