diff --git a/tests/playwright/pages/Dashboard/Settings/index.ts b/tests/playwright/pages/Dashboard/Settings/index.ts index 448f78550d..b5c42eeff6 100644 --- a/tests/playwright/pages/Dashboard/Settings/index.ts +++ b/tests/playwright/pages/Dashboard/Settings/index.ts @@ -49,4 +49,10 @@ export class SettingsPage extends BasePage { await this.get().locator('[data-testid="settings-modal-close-button"]').click(); await this.get().waitFor({ state: 'hidden' }); } + + async toggleNullEmptyFilters() { + await this.selectTab({ tab: SettingTab.ProjectSettings, subTab: SettingsSubTab.Miscellaneous }); + await this.miscellaneous.clickShowNullEmptyFilters(); + await this.close(); + } } diff --git a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts index 43470de79d..608565c2d4 100644 --- a/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts +++ b/tests/playwright/pages/Dashboard/common/Toolbar/Filter.ts @@ -119,10 +119,22 @@ export class ToolbarFilterPage extends BasePage { break; case UITypes.SingleSelect: await this.get().locator('.nc-filter-value-select').click(); - await this.rootPage - .locator(`.nc-dropdown-single-select-cell`) - .locator(`.nc-select-option-SingleSelect-${value}`) - .click(); + // check if value was an array + // eslint-disable-next-line no-case-declarations + const val = value.split(','); + if (val.length > 1) { + for (let i = 0; i < val.length; i++) { + await this.rootPage + .locator(`.nc-dropdown-multi-select-cell`) + .locator(`.nc-select-option-SingleSelect-${val[i]}`) + .click(); + } + } else { + await this.rootPage + .locator(`.nc-dropdown-single-select-cell`) + .locator(`.nc-select-option-SingleSelect-${value}`) + .click(); + } break; default: fillFilter = this.rootPage.locator('.nc-filter-value-select > input').last().fill(value); diff --git a/tests/playwright/tests/filters.spec.ts b/tests/playwright/tests/filters.spec.ts index 599445b951..b8be98450f 100644 --- a/tests/playwright/tests/filters.spec.ts +++ b/tests/playwright/tests/filters.spec.ts @@ -13,26 +13,19 @@ let api: Api; let records = []; const skipList = { - Number: ['is null', 'is not null', 'is blank', 'is not blank'], - Decimal: ['is null', 'is not null', 'is blank', 'is not blank'], - Percent: ['is null', 'is not null', 'is blank', 'is not blank'], - Currency: ['is null', 'is not null', 'is blank', 'is not blank'], + Number: ['is null', 'is not null'], + Decimal: ['is null', 'is not null'], + Percent: ['is null', 'is not null'], + Currency: ['is null', 'is not null'], Rating: ['is null', 'is not null', 'is blank', 'is not blank'], - Duration: ['is null', 'is not null', 'is blank', 'is not blank'], - SingleLineText: ['is blank', 'is not blank'], - MultiLineText: ['is blank', 'is not blank'], - Email: ['is blank', 'is not blank'], - PhoneNumber: ['is blank', 'is not blank'], - URL: ['is blank', 'is not blank'], - SingleSelect: [ - 'is blank', - 'is not blank', - 'contains all of', - 'does not contain all of', - 'contains any of', - 'does not contain any of', - ], - MultiSelect: ['is blank', 'is not blank', 'is', 'is not'], + Duration: ['is null', 'is not null'], + SingleLineText: [], + MultiLineText: [], + Email: [], + PhoneNumber: [], + URL: [], + SingleSelect: ['contains all of', 'does not contain all of'], + MultiSelect: ['is', 'is not'], }; async function verifyFilterOperatorList(param: { column: string; opType: string[] }) { @@ -103,6 +96,10 @@ test.describe('Filter Tests: Numerical', () => { await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.treeView.openTable({ title: 'numberBased' }); + // Enable NULL & EMPTY filters + await dashboard.gotoSettings(); + await dashboard.settings.toggleNullEmptyFilters(); + let eqStringDerived = eqString; let isLikeStringDerived = isLikeString; if (dataType === 'Duration') { @@ -303,6 +300,10 @@ test.describe('Filter Tests: Text based', () => { await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.treeView.openTable({ title: 'textBased' }); + // Enable NULL & EMPTY filters + await dashboard.gotoSettings(); + await dashboard.settings.toggleNullEmptyFilters(); + const filterList = [ { op: 'is equal', @@ -467,6 +468,10 @@ test.describe('Filter Tests: Select based', () => { await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.treeView.openTable({ title: 'selectBased' }); + // Enable NULL & EMPTY filters + await dashboard.gotoSettings(); + await dashboard.settings.toggleNullEmptyFilters(); + const filterList = [ { op: 'is', @@ -604,6 +609,10 @@ test.describe('Filter Tests: AddOn', () => { await dashboard.closeTab({ title: 'Team & Auth' }); await dashboard.treeView.openTable({ title: 'addOnTypes' }); + // Enable NULL & EMPTY filters + await dashboard.gotoSettings(); + await dashboard.settings.toggleNullEmptyFilters(); + const filterList = [ { op: 'is checked', @@ -713,9 +722,7 @@ test.describe('Filter Tests: Toggle button', () => { // Enable NULL & EMPTY button await dashboard.gotoSettings(); - await dashboard.settings.selectTab({ tab: SettingTab.ProjectSettings, subTab: SettingsSubTab.Miscellaneous }); - await dashboard.settings.miscellaneous.clickShowNullEmptyFilters(); - await dashboard.settings.close(); + await dashboard.settings.toggleNullEmptyFilters(); // Verify filter options await verifyFilterOperatorList({ @@ -746,19 +753,15 @@ test.describe('Filter Tests: Toggle button', () => { // Disable NULL & EMPTY button await dashboard.gotoSettings(); - await dashboard.settings.selectTab({ tab: SettingTab.ProjectSettings, subTab: SettingsSubTab.Miscellaneous }); - await dashboard.settings.miscellaneous.clickShowNullEmptyFilters(); + await dashboard.settings.toggleNullEmptyFilters(); // wait for toast message await dashboard.verifyToast({ message: 'Null / Empty filters exist. Please remove them first.' }); - await dashboard.settings.close(); // remove filter await toolbar.filter.reset(); // Disable NULL & EMPTY button await dashboard.gotoSettings(); - await dashboard.settings.selectTab({ tab: SettingTab.ProjectSettings, subTab: SettingsSubTab.Miscellaneous }); - await dashboard.settings.miscellaneous.clickShowNullEmptyFilters(); - await dashboard.settings.close(); + await dashboard.settings.toggleNullEmptyFilters(); }); });