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)
This commit is contained in:
adam-stasiak-polidea 2020-11-11 00:18:20 +01:00 committed by GitHub
parent 98d1c6964c
commit 4eff80c3f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 24 deletions

View File

@ -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
});
});