From 1301b09e36c9d3c12a91cff69d3cd61368cedb3f Mon Sep 17 00:00:00 2001 From: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com> Date: Thu, 20 Apr 2023 18:41:46 +0530 Subject: [PATCH] fix(test): dbt cypress flakiness (#11155) * fix(test): dbt cypress flakiness * added wait for ingestionPipelineStatus * fixed wait issue * added API wait * revet removal of service interception --------- Co-authored-by: Shailesh Parmar --- .../resources/ui/cypress/common/common.js | 25 +++++++++++++------ .../e2e/AddNewService/postgres.spec.js | 4 +++ .../e2e/AddNewService/redshiftWithDBT.spec.js | 11 ++++++++ 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js index 21f69fd1bd0..f25d3228bb3 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -140,11 +140,29 @@ export const handleIngestionRetry = ( }; export const scheduleIngestion = () => { + interceptURL( + 'POST', + '/api/v1/services/ingestionPipelines', + 'createIngestionPipelines' + ); + interceptURL( + 'POST', + '/api/v1/services/ingestionPipelines/deploy/*', + 'deployPipeline' + ); + interceptURL( + 'GET', + '/api/v1/services/ingestionPipelines/status', + 'getIngestionPipelineStatus' + ); // Schedule & Deploy cy.get('[data-testid="cron-type"]').should('be.visible').click(); cy.get('.ant-select-item-option-content').contains('Hour').click(); cy.get('[data-testid="deploy-button"]').should('be.visible').click(); + verifyResponseStatusCode('@createIngestionPipelines', 201); + verifyResponseStatusCode('@deployPipeline', 200); + verifyResponseStatusCode('@getIngestionPipelineStatus', 200); // check success cy.get('[data-testid="success-line"]', { timeout: 15000 }).should( 'be.visible' @@ -233,11 +251,6 @@ export const testServiceCreationAndIngestion = ( '/api/v1/services/ingestionPipelines/status', 'getIngestionPipelineStatus' ); - interceptURL( - 'POST', - '/api/v1/services/ingestionPipelines/deploy/*', - 'deployPipeline' - ); cy.get('[data-testid="submit-btn"]').should('exist').click(); verifyResponseStatusCode('@getIngestionPipelineStatus', 200); // check success @@ -268,8 +281,6 @@ export const testServiceCreationAndIngestion = ( scheduleIngestion(); - verifyResponseStatusCode('@deployPipeline', 200); - cy.contains(`${serviceName}_metadata`).should('be.visible'); // wait for ingestion to run diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/postgres.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/postgres.spec.js index 8557f646d08..be789a7ba7d 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/postgres.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/postgres.spec.js @@ -131,6 +131,8 @@ describe('Postgres Ingestion', () => { 'ingestionPermissions' ); interceptURL('GET', '/api/v1/services/*/name/*', 'serviceDetails'); + interceptURL('GET', `/api/v1/*`, 'database'); + cy.get(`[data-testid="service-name-${serviceName}"]`) .should('exist') .click(); @@ -139,6 +141,8 @@ describe('Postgres Ingestion', () => { }); verifyResponseStatusCode('@serviceDetails', 200); verifyResponseStatusCode('@airflow', 200); + verifyResponseStatusCode('@database', 200); + cy.get('[data-testid="tabs"]').should('exist'); cy.get('[data-testid="Ingestions"]') .scrollIntoView() diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/redshiftWithDBT.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/redshiftWithDBT.spec.js index 58c39a5d204..b9ca3510932 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/redshiftWithDBT.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/AddNewService/redshiftWithDBT.spec.js @@ -97,6 +97,11 @@ describe('RedShift Ingestion', () => { '/api/v1/services/ingestionPipelines/deploy/*', 'deployIngestion' ); + interceptURL( + 'GET', + '/api/v1/services/ingestionPipelines/*/pipelineStatus?startTs=*&endTs=*', + 'pipelineStatus' + ); cy.get('[data-testid="appbar-item-settings"]') .should('be.visible') .click({ force: true }); @@ -140,12 +145,18 @@ describe('RedShift Ingestion', () => { .scrollIntoView() .should('be.visible') .click(); + + verifyResponseStatusCode('@pipelineStatus', 200); verifyResponseStatusCode('@ingestionPermissions', 200); + cy.get('[data-testid="ingestion-details-container"]').should('exist'); cy.get('[data-testid="add-new-ingestion-button"]') .should('be.visible') .click(); cy.get('[data-testid="list-item"]').contains('Add dbt Ingestion').click(); + + verifyResponseStatusCode('@getServices', 200); + // Add DBT ingestion cy.contains('Add dbt Ingestion').should('be.visible'); cy.get('[data-testid="dbt-source"]').should('be.visible').click();