From c7e899c55b92c84b73b57545fd6af631b7caaac8 Mon Sep 17 00:00:00 2001 From: Karan Hotchandani <33024356+karanh37@users.noreply.github.com> Date: Fri, 26 Jan 2024 09:42:24 +0530 Subject: [PATCH] fix flaky lineage cypress (#14878) --- .../ui/cypress/constants/lineage.constants.js | 16 ++++++--- .../ui/cypress/e2e/Flow/Lineage.spec.js | 34 ++++++++++++------- 2 files changed, 33 insertions(+), 17 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/lineage.constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/lineage.constants.js index e523326ad9e..17331870b7d 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/lineage.constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/lineage.constants.js @@ -16,14 +16,14 @@ export const PIPELINE_SUPPORTED_TYPES = ['Table', 'Topic']; export const LINEAGE_ITEMS = [ { - term: 'fact_sale', - displayName: 'fact_sale', + term: 'marketing', + displayName: 'marketing', entity: DATA_ASSETS.tables, serviceName: 'sample_data', entityType: 'Table', - fqn: 'sample_data.ecommerce_db.shopify.fact_sale', + fqn: 'sample_data.ecommerce_db.shopify.marketing', searchIndex: SEARCH_INDEX.tables, - columns: ['sample_data.ecommerce_db.shopify.fact_sale.shop_id'], + columns: ['sample_data.ecommerce_db.shopify.marketing.ad_id'], }, { term: 'fact_session', @@ -61,6 +61,14 @@ export const LINEAGE_ITEMS = [ fqn: 's3_storage_sample.departments.media', searchIndex: SEARCH_INDEX.containers, }, + { + term: 'customers', + entity: DATA_ASSETS.dashboards, + serviceName: 'sample_looker', + entityType: 'Dashboard', + fqn: 'sample_looker.customers', + searchIndex: SEARCH_INDEX.dashboards, + }, ]; export const PIPELINE_ITEMS = [ diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Lineage.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Lineage.spec.js index e9d135c479c..8f5eaff76ea 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Lineage.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Lineage.spec.js @@ -30,8 +30,10 @@ const dragConnection = (sourceId, targetId) => { .click({ force: true }); // Adding force true for handles because it can be hidden behind the node }; -const performFitView = () => { - cy.get('.react-flow__controls-fitview').click({ force: true }); +const performZoomOut = () => { + for (let i = 0; i < 7; i++) { + cy.get('.react-flow__controls-zoomout').click({ force: true }); + } }; const connectEdgeBetweenNodes = (fromNode, toNode) => { @@ -63,7 +65,6 @@ const connectEdgeBetweenNodes = (fromNode, toNode) => { }; const verifyNodePresent = (node) => { - performFitView(); cy.get(`[data-testid="lineage-node-${node.fqn}"]`).should('be.visible'); cy.get( `[data-testid="lineage-node-${node.fqn}"] [data-testid="entity-header-name"]` @@ -71,7 +72,6 @@ const verifyNodePresent = (node) => { }; const deleteNode = (node) => { - performFitView(); interceptURL('DELETE', '/api/v1/lineage/**', 'lineageDeleteApi'); cy.get(`[data-testid="lineage-node-${node.fqn}"]`).click({ force: true }); // Adding force true for handles because it can be hidden behind the node @@ -142,6 +142,9 @@ const addPipelineBetweenNodes = ( cy.get('[data-testid="lineage"]').click(); cy.get('[data-testid="edit-lineage"]').click(); + + performZoomOut(); + connectEdgeBetweenNodes(sourceEntity, targetEntity); if (pipelineItem) { applyPipelineFromModal(sourceEntity, targetEntity, pipelineItem); @@ -155,22 +158,21 @@ const addPipelineBetweenNodes = ( } }; -const expandCols = (nodeFqn) => { +const expandCols = (nodeFqn, hasShowMore) => { cy.get( `[data-testid="lineage-node-${nodeFqn}"] [data-testid="expand-cols-btn"]` ).click({ force: true }); - cy.get( - `[data-testid="lineage-node-${nodeFqn}"] [data-testid="show-more-cols-btn"]` - ).click({ force: true }); + if (hasShowMore) { + cy.get( + `[data-testid="lineage-node-${nodeFqn}"] [data-testid="show-more-cols-btn"]` + ).click({ force: true }); + } }; const addColumnLineage = (fromNode, toNode) => { interceptURL('PUT', '/api/v1/lineage', 'lineageApi'); - performFitView(); - expandCols(fromNode.fqn); - performFitView(); - expandCols(toNode.fqn); - performFitView(); + expandCols(fromNode.fqn, false); + expandCols(toNode.fqn, true); dragConnection( `column-${fromNode.columns[0]}`, `column-${toNode.columns[0]}` @@ -198,6 +200,8 @@ describe('Lineage verification', () => { cy.get('[data-testid="lineage"]').click(); cy.get('[data-testid="edit-lineage"]').click(); + performZoomOut(); + // Connect the current entity to all others in the array except itself for (let i = 0; i < LINEAGE_ITEMS.length; i++) { if (i !== index) { @@ -208,6 +212,8 @@ describe('Lineage verification', () => { cy.get('[data-testid="edit-lineage"]').click(); cy.reload(); + performZoomOut(); + // Verify Added Nodes for (let i = 0; i < LINEAGE_ITEMS.length; i++) { if (i !== index) { @@ -228,6 +234,8 @@ describe('Lineage verification', () => { cy.get('[data-testid="lineage"]').click(); cy.get('[data-testid="edit-lineage"]').click(); + performZoomOut(); + // Delete Nodes for (let i = 0; i < LINEAGE_ITEMS.length; i++) { if (i !== index) {