Skip to content

Commit

Permalink
[Dashboard] Retry visbuilder dashboard test (#823) (#831)
Browse files Browse the repository at this point in the history
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:
opensearch-project/OpenSearch-Dashboards#4947

Signed-off-by: Kawika Avilla <[email protected]>
(cherry picked from commit a7abf31)

Co-authored-by: Kawika Avilla <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and kavilla authored Sep 7, 2023
1 parent 327dd23 commit daf284a
Showing 1 changed file with 36 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit daf284a

Please sign in to comment.