test: 💍 Add test for multiple filters

This commit is contained in:
Faris Ansari 2018-10-16 14:16:22 +05:30
parent 932afb6cbe
commit 7f779a3dd8

View File

@ -169,10 +169,12 @@ describe('DataTable', function () {
}); });
beforeEach(function () { beforeEach(function () {
cy.get('.dt-filter[data-col-index=4]').as('filterInput4');
cy.get('.dt-filter[data-col-index=5]').as('filterInput5'); cy.get('.dt-filter[data-col-index=5]').as('filterInput5');
}); });
afterEach(function () { afterEach(function () {
cy.get('@filterInput4').clear();
cy.get('@filterInput5').clear(); cy.get('@filterInput5').clear();
cy.get('.dt-row[data-row-index=0]').should('be.visible'); cy.get('.dt-row[data-row-index=0]').should('be.visible');
}); });
@ -180,11 +182,13 @@ describe('DataTable', function () {
it('simple text filter', function () { it('simple text filter', function () {
cy.getCell(4, 0).click().type('{ctrl}f'); cy.getCell(4, 0).click().type('{ctrl}f');
cy.get('.dt-filter[data-col-index=4]').as('filterInput4').type('edin'); cy.get('@filterInput4').type('edin');
cy.get('.dt-row[data-row-index=0]').should('be.visible'); cy.get('.dt-row[data-row-index=0]').should('be.visible');
cy.get('.dt-row[data-row-index=1]').should('not.be.visible'); cy.get('.dt-row[data-row-index=1]').should('not.be.visible');
cy.get('@filterInput4').clear(); cy.get('@filterInput4').clear();
cy.wait(500);
cy.get('@filterInput5').type('15'); cy.get('@filterInput5').type('15');
cy.get('.dt-row[data-row-index=2]').should('be.visible'); cy.get('.dt-row[data-row-index=2]').should('be.visible');
cy.get('.dt-row[data-row-index=15]').should('be.visible'); cy.get('.dt-row[data-row-index=15]').should('be.visible');
@ -208,5 +212,14 @@ describe('DataTable', function () {
cy.get('.dt-row[data-row-index=4]').should('not.be.visible'); cy.get('.dt-row[data-row-index=4]').should('not.be.visible');
cy.get('.dt-row[data-row-index=5]').should('be.visible'); cy.get('.dt-row[data-row-index=5]').should('be.visible');
}); });
it('multiple filters', function () {
cy.get('@filterInput4').type('to');
cy.get('@filterInput5').type('54');
cy.get('.dt-row[data-row-index=0]').should('be.visible');
cy.get('.dt-row[data-row-index=4]').should('be.visible');
cy.get('.dt-row[data-row-index=1]').should('not.be.visible');
});
}); });
}); });