cypress: updated tagsAddRemove spec as per upgrade test (#13083)

This commit is contained in:
Shailesh Parmar 2023-09-08 10:40:28 +05:30 committed by GitHub
parent 478837fa85
commit a41326ea1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 14 deletions

View File

@ -19,6 +19,7 @@ export const TAGS_ADD_REMOVE_ENTITIES = [
serviceName: 'sample_data',
fieldName: 'SKU',
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/name/*',
},
{
term: 'address_book',
@ -27,6 +28,7 @@ export const TAGS_ADD_REMOVE_ENTITIES = [
serviceName: 'sample_kafka',
fieldName: 'AddressBook',
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/name/*',
},
{
term: 'deck.gl Demo',
@ -36,6 +38,7 @@ export const TAGS_ADD_REMOVE_ENTITIES = [
serviceName: 'sample_superset',
fieldName: 'e3cfd274-44f8-4bf3-b75d-d40cf88869ba',
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/*',
},
{
term: 'dim_address_etl',
@ -44,6 +47,7 @@ export const TAGS_ADD_REMOVE_ENTITIES = [
serviceName: 'sample_airflow',
fieldName: 'dim_address_task',
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/*',
},
{
term: 'eta_predictions',
@ -52,5 +56,6 @@ export const TAGS_ADD_REMOVE_ENTITIES = [
serviceName: 'mlflow_svc',
fieldName: 'sales',
tags: ['PersonalData.Personal', 'PII.Sensitive'],
permissionApi: '/api/v1/permissions/*/*',
},
];

View File

@ -55,8 +55,8 @@ const DATABASE_AND_SCHEMA = {
export const ENTITIES_DISPLAY_NAME = {
table: {
name: 'dim(shop)',
oldDisplayName: 'dim(shop)',
name: 'dim.shop',
oldDisplayName: 'dim.shop',
displayName: 'Dim Shop Test',
entity: MYDATA_SUMMARY_OPTIONS.tables,
serviceName: DB_SERVICE,

View File

@ -49,42 +49,47 @@ const ID = {
teams: {
testid: '[data-menu-id*="teams"]',
button: 'add-team',
api: '/api/v1/teams/name/Organization?*',
},
users: {
testid: '[data-menu-id*="users"]',
button: 'add-user',
api: '/api/v1/users?fields=*isBot=false*',
},
admins: {
testid: '[data-menu-id*="admins"]',
button: 'add-user',
},
roles: {
testid: '[data-menu-id*="roles"]',
button: 'add-role',
},
policies: {
testid: '[data-menu-id*="policies"]',
button: 'add-policy',
api: '/api/v1/users?fields=*isAdmin=true*',
},
databases: {
testid: '[data-menu-id*="databases"]',
button: 'add-service-button',
api: '/api/v1/services/databaseServices?*',
},
messaging: {
testid: '[data-menu-id*="messaging"]',
button: 'add-service-button',
api: '/api/v1/services/messagingServices?*',
},
dashboard: {
testid: '[data-menu-id*="services.dashboards"]',
button: 'add-service-button',
api: '/api/v1/services/dashboardServices?*',
},
pipelines: {
testid: '[data-menu-id*="services.pipelines"]',
button: 'add-service-button',
api: '/api/v1/services/pipelineServices?*',
},
mlmodels: {
testid: '[data-menu-id*="services.mlModels"]',
button: 'add-service-button',
api: '/api/v1/services/mlmodelServices?*',
},
storage: {
testid: '[data-menu-id*="services.storages"]',
button: 'add-service-button',
api: '/api/v1/services/storageServices?*',
},
};
const PERMISSIONS = {
@ -273,7 +278,15 @@ describe('DataConsumer Edit policy should work properly', () => {
// Navigate to settings
cy.get(NAVBAR_DETAILS.settings.testid).should('be.visible').click();
Object.values(ID).forEach((id) => {
if (id?.api) {
interceptURL('GET', id.api, 'getTabDetails');
}
cy.get(id.testid).should('be.visible').click();
if (id?.api) {
verifyResponseStatusCode('@getTabDetails', 200);
}
cy.get(`[data-testid="${id.button}"]`).should('not.be.exist');
});

View File

@ -84,8 +84,10 @@ describe('Check if tags addition and removal flow working properly from tables',
cy.login();
});
TAGS_ADD_REMOVE_ENTITIES.map((entityDetails) =>
it(`Adding and removing tags to the ${entityDetails.entity} entity should work properly`, () => {
TAGS_ADD_REMOVE_ENTITIES.map((entityDetails) => {
it(`Adding & removing tags to the ${entityDetails.entity} entity`, () => {
interceptURL('GET', entityDetails.permissionApi, 'getEntityPermission');
interceptURL(
'GET',
`/api/v1/${entityDetails.entity}/name/*?fields=*`,
@ -103,6 +105,7 @@ describe('Check if tags addition and removal flow working properly from tables',
entityDetails.entity
);
verifyResponseStatusCode('@getEntityDetail', 200);
verifyResponseStatusCode('@getEntityPermission', 200);
cy.get(
'[data-testid="entity-right-panel"] [data-testid="tags-container"]'
@ -127,6 +130,44 @@ describe('Check if tags addition and removal flow working properly from tables',
checkTags(entityDetails.tags[0], true);
removeTags(true);
});
it(`Adding & removing tags to the ${entityDetails.entity} entity schema table`, () => {
interceptURL(
'GET',
`/api/v1/${entityDetails.entity}/name/*?fields=*`,
'getEntityDetail'
);
interceptURL('GET', entityDetails.permissionApi, 'getEntityPermission');
interceptURL('PATCH', `/api/v1/${entityDetails.entity}/*`, 'tagsChange');
interceptURL(
'PATCH',
`/api/v1/${entityDetails.insideEntity ?? entityDetails.entity}/*`,
'tagsChange'
);
if (entityDetails.insideEntity) {
interceptURL(
'GET',
`/api/v1/${entityDetails.insideEntity}/*`,
'getInsideColumn'
);
interceptURL(
'GET',
`/api/v1/permissions/chart/*`,
'getInsideColumnPermission'
);
}
visitEntityDetailsPage(
entityDetails.term,
entityDetails.serviceName,
entityDetails.entity
);
verifyResponseStatusCode('@getEntityDetail', 200);
verifyResponseStatusCode('@getEntityPermission', 200);
if (entityDetails.insideEntity) {
verifyResponseStatusCode('@getInsideColumn', 200);
verifyResponseStatusCode('@getInsideColumnPermission', 200);
}
if (entityDetails.entity === 'mlmodels') {
cy.get(
@ -165,6 +206,6 @@ describe('Check if tags addition and removal flow working properly from tables',
entityDetails.tags.map((tag) => checkTags(tag));
removeTags(false, entityDetails.separate);
})
);
});
});
});