mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-12-29 16:39:04 +00:00
cypress: worked on upgrade test part 2 (#12508)
This commit is contained in:
parent
db5f6c594c
commit
8feada22de
@ -585,6 +585,7 @@ export const addUser = (username, email) => {
|
||||
cy.wait(1000);
|
||||
interceptURL('POST', ' /api/v1/users', 'add-user');
|
||||
cy.get('[data-testid="save-user"]').scrollIntoView().click();
|
||||
verifyResponseStatusCode('@add-user', 201);
|
||||
};
|
||||
|
||||
export const softDeleteUser = (username, isAdmin) => {
|
||||
@ -594,18 +595,12 @@ export const softDeleteUser = (username, isAdmin) => {
|
||||
'/api/v1/search/query?q=**&from=0&size=*&index=*',
|
||||
'searchUser'
|
||||
);
|
||||
cy.get('[data-testid="searchbar"]')
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.type(username);
|
||||
cy.get('[data-testid="searchbar"]').type(username);
|
||||
|
||||
verifyResponseStatusCode('@searchUser', 200);
|
||||
|
||||
// Click on delete button
|
||||
cy.get(`[data-testid="delete-user-btn-${username}"]`)
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get(`[data-testid="delete-user-btn-${username}"]`).click();
|
||||
|
||||
// Soft deleting the user
|
||||
cy.get('[data-testid="soft-delete"]').click();
|
||||
@ -617,33 +612,16 @@ export const softDeleteUser = (username, isAdmin) => {
|
||||
'softdeleteUser'
|
||||
);
|
||||
interceptURL('GET', '/api/v1/users*', 'userDeleted');
|
||||
cy.get('[data-testid="confirm-button"]')
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="confirm-button"]').click();
|
||||
verifyResponseStatusCode('@softdeleteUser', 200);
|
||||
verifyResponseStatusCode('@userDeleted', 200);
|
||||
|
||||
toastNotification('User deleted successfully!');
|
||||
|
||||
if (!isAdmin) {
|
||||
cy.get('[data-testid="previous"]')
|
||||
.scrollIntoView()
|
||||
.should('exist')
|
||||
.should('be.disabled');
|
||||
|
||||
cy.get('[data-testid="page-indicator"]').contains('1/7 Page');
|
||||
}
|
||||
|
||||
interceptURL('GET', '/api/v1/search/query*', 'searchUser');
|
||||
|
||||
// Verifying the deleted user
|
||||
cy.get('[data-testid="searchbar"]')
|
||||
.scrollIntoView()
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.clear()
|
||||
.type(username);
|
||||
cy.get('[data-testid="searchbar"]').scrollIntoView().clear().type(username);
|
||||
|
||||
verifyResponseStatusCode('@searchUser', 200);
|
||||
cy.get('[data-testid="search-error-placeholder"]').should('be.visible');
|
||||
@ -742,26 +720,19 @@ export const addCustomPropertiesForEntity = (
|
||||
entityObj
|
||||
) => {
|
||||
// Add Custom property for selected entity
|
||||
cy.get('[data-testid="add-placeholder-button"]')
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="add-field-button"]').click();
|
||||
|
||||
// validation should work
|
||||
cy.get('[data-testid="create-button"]').scrollIntoView().click();
|
||||
|
||||
cy.get('#name_help').should('be.visible').contains('name is required');
|
||||
cy.get('#propertyType_help')
|
||||
.should('be.visible')
|
||||
.contains('propertyType is required');
|
||||
cy.get('#description_help')
|
||||
.should('be.visible')
|
||||
.contains('description is required');
|
||||
cy.get('#name_help').should('contain', 'name is required');
|
||||
cy.get('#propertyType_help').should('contain', 'propertyType is required');
|
||||
|
||||
cy.get('#description_help').should('contain', 'description is required');
|
||||
|
||||
// capital case validation
|
||||
cy.get('[data-testid="name"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.type(CUSTOM_PROPERTY_INVALID_NAMES.CAPITAL_CASE);
|
||||
cy.get('[role="alert"]').should(
|
||||
'contain',
|
||||
@ -770,7 +741,6 @@ export const addCustomPropertiesForEntity = (
|
||||
|
||||
// with underscore validation
|
||||
cy.get('[data-testid="name"]')
|
||||
.should('be.visible')
|
||||
.clear()
|
||||
.type(CUSTOM_PROPERTY_INVALID_NAMES.WITH_UNDERSCORE);
|
||||
cy.get('[role="alert"]').should(
|
||||
@ -780,7 +750,6 @@ export const addCustomPropertiesForEntity = (
|
||||
|
||||
// with space validation
|
||||
cy.get('[data-testid="name"]')
|
||||
.should('be.visible')
|
||||
.clear()
|
||||
.type(CUSTOM_PROPERTY_INVALID_NAMES.WITH_SPACE);
|
||||
cy.get('[role="alert"]').should(
|
||||
@ -790,7 +759,6 @@ export const addCustomPropertiesForEntity = (
|
||||
|
||||
// with dots validation
|
||||
cy.get('[data-testid="name"]')
|
||||
.should('be.visible')
|
||||
.clear()
|
||||
.type(CUSTOM_PROPERTY_INVALID_NAMES.WITH_DOTS);
|
||||
cy.get('[role="alert"]').should(
|
||||
@ -799,25 +767,16 @@ export const addCustomPropertiesForEntity = (
|
||||
);
|
||||
|
||||
// should allow name in another languages
|
||||
cy.get('[data-testid="name"]')
|
||||
.should('be.visible')
|
||||
.clear()
|
||||
.type('汝らヴェディア');
|
||||
cy.get('[data-testid="name"]').clear().type('汝らヴェディア');
|
||||
// should not throw the validation error
|
||||
cy.get('#name_help').should('not.exist');
|
||||
|
||||
cy.get('[data-testid="name"]')
|
||||
.should('be.visible')
|
||||
.clear()
|
||||
.type(propertyName);
|
||||
cy.get('[data-testid="name"]').clear().type(propertyName);
|
||||
|
||||
cy.get('[data-testid="propertyType"]').should('be.visible').click();
|
||||
cy.get(`[title="${customType}"]`).should('be.visible').click();
|
||||
cy.get('[data-testid="propertyType"]').click();
|
||||
cy.get(`[title="${customType}"]`).click();
|
||||
|
||||
cy.get(descriptionBox)
|
||||
.should('be.visible')
|
||||
.clear()
|
||||
.type(entityType.description);
|
||||
cy.get(descriptionBox).clear().type(entityType.description);
|
||||
|
||||
// Check if the property got added
|
||||
cy.intercept('/api/v1/metadata/types/name/*?fields=customProperties').as(
|
||||
@ -839,10 +798,7 @@ export const addCustomPropertiesForEntity = (
|
||||
entityObj.entity
|
||||
);
|
||||
|
||||
cy.get('[data-testid="custom_properties"]')
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="custom_properties"]').click();
|
||||
cy.get('tbody').should('contain', propertyName);
|
||||
|
||||
// Adding value for the custom property
|
||||
@ -853,21 +809,21 @@ export const addCustomPropertiesForEntity = (
|
||||
.as('editbutton');
|
||||
cy.wait(1000);
|
||||
|
||||
cy.get('@editbutton').should('exist').should('be.visible').click();
|
||||
cy.get('@editbutton').click();
|
||||
|
||||
// Checking for value text box or markdown box
|
||||
cy.get('body').then(($body) => {
|
||||
if ($body.find('[data-testid="value-input"]').length > 0) {
|
||||
cy.get('[data-testid="value-input"]').should('be.visible').type(value);
|
||||
cy.get('[data-testid="value-input"]').type(value);
|
||||
cy.get('[data-testid="inline-save-btn"]').click();
|
||||
} else if (
|
||||
$body.find(
|
||||
'.toastui-editor-md-container > .toastui-editor > .ProseMirror'
|
||||
)
|
||||
) {
|
||||
cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror')
|
||||
.should('be.visible')
|
||||
.type(value);
|
||||
cy.get(
|
||||
'.toastui-editor-md-container > .toastui-editor > .ProseMirror'
|
||||
).type(value);
|
||||
cy.get('[data-testid="save"]').click();
|
||||
}
|
||||
});
|
||||
@ -914,11 +870,6 @@ export const deleteCreatedProperty = (propertyName) => {
|
||||
cy.get('[data-testid="body-text"]').should('contain', propertyName);
|
||||
|
||||
cy.get('[data-testid="save-button"]').should('be.visible').click();
|
||||
|
||||
// Checking if property got deleted successfully
|
||||
cy.get('[data-testid="add-placeholder-button"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible');
|
||||
};
|
||||
|
||||
export const updateOwner = () => {
|
||||
|
||||
@ -164,7 +164,9 @@ describe('DataConsumer Edit policy should work properly', () => {
|
||||
cy.get('[data-testid="user-name"]')
|
||||
.should('be.visible')
|
||||
.click({ force: true });
|
||||
verifyResponseStatusCode('@getUserPage', 200);
|
||||
cy.wait('@getUserPage').then((response) => {
|
||||
CREDENTIALS.id = response.response.body.id;
|
||||
});
|
||||
cy.get(
|
||||
'[data-testid="user-profile"] [data-testid="user-profile-details"]'
|
||||
).should('contain', `${CREDENTIALS.firstName}${CREDENTIALS.lastName}`);
|
||||
@ -286,3 +288,21 @@ describe('DataConsumer Edit policy should work properly', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Cleanup', () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
});
|
||||
|
||||
it('delete user', () => {
|
||||
const token = localStorage.getItem('oidcIdToken');
|
||||
|
||||
cy.request({
|
||||
method: 'DELETE',
|
||||
url: `/api/v1/users/${CREDENTIALS.id}?hardDelete=true&recursive=false`,
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -43,37 +43,34 @@ describe('Restore entity functionality should work properly', () => {
|
||||
ENTITY_TABLE.entity
|
||||
);
|
||||
|
||||
cy.get('[data-testid="manage-button"]').should('exist').click();
|
||||
cy.get('[data-testid="manage-button"]').click();
|
||||
|
||||
cy.get('[data-testid="delete-button-title"]').should('exist').click();
|
||||
cy.get('[data-testid="delete-button-title"]').click();
|
||||
|
||||
cy.get('.ant-modal-header')
|
||||
.should('be.visible')
|
||||
.contains(`Delete ${ENTITY_TABLE.displayName}`);
|
||||
cy.get('.ant-modal-header').should(
|
||||
'contain',
|
||||
`Delete ${ENTITY_TABLE.displayName}`
|
||||
);
|
||||
|
||||
cy.get('[data-testid="soft-delete-option"]').should('exist').click();
|
||||
cy.get('[data-testid="soft-delete-option"]').click();
|
||||
|
||||
cy.get('[data-testid="confirm-button"]').should('be.disabled');
|
||||
cy.get('[data-testid="confirmation-text-input"]')
|
||||
.should('exist')
|
||||
.type(DELETE_TERM);
|
||||
cy.get('[data-testid="confirmation-text-input"]').type(DELETE_TERM);
|
||||
|
||||
interceptURL(
|
||||
'DELETE',
|
||||
'api/v1/tables/*?hardDelete=false&recursive=false',
|
||||
'softDeleteTable'
|
||||
);
|
||||
cy.get('[data-testid="confirm-button"]')
|
||||
.should('be.visible')
|
||||
.should('not.be.disabled')
|
||||
.click();
|
||||
cy.get('[data-testid="confirm-button"]').should('not.be.disabled');
|
||||
cy.get('[data-testid="confirm-button"]').click();
|
||||
verifyResponseStatusCode('@softDeleteTable', 200);
|
||||
|
||||
toastNotification('Table deleted successfully!');
|
||||
});
|
||||
|
||||
it('Check Soft Deleted entity table', () => {
|
||||
cy.get('[data-testid="appbar-item-explore"]').should('exist').click();
|
||||
cy.get('[data-testid="appbar-item-explore"]').click();
|
||||
|
||||
verifyResponseStatusCode('@nonDeletedTables', 200);
|
||||
cy.get('[data-testid="show-deleted"]').should('exist').click();
|
||||
@ -81,29 +78,29 @@ describe('Restore entity functionality should work properly', () => {
|
||||
|
||||
cy.get('[data-testid="entity-header-display-name"]')
|
||||
.contains('raw_product_catalog')
|
||||
.should('exist')
|
||||
.click();
|
||||
|
||||
cy.get('[data-testid="entity-header-display-name"]')
|
||||
.should('be.visible')
|
||||
.contains(ENTITY_TABLE.displayName);
|
||||
cy.get('[data-testid="entity-header-display-name"]').should(
|
||||
'contain',
|
||||
ENTITY_TABLE.displayName
|
||||
);
|
||||
|
||||
cy.get('[data-testid="deleted-badge"]').should('exist');
|
||||
cy.get('[data-testid="deleted-badge"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible');
|
||||
});
|
||||
|
||||
it("Check Soft Deleted table in it's Schema", () => {
|
||||
cy.get('[data-testid="appbar-item-explore"]').should('exist').click();
|
||||
cy.get('[data-testid="appbar-item-explore"]').click();
|
||||
verifyResponseStatusCode('@nonDeletedTables', 200);
|
||||
cy.get('[data-testid="show-deleted"]').should('exist').click();
|
||||
cy.get('[data-testid="show-deleted"]').click();
|
||||
verifyResponseStatusCode('@showDeletedTables', 200);
|
||||
|
||||
cy.get('[data-testid="entity-header-display-name"]')
|
||||
.contains('raw_product_catalog')
|
||||
.should('exist')
|
||||
.click();
|
||||
|
||||
cy.get('[data-testid="entity-header-display-name"]')
|
||||
.should('be.visible')
|
||||
.contains(ENTITY_TABLE.displayName)
|
||||
.click();
|
||||
|
||||
@ -111,7 +108,6 @@ describe('Restore entity functionality should work properly', () => {
|
||||
|
||||
cy.get('[data-testid="breadcrumb"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.contains(ENTITY_TABLE.schemaName)
|
||||
.click();
|
||||
|
||||
@ -121,49 +117,52 @@ describe('Restore entity functionality should work properly', () => {
|
||||
'queryDeletedTables'
|
||||
);
|
||||
|
||||
cy.get('[data-testid="show-deleted"]').should('exist').click();
|
||||
cy.get('[data-testid="show-deleted"]').click();
|
||||
|
||||
verifyResponseStatusCode('@queryDeletedTables', 200);
|
||||
|
||||
cy.get('[data-testid="table"] [data-testid="count"]')
|
||||
.should('exist')
|
||||
.contains('1');
|
||||
cy.get('[data-testid="table"] [data-testid="count"]').should(
|
||||
'contain',
|
||||
'1'
|
||||
);
|
||||
|
||||
cy.get('.ant-table-row > :nth-child(1)')
|
||||
.should('exist')
|
||||
.contains(ENTITY_TABLE.displayName);
|
||||
cy.get('.ant-table-row > :nth-child(1)').should(
|
||||
'contain',
|
||||
ENTITY_TABLE.displayName
|
||||
);
|
||||
});
|
||||
|
||||
it('Restore Soft Deleted table', () => {
|
||||
cy.get('[data-testid="appbar-item-explore"]').should('exist').click();
|
||||
cy.get('[data-testid="appbar-item-explore"]').click();
|
||||
verifyResponseStatusCode('@nonDeletedTables', 200);
|
||||
cy.get('[data-testid="show-deleted"]').should('exist').click();
|
||||
cy.get('[data-testid="show-deleted"]').click();
|
||||
verifyResponseStatusCode('@showDeletedTables', 200);
|
||||
|
||||
cy.get('[data-testid="entity-header-display-name"]')
|
||||
.contains('raw_product_catalog')
|
||||
.should('exist')
|
||||
.click();
|
||||
|
||||
cy.get('[data-testid="entity-header-display-name"]')
|
||||
.should('be.visible')
|
||||
.contains(ENTITY_TABLE.displayName);
|
||||
cy.get('[data-testid="entity-header-display-name"]').should(
|
||||
'contain',
|
||||
ENTITY_TABLE.displayName
|
||||
);
|
||||
|
||||
cy.get('[data-testid="deleted-badge"]').should('exist');
|
||||
cy.get('[data-testid="deleted-badge"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible');
|
||||
|
||||
cy.get('[data-testid="manage-button"]').should('exist').click();
|
||||
cy.get('[data-testid="manage-button"]').click();
|
||||
|
||||
cy.get('[data-testid="restore-button"]').should('be.visible').click();
|
||||
cy.get('[data-testid="restore-button"]').click();
|
||||
|
||||
cy.get('.ant-modal-header').should('be.visible').contains('Restore table');
|
||||
cy.get('.ant-modal-header').should('contain', 'Restore table');
|
||||
|
||||
cy.get('[data-testid="restore-modal-body"]')
|
||||
.should('be.visible')
|
||||
.contains(
|
||||
`Are you sure you want to restore ${ENTITY_TABLE.displayName}?`
|
||||
);
|
||||
cy.get('[data-testid="restore-modal-body"]').should(
|
||||
'contain',
|
||||
`Are you sure you want to restore ${ENTITY_TABLE.displayName}?`
|
||||
);
|
||||
|
||||
cy.get('.ant-btn-primary').should('be.visible').contains('Restore').click();
|
||||
cy.get('.ant-btn-primary').contains('Restore').click();
|
||||
|
||||
cy.wait(500);
|
||||
|
||||
|
||||
@ -243,12 +243,10 @@ describe('Add and Remove Owner and Tier', () => {
|
||||
interceptURL('GET', '/api/v1/permissions/glossary/*', 'glossaryPermission');
|
||||
interceptURL('GET', '/api/v1/glossaries?*', 'getGlossaries');
|
||||
cy.get('[data-testid="governance"]').should('be.visible').click();
|
||||
cy.get('[data-testid="appbar-item-glossary"]')
|
||||
.should('be.visible')
|
||||
.click({ waitForAnimations: true });
|
||||
cy.get('[data-testid="add-placeholder-button"]')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="appbar-item-glossary"]').click({
|
||||
waitForAnimations: true,
|
||||
});
|
||||
cy.get('[data-testid="add-glossary"]').click();
|
||||
cy.get('[data-testid="name"]').should('be.visible').type(glossary);
|
||||
cy.get(descriptionBox).scrollIntoView().should('be.visible').type(glossary);
|
||||
cy.get('[data-testid="save-glossary"]')
|
||||
@ -308,6 +306,9 @@ describe('Add and Remove Owner and Tier', () => {
|
||||
.click({ waitForAnimations: true });
|
||||
verifyResponseStatusCode('@getGlossaries', 200);
|
||||
verifyResponseStatusCode('@glossaryPermission', 200);
|
||||
interceptURL('GET', '/api/v1/glossaryTerms*', 'getGlossaryTerms');
|
||||
cy.get('.ant-menu-item').contains(glossary).should('be.visible').click();
|
||||
verifyResponseStatusCode('@getGlossaryTerms', 200);
|
||||
cy.get('[data-testid="add-new-tag-button-header"]')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
@ -365,6 +366,9 @@ describe('Add and Remove Owner and Tier', () => {
|
||||
.click({ waitForAnimations: true });
|
||||
verifyResponseStatusCode('@getGlossaries', 200);
|
||||
verifyResponseStatusCode('@glossaryPermission', 200);
|
||||
interceptURL('GET', '/api/v1/glossaryTerms*', 'getGlossaryTerms');
|
||||
cy.get('.ant-menu-item').contains(glossary).should('be.visible').click();
|
||||
verifyResponseStatusCode('@getGlossaryTerms', 200);
|
||||
cy.get('[data-testid="manage-button"]').should('be.visible').click();
|
||||
cy.get('[data-testid="delete-button"]')
|
||||
.scrollIntoView()
|
||||
|
||||
@ -118,6 +118,27 @@ describe('Create a team and add that team as a owner of the entity', () => {
|
||||
|
||||
cy.get('[data-testid="remove-owner"]').should('be.visible').click();
|
||||
verifyResponseStatusCode('@updateTable', 200);
|
||||
cy.get('[data-testid="owner-link"]').should('contain', 'No Owner');
|
||||
cy.get('[data-testid="owner-link"]').should(
|
||||
'not.contain',
|
||||
TEAM_DETAILS.name
|
||||
);
|
||||
});
|
||||
|
||||
it('Delete newly created team', () => {
|
||||
const token = localStorage.getItem('oidcIdToken');
|
||||
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: `/api/v1/teams/name/${teamName}`,
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
}).then((response) => {
|
||||
cy.request({
|
||||
method: 'GET',
|
||||
url: `/api/v1/teams/${response.body.id}?hardDelete=true&recursive=true`,
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -11,6 +11,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line spaced-comment
|
||||
/// <reference types="cypress" />
|
||||
|
||||
import {
|
||||
interceptURL,
|
||||
verifyResponseStatusCode,
|
||||
@ -24,7 +27,7 @@ const addTags = (tag) => {
|
||||
cy.get('[data-testid="tag-selector"]').scrollIntoView().should('be.visible');
|
||||
cy.get('[data-testid="tag-selector"]').click().type(tagName);
|
||||
|
||||
cy.get(`[data-testid='tag-${tag}']`).click();
|
||||
cy.get(`.ant-select-dropdown [data-testid='tag-${tag}']`).click();
|
||||
cy.get('[data-testid="tag-selector"] > .ant-select-selector').contains(tag);
|
||||
};
|
||||
|
||||
@ -53,7 +56,9 @@ const removeTags = (checkForParentEntity) => {
|
||||
.should('be.visible')
|
||||
.click();
|
||||
|
||||
cy.get('[data-testid="remove-tags"]').should('be.visible').click();
|
||||
cy.get('[data-testid="remove-tags"]')
|
||||
.should('be.visible')
|
||||
.click({ multiple: true });
|
||||
|
||||
cy.get('[data-testid="saveAssociatedTag"]')
|
||||
.scrollIntoView()
|
||||
@ -81,22 +86,37 @@ describe('Check if tags addition and removal flow working properly from tables',
|
||||
|
||||
TAGS_ADD_REMOVE_ENTITIES.map((entityDetails) =>
|
||||
it(`Adding and removing tags to the ${entityDetails.entity} entity should work properly`, () => {
|
||||
interceptURL(
|
||||
'GET',
|
||||
`/api/v1/${entityDetails.entity}/name/*?fields=*`,
|
||||
'getEntityDetail'
|
||||
);
|
||||
interceptURL('PATCH', `/api/v1/${entityDetails.entity}/*`, 'tagsChange');
|
||||
interceptURL(
|
||||
'PATCH',
|
||||
`/api/v1/${entityDetails.insideEntity ?? entityDetails.entity}/*`,
|
||||
'tagsChange'
|
||||
);
|
||||
visitEntityDetailsPage(
|
||||
entityDetails.term,
|
||||
entityDetails.serviceName,
|
||||
entityDetails.entity
|
||||
);
|
||||
verifyResponseStatusCode('@getEntityDetail', 200);
|
||||
|
||||
cy.get(
|
||||
'[data-testid="entity-right-panel"] [data-testid="tags-container"] [data-testid="add-tag"]'
|
||||
)
|
||||
.should('be.visible')
|
||||
.click();
|
||||
'[data-testid="entity-right-panel"] [data-testid="tags-container"]'
|
||||
).then(($container) => {
|
||||
if ($container.find('[data-testid="add-tag"]').length === 0) {
|
||||
removeTags(true);
|
||||
}
|
||||
cy.get(
|
||||
'[data-testid="entity-right-panel"] [data-testid="tags-container"] [data-testid="add-tag"]'
|
||||
).click();
|
||||
});
|
||||
|
||||
addTags(entityDetails.tags[0]);
|
||||
|
||||
interceptURL('PATCH', `/api/v1/${entityDetails.entity}/*`, 'tagsChange');
|
||||
|
||||
cy.get('[data-testid="saveAssociatedTag"]')
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
@ -110,26 +130,30 @@ describe('Check if tags addition and removal flow working properly from tables',
|
||||
|
||||
if (entityDetails.entity === 'mlmodels') {
|
||||
cy.get(
|
||||
`[data-testid="feature-card-${entityDetails.fieldName}"] [data-testid="Classification-tags-0"] [data-testid="add-tag"]`
|
||||
)
|
||||
.should('be.visible')
|
||||
.click();
|
||||
`[data-testid="feature-card-${entityDetails.fieldName}"] [data-testid="Classification-tags-0"]`
|
||||
).then(($container) => {
|
||||
if ($container.find('[data-testid="add-tag"]').length === 0) {
|
||||
removeTags(false);
|
||||
}
|
||||
cy.get(
|
||||
`[data-testid="feature-card-${entityDetails.fieldName}"] [data-testid="Classification-tags-0"] [data-testid="add-tag"]`
|
||||
).click();
|
||||
});
|
||||
} else {
|
||||
cy.get(
|
||||
`.ant-table-tbody [data-testid="Classification-tags-0"] [data-testid="tags-container"] [data-testid="entity-tags"]`
|
||||
)
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.click();
|
||||
'.ant-table-tbody [data-testid="Classification-tags-0"] [data-testid="tags-container"]'
|
||||
).then(($container) => {
|
||||
if ($container.find('[data-testid="add-tag"]').length === 0) {
|
||||
removeTags(false);
|
||||
}
|
||||
cy.get(
|
||||
'.ant-table-tbody [data-testid="Classification-tags-0"] [data-testid="tags-container"] [data-testid="add-tag"]'
|
||||
).click();
|
||||
});
|
||||
}
|
||||
|
||||
entityDetails.tags.map((tag) => addTags(tag));
|
||||
cy.clickOutside();
|
||||
interceptURL(
|
||||
'PATCH',
|
||||
`/api/v1/${entityDetails.insideEntity ?? entityDetails.entity}/*`,
|
||||
'tagsChange'
|
||||
);
|
||||
|
||||
cy.get('[data-testid="saveAssociatedTag"]')
|
||||
.scrollIntoView()
|
||||
|
||||
@ -59,12 +59,9 @@ describe('Custom Properties should work properly', () => {
|
||||
);
|
||||
|
||||
// Navigating back to custom properties page
|
||||
cy.get('[data-testid="appbar-item-settings"]')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="appbar-item-settings"]').click();
|
||||
cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`)
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.click();
|
||||
|
||||
verifyResponseStatusCode('@getEntity', 200);
|
||||
@ -80,7 +77,6 @@ describe('Custom Properties should work properly', () => {
|
||||
// Selecting the entity
|
||||
cy.get(`[data-menu-id*="customAttributes.${entity.name}"]`)
|
||||
.scrollIntoView()
|
||||
.should('be.visible')
|
||||
.click();
|
||||
|
||||
verifyResponseStatusCode('@getEntity', 200);
|
||||
|
||||
@ -372,10 +372,7 @@ describe('Glossary page should work properly', () => {
|
||||
'fetchTags'
|
||||
);
|
||||
|
||||
// check for no data placeholder
|
||||
cy.get('[data-testid="add-placeholder-button"]')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('[data-testid="add-glossary"]').click();
|
||||
|
||||
// Redirecting to add glossary page
|
||||
cy.get('[data-testid="form-heading"]')
|
||||
@ -499,6 +496,11 @@ describe('Glossary page should work properly', () => {
|
||||
});
|
||||
|
||||
it('Verify and Remove Tags from Glossary', () => {
|
||||
cy.get('[data-testid="glossary-left-panel"]')
|
||||
.contains(NEW_GLOSSARY.name)
|
||||
.click();
|
||||
|
||||
checkDisplayName(NEW_GLOSSARY.name);
|
||||
// Verify Tags which is added at the time of creating glossary
|
||||
cy.get('[data-testid="tags-container"]')
|
||||
.contains('Personal')
|
||||
@ -519,7 +521,7 @@ describe('Glossary page should work properly', () => {
|
||||
it('Verify added glossary details', () => {
|
||||
cy.get('[data-testid="glossary-left-panel"]')
|
||||
.contains(NEW_GLOSSARY.name)
|
||||
.should('be.visible');
|
||||
.click();
|
||||
|
||||
checkDisplayName(NEW_GLOSSARY.name);
|
||||
|
||||
@ -569,6 +571,11 @@ describe('Glossary page should work properly', () => {
|
||||
});
|
||||
|
||||
it('Updating data of glossary should work properly', () => {
|
||||
cy.get('[data-testid="glossary-left-panel"]')
|
||||
.contains(NEW_GLOSSARY.name)
|
||||
.click();
|
||||
|
||||
checkDisplayName(NEW_GLOSSARY.name);
|
||||
// updating tags
|
||||
updateTags(false);
|
||||
|
||||
|
||||
@ -23,6 +23,7 @@ const CREDENTIALS = {
|
||||
lastName: 'User',
|
||||
email: 'user@openmetadata.org',
|
||||
password: 'User@OMD123',
|
||||
id: '',
|
||||
};
|
||||
const invalidEmail = 'userTest@openmetadata.org';
|
||||
const invalidPassword = 'testUsers@123';
|
||||
@ -30,6 +31,7 @@ const invalidPassword = 'testUsers@123';
|
||||
describe('Login flow should work properly', () => {
|
||||
it('Signup and Login with signed up credentials', () => {
|
||||
interceptURL('GET', 'api/v1/system/config/auth', 'getLoginPage');
|
||||
interceptURL('POST', '/api/v1/users/checkEmailInUse', 'createUser');
|
||||
cy.visit('/');
|
||||
verifyResponseStatusCode('@getLoginPage', 200);
|
||||
// Click on create account button
|
||||
@ -58,6 +60,7 @@ describe('Login flow should work properly', () => {
|
||||
.type(CREDENTIALS.password);
|
||||
// Click on create account button
|
||||
cy.get('.ant-btn').contains('Create Account').should('be.visible').click();
|
||||
verifyResponseStatusCode('@createUser', 200);
|
||||
cy.url().should('eq', `${BASE_URL}/signin`).and('contain', 'signin');
|
||||
|
||||
// Login with the created user
|
||||
@ -81,7 +84,9 @@ describe('Login flow should work properly', () => {
|
||||
cy.get('[data-testid="user-name"]')
|
||||
.should('be.visible')
|
||||
.click({ force: true });
|
||||
verifyResponseStatusCode('@getUser', 200);
|
||||
cy.wait('@getUser').then((response) => {
|
||||
CREDENTIALS.id = response.response.body.id;
|
||||
});
|
||||
cy.get(
|
||||
'[data-testid="user-profile"] [data-testid="user-profile-details"]'
|
||||
).should('contain', `${CREDENTIALS.firstName}${CREDENTIALS.lastName}`);
|
||||
@ -122,3 +127,21 @@ describe('Login flow should work properly', () => {
|
||||
cy.get('.ant-btn').contains('Submit').click();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Cleanup', () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
});
|
||||
|
||||
it('delete user', () => {
|
||||
const token = localStorage.getItem('oidcIdToken');
|
||||
|
||||
cy.request({
|
||||
method: 'DELETE',
|
||||
url: `/api/v1/users/${CREDENTIALS.id}?hardDelete=true&recursive=false`,
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
}).then((response) => {
|
||||
expect(response.status).to.eq(200);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -10,7 +10,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line spaced-comment
|
||||
/// <reference types="cypress" />
|
||||
import {
|
||||
addUser,
|
||||
deleteSoftDeletedUser,
|
||||
@ -37,16 +38,8 @@ describe('Users flow should work properly', () => {
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
interceptURL(
|
||||
'GET',
|
||||
'/api/v1/users?fields=profile,teams,roles&&isBot=false&limit=15',
|
||||
'getUsers'
|
||||
);
|
||||
cy.get('[data-testid="settings-left-panel"]')
|
||||
.contains('Users')
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
interceptURL('GET', '/api/v1/users?fields=*', 'getUsers');
|
||||
cy.get('[data-testid="settings-left-panel"]').contains('Users').click();
|
||||
});
|
||||
|
||||
it('Add new User', () => {
|
||||
@ -55,20 +48,6 @@ describe('Users flow should work properly', () => {
|
||||
|
||||
addUser(userName, userEmail);
|
||||
verifyResponseStatusCode('@getUsers', 200);
|
||||
|
||||
// Validate if user is added in the User tab
|
||||
interceptURL(
|
||||
'GET',
|
||||
'/api/v1/search/query?q=**&from=0&size=*&index=*',
|
||||
'searchUser'
|
||||
);
|
||||
|
||||
cy.get('[data-testid="searchbar"]')
|
||||
.should('exist')
|
||||
.should('be.visible')
|
||||
.type(userName);
|
||||
verifyResponseStatusCode('@searchUser', 200);
|
||||
cy.get('.ant-table-tbody ').should('contain', userName);
|
||||
});
|
||||
|
||||
it('Soft delete user', () => {
|
||||
|
||||
@ -28,6 +28,7 @@ const CreateErrorPlaceHolder = ({
|
||||
onClick,
|
||||
heading,
|
||||
doc,
|
||||
buttonId,
|
||||
}: CreatePlaceholderProps) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@ -74,7 +75,7 @@ const CreateErrorPlaceHolder = ({
|
||||
<Button
|
||||
ghost
|
||||
className="p-x-lg"
|
||||
data-testid="add-placeholder-button"
|
||||
data-testid={buttonId ?? 'add-placeholder-button'}
|
||||
icon={<PlusOutlined />}
|
||||
type="primary"
|
||||
onClick={onClick}>
|
||||
|
||||
@ -32,12 +32,14 @@ const ErrorPlaceHolder = ({
|
||||
size = SIZE.LARGE,
|
||||
button,
|
||||
permission,
|
||||
buttonId,
|
||||
}: ErrorPlaceholderProps) => {
|
||||
const getErrorPlaceHolder = () => {
|
||||
switch (type) {
|
||||
case ERROR_PLACEHOLDER_TYPE.CREATE:
|
||||
return (
|
||||
<CreateErrorPlaceHolder
|
||||
buttonId={buttonId}
|
||||
className={className}
|
||||
doc={doc}
|
||||
heading={heading}
|
||||
|
||||
@ -16,14 +16,12 @@ import { ERROR_PLACEHOLDER_TYPE, SIZE } from 'enums/common.enum';
|
||||
export interface ErrorPlaceholderProps {
|
||||
children?: React.ReactNode;
|
||||
type?: ERROR_PLACEHOLDER_TYPE;
|
||||
buttonLabel?: string;
|
||||
buttonListener?: () => void;
|
||||
buttonId?: string;
|
||||
heading?: string;
|
||||
doc?: string;
|
||||
button?: React.ReactNode;
|
||||
className?: string;
|
||||
size?: SIZE;
|
||||
disabled?: boolean;
|
||||
onClick?: () => void;
|
||||
permission?: boolean;
|
||||
}
|
||||
@ -41,6 +39,7 @@ export interface CreatePlaceholderProps {
|
||||
heading?: string;
|
||||
doc?: string;
|
||||
permission?: boolean;
|
||||
buttonId?: string;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
|
||||
@ -179,6 +179,7 @@ const CustomEntityDetailV1 = () => {
|
||||
<div data-testid="entity-custom-fields">
|
||||
{isEmpty(selectedEntityTypeDetail.customProperties) ? (
|
||||
<ErrorPlaceHolder
|
||||
buttonId="add-field-button"
|
||||
className="mt-24"
|
||||
doc={CUSTOM_PROPERTIES_DOCS}
|
||||
heading={t('label.property')}
|
||||
|
||||
@ -314,6 +314,7 @@ const GlossaryPage = () => {
|
||||
if (glossaries.length === 0 && !isLoading) {
|
||||
return (
|
||||
<ErrorPlaceHolder
|
||||
buttonId="add-glossary"
|
||||
className="mt-0-important"
|
||||
doc={GLOSSARIES_DOCS}
|
||||
heading={t('label.glossary')}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user