mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-06 21:43:37 +00:00
UI : Added cypress for mutually exclusive tags (#9804)
* Added cypress for mutually exclusive tags * chanegs as per comments Co-authored-by: Sachin Chaurasiya <sachinchaurasiyachotey87@gmail.com>
This commit is contained in:
parent
04dae8bc75
commit
ca20029d75
@ -210,6 +210,13 @@ export const NEW_GLOSSARY = {
|
|||||||
reviewer: 'Aaron Johnson',
|
reviewer: 'Aaron Johnson',
|
||||||
tag: 'PII.None',
|
tag: 'PII.None',
|
||||||
};
|
};
|
||||||
|
export const NEW_GLOSSARY_1 = {
|
||||||
|
name: 'Product Glossary',
|
||||||
|
description: 'This is the Product glossary',
|
||||||
|
reviewer: 'Brandy Miller',
|
||||||
|
tag: 'PII.None',
|
||||||
|
};
|
||||||
|
|
||||||
export const NEW_GLOSSARY_TERMS = {
|
export const NEW_GLOSSARY_TERMS = {
|
||||||
term_1: {
|
term_1: {
|
||||||
name: 'Purchase',
|
name: 'Purchase',
|
||||||
@ -223,6 +230,19 @@ export const NEW_GLOSSARY_TERMS = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const NEW_GLOSSARY_1_TERMS = {
|
||||||
|
term_1: {
|
||||||
|
name: 'Features',
|
||||||
|
description: 'This is the Features',
|
||||||
|
synonyms: 'data,collect,time',
|
||||||
|
},
|
||||||
|
term_2: {
|
||||||
|
name: 'Uses',
|
||||||
|
description: 'This is the Uses',
|
||||||
|
synonyms: 'home,business,adventure',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
export const service = {
|
export const service = {
|
||||||
name: 'Glue',
|
name: 'Glue',
|
||||||
description: 'This is a Glue service',
|
description: 'This is a Glue service',
|
||||||
|
|||||||
@ -21,6 +21,8 @@ import {
|
|||||||
import {
|
import {
|
||||||
DELETE_TERM,
|
DELETE_TERM,
|
||||||
NEW_GLOSSARY,
|
NEW_GLOSSARY,
|
||||||
|
NEW_GLOSSARY_1,
|
||||||
|
NEW_GLOSSARY_1_TERMS,
|
||||||
NEW_GLOSSARY_TERMS,
|
NEW_GLOSSARY_TERMS,
|
||||||
SEARCH_ENTITY_TABLE,
|
SEARCH_ENTITY_TABLE,
|
||||||
} from '../../constants/constants';
|
} from '../../constants/constants';
|
||||||
@ -37,12 +39,12 @@ const visitGlossaryTermPage = (termName) => {
|
|||||||
.click();
|
.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
const createGlossaryTerm = (term) => {
|
const createGlossaryTerm = (term, glossary, isMutually = false) => {
|
||||||
cy.get('[data-testid="breadcrumb-link"]')
|
cy.get('[data-testid="breadcrumb-link"]')
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.should('exist')
|
.should('exist')
|
||||||
.and('be.visible')
|
.and('be.visible')
|
||||||
.contains(NEW_GLOSSARY.name)
|
.contains(glossary.name)
|
||||||
.should('exist');
|
.should('exist');
|
||||||
cy.get('[data-testid="add-new-tag-button"]').should('be.visible').click();
|
cy.get('[data-testid="add-new-tag-button"]').should('be.visible').click();
|
||||||
|
|
||||||
@ -59,12 +61,13 @@ const createGlossaryTerm = (term) => {
|
|||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.type(term.synonyms);
|
.type(term.synonyms);
|
||||||
|
if (isMutually) {
|
||||||
cy.get('[data-testid="mutually-exclusive-button"]')
|
cy.get('[data-testid="mutually-exclusive-button"]')
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.should('exist')
|
.should('exist')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.click();
|
.click();
|
||||||
|
}
|
||||||
cy.get('[data-testid="references"] > .ant-space-item > .button-comp')
|
cy.get('[data-testid="references"] > .ant-space-item > .button-comp')
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
@ -92,7 +95,7 @@ const createGlossaryTerm = (term) => {
|
|||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
};
|
};
|
||||||
|
|
||||||
const deleteGlossary = ({ name }) => {
|
const deleteGlossaryTerm = ({ name }) => {
|
||||||
visitGlossaryTermPage(name);
|
visitGlossaryTermPage(name);
|
||||||
cy.wait(500);
|
cy.wait(500);
|
||||||
cy.get('[data-testid="inactive-link"]').contains(name).should('be.visible');
|
cy.get('[data-testid="inactive-link"]').contains(name).should('be.visible');
|
||||||
@ -245,6 +248,34 @@ describe('Glossary page should work properly', () => {
|
|||||||
cy.contains(NEW_GLOSSARY.name);
|
cy.contains(NEW_GLOSSARY.name);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Adding another Glossary with mutually exclusive flag off
|
||||||
|
cy.get('[data-testid="add-glossary"]').should('be.visible').click();
|
||||||
|
cy.get('[data-testid="name"]')
|
||||||
|
.scrollIntoView()
|
||||||
|
.should('be.visible')
|
||||||
|
.type(NEW_GLOSSARY_1.name);
|
||||||
|
|
||||||
|
cy.get(descriptionBox)
|
||||||
|
.scrollIntoView()
|
||||||
|
.should('be.visible')
|
||||||
|
.type(NEW_GLOSSARY_1.description);
|
||||||
|
|
||||||
|
cy.get('[data-testid="save-glossary"]')
|
||||||
|
.scrollIntoView()
|
||||||
|
.should('be.visible')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.wait('@createGlossary').then(() => {
|
||||||
|
cy.url().should('include', '/glossary/');
|
||||||
|
cy.get('[data-testid="breadcrumb-link"]')
|
||||||
|
.scrollIntoView()
|
||||||
|
.should('exist')
|
||||||
|
.and('be.visible')
|
||||||
|
.within(() => {
|
||||||
|
cy.contains(NEW_GLOSSARY_1.name);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Verify added glossary details', () => {
|
it('Verify added glossary details', () => {
|
||||||
@ -268,12 +299,41 @@ describe('Glossary page should work properly', () => {
|
|||||||
.then((text) => {
|
.then((text) => {
|
||||||
expect(text).to.contain(NEW_GLOSSARY.reviewer);
|
expect(text).to.contain(NEW_GLOSSARY.reviewer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Verify Product glossary details
|
||||||
|
cy.get('.ant-menu-item')
|
||||||
|
.contains(NEW_GLOSSARY_1.name)
|
||||||
|
.should('be.visible')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get('[data-testid="glossary-left-panel"]')
|
||||||
|
.contains(NEW_GLOSSARY_1.name)
|
||||||
|
.should('be.visible');
|
||||||
|
cy.get('[data-testid="header"]')
|
||||||
|
.invoke('text')
|
||||||
|
.then((text) => {
|
||||||
|
expect(text).to.contain(NEW_GLOSSARY_1.name);
|
||||||
|
});
|
||||||
|
cy.get('[data-testid="viewer-container"]')
|
||||||
|
.invoke('text')
|
||||||
|
.then((text) => {
|
||||||
|
expect(text).to.contain(NEW_GLOSSARY_1.description);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Create glossary term should work properly', () => {
|
it('Create glossary term should work properly', () => {
|
||||||
const terms = Object.values(NEW_GLOSSARY_TERMS);
|
const terms = Object.values(NEW_GLOSSARY_TERMS);
|
||||||
|
terms.forEach((term) => createGlossaryTerm(term, NEW_GLOSSARY, true));
|
||||||
|
|
||||||
terms.forEach(createGlossaryTerm);
|
// Glossary term for Product glossary
|
||||||
|
|
||||||
|
cy.get('.ant-menu-item')
|
||||||
|
.contains(NEW_GLOSSARY_1.name)
|
||||||
|
.should('be.visible')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
const ProductTerms = Object.values(NEW_GLOSSARY_1_TERMS);
|
||||||
|
ProductTerms.forEach((term) => createGlossaryTerm(term, NEW_GLOSSARY_1));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Updating data of glossary should work properly', () => {
|
it('Updating data of glossary should work properly', () => {
|
||||||
@ -484,9 +544,21 @@ describe('Glossary page should work properly', () => {
|
|||||||
|
|
||||||
it('Assets Tab should work properly', () => {
|
it('Assets Tab should work properly', () => {
|
||||||
const glossary = NEW_GLOSSARY.name;
|
const glossary = NEW_GLOSSARY.name;
|
||||||
const term = NEW_GLOSSARY_TERMS.term_1.name;
|
const term1 = NEW_GLOSSARY_TERMS.term_1.name;
|
||||||
|
const term2 = NEW_GLOSSARY_TERMS.term_2.name;
|
||||||
|
|
||||||
|
const glossary1 = NEW_GLOSSARY_1.name;
|
||||||
|
const term3 = NEW_GLOSSARY_1_TERMS.term_1.name;
|
||||||
|
const term4 = NEW_GLOSSARY_1_TERMS.term_2.name;
|
||||||
|
|
||||||
const entity = SEARCH_ENTITY_TABLE.table_3;
|
const entity = SEARCH_ENTITY_TABLE.table_3;
|
||||||
goToAssetsTab(term);
|
|
||||||
|
cy.get('.ant-menu-item')
|
||||||
|
.contains(NEW_GLOSSARY_1.name)
|
||||||
|
.should('be.visible')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
goToAssetsTab(term3);
|
||||||
cy.contains('No assets available.').should('be.visible');
|
cy.contains('No assets available.').should('be.visible');
|
||||||
cy.get('[data-testid="no-data-image"]').should('be.visible');
|
cy.get('[data-testid="no-data-image"]').should('be.visible');
|
||||||
visitEntityDetailsPage(entity.term, entity.serviceName, entity.entity);
|
visitEntityDetailsPage(entity.term, entity.serviceName, entity.entity);
|
||||||
@ -499,22 +571,62 @@ describe('Glossary page should work properly', () => {
|
|||||||
cy.get('[data-testid="tag-selector"]')
|
cy.get('[data-testid="tag-selector"]')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.click()
|
.click()
|
||||||
.type(`${glossary}.${term}`);
|
.type(`${glossary}.${term1}`);
|
||||||
cy.get(`[title*="${term}"]`).should('be.visible').click();
|
cy.get(`[title*="${term1}"]`).should('be.visible').click();
|
||||||
cy.get(
|
cy.get(
|
||||||
'[data-testid="tags-wrapper"] [data-testid="tag-container"]'
|
'[data-testid="tags-wrapper"] [data-testid="tag-container"]'
|
||||||
).contains(term);
|
).contains(term1);
|
||||||
|
|
||||||
interceptURL('GET', '/api/v1/feed/count*', 'saveTag');
|
cy.get('[data-testid="tag-selector"]')
|
||||||
|
.should('be.visible')
|
||||||
|
.click()
|
||||||
|
.type(`${glossary}.${term2}`);
|
||||||
|
cy.get(`[title*="${term2}"]`).should('be.visible').click();
|
||||||
|
cy.get(
|
||||||
|
'[data-testid="tags-wrapper"] [data-testid="tag-container"]'
|
||||||
|
).contains(term2);
|
||||||
|
|
||||||
|
interceptURL('GET', '/api/v1/feed/count*', 'countTag');
|
||||||
interceptURL('GET', '/api/v1/tags', 'tags');
|
interceptURL('GET', '/api/v1/tags', 'tags');
|
||||||
|
interceptURL('PATCH', '/api/v1/tables/*', 'saveTag');
|
||||||
|
|
||||||
cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click();
|
cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click();
|
||||||
|
verifyResponseStatusCode('@saveTag', 400);
|
||||||
|
toastNotification(
|
||||||
|
`Tag labels ${glossary}.${term2} and ${glossary}.${term1} are mutually exclusive and can't be assigned together`
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add non mutually exclusive tags
|
||||||
|
cy.get('[data-testid="tag-container"] [data-testid="tags"]')
|
||||||
|
.eq(0)
|
||||||
|
.should('be.visible')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
cy.get('[data-testid="tag-selector"]')
|
||||||
|
.should('be.visible')
|
||||||
|
.click()
|
||||||
|
.type(`${glossary1}.${term3}`);
|
||||||
|
cy.get(`[title*="${term3}"]`).should('be.visible').click();
|
||||||
|
cy.get(
|
||||||
|
'[data-testid="tags-wrapper"] [data-testid="tag-container"]'
|
||||||
|
).contains(term3);
|
||||||
|
|
||||||
|
cy.get('[data-testid="tag-selector"]')
|
||||||
|
.should('be.visible')
|
||||||
|
.click()
|
||||||
|
.type(`${glossary1}.${term4}`);
|
||||||
|
cy.get(`[title*="${term4}"]`).should('be.visible').click();
|
||||||
|
cy.get(
|
||||||
|
'[data-testid="tags-wrapper"] [data-testid="tag-container"]'
|
||||||
|
).contains(term4);
|
||||||
|
|
||||||
|
cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click();
|
||||||
verifyResponseStatusCode('@saveTag', 200);
|
verifyResponseStatusCode('@saveTag', 200);
|
||||||
|
verifyResponseStatusCode('@countTag', 200);
|
||||||
cy.get('[data-testid="entity-tags"]')
|
cy.get('[data-testid="entity-tags"]')
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.contains(term);
|
.contains(term3);
|
||||||
|
|
||||||
// Add tag to schema table
|
// Add tag to schema table
|
||||||
cy.get(
|
cy.get(
|
||||||
@ -527,18 +639,18 @@ describe('Glossary page should work properly', () => {
|
|||||||
cy.get('[data-testid="tag-selector"]')
|
cy.get('[data-testid="tag-selector"]')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.click()
|
.click()
|
||||||
.type(`${glossary}.${term}`);
|
.type(`${glossary1}.${term3}`);
|
||||||
cy.get(`[title*="${term}"]`).should('be.visible').click();
|
cy.get(`[title*="${term3}"]`).should('be.visible').click();
|
||||||
|
|
||||||
cy.get(
|
cy.get(
|
||||||
'[data-row-key="comments"] [data-testid="tags-wrapper"] [data-testid="tag-container"]'
|
'[data-row-key="comments"] [data-testid="tags-wrapper"] [data-testid="tag-container"]'
|
||||||
).contains(term);
|
).contains(term3);
|
||||||
cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click();
|
cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click();
|
||||||
verifyResponseStatusCode('@saveTag', 200);
|
verifyResponseStatusCode('@countTag', 200);
|
||||||
cy.get(`[data-testid="tag-${glossary}.${term}"]`)
|
cy.get(`[data-testid="tag-${glossary1}.${term3}"]`)
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.contains(term);
|
.contains(term3);
|
||||||
|
|
||||||
cy.get('[data-testid="governance"]')
|
cy.get('[data-testid="governance"]')
|
||||||
.should('exist')
|
.should('exist')
|
||||||
@ -549,16 +661,26 @@ describe('Glossary page should work properly', () => {
|
|||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
goToAssetsTab(term);
|
cy.get('.ant-menu-item')
|
||||||
|
.contains(NEW_GLOSSARY_1.name)
|
||||||
|
.should('be.visible')
|
||||||
|
.click();
|
||||||
|
goToAssetsTab(term3);
|
||||||
|
|
||||||
cy.get(`[data-testid="${entity.serviceName}-${entity.term}"]`)
|
cy.get(`[data-testid="${entity.serviceName}-${entity.term}"]`)
|
||||||
.contains(entity.term)
|
.contains(entity.term)
|
||||||
.should('be.visible');
|
.should('be.visible');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Remove Glossary term from entity should work properly', () => {
|
it('Remove Glossary term from entity should work properly', () => {
|
||||||
const term = NEW_GLOSSARY_TERMS.term_1.name;
|
const term = NEW_GLOSSARY_1_TERMS.term_1.name;
|
||||||
const entity = SEARCH_ENTITY_TABLE.table_3;
|
const entity = SEARCH_ENTITY_TABLE.table_3;
|
||||||
|
|
||||||
|
cy.get('.ant-menu-item')
|
||||||
|
.contains(NEW_GLOSSARY_1.name)
|
||||||
|
.should('be.visible')
|
||||||
|
.click();
|
||||||
|
|
||||||
interceptURL('GET', '/api/v1/search/query*', 'assetTab');
|
interceptURL('GET', '/api/v1/search/query*', 'assetTab');
|
||||||
// go assets tab
|
// go assets tab
|
||||||
goToAssetsTab(term);
|
goToAssetsTab(term);
|
||||||
@ -595,9 +717,6 @@ describe('Glossary page should work properly', () => {
|
|||||||
.should('not.contain', term)
|
.should('not.contain', term)
|
||||||
.and('not.contain', 'Personal');
|
.and('not.contain', 'Personal');
|
||||||
// Remove the added column tag from entity
|
// Remove the added column tag from entity
|
||||||
|
|
||||||
cy.get('[data-testid="remove"]').eq(0).should('be.visible').click();
|
|
||||||
cy.wait(200);
|
|
||||||
interceptURL('PATCH', '/api/v1/tables/*', 'removeSchemaTags');
|
interceptURL('PATCH', '/api/v1/tables/*', 'removeSchemaTags');
|
||||||
cy.get('[data-testid="remove"]').eq(0).should('be.visible').click();
|
cy.get('[data-testid="remove"]').eq(0).should('be.visible').click();
|
||||||
verifyResponseStatusCode('@removeSchemaTags', 200);
|
verifyResponseStatusCode('@removeSchemaTags', 200);
|
||||||
@ -616,6 +735,12 @@ describe('Glossary page should work properly', () => {
|
|||||||
.click();
|
.click();
|
||||||
|
|
||||||
cy.wait(500);
|
cy.wait(500);
|
||||||
|
|
||||||
|
cy.get('.ant-menu-item')
|
||||||
|
.contains(NEW_GLOSSARY_1.name)
|
||||||
|
.should('be.visible')
|
||||||
|
.click();
|
||||||
|
|
||||||
goToAssetsTab(term);
|
goToAssetsTab(term);
|
||||||
cy.contains('No assets available.').should('be.visible');
|
cy.contains('No assets available.').should('be.visible');
|
||||||
cy.get('[data-testid="no-data-image"]').should('be.visible');
|
cy.get('[data-testid="no-data-image"]').should('be.visible');
|
||||||
@ -624,14 +749,23 @@ describe('Glossary page should work properly', () => {
|
|||||||
it('Delete glossary term should work properly', () => {
|
it('Delete glossary term should work properly', () => {
|
||||||
const terms = Object.values(NEW_GLOSSARY_TERMS);
|
const terms = Object.values(NEW_GLOSSARY_TERMS);
|
||||||
|
|
||||||
terms.forEach(deleteGlossary);
|
terms.forEach(deleteGlossaryTerm);
|
||||||
|
// Glossary term for Product glossary
|
||||||
|
|
||||||
|
cy.get('.ant-menu-item')
|
||||||
|
.contains(NEW_GLOSSARY_1.name)
|
||||||
|
.should('be.visible')
|
||||||
|
.click();
|
||||||
|
|
||||||
|
Object.values(NEW_GLOSSARY_1_TERMS).forEach(deleteGlossaryTerm);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Delete glossary should work properly', () => {
|
it('Delete glossary should work properly', () => {
|
||||||
|
[NEW_GLOSSARY.name, NEW_GLOSSARY_1.name].forEach((glossary) => {
|
||||||
verifyResponseStatusCode('@fetchGlossaries', 200);
|
verifyResponseStatusCode('@fetchGlossaries', 200);
|
||||||
cy.get('[data-testid="header"]')
|
cy.get('[data-testid="header"]')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.contains(NEW_GLOSSARY.name)
|
.contains(glossary)
|
||||||
.should('exist');
|
.should('exist');
|
||||||
cy.get('[data-testid="manage-button"]').should('be.visible').click();
|
cy.get('[data-testid="manage-button"]').should('be.visible').click();
|
||||||
cy.get('[data-testid="delete-button"]')
|
cy.get('[data-testid="delete-button"]')
|
||||||
@ -647,7 +781,7 @@ describe('Glossary page should work properly', () => {
|
|||||||
});
|
});
|
||||||
cy.get('[data-testid="modal-header"]')
|
cy.get('[data-testid="modal-header"]')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.should('contain', `Delete ${NEW_GLOSSARY.name}`);
|
.should('contain', `Delete ${glossary}`);
|
||||||
cy.get('[data-testid="confirmation-text-input"]')
|
cy.get('[data-testid="confirmation-text-input"]')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
.type(DELETE_TERM);
|
.type(DELETE_TERM);
|
||||||
@ -659,6 +793,7 @@ describe('Glossary page should work properly', () => {
|
|||||||
verifyResponseStatusCode('@getGlossary', 200);
|
verifyResponseStatusCode('@getGlossary', 200);
|
||||||
|
|
||||||
toastNotification('Glossary deleted successfully!');
|
toastNotification('Glossary deleted successfully!');
|
||||||
|
});
|
||||||
cy.contains('Add New Glossary').should('be.visible');
|
cy.contains('Add New Glossary').should('be.visible');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user