Skip to content

Commit d75f574

Browse files
FriedhelmWSSuZhou-Joe
authored andcommitted
Improve the assertion in recent history test to avoid flakiness (#1717)
Signed-off-by: Owen Wang <[email protected]> (cherry picked from commit c064e03)
1 parent 9509961 commit d75f574

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/left-navigation/left_navigation.spec.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,13 @@ describe('Left navigation menu', () => {
267267

268268
// open recent history dialog
269269
cy.get('.headerRecentItemsButton').should('exist').click();
270-
cy.get('div[role="dialog"]').within(() => {
271-
// dialog displays correct visited content
272-
cy.contains(/Recent assets/).should('exist');
273-
cy.contains(visualizationName).should('exist');
274-
});
270+
cy.get('div[role="dialog"][data-autofocus="true"]')
271+
.should('have.class', 'euiPanel')
272+
.within(() => {
273+
// dialog displays correct visited content
274+
cy.contains(/Recent assets/).should('exist');
275+
cy.contains(visualizationName).should('exist');
276+
});
275277

276278
// back to dashboard
277279
cy.get('.left-navigation-wrapper').within(() => {
@@ -283,10 +285,14 @@ describe('Left navigation menu', () => {
283285
// wait for the page to be loaded
284286
cy.get('.application').should('exist');
285287
cy.get('.headerRecentItemsButton--loadingIndicator').should('not.exist');
288+
// wait for the dashboards list loaded, avoid flaky loading icon
289+
cy.getElementByTestId('dashboardLandingPage').within(() => {
290+
cy.get('.euiBasicTable .euiTableRow').should('exist');
291+
});
286292

287293
// open recent history dialog again
288294
cy.get('.headerRecentItemsButton').should('exist').click();
289-
cy.get('div[role="dialog"]').within(() => {
295+
cy.get('div[role="dialog"][data-autofocus="true"]').within(() => {
290296
// click recent visited visualization in the dialog
291297
cy.contains(visualizationName).should('exist').click({ force: true });
292298
});

0 commit comments

Comments
 (0)