From a41326ea1e4a8929b357a9f153452c4ccb148653 Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Fri, 8 Sep 2023 10:40:28 +0530 Subject: [PATCH] cypress: updated tagsAddRemove spec as per upgrade test (#13083) --- .../constants/tagsAddRemove.constants.js | 5 ++ .../constants/updateDisplayName.constant.js | 4 +- .../e2e/Features/DataConsumerRole.spec.js | 29 ++++++++--- .../ui/cypress/e2e/Flow/TagsAddRemove.spec.js | 49 +++++++++++++++++-- 4 files changed, 73 insertions(+), 14 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/tagsAddRemove.constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/tagsAddRemove.constants.js index 97ae6050f3a..9b924dbcaff 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/tagsAddRemove.constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/tagsAddRemove.constants.js @@ -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/*/*', }, ]; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/updateDisplayName.constant.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/updateDisplayName.constant.js index 2b830d49fa1..0d75eb684d7 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/updateDisplayName.constant.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/updateDisplayName.constant.js @@ -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, diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/DataConsumerRole.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/DataConsumerRole.spec.js index 06b59fb11ce..beb8f7f9307 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/DataConsumerRole.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/DataConsumerRole.spec.js @@ -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'); }); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/TagsAddRemove.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/TagsAddRemove.spec.js index 4d83b2a396e..e76eb593ce4 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/TagsAddRemove.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/TagsAddRemove.spec.js @@ -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); - }) - ); + }); + }); });