From 4eff80c3f3cf41c05b404fe4aa5a8269b1f16308 Mon Sep 17 00:00:00 2001 From: adam-stasiak-polidea Date: Wed, 11 Nov 2020 00:18:20 +0100 Subject: [PATCH] chore: enabled cypress test in filter file (#11458) * enabled cypress test in filter file * added delay to typing * additional assertion and timeout * Modified test logic - changed user's action to selection from list instead of typing (unstable with cypress) --- .../integration/dashboard/filter.test.ts | 39 +++++++------------ 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/superset-frontend/cypress-base/cypress/integration/dashboard/filter.test.ts b/superset-frontend/cypress-base/cypress/integration/dashboard/filter.test.ts index 1cf35b92f..82aa429c4 100644 --- a/superset-frontend/cypress-base/cypress/integration/dashboard/filter.test.ts +++ b/superset-frontend/cypress-base/cypress/integration/dashboard/filter.test.ts @@ -63,41 +63,30 @@ describe('Dashboard filter', () => { cy.wait(aliases); }); }); - // TODO fix and reactivate this flaky test - xit('should apply filter', () => { - cy.get('.Select__control input[type=text]').first().focus(); + it('should apply filter', () => { + cy.get('.Select__control input[type=text]') + .first() + .should('be.visible') + .focus(); // should open the filter indicator - cy.get('.filter-indicator.active') - .should('be.visible') + cy.get('[data-test="filter"]') + .should('be.visible', { timeout: 10000 }) .should(nodes => { expect(nodes).to.have.length(9); }); + cy.get('[data-test="chart-container"]').find('svg').should('be.visible'); + cy.get('.Select__control input[type=text]').first().focus().blur(); - // should hide the filter indicator - cy.get('.filter-indicator') - .not('.active') - .should(nodes => { - expect(nodes).to.have.length(18); - }); - cy.get('.Select__control input[type=text]') .first() .focus() - .type('So', { force: true }); + .type('So', { force: true, delay: 100 }); - cy.get('.Select__menu').first().contains('Create "So"'); + cy.get('.Select__menu').first().contains('South Asia').click(); - // Somehow Input loses focus after typing "So" while in Cypress, so - // we refocus the input again here. The is not happening in real life. - cy.get('.Select__control input[type=text]') - .first() - .focus() - .type('uth Asia{enter}', { force: true }); - - // by default, need to click Apply button to apply filter cy.get('.filter_box button').click({ force: true }); // wait again after applied filters @@ -109,10 +98,12 @@ describe('Dashboard filter', () => { ); expect(requestParams.extra_filters[0]).deep.eq({ col: 'region', - op: 'in', - val: ['South Asia'], + op: '==', + val: 'South Asia', }); }); }); + + // TODO add test with South Asia{enter} type action to select filter }); });