diff --git a/openmetadata-ui/src/main/resources/ui/cypress/common/TaskUtils.js b/openmetadata-ui/src/main/resources/ui/cypress/common/TaskUtils.js index ff29bde634eb..eb8a61efee42 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/common/TaskUtils.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/common/TaskUtils.js @@ -61,7 +61,7 @@ export const editAssignee = () => { cy.get(`[data-testid="assignee-${assignee}"]`).should('be.visible'); }; -export const createDescriptionTask = (value) => { +export const createDescriptionTask = (value, assigneeDisabled) => { interceptURL('POST', 'api/v1/feed', 'createTask'); cy.get('#title').should( @@ -69,18 +69,27 @@ export const createDescriptionTask = (value) => { `Update description for table ${value.term}` ); - cy.get('[data-testid="select-assignee"] > .ant-select-selector').type( - value.assignee ?? assignee - ); - // select value from dropdown - verifyResponseStatusCode('@suggestApi', 200); - - cy.get(`[data-testid="assignee-option-${value.assignee ?? assignee}"]`) - .should('be.visible') - .trigger('mouseover') - .trigger('click'); - - cy.clickOutside(); + if (assigneeDisabled) { + cy.get('[data-testid="select-assignee"] > .ant-select-selector').contains( + value.assignee + ); + + cy.get( + '[data-testid="select-assignee"] > .ant-select-selector input' + ).should('be.disabled'); + } else { + cy.get('[data-testid="select-assignee"] > .ant-select-selector').type( + value.assignee ?? assignee + ); + // select value from dropdown + verifyResponseStatusCode('@suggestApi', 200); + + cy.get(`[data-testid="assignee-option-${value.assignee ?? assignee}"]`) + .should('be.visible') + .trigger('mouseover') + .trigger('click'); + cy.clickOutside(); + } cy.get(descriptionBox).scrollIntoView().clear().type('Updated description'); diff --git a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Task.spec.js b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Task.spec.js index 754f18cc7874..d023e17a75e3 100644 --- a/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Task.spec.js +++ b/openmetadata-ui/src/main/resources/ui/cypress/e2e/Flow/Task.spec.js @@ -14,6 +14,7 @@ /// import { + addOwner, interceptURL, toastNotification, verifyResponseStatusCode, @@ -22,6 +23,7 @@ import { import { createEntityTable, hardDeleteService } from '../../common/EntityUtils'; import { createAndUpdateDescriptionTask, + createDescriptionTask, editAssignee, verifyTaskDetails, } from '../../common/TaskUtils'; @@ -193,4 +195,38 @@ describe('Task flow should work', () => { }); }); }); + + it('Asignee field should be disabled for owned entity tasks', () => { + interceptURL( + 'GET', + `/api/v1/${ENTITY_TABLE.entity}/name/*`, + 'getEntityDetails' + ); + + visitEntityDetailsPage({ + term: ENTITY_TABLE.term, + serviceName: ENTITY_TABLE.serviceName, + entity: ENTITY_TABLE.entity, + }); + + addOwner('Adam Rodriguez', 'tables'); + + cy.get('[data-testid="request-description"]').click(); + + cy.wait('@getEntityDetails').then((res) => { + const entity = res.response.body; + + // create description task and verify asignee field to have owner + // and should be disbaled + + createDescriptionTask( + { + ...ENTITY_TABLE, + assignee: 'Adam Rodriguez', + term: entity.displayName ?? entity.name, + }, + true + ); + }); + }); }); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Task/TaskTab/TaskTab.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Task/TaskTab/TaskTab.component.tsx index 1548c199f66b..13b9771b19e3 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Task/TaskTab/TaskTab.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Task/TaskTab/TaskTab.component.tsx @@ -468,6 +468,7 @@ export const TaskTab = ({ }} onSave={() => assigneesForm.submit()}> @@ -490,7 +491,7 @@ export const TaskTab = ({ profileWidth="24" showUserName={false} /> - {(isCreator || hasEditAccess) && !isTaskClosed ? ( + {(isCreator || hasEditAccess) && !isTaskClosed && !owner ? (