Added test for numeric facet (#4292)

This commit is contained in:
Ritesh Soni 2021-11-26 19:01:17 +05:30 committed by GitHub
parent 4d106b118f
commit 5d3013c6d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 64 additions and 1 deletions

View File

@ -17,8 +17,62 @@ describe(__filename, function () {
cy.get( cy.get(
'#refine-tabs-facets .facets-container li:first-child a[bind="changeButton"]' '#refine-tabs-facets .facets-container li:first-child a[bind="changeButton"]'
).click(); ).click();
cy.get('.expression-preview-code').type('value.toNumber()'); cy.typeExpression('value.toNumber()');
cy.get('.dialog-footer button').contains('OK').click(); cy.get('.dialog-footer button').contains('OK').click();
cy.get('.facet-container .facet-range-body').should('exist'); cy.get('.facet-container .facet-range-body').should('exist');
}); });
it('Test for change button and the sliding feature in numeric facet', function () {
cy.loadAndVisitProject('food.small');
cy.columnActionClick('Water', ['Facet', 'Numeric facet']);
cy.get('#refine-tabs-facets .facets-container li:first-child a[bind="changeButton"]').click();
cy.typeExpression('value.toNumber()');
cy.get('.dialog-footer button').contains('OK').click();
cy.get('#refine-tabs-facets').should('exist');
cy.waitForOrOperation();
//sliding the right slider
cy.get('.slider-widget-bracket').eq(1)
.trigger('mousedown',{ force: true })
.trigger('mousemove',-130,0,{ force: true })
.trigger('mouseup',{ force: true })
cy.get('#summary-bar').contains('72 matching rows');
//sliding the middle portion in numeric facet
cy.get('.slider-widget-draggable').eq(0)
.trigger('mousedown',{ force: true }).waitForOrOperation()
.trigger('mousemove',130,0,{ force: true })
.trigger('mouseup',{ force: true }).waitForOrOperation();
cy.get('#summary-bar').contains('70 matching rows');
//sliding the left slider
cy.get('.slider-widget-bracket').eq(0)
.trigger('mousedown',{ force: true })
.trigger('mousemove',130,0,{ force: true })
.trigger('mouseup',{ force: true })
cy.get('#summary-bar').contains('4 matching rows');
});
it('Test for checkboxes and reset button', function () {
cy.loadAndVisitProject('food.small');
cy.columnActionClick('Magnesium', ['Facet', 'Numeric facet']);
cy.get('#refine-tabs-facets .facets-container li:first-child a[bind="changeButton"]').click();
cy.typeExpression('value.toNumber()');
cy.get('.dialog-footer button').contains('OK').click();
cy.get('#refine-tabs-facets').should('exist');
cy.getNumericFacetContainer('Magnesium').find('#facet-0-numeric').click();
cy.get('#summary-bar').contains('11 matching rows');
cy.waitForOrOperation();
cy.getNumericFacetContainer('Magnesium').find('#facet-0-error').click();
cy.get('#summary-bar').contains('0 matching rows');
cy.getNumericFacetContainer('Magnesium').contains('reset').click();
cy.get('#summary-bar').contains('199 rows');
});
}); });

View File

@ -107,6 +107,15 @@ Cypress.Commands.add('getFacetContainer', (facetName) => {
.parentsUntil('.facets-container', { log: false }); .parentsUntil('.facets-container', { log: false });
}); });
Cypress.Commands.add('getNumericFacetContainer', (facetName) => {
return cy
.get(
`#refine-tabs-facets .facets-container .facet-container span[bind="facetTitle"]:contains("${facetName}")`,
{ log: false }
)
.parentsUntil('.facets-container', { log: false });
});
/** /**
* Edit a cell, for a given row index, a column name and a value * Edit a cell, for a given row index, a column name and a value
*/ */