diff --git a/main/tests/cypress/cypress/integration/project/grid/column/facet/facets.numeric.spec.js b/main/tests/cypress/cypress/integration/project/grid/column/facet/facets.numeric.spec.js index 7bb31b289..2bd65f572 100644 --- a/main/tests/cypress/cypress/integration/project/grid/column/facet/facets.numeric.spec.js +++ b/main/tests/cypress/cypress/integration/project/grid/column/facet/facets.numeric.spec.js @@ -17,8 +17,62 @@ describe(__filename, function () { cy.get( '#refine-tabs-facets .facets-container li:first-child a[bind="changeButton"]' ).click(); - cy.get('.expression-preview-code').type('value.toNumber()'); + cy.typeExpression('value.toNumber()'); cy.get('.dialog-footer button').contains('OK').click(); 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'); + }); }); diff --git a/main/tests/cypress/cypress/support/commands.js b/main/tests/cypress/cypress/support/commands.js index 34af6bb8d..b7cdc6b3e 100644 --- a/main/tests/cypress/cypress/support/commands.js +++ b/main/tests/cypress/cypress/support/commands.js @@ -107,6 +107,15 @@ Cypress.Commands.add('getFacetContainer', (facetName) => { .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 */