From 51cf07a353fcae11c28753ec5e6d7ba3ffc58af5 Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Wed, 6 Sep 2023 17:55:56 +0000 Subject: [PATCH] [Dashboard] Retry visbuilder dashboard test Seeing it pass in video replays but occassionally doesn't pass. However, it doesn't pass with security enabled so I'd imagine it could be related to the refreshing of the session. Issue: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4947 Signed-off-by: Kawika Avilla --- .../apps/vis_builder/dashboard.spec.js | 68 ++++++++++--------- 1 file changed, 36 insertions(+), 32 deletions(-) diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/dashboard.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/dashboard.spec.js index 72bd3a35a..92aee997a 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/dashboard.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/dashboard.spec.js @@ -108,38 +108,42 @@ if (Cypress.env('VISBUILDER_ENABLED')) { cy.deleteSavedObjectByType(VB_SO_TYPE, `vb${cleanupKey}`); }); - it('Should be able to edit a visualization', () => { - // Navigate to vis builder - cy.getElementByTestId('dashboardEditMode').click(); - cy.getElementByTestId( - `embeddablePanelHeading-${toTestId(VB_METRIC_VIS_TITLE, '')}` - ) - .find('[data-test-subj="embeddablePanelToggleMenuIcon"]') - .click(); - cy.getElementByTestId('embeddablePanelAction-editPanel').click(); - cy.getElementByTestId('visualizationLoader') - .find('.mtrVis__value') - .should('contain.text', VB_INDEX_DOC_COUNT); - - // Edit visualization - const newLabel = 'Editied Label'; - cy.getElementByTestId('dropBoxField-metric-0').click(); - cy.vbEditAgg([ - { - testSubj: 'visEditorStringInput1customLabel', - type: 'input', - value: newLabel, - }, - ]); - - // Save and return - cy.getElementByTestId('visBuilderSaveAndReturnButton').click(); - - cy.getElementByTestId('visualizationLoader').should( - 'contain.text', - newLabel - ); - }); + it( + 'Should be able to edit a visualization', + { retries: { runMode: 2 } }, + () => { + // Navigate to vis builder + cy.getElementByTestId('dashboardEditMode').click(); + cy.getElementByTestId( + `embeddablePanelHeading-${toTestId(VB_METRIC_VIS_TITLE, '')}` + ) + .find('[data-test-subj="embeddablePanelToggleMenuIcon"]') + .click(); + cy.getElementByTestId('embeddablePanelAction-editPanel').click(); + cy.getElementByTestId('visualizationLoader') + .find('.mtrVis__value') + .should('contain.text', VB_INDEX_DOC_COUNT); + + // Edit visualization + const newLabel = 'Editied Label'; + cy.getElementByTestId('dropBoxField-metric-0').click(); + cy.vbEditAgg([ + { + testSubj: 'visEditorStringInput1customLabel', + type: 'input', + value: newLabel, + }, + ]); + + // Save and return + cy.getElementByTestId('visBuilderSaveAndReturnButton').click(); + + cy.getElementByTestId('visualizationLoader').should( + 'contain.text', + newLabel + ); + } + ); after(() => { cy.deleteIndex(VB_INDEX_ID);