Browse Source

test: filters test for Time

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

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

@ -95,6 +95,21 @@ export class ToolbarFilterPage extends BasePage {
await this.rootPage.locator(`.ant-picker-dropdown:visible`); await this.rootPage.locator(`.ant-picker-dropdown:visible`);
await this.rootPage.locator(`.ant-picker-cell-inner:has-text("${value}")`).click(); await this.rootPage.locator(`.ant-picker-cell-inner:has-text("${value}")`).click();
break; break;
case UITypes.Time:
// eslint-disable-next-line no-case-declarations
const time = value.split(':');
await this.get().locator('.nc-filter-value-select').click();
await this.rootPage.locator(`.ant-picker-dropdown:visible`);
await this.rootPage
.locator(`.ant-picker-time-panel-column:nth-child(1)`)
.locator(`.ant-picker-time-panel-cell:has-text("${time[0]}")`)
.click();
await this.rootPage
.locator(`.ant-picker-time-panel-column:nth-child(2)`)
.locator(`.ant-picker-time-panel-cell:has-text("${time[1]}")`)
.click();
await this.rootPage.locator(`.ant-btn-primary:has-text("Ok")`).click();
break;
case UITypes.Date: case UITypes.Date:
if (opSubType === 'exact date') { if (opSubType === 'exact date') {
await this.get().locator('.nc-filter-value-select').click(); await this.get().locator('.nc-filter-value-select').click();

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

@ -40,6 +40,19 @@ const rowMixedValue = (column: ColumnType, index: number) => {
const numbers = [33, null, 456, 333, 267, 34, 8754, 3234, 44, 33, null]; const numbers = [33, null, 456, 333, 267, 34, 8754, 3234, 44, 33, null];
const decimals = [33.3, 456.34, 333.3, null, 267.5674, 34.0, 8754.0, 3234.547, 44.2647, 33.98, null]; 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 duration = [60, 120, 180, 3600, 3660, 3720, null, 3780, 60, 120, null];
const time = [
'02:02:00',
'20:20:20',
'04:04:00',
'02:02:00',
'20:20:20',
'18:18:18',
null,
'02:02:00',
'20:20:20',
'18:18:18',
null,
];
const rating = [0, 1, 2, 3, null, 0, 4, 5, 0, 1, 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]; const years = [2023, null, 1956, 2023, 1967, 2024, 1954, 1924, 2044, 1923, null];
@ -134,6 +147,8 @@ const rowMixedValue = (column: ColumnType, index: number) => {
return multiSelect[index % multiSelect.length]; return multiSelect[index % multiSelect.length];
case UITypes.Year: case UITypes.Year:
return years[index % years.length]; return years[index % years.length];
case UITypes.Time:
return time[index % time.length];
default: default:
return `test-${index}`; return `test-${index}`;
} }

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

@ -19,6 +19,7 @@ const skipList = {
Currency: ['is null', 'is not null'], Currency: ['is null', 'is not null'],
Rating: ['is null', 'is not null', 'is blank', 'is not blank'], Rating: ['is null', 'is not null', 'is blank', 'is not blank'],
Duration: ['is null', 'is not null'], Duration: ['is null', 'is not null'],
Time: ['is null', 'is not null'],
SingleLineText: [], SingleLineText: [],
MultiLineText: [], MultiLineText: [],
Email: [], Email: [],
@ -261,6 +262,11 @@ test.describe('Filter Tests: Numerical', () => {
title: 'Year', title: 'Year',
uidt: UITypes.Year, uidt: UITypes.Year,
}, },
{
column_name: 'Time',
title: 'Time',
uidt: UITypes.Time,
},
]; ];
try { try {
@ -281,6 +287,7 @@ test.describe('Filter Tests: Numerical', () => {
Duration: rowMixedValue(columns[5], i), Duration: rowMixedValue(columns[5], i),
Rating: rowMixedValue(columns[6], i), Rating: rowMixedValue(columns[6], i),
Year: rowMixedValue(columns[7], i), Year: rowMixedValue(columns[7], i),
Time: rowMixedValue(columns[8], i),
}; };
rowAttributes.push(row); rowAttributes.push(row);
} }
@ -319,6 +326,10 @@ test.describe('Filter Tests: Numerical', () => {
test('Filter: Year', async () => { test('Filter: Year', async () => {
await numBasedFilterTest('Year', '2023', '2024'); await numBasedFilterTest('Year', '2023', '2024');
}); });
test('Filter: Time', async () => {
await numBasedFilterTest('Time', '02:02:00', '04:04:00');
});
}); });
// Text based filters // Text based filters

Loading…
Cancel
Save