From dd891f1fe57713e0378e2d565f0222aef0a06cb4 Mon Sep 17 00:00:00 2001 From: Hailong Cui Date: Fri, 15 Nov 2024 12:10:23 +0800 Subject: [PATCH] wait for page load complete Signed-off-by: Hailong Cui --- .../mds_workspace_breadcrumbs.spec.js | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_breadcrumbs.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_breadcrumbs.spec.js index 10ad67c0a..6c19e436b 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_breadcrumbs.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_breadcrumbs.spec.js @@ -64,9 +64,16 @@ if (Cypress.env('WORKSPACE_ENABLED')) { miscUtils.visitPage(`w/${workspaceId}/app/workspace_detail`); // wait for page load cy.contains('h1', 'Workspace details'); - cy.getElementByTestId('recentItemsSectionButton') - .should('exist') - .click({ force: true }); + // waiting for page load completely + cy.getElementByTestId('recentItemsSectionButton').should( + 'not.have.class', + 'headerRecentItemsButton--loadingIndicator', + { + timeout: 10000, + } + ); + + cy.getElementByTestId('recentItemsSectionButton').click({ force: true }); cy.get('.euiPopover__panel').within(() => { cy.getElementByTestId('breadcrumbs').within(() => { @@ -121,9 +128,15 @@ if (Cypress.env('WORKSPACE_ENABLED')) { }); // check breadcrumbs in recent popover - cy.getElementByTestId('recentItemsSectionButton') - .should('exist') - .click({ force: true }); + cy.getElementByTestId('recentItemsSectionButton').should( + 'not.have.class', + 'headerRecentItemsButton--loadingIndicator', + { + timeout: 10000, + } + ); + + cy.getElementByTestId('recentItemsSectionButton').click({ force: true }); cy.get('.euiPopover__panel').within(() => { cy.getElementByTestId('breadcrumbs').within(() => {