From 0af671fa255027fa4bbea623d02cef9a8839d77a Mon Sep 17 00:00:00 2001 From: Jinghuayao <81597121+jinghua-qa@users.noreply.github.com> Date: Thu, 24 Feb 2022 10:24:14 -0800 Subject: [PATCH] test(native filter): add new native filter test for time column filter (#18850) * add new native filter test for time column filter --- .../dashboard/nativeFilters.test.ts | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts index 74785d05df5bf..414f14df5c598 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts @@ -501,6 +501,47 @@ describe('Nativefilters Sanity test', () => { .contains('Month') .should('be.visible'); }); + it('User can create a time column filter', () => { + cy.get(nativeFilters.filterFromDashboardView.expand).click({ force: true }); + cy.get(nativeFilters.filterFromDashboardView.createFilterButton) + .should('be.visible') + .click(); + cy.get(nativeFilters.filtersPanel.filterTypeInput) + .find(nativeFilters.filtersPanel.filterTypeItem) + .click({ force: true }); + cy.get('[label="Time column"]').click({ force: true }); + cy.get(nativeFilters.modal.container) + .find(nativeFilters.filtersPanel.filterName) + .click({ force: true }) + .clear() + .type('time column'); + cy.get(nativeFilters.modal.container) + .find(nativeFilters.filtersPanel.datasetName) + .click() + .type('wb_health_population'); + cy.get(nativeFilters.silentLoading).should('not.exist'); + cy.get('[label="wb_health_population"]').click(); + + cy.get(nativeFilters.modal.footer) + .contains('Save') + .should('be.visible') + .click(); + cy.intercept(`/api/v1/chart/data?form_data=**`).as('chart'); + cy.get(nativeFilters.modal.container).should('not.exist'); + // assert that native filter is created + cy.get(nativeFilters.filterFromDashboardView.filterName) + .should('be.visible') + .contains('time column'); + cy.get(nativeFilters.filterFromDashboardView.filterValueInput) + .should('be.visible', { timeout: 10000 }) + .click() + .type('year{enter}'); + cy.get(nativeFilters.applyFilter).click({ force: true }); + cy.wait('@chart'); + cy.get(nativeFilters.filterFromDashboardView.filterContent) + .contains('year') + .should('be.visible'); + }); }); xdescribe('Nativefilters', () => {