Browse Source

test: split date suite

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5363/head
Raju Udava 2 years ago
parent
commit
d02f022489
  1. 192
      tests/playwright/tests/filters.spec.ts

192
tests/playwright/tests/filters.spec.ts

@ -668,7 +668,7 @@ test.describe('Filter Tests: Date based', () => {
const oneYearAgo = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setHours(0, 0, 0, 0); const oneYearAgo = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).setHours(0, 0, 0, 0);
const oneYearFromNow = new Date(new Date().setFullYear(new Date().getFullYear() + 1)).setHours(0, 0, 0, 0); const oneYearFromNow = new Date(new Date().setFullYear(new Date().getFullYear() + 1)).setHours(0, 0, 0, 0);
async function dateTimeBasedFilterTest(dataType) { async function dateTimeBasedFilterTest(dataType, setCount) {
await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.closeTab({ title: 'Team & Auth' });
await dashboard.treeView.openTable({ title: 'dateTimeBased' }); await dashboard.treeView.openTable({ title: 'dateTimeBased' });
@ -829,106 +829,104 @@ test.describe('Filter Tests: Date based', () => {
await toolbar.clickFilter(); await toolbar.clickFilter();
await toolbar.filter.clickAddFilter(); await toolbar.filter.clickAddFilter();
// "is" filter list if (setCount === 0) {
for (let i = 0; i < isFilterList.length; i++) { // "is" filter list
await verifyFilter_withFixedModal({ for (let i = 0; i < isFilterList.length; i++) {
column: dataType, await verifyFilter_withFixedModal({
opType: 'is', column: dataType,
opSubType: isFilterList[i].opSub, opType: 'is',
value: isFilterList[i]?.value?.toString() || '', opSubType: isFilterList[i].opSub,
result: { rowCount: isFilterList[i].rowCount }, value: isFilterList[i]?.value?.toString() || '',
dataType: dataType, result: { rowCount: isFilterList[i].rowCount },
}); dataType: dataType,
} });
}
// mutually exclusive of "is" filter list
for (let i = 0; i < isFilterList.length; i++) {
await verifyFilter_withFixedModal({
column: dataType,
opType: 'is not',
opSubType: isFilterList[i].opSub,
value: isFilterList[i]?.value?.toString() || '',
result: { rowCount: 800 - isFilterList[i].rowCount },
dataType: dataType,
});
}
// "is before" filter list // mutually exclusive of "is" filter list
for (let i = 0; i < isAfterFilterList.length; i++) { for (let i = 0; i < isFilterList.length; i++) {
await verifyFilter_withFixedModal({ await verifyFilter_withFixedModal({
column: dataType, column: dataType,
opType: 'is before', opType: 'is not',
opSubType: isAfterFilterList[i].opSub, opSubType: isFilterList[i].opSub,
value: isAfterFilterList[i]?.value?.toString() || '', value: isFilterList[i]?.value?.toString() || '',
result: { rowCount: 800 - isAfterFilterList[i].rowCount - 1 }, result: { rowCount: 800 - isFilterList[i].rowCount },
dataType: dataType, dataType: dataType,
}); });
} }
// "is on or before" filter list // "is before" filter list
for (let i = 0; i < isAfterFilterList.length; i++) { for (let i = 0; i < isAfterFilterList.length; i++) {
await verifyFilter_withFixedModal({ await verifyFilter_withFixedModal({
column: dataType, column: dataType,
opType: 'is on or before', opType: 'is before',
opSubType: isAfterFilterList[i].opSub, opSubType: isAfterFilterList[i].opSub,
value: isAfterFilterList[i]?.value?.toString() || '', value: isAfterFilterList[i]?.value?.toString() || '',
result: { rowCount: 800 - isAfterFilterList[i].rowCount }, result: { rowCount: 800 - isAfterFilterList[i].rowCount - 1 },
dataType: dataType, dataType: dataType,
}); });
} }
} else {
// "is on or before" filter list
for (let i = 0; i < isAfterFilterList.length; i++) {
await verifyFilter_withFixedModal({
column: dataType,
opType: 'is on or before',
opSubType: isAfterFilterList[i].opSub,
value: isAfterFilterList[i]?.value?.toString() || '',
result: { rowCount: 800 - isAfterFilterList[i].rowCount },
dataType: dataType,
});
}
// "is after" filter list // "is after" filter list
for (let i = 0; i < isAfterFilterList.length; i++) { for (let i = 0; i < isAfterFilterList.length; i++) {
await verifyFilter_withFixedModal({ await verifyFilter_withFixedModal({
column: dataType, column: dataType,
opType: 'is after', opType: 'is after',
opSubType: isAfterFilterList[i].opSub, opSubType: isAfterFilterList[i].opSub,
value: isAfterFilterList[i]?.value?.toString() || '', value: isAfterFilterList[i]?.value?.toString() || '',
result: { rowCount: isAfterFilterList[i].rowCount }, result: { rowCount: isAfterFilterList[i].rowCount },
dataType: dataType, dataType: dataType,
}); });
} }
// "is on or after" filter list // "is on or after" filter list
for (let i = 0; i < isAfterFilterList.length; i++) { for (let i = 0; i < isAfterFilterList.length; i++) {
await verifyFilter_withFixedModal({ await verifyFilter_withFixedModal({
column: dataType, column: dataType,
opType: 'is on or after', opType: 'is on or after',
opSubType: isAfterFilterList[i].opSub, opSubType: isAfterFilterList[i].opSub,
value: isAfterFilterList[i]?.value?.toString() || '', value: isAfterFilterList[i]?.value?.toString() || '',
result: { rowCount: 1 + isAfterFilterList[i].rowCount }, result: { rowCount: 1 + isAfterFilterList[i].rowCount },
dataType: dataType, dataType: dataType,
}); });
} }
// "is within" filter list // "is within" filter list
for (let i = 0; i < isWithinFilterList.length; i++) { for (let i = 0; i < isWithinFilterList.length; i++) {
await verifyFilter_withFixedModal({ await verifyFilter_withFixedModal({
column: dataType, column: dataType,
opType: 'is within', opType: 'is within',
opSubType: isWithinFilterList[i].opSub, opSubType: isWithinFilterList[i].opSub,
value: isWithinFilterList[i]?.value?.toString() || '', value: isWithinFilterList[i]?.value?.toString() || '',
result: { rowCount: isWithinFilterList[i].rowCount }, result: { rowCount: isWithinFilterList[i].rowCount },
dataType: dataType, dataType: dataType,
}); });
} }
// "is blank" and "is not blank" filter list // "is blank" and "is not blank" filter list
for (let i = 0; i < filterList.length; i++) { for (let i = 0; i < filterList.length; i++) {
await verifyFilter_withFixedModal({ await verifyFilter_withFixedModal({
column: dataType, column: dataType,
opType: filterList[i].opType, opType: filterList[i].opType,
opSubType: null, opSubType: null,
value: null, value: null,
result: { rowCount: filterList[i].rowCount }, result: { rowCount: filterList[i].rowCount },
dataType: dataType, dataType: dataType,
}); });
}
} }
} }
test.beforeAll(async () => {
// Set timeout for this hook.
test.setTimeout(180000);
});
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
context = await setup({ page }); context = await setup({ page });
@ -978,8 +976,12 @@ test.describe('Filter Tests: Date based', () => {
} }
}); });
test('Date : filters', async () => { test('Date : filters-1', async () => {
await dateTimeBasedFilterTest('Date'); await dateTimeBasedFilterTest('Date', 1);
});
test('Date : filters-2', async () => {
await dateTimeBasedFilterTest('Date', 2);
}); });
}); });

Loading…
Cancel
Save