2022-06-01 11:36:36 +05:30
|
|
|
/*
|
2022-12-27 12:37:58 +05:30
|
|
|
* Copyright 2022 Collate.
|
2022-06-01 11:36:36 +05:30
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2022-11-14 18:09:38 +05:30
|
|
|
import {
|
|
|
|
descriptionBox,
|
2022-11-21 17:02:48 +05:30
|
|
|
interceptURL, toastNotification,
|
2022-11-14 18:09:38 +05:30
|
|
|
verifyResponseStatusCode,
|
|
|
|
visitEntityDetailsPage
|
|
|
|
} from '../../common/common';
|
|
|
|
import {
|
2022-11-21 17:02:48 +05:30
|
|
|
DELETE_TERM, NEW_GLOSSARY,
|
2022-11-14 18:09:38 +05:30
|
|
|
NEW_GLOSSARY_TERMS,
|
|
|
|
SEARCH_ENTITY_TABLE
|
|
|
|
} from '../../constants/constants';
|
2022-06-01 11:36:36 +05:30
|
|
|
|
|
|
|
const createGlossaryTerm = (term) => {
|
2022-12-02 21:45:35 +05:30
|
|
|
cy.get('[data-testid="breadcrumb-link"]')
|
|
|
|
.should('exist')
|
|
|
|
.and('be.visible')
|
2022-06-01 11:36:36 +05:30
|
|
|
.contains(NEW_GLOSSARY.name)
|
|
|
|
.should('exist');
|
|
|
|
cy.get('[data-testid="add-new-tag-button"]').should('be.visible').click();
|
|
|
|
|
|
|
|
cy.contains('Add Glossary Term').should('be.visible');
|
|
|
|
cy.get('[data-testid="name"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.type(term.name);
|
2022-09-14 19:19:42 +05:30
|
|
|
cy.get(descriptionBox)
|
2022-06-01 11:36:36 +05:30
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.type(term.description);
|
|
|
|
cy.get('[data-testid="synonyms"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.type(term.synonyms);
|
|
|
|
|
|
|
|
cy.get('[data-testid="references"] > .tw-flex > .button-comp')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.get('#name-0').scrollIntoView().should('be.visible').type('test');
|
|
|
|
cy.get('#url-0')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.type('https://test.com');
|
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
interceptURL('POST', '/api/v1/glossaryTerms', 'createGlossaryTerms');
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="save-glossary-term"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@createGlossaryTerms', 201);
|
|
|
|
|
2022-12-02 21:45:35 +05:30
|
|
|
cy.get('[data-testid="glossary-left-panel"]').contains(term.name).should('be.visible');
|
2022-06-01 11:36:36 +05:30
|
|
|
};
|
|
|
|
|
2022-06-08 23:04:41 +05:30
|
|
|
const deleteGlossary = ({ name }) => {
|
2022-09-28 21:58:20 +05:30
|
|
|
verifyResponseStatusCode('@getGlossaryTerms', 200);
|
2022-12-02 21:45:35 +05:30
|
|
|
cy.get('[data-testid="glossary-left-panel"]').contains(name).should('be.visible').click();
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.wait(500);
|
|
|
|
cy.get('[data-testid="inactive-link"]').contains(name).should('be.visible');
|
|
|
|
|
2022-06-08 23:04:41 +05:30
|
|
|
cy.get('[data-testid="manage-button"]').should('be.visible').click();
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="delete-button"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
2022-12-06 17:34:09 +05:30
|
|
|
cy.get('[data-testid="delete-confirmation-modal"]').should('exist').then(() => {
|
|
|
|
cy.get('[role="dialog"]').should('be.visible');
|
|
|
|
cy.get('[data-testid="modal-header"]').should('be.visible');
|
|
|
|
})
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get('[data-testid="modal-header"]').should('be.visible').should('contain', `Delete ${name}`);
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="confirmation-text-input"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(DELETE_TERM);
|
|
|
|
|
|
|
|
cy.get('[data-testid="confirm-button"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.should('not.disabled')
|
|
|
|
.click();
|
2022-06-08 23:04:41 +05:30
|
|
|
|
2022-11-14 18:09:38 +05:30
|
|
|
toastNotification('Glossary term deleted successfully!')
|
2022-12-06 17:34:09 +05:30
|
|
|
cy.get('[data-testid="delete-confirmation-modal"]').should('not.exist');
|
2022-12-02 21:45:35 +05:30
|
|
|
cy.get('[data-testid="glossary-left-panel"]').should('be.visible').should('not.contain', name)
|
2022-06-01 11:36:36 +05:30
|
|
|
};
|
|
|
|
|
|
|
|
const goToAssetsTab = (term) => {
|
2022-12-02 21:45:35 +05:30
|
|
|
cy.get('[data-testid="glossary-left-panel"]').should('be.visible').contains(term).click();
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.wait(500);
|
|
|
|
cy.get('[data-testid="inactive-link"]').contains(term).should('be.visible');
|
|
|
|
cy.get('[data-testid="Assets"]').should('be.visible').click();
|
|
|
|
cy.get('[data-testid="Assets"]').should('have.class', 'active');
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('Glossary page should work properly', () => {
|
|
|
|
beforeEach(() => {
|
2022-11-21 17:02:48 +05:30
|
|
|
cy.login();
|
2022-09-28 21:58:20 +05:30
|
|
|
|
|
|
|
interceptURL('GET', '/api/v1/glossaryTerms*', 'getGlossaryTerms');
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get('[data-testid="governance"]')
|
|
|
|
.should('exist')
|
2022-12-02 15:43:12 +05:30
|
|
|
.and('be.visible')
|
2022-12-06 15:19:52 +05:30
|
|
|
.click({ animationDistanceThreshold: 20 });
|
|
|
|
|
|
|
|
//Clicking on Glossary
|
|
|
|
cy.get('.ant-dropdown-menu')
|
|
|
|
.should('exist')
|
|
|
|
.and('be.visible')
|
|
|
|
.then(($el) => {
|
|
|
|
cy.wrap($el)
|
|
|
|
.find('[data-testid="appbar-item-glossary"]')
|
2022-12-02 21:45:35 +05:30
|
|
|
.should('exist')
|
|
|
|
.and('be.visible')
|
2022-12-06 15:19:52 +05:30
|
|
|
.click()
|
|
|
|
});
|
2022-08-11 10:57:39 +05:30
|
|
|
|
2022-06-01 11:36:36 +05:30
|
|
|
// Todo: need to remove below uncaught exception once tree-view error resolves
|
|
|
|
cy.on('uncaught:exception', () => {
|
|
|
|
// return false to prevent the error from
|
|
|
|
// failing this test
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Create new glossary flow should work properly', () => {
|
2022-12-02 21:45:35 +05:30
|
|
|
interceptURL('POST', '/api/v1/glossaries', 'createGlossary');
|
|
|
|
|
2022-06-01 11:36:36 +05:30
|
|
|
// check for no data placeholder
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get('[data-testid="add-new-glossary"]').should('be.visible').as('addNewGlossary');
|
2022-06-01 11:36:36 +05:30
|
|
|
|
|
|
|
// Redirecting to add glossary page
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get('@addNewGlossary').click();
|
2022-12-07 14:31:27 +05:30
|
|
|
cy.get('[data-testid="form-heading"]')
|
2022-06-01 11:36:36 +05:30
|
|
|
.contains('Add Glossary')
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
cy.get('[data-testid="name"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.type(NEW_GLOSSARY.name);
|
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
cy.get(descriptionBox)
|
2022-06-01 11:36:36 +05:30
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.type(NEW_GLOSSARY.description);
|
|
|
|
|
|
|
|
cy.get('[data-testid="add-reviewers"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-11-14 18:09:38 +05:30
|
|
|
|
2022-12-02 21:45:35 +05:30
|
|
|
cy.get('[data-testid="confirmation-modal"]').should('exist').within(() => {
|
|
|
|
cy.get('[role="dialog"]').should('be.visible');
|
|
|
|
});
|
2022-06-01 11:36:36 +05:30
|
|
|
|
2022-11-14 18:09:38 +05:30
|
|
|
//Change this once issue related to suggestion API is fixed.
|
2022-12-02 21:45:35 +05:30
|
|
|
cy.get('[data-testid="user-card-container"]')
|
2022-06-01 11:36:36 +05:30
|
|
|
.first()
|
|
|
|
.should('be.visible')
|
|
|
|
.as('reviewer');
|
|
|
|
|
|
|
|
cy.get('@reviewer')
|
|
|
|
.find('[data-testid="checkboxAddUser"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.check();
|
|
|
|
|
2022-12-02 21:45:35 +05:30
|
|
|
cy.get('[data-testid="save-button"]').should('exist').and('be.visible').click();
|
|
|
|
cy.get('[data-testid="delete-confirmation-modal"]').should('not.exist');
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="reviewers-container"]')
|
|
|
|
.children()
|
|
|
|
.should('have.length', 1);
|
|
|
|
|
|
|
|
cy.get('[data-testid="save-glossary"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
2022-12-02 21:45:35 +05:30
|
|
|
cy.wait("@createGlossary").then(() => {
|
|
|
|
cy.url().should('include', '/glossary/')
|
|
|
|
cy.get('[data-testid="breadcrumb-link"]')
|
|
|
|
.should('exist')
|
|
|
|
.and('be.visible')
|
|
|
|
.within(() => {
|
|
|
|
cy.contains(NEW_GLOSSARY.name);
|
|
|
|
})
|
|
|
|
});
|
2022-06-01 11:36:36 +05:30
|
|
|
});
|
|
|
|
|
2022-11-14 18:09:38 +05:30
|
|
|
it('Verify added glossary details', () => {
|
|
|
|
cy.get('[data-testid="glossary-left-panel"]').contains(NEW_GLOSSARY.name).should('be.visible');
|
|
|
|
cy.get('[data-testid="header"]').invoke('text').then((text) => {
|
|
|
|
expect(text).to.contain(NEW_GLOSSARY.name)
|
|
|
|
})
|
|
|
|
cy.get('[data-testid="viewer-container"]').invoke('text').then((text) => {
|
|
|
|
expect(text).to.contain(NEW_GLOSSARY.description)
|
|
|
|
})
|
|
|
|
cy.get('[data-testid="reviewer-card-container"]').should('have.length', 1);
|
|
|
|
//Uncomment once the suggestion API issue gets resolved
|
|
|
|
// cy.get('[data-testid="reviewer-card-container"]').invoke('text').then((text) => {
|
|
|
|
// expect(text).to.contain(NEW_GLOSSARY.reviewer)
|
|
|
|
// })
|
|
|
|
})
|
|
|
|
|
2022-06-01 11:36:36 +05:30
|
|
|
it('Create glossary term should work properly', () => {
|
|
|
|
const terms = Object.values(NEW_GLOSSARY_TERMS);
|
|
|
|
|
|
|
|
terms.forEach(createGlossaryTerm);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Updating data of glossary should work properly', () => {
|
|
|
|
const newDescription = 'Updated description';
|
|
|
|
// updating tags
|
|
|
|
cy.get('[data-testid="tag-container"]')
|
2022-12-02 21:45:35 +05:30
|
|
|
.should('exist')
|
|
|
|
.and('be.visible')
|
|
|
|
.within(() => {
|
|
|
|
cy.get('[data-testid="add-tag"]').should('exist').and('be.visible').click()
|
|
|
|
});
|
|
|
|
|
2022-06-03 01:51:45 +05:30
|
|
|
cy.get('[class*="-control"]')
|
2022-06-01 11:36:36 +05:30
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.type('personal');
|
2022-09-14 19:19:42 +05:30
|
|
|
cy.get('[id*="-option-0"]').should('contain', 'Personal');
|
|
|
|
|
2022-06-03 01:51:45 +05:30
|
|
|
cy.get('[id*="-option-0"]').scrollIntoView().should('be.visible').click();
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView().click();
|
|
|
|
cy.get('[data-testid="glossary-details"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.contains('PersonalData.Personal')
|
|
|
|
.should('be.visible');
|
2022-12-02 21:45:35 +05:30
|
|
|
|
2022-06-01 11:36:36 +05:30
|
|
|
// updating description
|
2022-06-08 23:04:41 +05:30
|
|
|
cy.get('[data-testid="edit-description"]').should('be.visible').click();
|
2022-12-18 10:31:22 +05:30
|
|
|
cy.get('.ant-modal-wrap').should('be.visible');
|
2022-09-14 19:19:42 +05:30
|
|
|
cy.get(descriptionBox).should('be.visible').as('description');
|
2022-06-01 11:36:36 +05:30
|
|
|
|
|
|
|
cy.get('@description').clear();
|
|
|
|
cy.get('@description').type(newDescription);
|
2022-09-14 19:19:42 +05:30
|
|
|
|
|
|
|
interceptURL('PATCH', '/api/v1/glossaries/*', 'saveGlossary');
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="save"]').click();
|
2022-09-14 19:19:42 +05:30
|
|
|
|
2022-12-18 10:31:22 +05:30
|
|
|
cy.get('.ant-modal-wrap').should('not.exist');
|
2022-09-14 19:19:42 +05:30
|
|
|
|
|
|
|
verifyResponseStatusCode('@saveGlossary', 200);
|
|
|
|
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="viewer-container"]')
|
|
|
|
.contains(newDescription)
|
|
|
|
.should('be.visible');
|
|
|
|
});
|
2022-11-17 19:25:31 +05:30
|
|
|
// Todo:- skipping this as its flaky, need to check cause
|
2022-11-17 15:41:32 +05:30
|
|
|
it.skip('Updating data of glossary term should work properly', () => {
|
2022-09-24 09:33:31 +05:30
|
|
|
interceptURL('GET', '/api/v1/permissions/*/*', 'permissionApi');
|
|
|
|
interceptURL('GET', '/api/v1/search/query?*', 'glossaryAPI');
|
2022-06-01 11:36:36 +05:30
|
|
|
const term = NEW_GLOSSARY_TERMS.term_1.name;
|
2022-09-24 09:33:31 +05:30
|
|
|
const term2 = NEW_GLOSSARY_TERMS.term_2.name;
|
|
|
|
const uSynonyms = ['pick up', 'take', 'obtain'];
|
2022-06-01 11:36:36 +05:30
|
|
|
const newRef = { name: 'take', url: 'https://take.com' };
|
|
|
|
const newDescription = 'Updated description';
|
2022-12-02 21:45:35 +05:30
|
|
|
cy.get('[data-testid="glossary-left-panel"]').should('be.visible').contains(term).click();
|
2022-09-24 09:33:31 +05:30
|
|
|
verifyResponseStatusCode('@permissionApi', 200);
|
|
|
|
verifyResponseStatusCode('@glossaryAPI', 200);
|
2022-06-01 11:36:36 +05:30
|
|
|
|
|
|
|
// updating tags
|
|
|
|
cy.get('[data-testid="tag-container"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-06-03 01:51:45 +05:30
|
|
|
cy.get('[class*="-control"]')
|
2022-06-01 11:36:36 +05:30
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.type('personal');
|
2022-09-14 19:19:42 +05:30
|
|
|
cy.get('[id*="-option-0"]').should('contain', 'Personal');
|
|
|
|
|
2022-06-03 01:51:45 +05:30
|
|
|
cy.get('[id*="-option-0"]').scrollIntoView().should('be.visible').click();
|
2022-09-14 19:19:42 +05:30
|
|
|
|
|
|
|
interceptURL('PATCH', '/api/v1/glossaryTerms/*', 'saveData');
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView().click();
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@saveData', 200);
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="glossary-term"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.contains('PersonalData.Personal')
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
// updating description
|
2022-06-08 23:04:41 +05:30
|
|
|
cy.get('[data-testid="edit-description"]').should('be.visible').click();
|
2022-12-18 10:31:22 +05:30
|
|
|
cy.get('.ant-modal-wrap').should('be.visible');
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror')
|
|
|
|
.should('be.visible')
|
|
|
|
.as('description');
|
|
|
|
cy.get('@description').clear();
|
|
|
|
cy.get('@description').type(newDescription);
|
|
|
|
cy.get('[data-testid="save"]').click();
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@saveData', 200);
|
2022-12-18 10:31:22 +05:30
|
|
|
cy.get('.ant-modal-wrap').should('not.exist');
|
2022-08-26 16:08:02 +05:30
|
|
|
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="viewer-container"]')
|
|
|
|
.contains(newDescription)
|
|
|
|
.should('be.visible');
|
2022-09-24 09:33:31 +05:30
|
|
|
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="inactive-link"]').contains(term).should('be.visible');
|
|
|
|
|
2022-09-24 09:33:31 +05:30
|
|
|
// updating synonyms
|
|
|
|
cy.get('[data-testid="section-synonyms"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
cy.get('[data-testid="section-synonyms"] [data-testid="edit-button"]')
|
|
|
|
.scrollIntoView()
|
2022-06-01 11:36:36 +05:30
|
|
|
.should('be.visible')
|
2022-09-24 09:33:31 +05:30
|
|
|
.should('not.be.disabled')
|
2022-06-01 11:36:36 +05:30
|
|
|
.click();
|
2022-09-24 09:33:31 +05:30
|
|
|
|
|
|
|
cy.get('.ant-select-selector').should('be.visible');
|
|
|
|
cy.get('.ant-select-clear > .anticon > svg')
|
|
|
|
.should('exist')
|
|
|
|
.click({ force: true });
|
|
|
|
|
|
|
|
cy.get('.ant-select-selection-overflow')
|
|
|
|
.should('exist')
|
|
|
|
.type(uSynonyms.join('{enter}'));
|
|
|
|
|
|
|
|
interceptURL('PATCH', '/api/v1/glossaryTerms/*', 'getGlossary');
|
|
|
|
cy.get('[data-testid="save-btn"]').should('be.visible').click();
|
|
|
|
verifyResponseStatusCode('@getGlossary', 200);
|
|
|
|
|
|
|
|
cy.get('[data-testid="synonyms-container"]')
|
|
|
|
.as('synonyms-container')
|
|
|
|
.should('be.visible');
|
|
|
|
|
|
|
|
uSynonyms.forEach((synonym) => {
|
|
|
|
cy.get('@synonyms-container').contains(synonym).should('be.visible');
|
|
|
|
});
|
|
|
|
|
|
|
|
// updating References
|
|
|
|
cy.get('[data-testid="section-references"] [data-testid="edit-button"]')
|
|
|
|
.should('exist')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
cy.get('[data-testid="add-button"]').should('be.visible').click();
|
|
|
|
cy.get('#references_1_name').should('be.visible').type(newRef.name);
|
|
|
|
cy.get('#references_1_endpoint').should('be.visible').type(newRef.url);
|
|
|
|
cy.get('[data-testid="save-btn"]').should('be.visible').click();
|
|
|
|
verifyResponseStatusCode('@getGlossary', 200);
|
|
|
|
cy.get('[data-testid="references-container"]')
|
|
|
|
.contains(newRef.name)
|
2022-06-01 11:36:36 +05:30
|
|
|
.should('be.visible')
|
2022-09-24 09:33:31 +05:30
|
|
|
.invoke('attr', 'href')
|
|
|
|
.should('eq', newRef.url);
|
|
|
|
|
|
|
|
// add relented term
|
|
|
|
cy.get('[data-testid="section-related-terms"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get('[data-testid="section-related-terms"] [data-testid="edit-button"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
2022-10-08 00:07:24 +05:30
|
|
|
.click({ force: true });
|
2022-09-24 09:33:31 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/search/query?q=*&from=0&size=10&index=glossary_search_index',
|
|
|
|
'getGlossaryTerm'
|
|
|
|
);
|
|
|
|
cy.get('.ant-select-selection-overflow').should('be.visible').click();
|
|
|
|
verifyResponseStatusCode('@getGlossaryTerm', 200);
|
|
|
|
cy.get('.ant-select-item-option-content')
|
|
|
|
.contains(term2)
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
|
|
|
|
interceptURL('PATCH', '/api/v1/glossaryTerms/*', 'getGlossary');
|
|
|
|
cy.get('[data-testid="save-btn"]').should('be.visible').click();
|
|
|
|
verifyResponseStatusCode('@getGlossary', 200);
|
|
|
|
|
|
|
|
cy.get('[data-testid="related-term-container"]')
|
2022-06-01 11:36:36 +05:30
|
|
|
.contains(term2)
|
|
|
|
.should('be.visible');
|
|
|
|
});
|
2022-06-16 22:05:22 +05:30
|
|
|
|
|
|
|
it('Assets Tab should work properly', () => {
|
2022-08-31 00:11:02 +05:30
|
|
|
const glossary = NEW_GLOSSARY.name;
|
2022-06-01 11:36:36 +05:30
|
|
|
const term = NEW_GLOSSARY_TERMS.term_1.name;
|
2022-09-29 02:49:03 +05:30
|
|
|
const entity = SEARCH_ENTITY_TABLE.table_3;
|
2022-06-01 11:36:36 +05:30
|
|
|
goToAssetsTab(term);
|
2022-09-24 09:33:31 +05:30
|
|
|
cy.contains('No assets available.').should('be.visible');
|
|
|
|
cy.get('[data-testid="no-data-image"]').should('be.visible');
|
2022-09-29 02:49:03 +05:30
|
|
|
visitEntityDetailsPage(entity.term, entity.serviceName, entity.entity);
|
2022-09-14 19:19:42 +05:30
|
|
|
|
2022-08-31 00:11:02 +05:30
|
|
|
//Add tag to breadcrumb
|
|
|
|
cy.get('[data-testid="tag-container"] [data-testid="tags"]')
|
|
|
|
.eq(0)
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
|
|
|
cy.get('[class*="-control"]').should('be.visible').type(term);
|
2022-09-14 19:19:42 +05:30
|
|
|
cy.get('[id*="-option-0"]').should('contain', term);
|
2022-08-31 00:11:02 +05:30
|
|
|
cy.get('[id*="-option-0"]').should('be.visible').click();
|
|
|
|
cy.get(
|
|
|
|
'[data-testid="tags-wrapper"] [data-testid="tag-container"]'
|
|
|
|
).contains(term);
|
2022-09-14 19:19:42 +05:30
|
|
|
|
|
|
|
interceptURL('GET', '/api/v1/feed/count*', 'saveTag');
|
2022-12-02 15:43:12 +05:30
|
|
|
interceptURL('GET', '/api/v1/tags', 'tags');
|
|
|
|
|
2022-08-31 00:11:02 +05:30
|
|
|
cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click();
|
|
|
|
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@saveTag', 200);
|
2022-08-31 00:11:02 +05:30
|
|
|
cy.get('[data-testid="entity-tags"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.contains(term);
|
|
|
|
|
|
|
|
//Add tag to schema table
|
2022-12-02 15:43:12 +05:30
|
|
|
cy.get('[data-row-key="comments"] [data-testid="tags-wrapper"] [data-testid="tag-container"]')
|
2022-08-31 00:11:02 +05:30
|
|
|
.should('be.visible')
|
2022-12-02 15:43:12 +05:30
|
|
|
.first()
|
2022-08-31 00:11:02 +05:30
|
|
|
.click();
|
2022-09-14 19:19:42 +05:30
|
|
|
|
2022-12-02 15:43:12 +05:30
|
|
|
cy.get('[class*="-control"]').should('be.visible').type(term);
|
|
|
|
cy.get('[id*="-option-0"]').should('contain', term);
|
|
|
|
cy.get('[id*="-option-0"]').should('be.visible').click();
|
|
|
|
cy.get(
|
|
|
|
'[data-row-key="comments"] [data-testid="tags-wrapper"] [data-testid="tag-container"]'
|
|
|
|
).contains(term);
|
2022-08-31 00:11:02 +05:30
|
|
|
cy.get('[data-testid="saveAssociatedTag"]').should('be.visible').click();
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@saveTag', 200);
|
2022-08-31 00:11:02 +05:30
|
|
|
cy.get(`[data-testid="tag-${glossary}.${term}"]`)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.contains(term);
|
2022-06-01 11:36:36 +05:30
|
|
|
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get('[data-testid="governance"]')
|
|
|
|
.should('exist')
|
2022-12-02 21:45:35 +05:30
|
|
|
.and('be.visible')
|
2022-12-02 15:43:12 +05:30
|
|
|
.click();
|
2022-08-11 10:57:39 +05:30
|
|
|
cy.get('[data-testid="appbar-item-glossary"]')
|
|
|
|
.should('exist')
|
2022-06-01 11:36:36 +05:30
|
|
|
.should('be.visible')
|
2022-12-02 15:43:12 +05:30
|
|
|
.click();
|
2022-08-11 10:57:39 +05:30
|
|
|
|
2022-06-01 11:36:36 +05:30
|
|
|
goToAssetsTab(term);
|
2022-09-29 02:49:03 +05:30
|
|
|
cy.get(`[data-testid="${entity.serviceName}-${entity.term}"]`)
|
|
|
|
.contains(entity.term)
|
|
|
|
.should('be.visible');
|
2022-06-01 11:36:36 +05:30
|
|
|
});
|
|
|
|
|
2022-06-16 22:05:22 +05:30
|
|
|
it('Remove Glossary term from entity should work properly', () => {
|
2022-06-01 11:36:36 +05:30
|
|
|
const term = NEW_GLOSSARY_TERMS.term_1.name;
|
2022-09-29 02:49:03 +05:30
|
|
|
const entity = SEARCH_ENTITY_TABLE.table_3;
|
2022-09-14 19:19:42 +05:30
|
|
|
|
|
|
|
interceptURL('GET', '/api/v1/search/query*', 'assetTab');
|
2022-06-01 11:36:36 +05:30
|
|
|
// go assets tab
|
|
|
|
goToAssetsTab(term);
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@assetTab', 200);
|
|
|
|
|
|
|
|
interceptURL('GET', '/api/v1/feed*', 'entityDetails');
|
2022-09-29 02:49:03 +05:30
|
|
|
cy.get(`[data-testid="${entity.serviceName}-${entity.term}"]`)
|
|
|
|
.contains(entity.term)
|
2022-06-01 11:36:36 +05:30
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@entityDetails', 200);
|
2022-06-01 11:36:36 +05:30
|
|
|
// redirect to entity detail page
|
2022-06-16 22:05:22 +05:30
|
|
|
cy.get('[data-testid="entity-tags"]')
|
|
|
|
.find('[data-testid="edit-button"]')
|
2022-06-01 11:36:36 +05:30
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
|
|
|
.click();
|
2022-08-31 00:11:02 +05:30
|
|
|
cy.get('[role="button"]').eq(0).should('be.visible').click();
|
2022-11-17 19:25:31 +05:30
|
|
|
// uncomment below code once `Updating data of glossary term should work properly` is fixed
|
|
|
|
// cy.get('[role="button"]').eq(0).should('be.visible').click();
|
2022-08-26 16:08:02 +05:30
|
|
|
|
2022-11-14 18:09:38 +05:30
|
|
|
interceptURL('PATCH', '/api/v1/tables/*', 'removeTags');
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="saveAssociatedTag"]').scrollIntoView().click();
|
2022-11-14 18:09:38 +05:30
|
|
|
verifyResponseStatusCode('@removeTags', 200);
|
2022-06-01 11:36:36 +05:30
|
|
|
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get('[data-testid="entity-tags"]')
|
|
|
|
.should('not.contain', term)
|
|
|
|
.and('not.contain', 'Personal');
|
2022-08-26 16:08:02 +05:30
|
|
|
//Remove the added column tag from entity
|
2022-11-17 19:25:31 +05:30
|
|
|
// uncomment below code once `Updating data of glossary term should work properly` is fixed
|
|
|
|
// cy.get('[data-testid="remove"]').eq(0).should('be.visible').click();
|
2022-08-31 00:11:02 +05:30
|
|
|
cy.wait(500);
|
2022-11-14 18:09:38 +05:30
|
|
|
interceptURL('PATCH', '/api/v1/tables/*', 'removeSchemaTags');
|
2022-08-31 00:11:02 +05:30
|
|
|
cy.get('[data-testid="remove"]').eq(0).should('be.visible').click();
|
2022-11-14 18:09:38 +05:30
|
|
|
verifyResponseStatusCode('@removeSchemaTags', 200);
|
|
|
|
|
|
|
|
cy.get('[data-testid="tags"]')
|
|
|
|
.should('not.contain', term)
|
|
|
|
.and('not.contain', 'Personal');
|
2022-08-11 10:57:39 +05:30
|
|
|
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get('[data-testid="governance"]')
|
|
|
|
.should('exist')
|
|
|
|
.should('be.visible')
|
2022-12-02 15:43:12 +05:30
|
|
|
.click();
|
2022-08-11 10:57:39 +05:30
|
|
|
cy.get('[data-testid="appbar-item-glossary"]')
|
|
|
|
.should('exist')
|
2022-06-01 11:36:36 +05:30
|
|
|
.should('be.visible')
|
2022-12-02 15:43:12 +05:30
|
|
|
.click();
|
2022-08-24 20:01:22 +05:30
|
|
|
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.wait(500);
|
|
|
|
goToAssetsTab(term);
|
2022-09-24 09:33:31 +05:30
|
|
|
cy.contains('No assets available.').should('be.visible');
|
|
|
|
cy.get('[data-testid="no-data-image"]').should('be.visible');
|
2022-06-01 11:36:36 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('Delete glossary term should work properly', () => {
|
|
|
|
const terms = Object.values(NEW_GLOSSARY_TERMS);
|
|
|
|
|
2022-06-08 23:04:41 +05:30
|
|
|
terms.forEach(deleteGlossary);
|
2022-06-01 11:36:36 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('Delete glossary should work properly', () => {
|
2022-09-28 21:58:20 +05:30
|
|
|
verifyResponseStatusCode('@getGlossaryTerms', 200);
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="header"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.contains(NEW_GLOSSARY.name)
|
|
|
|
.should('exist');
|
2022-06-08 23:04:41 +05:30
|
|
|
cy.get('[data-testid="manage-button"]').should('be.visible').click();
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="delete-button"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible')
|
2022-12-06 17:34:09 +05:30
|
|
|
.click();
|
2022-06-01 11:36:36 +05:30
|
|
|
|
2022-12-06 17:34:09 +05:30
|
|
|
cy.get('[data-testid="delete-confirmation-modal"]').should('exist').then(() => {
|
|
|
|
cy.get('[role="dialog"]').should('be.visible');
|
|
|
|
cy.get('[data-testid="modal-header"]').should('be.visible');
|
|
|
|
});
|
2022-11-14 18:09:38 +05:30
|
|
|
cy.get('[data-testid="modal-header"]').should('be.visible').should('contain', `Delete ${NEW_GLOSSARY.name}`);
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="confirmation-text-input"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.type(DELETE_TERM);
|
2022-09-14 19:19:42 +05:30
|
|
|
interceptURL('DELETE', '/api/v1/glossaries/*', 'getGlossary');
|
2022-06-01 11:36:36 +05:30
|
|
|
cy.get('[data-testid="confirm-button"]')
|
|
|
|
.should('be.visible')
|
|
|
|
.should('not.disabled')
|
|
|
|
.click();
|
2022-09-14 19:19:42 +05:30
|
|
|
verifyResponseStatusCode('@getGlossary', 200);
|
2022-06-01 11:36:36 +05:30
|
|
|
|
2022-11-14 18:09:38 +05:30
|
|
|
toastNotification('Glossary deleted successfully!')
|
2022-09-14 19:19:42 +05:30
|
|
|
cy.contains('Add New Glossary').should('be.visible');
|
2022-06-01 11:36:36 +05:30
|
|
|
});
|
|
|
|
});
|