cypress: worked on skip test cypress part 2 (#12460)

* cypress: worked on skip test cypress part 2

* fixed failing cypress for glossary
This commit is contained in:
Shailesh Parmar 2023-07-19 14:17:56 +05:30 committed by GitHub
parent 6b46f4e1cb
commit 0cfa519139
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 74 additions and 144 deletions

View File

@ -631,7 +631,7 @@ describe('Glossary page should work properly', () => {
updateDescription('Updated description', false);
});
it.skip('Assets Tab should work properly', () => {
it('Assets Tab should work properly', () => {
selectActiveGlossary(NEW_GLOSSARY.name);
const glossary = NEW_GLOSSARY.name;
const term1 = NEW_GLOSSARY_TERMS.term_1.name;
@ -658,126 +658,79 @@ describe('Glossary page should work properly', () => {
);
visitEntityDetailsPage(entity.term, entity.serviceName, entity.entity);
// Add tag to breadcrumb
// Add glossary tag to entity for mutually exclusive
cy.get(
'[data-testid="glossary-tags-0"] [data-testid="tag-container"] [data-testid="add-tag"]'
)
.eq(0)
.should('be.visible')
.click();
cy.get('[data-testid="tag-selector"]')
.should('be.visible')
.click()
.type(`${glossary}.${term1}`);
cy.get('.ant-select-item-option-content')
.contains(term1)
.should('be.visible')
.click();
cy.get(
'[data-testid="tags-wrapper"] [data-testid="tag-container"]'
).contains(term1);
cy.get('[data-testid="tag-selector"]')
.should('be.visible')
.click()
.type(`${glossary}.${term2}`);
cy.get('.ant-select-item-option-content')
.contains(term2)
.should('be.visible')
.click();
cy.get(
'[data-testid="tags-wrapper"] [data-testid="tag-container"]'
).contains(term2);
'[data-testid="entity-right-panel"] [data-testid="glossary-container"] > [data-testid="entity-tags"]'
).click();
// Select 1st term
cy.get('[data-testid="tag-selector"]').click().type(term1);
cy.get(`[data-testid="tag-${glossary}.${term1}"]`).click();
cy.get('[data-testid="tag-selector"]').should('contain', term1);
// Select 2nd term
cy.get('[data-testid="tag-selector"]').click().type(term2);
cy.get(`[data-testid="tag-${glossary}.${term2}"]`).click();
cy.get('[data-testid="tag-selector"]').should('contain', term2);
interceptURL('GET', '/api/v1/feed/count*', 'countTag');
interceptURL('GET', '/api/v1/tags', 'tags');
interceptURL('PATCH', '/api/v1/tables/*', 'saveTag');
cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView().click();
cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView();
cy.get('[data-testid="saveAssociatedTag"]').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="entity-tags"] [data-testid="add-tag"]')
.scrollIntoView()
.should('be.visible')
.click();
cy.get('[data-testid="tag-selector"]')
.should('be.visible')
.click()
.type(`${glossary1}.${term3}`);
cy.get('.ant-select-item-option-content')
.contains(term3)
.should('be.visible')
.click();
cy.get(
'[data-testid="tags-wrapper"] [data-testid="tag-container"]'
).contains(term3);
'[data-testid="entity-right-panel"] [data-testid="glossary-container"] > [data-testid="entity-tags"]'
).click();
cy.get('[data-testid="tag-selector"]')
.should('be.visible')
.click()
.type(`${glossary1}.${term4}`);
cy.get('.ant-select-item-option-content')
.contains(term4)
.should('be.visible')
.click();
cy.get(
'[data-testid="tags-wrapper"] [data-testid="tag-container"]'
).contains(term4);
// Select 1st term
cy.get('[data-testid="tag-selector"]').click().type(term3);
cy.get(`[data-testid="tag-${glossary1}.${term3}"]`).click();
cy.get('[data-testid="tag-selector"]').should('contain', term3);
// Select 2nd term
cy.get('[data-testid="tag-selector"]').click().type(term4);
cy.get(`[data-testid="tag-${glossary1}.${term4}"]`).click();
cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView().click();
verifyResponseStatusCode('@saveTag', 200);
verifyResponseStatusCode('@countTag', 200);
cy.get('[data-testid="entity-tags"]')
.scrollIntoView()
.should('be.visible')
.contains(term3);
// Add tag to schema table
cy.get(
`[data-testid="glossary-tags-0"] [data-testid="tags-wrapper"]
[data-testid="tag-container"] [data-testid="tags"]`
'[data-testid="entity-right-panel"] [data-testid="glossary-container"]'
)
.scrollIntoView()
.should('be.visible')
.click();
.should('contain', term3)
.should('contain', term4);
cy.get('[data-testid="tag-selector"]')
.should('be.visible')
.click()
.type(`${glossary1}.${term3}`);
cy.get('.ant-select-item-option-content')
.contains(term3)
.should('be.visible')
.click();
// Add tag to schema table
const firstColumn =
'[data-testid="Glossary-tags-0"] > [data-testid="tags-wrapper"] > [data-testid="glossary-container"] > [data-testid="entity-tags"]';
cy.get(firstColumn).scrollIntoView();
cy.get(firstColumn).click();
cy.get('[data-testid="tag-selector"]').click().type(term3);
cy.get(
`.ant-select-dropdown [data-testid="tag-${glossary1}.${term3}"]`
).click();
cy.get('[data-testid="tag-selector"] > .ant-select-selector').contains(
term3
);
cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click();
cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView().click();
verifyResponseStatusCode('@countTag', 200);
cy.get(`[data-testid="tag-${glossary1}.${term3}"]`)
cy.get(
'[data-testid="Glossary-tags-0"] > [data-testid="tags-wrapper"] > [data-testid="glossary-container"]'
)
.scrollIntoView()
.should('be.visible')
.contains(term3);
.should('contain', term3);
cy.get('[data-testid="governance"]')
.should('exist')
.and('be.visible')
.click();
cy.get('[data-testid="appbar-item-glossary"]')
.should('exist')
.should('be.visible')
.click();
cy.get('[data-testid="governance"]').click();
cy.get('[data-testid="appbar-item-glossary"]').click();
cy.get('.ant-menu-item')
.contains(NEW_GLOSSARY_1.name)
.should('be.visible')
.click();
cy.get('.ant-menu-item').contains(NEW_GLOSSARY_1.name).click();
goToAssetsTab(
NEW_GLOSSARY_1_TERMS.term_1.name,
@ -790,7 +743,7 @@ describe('Glossary page should work properly', () => {
.should('be.visible');
});
it.skip('Remove Glossary term from entity should work properly', () => {
it('Remove Glossary term from entity should work properly', () => {
const glossaryName = NEW_GLOSSARY_1.name;
const { name, fullyQualifiedName } = NEW_GLOSSARY_1_TERMS.term_1;
const entity = SEARCH_ENTITY_TABLE.table_3;
@ -806,16 +759,13 @@ describe('Glossary page should work properly', () => {
cy.get('[data-testid="entity-header-display-name"]')
.contains(entity.term)
.should('be.visible')
.click();
verifyResponseStatusCode('@entityDetails', 200);
// redirect to entity detail page
cy.get('[data-testid="entity-tags"]')
.find('[data-testid="edit-button"]')
.scrollIntoView()
.should('be.visible')
.click();
// Remove all added tags from breadcrumb
// Remove all added tags
cy.get(
'[data-testid="entity-right-panel"] [data-testid="glossary-container"] [data-testid="edit-button"]'
).click();
cy.get('[data-testid="remove-tags"]')
.should('be.visible')
.click({ multiple: true });
@ -824,39 +774,33 @@ describe('Glossary page should work properly', () => {
cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView().click();
verifyResponseStatusCode('@removeTags', 200);
cy.get('[data-testid="entity-tags"]')
.should('not.contain', name)
.and('not.contain', 'Personal');
// Remove the added column tag from entity
interceptURL('PATCH', '/api/v1/tables/*', 'removeSchemaTags');
cy.get('[data-testid="glossary-tags-0"] [data-testid="edit-button"]')
cy.get(
'[data-testid="Glossary-tags-0"] > [data-testid="tags-wrapper"] > [data-testid="glossary-container"]'
)
.scrollIntoView()
.trigger('mouseover')
.find('[data-testid="edit-button"]')
.click();
cy.get(
`[data-testid="selected-tag-${glossaryName}.${name}"] [data-testid="remove-tags"`
)
.should('be.visible')
.click();
).click();
cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click();
cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView().click();
verifyResponseStatusCode('@removeSchemaTags', 200);
cy.get('[data-testid="glossary-tags-0"]')
cy.get(
'[data-testid="Glossary-tags-0"] > [data-testid="tags-wrapper"] > [data-testid="glossary-container"]'
)
.scrollIntoView()
.should('not.contain', name)
.and('not.contain', 'Personal');
cy.get('[data-testid="governance"]')
.should('exist')
.should('be.visible')
.click();
cy.get('[data-testid="appbar-item-glossary"]')
.should('exist')
.should('be.visible')
.click();
cy.get('[data-testid="governance"]').click();
cy.get('[data-testid="appbar-item-glossary"]').click();
selectActiveGlossary(NEW_GLOSSARY_1.name);

View File

@ -106,7 +106,7 @@ describe('Tags page should work', () => {
interceptURL('GET', `/api/v1/permissions/classification/*`, 'permissions');
interceptURL(
'GET',
`/api/v1/search/suggest?q=*&index=tag_search_index*glossary_search_index`,
`/api/v1/search/query?q=*%20AND%20disabled%3Afalse&index=tag_search_index*`,
'suggestTag'
);
interceptURL('GET', '/api/v1/tags*', 'getTags');
@ -298,7 +298,7 @@ describe('Tags page should work', () => {
cy.get('[data-testid="tags"] [data-testid="add-tag"]').should('be.visible');
});
it.skip('Add tag at DatabaseSchema level with task & suggestions', () => {
it('Add tag at DatabaseSchema level with task & suggestions', () => {
interceptURL(
'GET',
'/api/v1/permissions/databaseSchema/name/*',
@ -307,12 +307,12 @@ describe('Tags page should work', () => {
interceptURL('PUT', '/api/v1/feed/tasks/*/resolve', 'taskResolve');
interceptURL(
'GET',
'/api/v1/databaseSchemas/name/*?fields=owner,usageSummary,tags',
'/api/v1/databaseSchemas/name/*?fields=*',
'databaseSchemasPage'
);
const entity = SEARCH_ENTITY_TABLE.table_2;
const tag = 'PersonalData.Personal';
const tag = 'Personal';
const assignee = 'admin';
visitEntityDetailsPage(entity.term, entity.serviceName, entity.entity);
@ -333,53 +333,39 @@ describe('Tags page should work', () => {
cy.get(
'[data-testid="select-assignee"] > .ant-select-selector > .ant-select-selection-overflow'
)
.should('be.visible')
.click()
.type(assignee);
cy.get('.ant-select-item-option-content').contains(assignee).click();
// click outside the select box
cy.get('[data-testid="entity-details"]').should('exist').click();
cy.clickOutside();
cy.get(
'[data-testid="select-tags"] > .ant-select-selector > .ant-select-selection-overflow'
)
.should('be.visible')
.click()
.type(tag);
cy.get('[data-testid="tag-selector"]').click().type(tag);
verifyResponseStatusCode('@suggestTag', 200);
cy.get('.ant-select-item-option-content').contains(tag).click();
cy.get('[data-testid="tag-PersonalData.Personal"]').click();
cy.get('[data-testid="tags-label"]').click();
cy.get('[data-testid="submit-tag-request"]').should('be.visible').click();
cy.get('[data-testid="submit-tag-request"]').click();
verifyResponseStatusCode('@taskCreated', 201);
// Accept the tag suggestion which is created
cy.get('.ant-btn-compact-first-item')
.should('be.visible')
.contains('Accept Suggestion')
.click();
cy.get('.ant-btn-compact-first-item').contains('Accept Suggestion').click();
verifyResponseStatusCode('@taskResolve', 200);
verifyResponseStatusCode('@databaseSchemasPage', 200);
cy.get('[data-testid="entity-tags"]')
.scrollIntoView()
.should('be.visible')
.contains(tag);
cy.get('[data-testid="entity-tags"]').scrollIntoView().contains(tag);
cy.get('[data-testid="add-tag"]').should('exist').click();
cy.get('[data-testid="edit-button"]').click();
// Remove all added tags
cy.get('[data-testid="remove-tags"]').eq(0).should('be.visible').click();
cy.get('[data-testid="remove-tags"]').click({ multiple: true });
interceptURL('PATCH', '/api/v1/databaseSchemas/*', 'removeTags');
cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView().click();
verifyResponseStatusCode('@removeTags', 200);
cy.get('[data-testid="tags"] [data-testid="add-tag"]').should('be.visible');
});
it('Check Usage of tag and it should redirect to explore page with tags filter', () => {

View File

@ -725,7 +725,7 @@ const DatabaseSchemaPage: FunctionComponent = () => {
<ActivityFeedProvider>
<ActivityFeedTab
entityType={EntityType.DATABASE_SCHEMA}
fqn={databaseSchema?.fullyQualifiedName ?? ''}
fqn={databaseSchemaFQN}
onFeedUpdate={getEntityFeedCount}
onUpdateEntityDetails={getDetailsByFQN}
/>