From 2e542fa80031092f0db4049f8e376f8a43fd4f00 Mon Sep 17 00:00:00 2001 From: jinghua-qa <81597121+jinghua-qa@users.noreply.github.com> Date: Fri, 5 Nov 2021 07:32:27 -0700 Subject: [PATCH] test: add native filter e2e test part3 (#17343) * add 2 stable test * fix lint --- .../dashboard/nativeFilters.test.ts | 93 +++++++++++++++++++ 1 file changed, 93 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 35e3f013c9f58..54d94a9d95ba8 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts @@ -195,6 +195,99 @@ describe('Nativefilters Sanity test', () => { .click(); cy.get(nativeFilters.modal.container).should('not.exist'); }); + it('User can undo deleting a native filter', () => { + cy.get(nativeFilters.filterFromDashboardView.expand) + .should('be.visible') + .click(); + cy.get(nativeFilters.createFilterButton).should('be.visible').click(); + cy.get(nativeFilters.modal.container).should('be.visible'); + cy.get(nativeFilters.modal.container) + .find(nativeFilters.filtersPanel.filterName) + .click() + .type('Country name'); + cy.get(nativeFilters.modal.container) + .find(nativeFilters.filtersPanel.datasetName) + .click() + .type("World Bank's Data{enter}"); + + cy.get('.loading inline-centered css-101mkpk').should('not.exist'); + // hack for unclickable country_name + cy.wait(5000); + cy.get(nativeFilters.filtersPanel.filterInfoInput) + .last() + .should('be.visible') + .click({ force: true }); + cy.get(nativeFilters.filtersPanel.filterInfoInput) + .last() + .type('country_name'); + cy.get(nativeFilters.filtersPanel.inputDropdown) + .should('be.visible', { timeout: 20000 }) + .last() + .click(); + cy.get(nativeFilters.modal.footer) + .contains('Save') + .should('be.visible') + .click(); + cy.get(nativeFilters.filterFromDashboardView.filterName) + .should('be.visible') + .contains('Country name'); + cy.get(nativeFilters.createFilterButton).should('be.visible').click(); + cy.get(nativeFilters.modal.container).should('be.visible'); + cy.get(nativeFilters.filtersList.removeIcon).first().click(); + cy.contains('Undo?').click(); + }); + it('Verify setting options and tooltips for value filter', () => { + cy.get(nativeFilters.filterFromDashboardView.expand).click({ force: true }); + cy.get(nativeFilters.createFilterButton).should('be.visible').click(); + cy.get(nativeFilters.modal.container).should('be.visible'); + cy.get(nativeFilters.filterConfigurationSections.collapseExpandButton) + .last() + .click(); + [ + 'Filter has default value', + 'Multiple select', + 'Required', + 'Filter is hierarchical', + 'Default to first item', + 'Inverse selection', + 'Search all filter options', + 'Pre-filter available values', + 'Sort filter values', + ].forEach(el => { + cy.contains(el); + }); + cy.get(nativeFilters.filterConfigurationSections.checkedCheckbox).contains( + 'Multiple select', + ); + cy.get(nativeFilters.filterConfigurationSections.infoTooltip) + .eq(0) + .trigger('mouseover'); + cy.contains('Allow selecting multiple values'); + + cy.get(nativeFilters.filterConfigurationSections.infoTooltip) + .eq(1) + .trigger('mouseover'); + cy.contains('User must select a value before applying the filter'); + + cy.get(nativeFilters.filterConfigurationSections.infoTooltip) + .eq(2) + .trigger('mouseover'); + cy.contains( + 'Select first item by default (when using this option, default value can’t be set)', + ); + + cy.get(nativeFilters.filterConfigurationSections.infoTooltip) + .eq(3) + .trigger('mouseover'); + cy.contains('Exclude selected values'); + + cy.get(nativeFilters.filterConfigurationSections.infoTooltip) + .eq(4) + .trigger('mouseover'); + cy.contains( + 'By default, each filter loads at most 1000 choices at the initial page load. Check this box if you have more than 1000 filter values and want to enable dynamically searching that loads filter values as users type (may add stress to your database).', + ); + }); }); xdescribe('Nativefilters', () => {