diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.ts b/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.ts index 0efa12ef02d..e26524d77db 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/DomainUtils.ts @@ -26,6 +26,12 @@ import { } from './common'; import { visitEntityDetailsPage } from './Utils/Entity'; +const selectDomain = (domainObj) => { + cy.get('[data-testid="domain-left-panel"]') + .find(`li[data-menu-id$='${domainObj.fullyQualifiedName}']`) + .click(); +}; + export const validateDomainForm = () => { // error messages cy.get('#name_help') @@ -97,14 +103,14 @@ const updateOwner = (newOwner) => { }; const goToAssetsTab = (domainObj) => { - cy.get('[data-testid="domain-left-panel"]').contains(domainObj.name).click(); + selectDomain(domainObj); checkDisplayName(domainObj.name); cy.get('[data-testid="assets"]').should('be.visible').click(); cy.get('.ant-tabs-tab-active').contains('Assets').should('be.visible'); }; const goToDataProductsTab = (domainObj) => { - cy.get('[data-testid="domain-left-panel"]').contains(domainObj.name).click(); + selectDomain(domainObj); checkDisplayName(domainObj.name); cy.get('[data-testid="data_products"]').click(); cy.get('.ant-tabs-tab-active').contains('Data Products').should('be.visible'); @@ -309,7 +315,7 @@ export const deleteDomain = (domainObj) => { }; export const verifyDomain = (domainObj) => { - cy.get('[data-testid="domain-left-panel"]').contains(domainObj.name).click(); + selectDomain(domainObj); checkDisplayName(domainObj.name); cy.get('[data-testid="viewer-container"]') @@ -332,7 +338,7 @@ export const verifyDomain = (domainObj) => { }; export const updateDomainDetails = (domainObj) => { - cy.get('[data-testid="domain-left-panel"]').contains(domainObj.name).click(); + selectDomain(domainObj); checkDisplayName(domainObj.name); // Update description @@ -343,7 +349,7 @@ export const updateDomainDetails = (domainObj) => { }; export const createDataProducts = (dataProduct, domainObj) => { - cy.get('[data-testid="domain-left-panel"]').contains(domainObj.name).click(); + selectDomain(domainObj); checkDisplayName(domainObj.name); cy.get('[data-testid="domain-details-add-button"]').click(); @@ -369,7 +375,7 @@ export const createDataProducts = (dataProduct, domainObj) => { export const renameDomain = (domainObj) => { interceptURL('PATCH', `/api/v1/domains/*`, 'patchName&DisplayName'); - cy.get('[data-testid="domain-left-panel"]').contains(domainObj.name).click(); + selectDomain(domainObj); checkDisplayName(domainObj.name); cy.get('[data-testid="manage-button"]').click(); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.ts b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.ts index 320dcb5ce63..408b3f765c2 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.ts @@ -384,33 +384,35 @@ export const CYPRESS_ASSETS_GLOSSARY_TERMS = { }, }; +const assetTermsUUId = uuid(); + export const CYPRESS_ASSETS_GLOSSARY_TERMS_1 = { term_1: { - name: 'Term1', + name: `Term1_${assetTermsUUId}`, description: 'term1 desc', - fullyQualifiedName: `${cypressAssetsGlossary1Name}.Term1`, + fullyQualifiedName: `${cypressAssetsGlossary1Name}.Term1_${assetTermsUUId}`, synonyms: 'buy,collect,acquire', assets: COMMON_ASSETS, }, term_2: { - name: 'Term2', + name: `Term2_${assetTermsUUId}`, description: 'term2 desc', synonyms: 'give,disposal,deal', - fullyQualifiedName: `${cypressAssetsGlossary1Name}.Term2`, + fullyQualifiedName: `${cypressAssetsGlossary1Name}.Term2_${assetTermsUUId}`, assets: COMMON_ASSETS, }, term_3: { - name: 'Term3', + name: `Term3_${assetTermsUUId}`, synonyms: 'tea,coffee,water', description: 'term3 desc', - fullyQualifiedName: `${cypressAssetsGlossary1Name}.Term3`, + fullyQualifiedName: `${cypressAssetsGlossary1Name}.Term3_${assetTermsUUId}`, assets: COMMON_ASSETS, }, term_4: { - name: 'Term4', + name: `Term4_${assetTermsUUId}`, description: 'term4 desc', synonyms: 'milk,biscuit,water', - fullyQualifiedName: `${cypressAssetsGlossary1Name}.Term4`, + fullyQualifiedName: `${cypressAssetsGlossary1Name}.Term4_${assetTermsUUId}`, assets: COMMON_ASSETS, }, }; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Glossary.spec.ts b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Glossary.spec.ts index b7ccb5c5e53..76de6a141db 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Glossary.spec.ts +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Pages/Glossary.spec.ts @@ -83,7 +83,7 @@ const visitGlossaryTermPage = ( cy.get('.ant-tabs .glossary-overview-tab').should('be.visible').click(); }; -const createGlossary = (glossaryData) => { +const createGlossary = (glossaryData, bValidateForm) => { // Intercept API calls interceptURL('POST', '/api/v1/glossaries', 'createGlossary'); interceptURL( @@ -106,7 +106,9 @@ const createGlossary = (glossaryData) => { .should('be.visible') .click(); - validateForm(); + if (bValidateForm) { + validateForm(); + } cy.get('[data-testid="name"]') .scrollIntoView() @@ -206,7 +208,11 @@ const validateForm = () => { cy.get('#name_help').should('be.visible').contains(NAME_VALIDATION_ERROR); }; -const fillGlossaryTermDetails = (term, glossary, isMutually = false) => { +const fillGlossaryTermDetails = ( + term, + isMutually = false, + validateCreateForm = true +) => { cy.get('[data-testid="add-new-tag-button-header"]').click(); cy.contains('Add Glossary Term').should('be.visible'); @@ -217,7 +223,9 @@ const fillGlossaryTermDetails = (term, glossary, isMutually = false) => { .should('be.visible') .click(); - validateForm(); + if (validateCreateForm) { + validateForm(); + } cy.get('[data-testid="name"]') .scrollIntoView() @@ -321,8 +329,14 @@ const removeAssetsFromGlossaryTerm = (glossaryTerm, glossary) => { }); }; -const createGlossaryTerm = (term, glossary, status, isMutually = false) => { - fillGlossaryTermDetails(term, glossary, isMutually); +const createGlossaryTerm = ( + term, + glossary, + status, + isMutually = false, + validateCreateForm = true +) => { + fillGlossaryTermDetails(term, isMutually, validateCreateForm); interceptURL('POST', '/api/v1/glossaryTerms', 'createGlossaryTerms'); cy.get('[data-testid="save-glossary-term"]') @@ -733,8 +747,8 @@ describe('Glossary page should work properly', { tags: 'Governance' }, () => { }); it('Create new glossary flow should work properly', () => { - createGlossary(NEW_GLOSSARY); - createGlossary(NEW_GLOSSARY_1); + createGlossary(NEW_GLOSSARY, true); + createGlossary(NEW_GLOSSARY_1, false); }); it('Assign Owner', () => { @@ -827,8 +841,8 @@ describe('Glossary page should work properly', { tags: 'Governance' }, () => { it('Create glossary term should work properly', () => { const terms = Object.values(NEW_GLOSSARY_TERMS); selectActiveGlossary(NEW_GLOSSARY.name); - terms.forEach((term) => - createGlossaryTerm(term, NEW_GLOSSARY, 'Draft', true) + terms.forEach((term, index) => + createGlossaryTerm(term, NEW_GLOSSARY, 'Draft', true, index === 0) ); // Glossary term for Product glossary @@ -836,7 +850,7 @@ describe('Glossary page should work properly', { tags: 'Governance' }, () => { const ProductTerms = Object.values(NEW_GLOSSARY_1_TERMS); ProductTerms.forEach((term) => - createGlossaryTerm(term, NEW_GLOSSARY_1, 'Approved', false) + createGlossaryTerm(term, NEW_GLOSSARY_1, 'Approved', false, false) ); }); @@ -1112,11 +1126,11 @@ describe('Glossary page should work properly', { tags: 'Governance' }, () => { }); it('Add asset to glossary term using asset modal', () => { - createGlossary(CYPRESS_ASSETS_GLOSSARY); + createGlossary(CYPRESS_ASSETS_GLOSSARY, false); const terms = Object.values(CYPRESS_ASSETS_GLOSSARY_TERMS); selectActiveGlossary(CYPRESS_ASSETS_GLOSSARY.name); terms.forEach((term) => - createGlossaryTerm(term, CYPRESS_ASSETS_GLOSSARY, 'Approved', true) + createGlossaryTerm(term, CYPRESS_ASSETS_GLOSSARY, 'Approved', true, false) ); terms.forEach((term) => { @@ -1202,12 +1216,18 @@ describe('Glossary page should work properly', { tags: 'Governance' }, () => { }); it('Tags and entity summary columns should be sorted based on current Term Page', () => { - createGlossary(CYPRESS_ASSETS_GLOSSARY_1); + createGlossary(CYPRESS_ASSETS_GLOSSARY_1, false); selectActiveGlossary(CYPRESS_ASSETS_GLOSSARY_1.name); const terms = Object.values(CYPRESS_ASSETS_GLOSSARY_TERMS_1); terms.forEach((term) => - createGlossaryTerm(term, CYPRESS_ASSETS_GLOSSARY_1, 'Approved', true) + createGlossaryTerm( + term, + CYPRESS_ASSETS_GLOSSARY_1, + 'Approved', + true, + false + ) ); const entityTable = SEARCH_ENTITY_TABLE.table_1;