From 2ebee759900c14e5ee771953276be91d4500bd52 Mon Sep 17 00:00:00 2001 From: Suchit Sahoo Date: Sun, 26 May 2024 23:08:40 -0700 Subject: [PATCH] Add Test for Vis Builder Bugs Signed-off-by: Suchit Sahoo --- .../apps/vis_builder/basic.spec.js | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/basic.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/basic.spec.js index 6f2edfea6..1a46442a6 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/basic.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/basic.spec.js @@ -161,6 +161,47 @@ if (Cypress.env('VISBUILDER_ENABLED')) { cy.deleteSavedObjectByType(VB_SO_TYPE, `vb${cleanupKey}`); }); + it('Check toggle legend functionality', () => { + // Settting up the page + cy.visit(VB_APP_URL); + + // Wait for page to load + cy.waitForLoader(); + cy.vbSelectDataSource(VB_INDEX_PATTERN); + + cy.getElementByTestId('field-undefined-showDetails').drag( + '[data-test-subj=dropBoxAddField-metric]' + ); + + // default behaviour: hidden + cy.getElementByTestId('legend-Count').should('be.visible'); + cy.getElementByTestId('vislibToggleLegend').click(); + + cy.getElementByTestId('legend-Count').should('not.exist'); + cy.getElementByTestId('vislibToggleLegend').click(); + + cy.getElementByTestId('legend-Count').should('be.visible'); + }); + + it('Check dragging a field out of bounds does not scroll the pane', () => { + // Settting up the page + cy.visit(VB_APP_URL); + + // Wait for page to load + cy.waitForLoader(); + cy.vbSelectDataSource(VB_INDEX_PATTERN); + + cy.getElementByTestId('field-undefined-showDetails').drag( + '[data-test-subj=dropBoxAddField-metric]' + ); + + cy.getElementByTestId('dropBoxField-metric-0').drag( + '[data-test-subj="vbOption-Settings"]' + ); + + cy.get('[class="vbConfig__title"]').contains('Configuration'); + }); + after(() => { cy.deleteIndex(VB_INDEX_ID); });