From 4322030450cb978ec6a1c860d151ff371edd80d9 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Fri, 22 Sep 2023 17:45:38 +0530 Subject: [PATCH 1/3] supported cypress for stored procedure and data models --- .../resources/ui/cypress/common/common.js | 11 +- .../ui/cypress/constants/Version.constants.js | 206 +++++++++++------- .../ui/cypress/constants/constants.js | 35 +++ .../constants/tagsAddRemove.constants.js | 16 ++ .../constants/updateDisplayName.constant.js | 12 + ...version.constant.js => voting.constant.js} | 21 ++ .../ui/cypress/e2e/Features/Following.spec.js | 20 ++ .../e2e/Features/RecentlyViewed.spec.js | 2 + .../e2e/Flow/AddAndRemoveTierAndOwner.spec.js | 2 + .../ui/cypress/e2e/Flow/EntityVoting.spec.js | 2 +- .../ui/cypress/e2e/Flow/TagsAddRemove.spec.js | 140 ++++++------ .../StoredProcedureVersion.component.tsx | 8 +- .../DataModelPage/DataModelPage.component.tsx | 2 +- .../resources/ui/src/rest/dataModelsAPI.ts | 6 +- 14 files changed, 334 insertions(+), 149 deletions(-) rename openmetadata-ui/src/main/resources/ui/cypress/constants/{version.constant.js => voting.constant.js} (75%) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js index 3c807ca04b65..388dd68859ec 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/common.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/common.js @@ -482,7 +482,16 @@ export const visitEntityDetailsPage = ( dataTestId, entityType ) => { - interceptURL('GET', '/api/v1/*/name/*', 'getEntityDetails'); + if (entity === 'dashboardDataModel') { + interceptURL( + 'GET', + '/api/v1/dashboard/datamodels/name/*', + 'getEntityDetails' + ); + } else { + interceptURL('GET', '/api/v1/*/name/*', 'getEntityDetails'); + } + interceptURL( 'GET', `/api/v1/search/query?q=*&index=${SEARCH_INDEX[entity]}&from=*&size=**`, diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js index 8aedd9757933..1ea85b329a40 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js @@ -24,6 +24,8 @@ const DASHBOARD_NAME = `cypress_version_dashboard-${uuid()}`; const PIPELINE_NAME = `cypress_version_pipeline-${uuid()}`; const ML_MODEL_NAME = `cypress_version_ml_model-${uuid()}`; const CONTAINER_NAME = `cypress_version_container-${uuid()}`; +const STORED_PROCEDURE_NAME = `cypress_version_stored_procedure-${uuid()}`; +const DATA_MODEL_NAME = `cypress_version_data_model_${uuid()}`; const TABLE_DETAILS_FOR_VERSION_TEST = { name: TABLE_NAME, @@ -510,90 +512,39 @@ const CONTAINER_PATCH_PAYLOAD = [ }, ]; -export const ENTITY_DETAILS_FOR_VERSION_TEST = { - Table: { - name: TABLE_NAME, - serviceName: 'sample_data', - entity: 'tables', - entityCreationDetails: TABLE_DETAILS_FOR_VERSION_TEST, - entityPatchPayload: TABLE_PATCH_PAYLOAD, - isChildrenExist: true, - childSelector: 'data-row-key', - entityAddedDescription: `Description for ${TABLE_NAME}`, - updatedTagEntityChildName: 'user_id', - entityChildRemovedDescription: 'First name of the staff member.', - entityChildAddedDescription: 'Last name of the staff member.', - }, - Topic: { - name: TOPIC_NAME, - serviceName: 'sample_kafka', - entity: 'topics', - entityCreationDetails: TOPIC_DETAILS_FOR_VERSION_TEST, - entityPatchPayload: TOPIC_PATCH_PAYLOAD, - isChildrenExist: true, - childSelector: 'data-row-key', - entityAddedDescription: `Description for ${TOPIC_NAME}`, - updatedTagEntityChildName: 'default', - entityChildRemovedDescription: 'Description for schema field first_name', - entityChildAddedDescription: 'Description for schema field last_name', - }, - // TODO - Remove the comment after this issue is resolved https://github.com/open-metadata/OpenMetadata/issues/12924 - // Dashboard: { - // name: DASHBOARD_NAME, - // serviceName: 'sample_superset', - // entity: 'dashboards', - // entityCreationDetails: DASHBOARD_DETAILS_FOR_VERSION_TEST, - // entityPatchPayload: DASHBOARD_PATCH_PAYLOAD, - // isChildrenExist: false, - // entityAddedDescription: `Description for ${DASHBOARD_NAME}`, - // }, - Pipeline: { - name: PIPELINE_NAME, - serviceName: 'sample_airflow', - entity: 'pipelines', - entityCreationDetails: PIPELINE_DETAILS_FOR_VERSION_TEST, - entityPatchPayload: PIPELINE_PATCH_PAYLOAD, - isChildrenExist: true, - childSelector: 'data-row-key', - entityAddedDescription: `Description for ${PIPELINE_NAME}`, - updatedTagEntityChildName: 'cypress_task_1', - entityChildRemovedDescription: 'Description for task cypress_task_2', - entityChildAddedDescription: 'Description for task cypress_task_3', - }, - 'ML Model': { - name: ML_MODEL_NAME, - serviceName: 'mlflow_svc', - entity: 'mlmodels', - entityCreationDetails: ML_MODEL_DETAILS_FOR_VERSION_TEST, - entityPatchPayload: ML_MODEL_PATCH_PAYLOAD, - isChildrenExist: true, - childSelector: 'data-testid', - entityAddedDescription: `Description for ${ML_MODEL_NAME}`, - updatedTagEntityChildName: 'feature-card-feature_1', - entityChildRemovedDescription: 'Description for mlFeature feature_2', - entityChildAddedDescription: 'Description for mlFeature feature_3', - }, - Container: { - name: CONTAINER_NAME, - serviceName: 's3_storage_sample', - entity: 'containers', - entityCreationDetails: CONTAINER_DETAILS_FOR_VERSION_TEST, - entityPatchPayload: CONTAINER_PATCH_PAYLOAD, - isChildrenExist: true, - childSelector: 'data-row-key', - entityAddedDescription: `Description for ${CONTAINER_NAME}`, - updatedTagEntityChildName: 'column_1', - entityChildRemovedDescription: 'Description for column column_2', - entityChildAddedDescription: 'Description for column column_3', +const STORED_PROCEDURE_DETAILS_FOR_VERSION_TEST = { + name: STORED_PROCEDURE_NAME, + databaseSchema: 'sample_data.ecommerce_db.shopify', + storedProcedureCode: { + langauge: 'SQL', + code: 'CREATE OR REPLACE PROCEDURE output_message(message VARCHAR)\nRETURNS VARCHAR NOT NULL\nLANGUAGE SQL\nAS\n$$\nBEGIN\n RETURN message;\nEND;\n$$\n;', }, + tags: [], }; -export const DATA_MODEL_NAME = `cypress_version_data_model_${uuid()}`; +const STORED_PROCEDURE_PATCH_PAYLOAD = [ + { + op: 'add', + path: '/tags/0', + value: { + labelType: 'Manual', + state: 'Confirmed', + source: 'Classification', + tagFQN: 'PersonalData.SpecialCategory', + }, + }, + { + op: 'add', + path: '/description', + value: `Description for ${STORED_PROCEDURE_NAME}`, + }, +]; export const DATA_MODEL_DETAILS_FOR_VERSION_TEST = { name: DATA_MODEL_NAME, service: 'sample_looker', dataModelType: 'LookMlExplore', + tags: [], columns: [ { name: 'column_1', @@ -673,6 +624,109 @@ export const DATA_MODEL_PATCH_PAYLOAD = [ value: `Description for ${DATA_MODEL_NAME}`, }, ]; +export const ENTITY_DETAILS_FOR_VERSION_TEST = { + Table: { + name: TABLE_NAME, + serviceName: 'sample_data', + entity: 'tables', + entityCreationDetails: TABLE_DETAILS_FOR_VERSION_TEST, + entityPatchPayload: TABLE_PATCH_PAYLOAD, + isChildrenExist: true, + childSelector: 'data-row-key', + entityAddedDescription: `Description for ${TABLE_NAME}`, + updatedTagEntityChildName: 'user_id', + entityChildRemovedDescription: 'First name of the staff member.', + entityChildAddedDescription: 'Last name of the staff member.', + }, + Topic: { + name: TOPIC_NAME, + serviceName: 'sample_kafka', + entity: 'topics', + entityCreationDetails: TOPIC_DETAILS_FOR_VERSION_TEST, + entityPatchPayload: TOPIC_PATCH_PAYLOAD, + isChildrenExist: true, + childSelector: 'data-row-key', + entityAddedDescription: `Description for ${TOPIC_NAME}`, + updatedTagEntityChildName: 'default', + entityChildRemovedDescription: 'Description for schema field first_name', + entityChildAddedDescription: 'Description for schema field last_name', + }, + // TODO - Remove the comment after this issue is resolved https://github.com/open-metadata/OpenMetadata/issues/12924 + // Dashboard: { + // name: DASHBOARD_NAME, + // serviceName: 'sample_superset', + // entity: 'dashboards', + // entityCreationDetails: DASHBOARD_DETAILS_FOR_VERSION_TEST, + // entityPatchPayload: DASHBOARD_PATCH_PAYLOAD, + // isChildrenExist: false, + // entityAddedDescription: `Description for ${DASHBOARD_NAME}`, + // }, + Pipeline: { + name: PIPELINE_NAME, + serviceName: 'sample_airflow', + entity: 'pipelines', + entityCreationDetails: PIPELINE_DETAILS_FOR_VERSION_TEST, + entityPatchPayload: PIPELINE_PATCH_PAYLOAD, + isChildrenExist: true, + childSelector: 'data-row-key', + entityAddedDescription: `Description for ${PIPELINE_NAME}`, + updatedTagEntityChildName: 'cypress_task_1', + entityChildRemovedDescription: 'Description for task cypress_task_2', + entityChildAddedDescription: 'Description for task cypress_task_3', + }, + 'ML Model': { + name: ML_MODEL_NAME, + serviceName: 'mlflow_svc', + entity: 'mlmodels', + entityCreationDetails: ML_MODEL_DETAILS_FOR_VERSION_TEST, + entityPatchPayload: ML_MODEL_PATCH_PAYLOAD, + isChildrenExist: true, + childSelector: 'data-testid', + entityAddedDescription: `Description for ${ML_MODEL_NAME}`, + updatedTagEntityChildName: 'feature-card-feature_1', + entityChildRemovedDescription: 'Description for mlFeature feature_2', + entityChildAddedDescription: 'Description for mlFeature feature_3', + }, + Container: { + name: CONTAINER_NAME, + serviceName: 's3_storage_sample', + entity: 'containers', + entityCreationDetails: CONTAINER_DETAILS_FOR_VERSION_TEST, + entityPatchPayload: CONTAINER_PATCH_PAYLOAD, + isChildrenExist: true, + childSelector: 'data-row-key', + entityAddedDescription: `Description for ${CONTAINER_NAME}`, + updatedTagEntityChildName: 'column_1', + entityChildRemovedDescription: 'Description for column column_2', + entityChildAddedDescription: 'Description for column column_3', + }, + 'Stored Procedure': { + name: STORED_PROCEDURE_NAME, + serviceName: 'sample_data', + entity: 'storedProcedures', + entityCreationDetails: STORED_PROCEDURE_DETAILS_FOR_VERSION_TEST, + entityPatchPayload: STORED_PROCEDURE_PATCH_PAYLOAD, + isChildrenExist: false, + childSelector: 'data-row-key', + entityAddedDescription: `Description for ${STORED_PROCEDURE_NAME}`, + updatedTagEntityChildName: '', + entityChildRemovedDescription: '', + entityChildAddedDescription: '', + }, + 'Data Model': { + name: DATA_MODEL_NAME, + serviceName: 'sample_looker', + entity: 'dashboardDataModel', + entityCreationDetails: DATA_MODEL_DETAILS_FOR_VERSION_TEST, + entityPatchPayload: DATA_MODEL_PATCH_PAYLOAD, + isChildrenExist: true, + childSelector: 'data-row-key', + entityAddedDescription: `Description for ${DATA_MODEL_NAME}`, + updatedTagEntityChildName: 'column_1', + entityChildRemovedDescription: 'Description for column column_2', + entityChildAddedDescription: 'Description for column column_3', + }, +}; export const DATA_MODEL_DETAILS = { name: DATA_MODEL_NAME, diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js index 75e46c0858b1..97b590825a00 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js @@ -32,6 +32,8 @@ export const MYDATA_SUMMARY_OPTIONS = { containers: 'containers', glossaryTerms: 'glossary-terms', tags: 'tags', + storedProcedures: 'storedProcedures', + dataModel: 'dashboardDataModel', }; export const SEARCH_INDEX = { @@ -156,6 +158,38 @@ export const SEARCH_ENTITY_MLMODEL = { }, }; +export const SEARCH_ENTITY_STORED_PROCEDURE = { + stored_procedure_1: { + term: 'update_dim_address_table', + entity: MYDATA_SUMMARY_OPTIONS.storedProcedures, + serviceName: 'sample_data', + entityType: 'Stored Procedure', + }, + stored_procedure_2: { + term: 'update_dim_address_table', + entity: MYDATA_SUMMARY_OPTIONS.storedProcedures, + serviceName: 'sample_data', + displayName: 'update_dim_address_table', + entityType: 'Stored Procedure', + }, +}; + +export const SEARCH_ENTITY_DATA_MODEL = { + data_model_1: { + term: 'operations_view', + entity: MYDATA_SUMMARY_OPTIONS.dataModel, + serviceName: 'sample_looker', + entityType: 'Data Model', + }, + data_model_2: { + term: 'operations_view', + entity: MYDATA_SUMMARY_OPTIONS.dataModel, + serviceName: 'sample_looker', + displayName: 'operations_view', + entityType: 'Data Model', + }, +}; + export const DELETE_ENTITY = { table: { term: 'dim.shop', @@ -323,6 +357,7 @@ export const SERVICE_TYPE = { Pipeline: 'Pipeline', MLModels: 'ML Models', Storage: 'Storage', + StoredProcedure: 'StoredProcedure', }; export const ENTITIES = { 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 9b924dbcaffb..2e7d9654a224 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 @@ -58,4 +58,20 @@ export const TAGS_ADD_REMOVE_ENTITIES = [ tags: ['PersonalData.Personal', 'PII.Sensitive'], permissionApi: '/api/v1/permissions/*/*', }, + { + term: 'update_orders_table', + displayName: 'update_orders_table', + entity: 'storedProcedures', + serviceName: 'sample_data', + tags: ['PersonalData.Personal', 'PII.Sensitive'], + permissionApi: '/api/v1/permissions/*/*', + }, + { + term: 'orders_view', + displayName: 'orders_view', + entity: 'dashboardDataModel', + serviceName: 'sample_looker', + 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 0d75eb684d74..ca29ca35d9cc 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 @@ -106,6 +106,18 @@ export const ENTITIES_DISPLAY_NAME = { serviceName: SERVICES.storageServices.name, breadcrumb: [SERVICES.storageServices.displayName], }, + storedProcedure: { + name: 'update_dim_address_table', + oldDisplayName: 'update_dim_address_table', + displayName: 'Update_Dim_Address_Table', + entity: MYDATA_SUMMARY_OPTIONS.storedProcedures, + serviceName: 'sample_data', + breadcrumb: [ + DATABASE_AND_SCHEMA.schemaDisplayName, + DATABASE_AND_SCHEMA.databaseDisplayName, + SERVICES.databaseServices.displayName, + ], + }, }; export const DASHBOARD_DATA_MODEL = { service: SERVICES.dashboardServices, diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/version.constant.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/voting.constant.js similarity index 75% rename from openmetadata-ui/src/main/resources/ui/cypress/constants/version.constant.js rename to openmetadata-ui/src/main/resources/ui/cypress/constants/voting.constant.js index 7ff870929300..aa3f18c339b4 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/version.constant.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/voting.constant.js @@ -53,4 +53,25 @@ export const VOTING_ENTITIES = [ fieldName: 'sales', permissionApi: '/api/v1/permissions/*/*', }, + { + term: 'update_orders_table', + displayName: 'update_orders_table', + entity: 'storedProcedure', + serviceName: 'sample_data', + permissionApi: '/api/v1/permissions/*/*', + }, + { + term: 'update_orders_table', + displayName: 'update_orders_table', + entity: 'storedProcedure', + serviceName: 'sample_data', + permissionApi: '/api/v1/permissions/*/*', + }, + { + term: 'orders_view', + displayName: 'orders_view', + entity: 'dashboardDataModel', + serviceName: 'sample_looker', + permissionApi: '/api/v1/permissions/*/*', + }, ]; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/Following.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/Following.spec.js index 627c62be8bce..b257a590cf2d 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/Following.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/Following.spec.js @@ -17,8 +17,10 @@ import { } from '../../common/common'; import { SEARCH_ENTITY_DASHBOARD, + SEARCH_ENTITY_DATA_MODEL, SEARCH_ENTITY_MLMODEL, SEARCH_ENTITY_PIPELINE, + SEARCH_ENTITY_STORED_PROCEDURE, SEARCH_ENTITY_TABLE, SEARCH_ENTITY_TOPIC, } from '../../constants/constants'; @@ -33,11 +35,29 @@ const FOLLOWING_ENTITIES = [ SEARCH_ENTITY_TOPIC.topic_1, SEARCH_ENTITY_PIPELINE.pipeline_1, SEARCH_ENTITY_MLMODEL.mlmodel_2, + SEARCH_ENTITY_STORED_PROCEDURE.stored_procedure_2, + SEARCH_ENTITY_DATA_MODEL.data_model_2, ]; const followEntity = ({ term, serviceName, entity }, isUnfollow) => { visitEntityDetailsPage(term, serviceName, entity); + if (entity === 'dashboardDataModel') { + interceptURL( + isUnfollow ? 'DELETE' : 'PUT', + isUnfollow + ? '/api/v1/dashboard/datamodels/*/followers/*' + : '/api/v1/dashboard/datamodels/*/followers', + 'waitAfterFollow' + ); + } else { + interceptURL( + isUnfollow ? 'DELETE' : 'PUT', + isUnfollow ? '/api/v1/*/*/followers/*' : '/api/v1/*/*/followers', + 'waitAfterFollow' + ); + } + interceptURL( isUnfollow ? 'DELETE' : 'PUT', isUnfollow ? '/api/v1/*/*/followers/*' : '/api/v1/*/*/followers', diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/RecentlyViewed.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/RecentlyViewed.spec.js index e34d24d4acbb..6b09a56de64b 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/RecentlyViewed.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Features/RecentlyViewed.spec.js @@ -19,6 +19,7 @@ import { SEARCH_ENTITY_DASHBOARD, SEARCH_ENTITY_MLMODEL, SEARCH_ENTITY_PIPELINE, + SEARCH_ENTITY_STORED_PROCEDURE, SEARCH_ENTITY_TABLE, SEARCH_ENTITY_TOPIC, } from '../../constants/constants'; @@ -33,6 +34,7 @@ const RECENTLY_VIEW_ENTITIES = [ SEARCH_ENTITY_TOPIC.topic_1, SEARCH_ENTITY_PIPELINE.pipeline_1, SEARCH_ENTITY_MLMODEL.mlmodel_2, + SEARCH_ENTITY_STORED_PROCEDURE.stored_procedure_2, ]; describe('Recently viwed data assets', () => { diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js index b4efd27df156..098a5e33da83 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/AddAndRemoveTierAndOwner.spec.js @@ -26,6 +26,7 @@ import { DELETE_TERM, SEARCH_ENTITY_MLMODEL, SEARCH_ENTITY_PIPELINE, + SEARCH_ENTITY_STORED_PROCEDURE, SEARCH_ENTITY_TOPIC, } from '../../constants/constants'; @@ -39,6 +40,7 @@ const ENTITIES = { // dashboard: SEARCH_ENTITY_DASHBOARD.dashboard_2, pipeline: SEARCH_ENTITY_PIPELINE.pipeline_2, mlmodel: SEARCH_ENTITY_MLMODEL.mlmodel_2, + storedProcedure: SEARCH_ENTITY_STORED_PROCEDURE.stored_procedure_2, }; const glossary = 'GlossaryOwnerTest'; const glossaryTerm = 'GlossaryTermOwnerTest'; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js index d890874d96ca..9d9d225d7595 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js @@ -16,7 +16,7 @@ import { verifyResponseStatusCode, visitEntityDetailsPage, } from '../../common/common'; -import { VOTING_ENTITIES } from '../../constants/version.constant'; +import { VOTING_ENTITIES } from '../../constants/voting.constant'; describe('Check if voting work properly in entities', () => { beforeEach(() => { 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 33319382ca46..c4285f263b9e 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 @@ -31,7 +31,7 @@ const addTags = (tag) => { cy.get('[data-testid="tag-selector"] > .ant-select-selector').contains(tag); }; const verifyTagFilter = ({ entity, tag }) => { - if (entity !== 'mlmodels') { + if (!['mlmodels', 'dashboardDataModel'].includes(entity)) { let columnLength = 0; cy.get('.ant-table-tbody') .find('tr') @@ -156,85 +156,91 @@ describe('Check if tags addition and removal flow working properly from tables', }); 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) { + if (entityDetails.entity !== 'storedProcedures') { interceptURL( 'GET', - `/api/v1/${entityDetails.insideEntity}/*`, - 'getInsideColumn' + `/api/v1/${entityDetails.entity}/name/*?fields=*`, + 'getEntityDetail' ); + interceptURL('GET', entityDetails.permissionApi, 'getEntityPermission'); interceptURL( - 'GET', - `/api/v1/permissions/chart/*`, - 'getInsideColumnPermission' + 'PATCH', + `/api/v1/${entityDetails.entity}/*`, + 'tagsChange' ); - } - visitEntityDetailsPage( - entityDetails.term, - entityDetails.serviceName, - entityDetails.entity - ); - verifyResponseStatusCode('@getEntityDetail', 200); - verifyResponseStatusCode('@getEntityPermission', 200); - if (entityDetails.insideEntity) { - verifyResponseStatusCode('@getInsideColumn', 200); - verifyResponseStatusCode('@getInsideColumnPermission', 200); - } + 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( - `[data-testid="feature-card-${entityDetails.fieldName}"] [data-testid="classification-tags-0"]` - ).then(($container) => { - if ($container.find('[data-testid="add-tag"]').length === 0) { - removeTags(false); - } + if (entityDetails.entity === 'mlmodels') { cy.get( - `[data-testid="feature-card-${entityDetails.fieldName}"] [data-testid="classification-tags-0"] [data-testid="add-tag"]` - ).click(); - }); - } else { - if (entityDetails.entity === 'topics') { - cy.get('[id*=panel-schema]').contains('Collapse All').click(); - } - cy.get( - '.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); + `[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 { + if (entityDetails.entity === 'topics') { + cy.get('[id*=panel-schema]').contains('Collapse All').click(); } cy.get( - '.ant-table-tbody [data-testid="classification-tags-0"] [data-testid="tags-container"] [data-testid="add-tag"]' - ).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(); + entityDetails.tags.map((tag) => addTags(tag)); + cy.clickOutside(); - cy.get('[data-testid="saveAssociatedTag"]') - .scrollIntoView() - .should('be.visible') - .click(); + cy.get('[data-testid="saveAssociatedTag"]') + .scrollIntoView() + .should('be.visible') + .click(); - verifyResponseStatusCode('@tagsChange', 200); + verifyResponseStatusCode('@tagsChange', 200); - entityDetails.tags.map((tag) => checkTags(tag)); - verifyTagFilter({ - entity: entityDetails.entity, - tag: entityDetails.tags[0], - }); - removeTags(false, entityDetails.separate); + entityDetails.tags.map((tag) => checkTags(tag)); + verifyTagFilter({ + entity: entityDetails.entity, + tag: entityDetails.tags[0], + }); + removeTags(false, entityDetails.separate); + } }); }); }); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/StoredProcedureVersion/StoredProcedureVersion.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/StoredProcedureVersion/StoredProcedureVersion.component.tsx index 8f58a07fc7bb..7d6fc759455f 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/StoredProcedureVersion/StoredProcedureVersion.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/StoredProcedureVersion/StoredProcedureVersion.component.tsx @@ -160,7 +160,13 @@ const StoredProcedureVersion = ({ ), }, ], - [description, storedProcedureFQN, currentVersionData, entityPermissions] + [ + tags, + description, + storedProcedureFQN, + currentVersionData, + entityPermissions, + ] ); return ( diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/DataModelPage/DataModelPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/DataModelPage/DataModelPage.component.tsx index 06fcb2281952..2ddad030cf14 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/DataModelPage/DataModelPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/DataModelPage/DataModelPage.component.tsx @@ -94,7 +94,7 @@ const DataModelsPage = () => { setIsLoading(true); try { const entityPermission = await getEntityPermissionByFqn( - ResourceEntity.CONTAINER, + ResourceEntity.DASHBOARD_DATA_MODEL, dashboardDataModelFQN ); setDataModelPermissions(entityPermission); diff --git a/openmetadata-ui/src/main/resources/ui/src/rest/dataModelsAPI.ts b/openmetadata-ui/src/main/resources/ui/src/rest/dataModelsAPI.ts index be5a00786cde..5ab809da0261 100644 --- a/openmetadata-ui/src/main/resources/ui/src/rest/dataModelsAPI.ts +++ b/openmetadata-ui/src/main/resources/ui/src/rest/dataModelsAPI.ts @@ -61,11 +61,13 @@ export const getDataModelsByName = async ( export const getDataModelDetailsByFQN = async ( databaseSchemaName: string, - arrQueryFields?: string | string[] + arrQueryFields?: string | string[], + include = Include.All ) => { const url = `${getURLWithQueryFields( `${URL}/name/${databaseSchemaName}`, - arrQueryFields + arrQueryFields, + `include=${include}` )}`; const response = await APIClient.get(url); From 5a3225da4e9672c6e16abf760baa476e28e6aff3 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Mon, 25 Sep 2023 12:37:13 +0530 Subject: [PATCH 2/3] fix failing cypress --- .../ui/cypress/constants/Version.constants.js | 2 +- .../ui/cypress/constants/constants.js | 4 +-- .../constants/tagsAddRemove.constants.js | 4 +-- .../ui/cypress/constants/voting.constant.js | 13 ++------ .../ui/cypress/e2e/Flow/EntityVoting.spec.js | 31 +++++++++++++------ .../ui/cypress/e2e/Flow/TagsAddRemove.spec.js | 25 ++++++++------- 6 files changed, 42 insertions(+), 37 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js index 1ea85b329a40..5465bdaf65b9 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js @@ -716,7 +716,7 @@ export const ENTITY_DETAILS_FOR_VERSION_TEST = { 'Data Model': { name: DATA_MODEL_NAME, serviceName: 'sample_looker', - entity: 'dashboardDataModel', + entity: 'dashboard/datamodels', entityCreationDetails: DATA_MODEL_DETAILS_FOR_VERSION_TEST, entityPatchPayload: DATA_MODEL_PATCH_PAYLOAD, isChildrenExist: true, diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js index 97b590825a00..09ed65b1eb58 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/constants.js @@ -182,10 +182,10 @@ export const SEARCH_ENTITY_DATA_MODEL = { entityType: 'Data Model', }, data_model_2: { - term: 'operations_view', + term: 'orders_view', entity: MYDATA_SUMMARY_OPTIONS.dataModel, serviceName: 'sample_looker', - displayName: 'operations_view', + displayName: 'Orders View', entityType: 'Data Model', }, }; 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 2e7d9654a224..f88a0ccba7a4 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 @@ -64,7 +64,7 @@ export const TAGS_ADD_REMOVE_ENTITIES = [ entity: 'storedProcedures', serviceName: 'sample_data', tags: ['PersonalData.Personal', 'PII.Sensitive'], - permissionApi: '/api/v1/permissions/*/*', + permissionApi: '/api/v1/permissions/*/name/*', }, { term: 'orders_view', @@ -72,6 +72,6 @@ export const TAGS_ADD_REMOVE_ENTITIES = [ entity: 'dashboardDataModel', serviceName: 'sample_looker', tags: ['PersonalData.Personal', 'PII.Sensitive'], - permissionApi: '/api/v1/permissions/*/*', + permissionApi: '/api/v1/permissions/*/name/*', }, ]; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/voting.constant.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/voting.constant.js index aa3f18c339b4..062fa7667873 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/voting.constant.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/voting.constant.js @@ -56,22 +56,15 @@ export const VOTING_ENTITIES = [ { term: 'update_orders_table', displayName: 'update_orders_table', - entity: 'storedProcedure', + entity: 'storedProcedures', serviceName: 'sample_data', - permissionApi: '/api/v1/permissions/*/*', - }, - { - term: 'update_orders_table', - displayName: 'update_orders_table', - entity: 'storedProcedure', - serviceName: 'sample_data', - permissionApi: '/api/v1/permissions/*/*', + permissionApi: '/api/v1/permissions/*/name/*', }, { term: 'orders_view', displayName: 'orders_view', entity: 'dashboardDataModel', serviceName: 'sample_looker', - permissionApi: '/api/v1/permissions/*/*', + permissionApi: '/api/v1/permissions/*/name/*', }, ]; diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js index 9d9d225d7595..dfdc6e3b80d9 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/EntityVoting.spec.js @@ -24,15 +24,20 @@ describe('Check if voting work properly in entities', () => { }); VOTING_ENTITIES.map((entityDetails) => { + const apiEntity = + entityDetails.entity === 'dashboardDataModel' + ? 'dashboard/datamodels' + : entityDetails.entity; + it(`UpVote the ${entityDetails.entity} entity`, () => { interceptURL('GET', entityDetails.permissionApi, 'getEntityPermission'); interceptURL( 'GET', - `/api/v1/${entityDetails.entity}/name/*?fields=*`, + `/api/v1/${apiEntity}/name/*?fields=*`, 'getEntityDetail' ); - interceptURL('PUT', `/api/v1/${entityDetails.entity}/*/vote`, 'upVoting'); + interceptURL('PUT', `/api/v1/${apiEntity}/*/vote`, 'upVoting'); visitEntityDetailsPage( entityDetails.term, @@ -55,19 +60,20 @@ describe('Check if voting work properly in entities', () => { }); VOTING_ENTITIES.map((entityDetails) => { + const apiEntity = + entityDetails.entity === 'dashboardDataModel' + ? 'dashboard/datamodels' + : entityDetails.entity; + it(`DownVote the ${entityDetails.entity} entity`, () => { interceptURL('GET', entityDetails.permissionApi, 'getEntityPermission'); interceptURL( 'GET', - `/api/v1/${entityDetails.entity}/name/*?fields=*`, + `/api/v1/${apiEntity}/name/*?fields=*`, 'getEntityDetail' ); - interceptURL( - 'PUT', - `/api/v1/${entityDetails.entity}/*/vote`, - 'downVoting' - ); + interceptURL('PUT', `/api/v1/${apiEntity}/*/vote`, 'downVoting'); visitEntityDetailsPage( entityDetails.term, @@ -93,15 +99,20 @@ describe('Check if voting work properly in entities', () => { }); VOTING_ENTITIES.map((entityDetails) => { + const apiEntity = + entityDetails.entity === 'dashboardDataModel' + ? 'dashboard/datamodels' + : entityDetails.entity; + it(`UnVote the ${entityDetails.entity} entity`, () => { interceptURL('GET', entityDetails.permissionApi, 'getEntityPermission'); interceptURL( 'GET', - `/api/v1/${entityDetails.entity}/name/*?fields=*`, + `/api/v1/${apiEntity}/name/*?fields=*`, 'getEntityDetail' ); - interceptURL('PUT', `/api/v1/${entityDetails.entity}/*/vote`, 'unVoting'); + interceptURL('PUT', `/api/v1/${apiEntity}/*/vote`, 'unVoting'); visitEntityDetailsPage( entityDetails.term, 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 c4285f263b9e..104d06935995 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 @@ -108,24 +108,29 @@ describe('Check if tags addition and removal flow working properly from tables', }); TAGS_ADD_REMOVE_ENTITIES.map((entityDetails) => { + const apiEntity = + entityDetails.entity === 'dashboardDataModel' + ? 'dashboard/datamodels' + : entityDetails.entity; + it(`Adding & removing tags to the ${entityDetails.entity} entity`, () => { interceptURL('GET', entityDetails.permissionApi, 'getEntityPermission'); interceptURL( 'GET', - `/api/v1/${entityDetails.entity}/name/*?fields=*`, + `/api/v1/${apiEntity}/name/*?fields=*`, 'getEntityDetail' ); - interceptURL('PATCH', `/api/v1/${entityDetails.entity}/*`, 'tagsChange'); + interceptURL('PATCH', `/api/v1/${apiEntity}/*`, 'tagsChange'); interceptURL( 'PATCH', - `/api/v1/${entityDetails.insideEntity ?? entityDetails.entity}/*`, + `/api/v1/${entityDetails.insideEntity ?? apiEntity}/*`, 'tagsChange' ); visitEntityDetailsPage( entityDetails.term, entityDetails.serviceName, - entityDetails.entity + apiEntity ); verifyResponseStatusCode('@getEntityDetail', 200); verifyResponseStatusCode('@getEntityPermission', 200); @@ -159,18 +164,14 @@ describe('Check if tags addition and removal flow working properly from tables', if (entityDetails.entity !== 'storedProcedures') { interceptURL( 'GET', - `/api/v1/${entityDetails.entity}/name/*?fields=*`, + `/api/v1/${apiEntity}/name/*?fields=*`, 'getEntityDetail' ); interceptURL('GET', entityDetails.permissionApi, 'getEntityPermission'); + interceptURL('PATCH', `/api/v1/${apiEntity}/*`, 'tagsChange'); interceptURL( 'PATCH', - `/api/v1/${entityDetails.entity}/*`, - 'tagsChange' - ); - interceptURL( - 'PATCH', - `/api/v1/${entityDetails.insideEntity ?? entityDetails.entity}/*`, + `/api/v1/${entityDetails.insideEntity ?? apiEntity}/*`, 'tagsChange' ); if (entityDetails.insideEntity) { @@ -188,7 +189,7 @@ describe('Check if tags addition and removal flow working properly from tables', visitEntityDetailsPage( entityDetails.term, entityDetails.serviceName, - entityDetails.entity + apiEntity ); verifyResponseStatusCode('@getEntityDetail', 200); verifyResponseStatusCode('@getEntityPermission', 200); From f764927d8ddfae87e2c9ea17f4fcecbc5c5c1230 Mon Sep 17 00:00:00 2001 From: Ashish Gupta Date: Mon, 25 Sep 2023 17:06:54 +0530 Subject: [PATCH 3/3] remove data model cypress --- .../ui/cypress/constants/Version.constants.js | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js b/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js index 5465bdaf65b9..5c298152acfc 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/constants/Version.constants.js @@ -713,19 +713,6 @@ export const ENTITY_DETAILS_FOR_VERSION_TEST = { entityChildRemovedDescription: '', entityChildAddedDescription: '', }, - 'Data Model': { - name: DATA_MODEL_NAME, - serviceName: 'sample_looker', - entity: 'dashboard/datamodels', - entityCreationDetails: DATA_MODEL_DETAILS_FOR_VERSION_TEST, - entityPatchPayload: DATA_MODEL_PATCH_PAYLOAD, - isChildrenExist: true, - childSelector: 'data-row-key', - entityAddedDescription: `Description for ${DATA_MODEL_NAME}`, - updatedTagEntityChildName: 'column_1', - entityChildRemovedDescription: 'Description for column column_2', - entityChildAddedDescription: 'Description for column column_3', - }, }; export const DATA_MODEL_DETAILS = {