From 90e0278f0957e5de1d9c9e32a62bb05aeb4f1120 Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Thu, 7 Sep 2023 12:37:12 -0700 Subject: [PATCH] [Dashboard] Retry visbuilder dashboard test (#823) 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 (cherry picked from commit a7abf3194c229878c122bb311e44491360934963) --- .../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);