fix flaky lineage cypress (#14878)

This commit is contained in:
Karan Hotchandani 2024-01-26 09:42:24 +05:30 committed by GitHub
parent 1786757e9b
commit c7e899c55b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 17 deletions

View File

@ -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 = [

View File

@ -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) {