Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

233 lines
6.3 KiB
JavaScript
Raw Normal View History

/*
* Copyright 2023 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// eslint-disable-next-line spaced-comment
/// <reference types="cypress" />
import {
addOwner,
interceptURL,
toastNotification,
verifyResponseStatusCode,
visitEntityDetailsPage,
} from '../../common/common';
import { createEntityTable, hardDeleteService } from '../../common/EntityUtils';
import {
createAndUpdateDescriptionTask,
createDescriptionTask,
editAssignee,
verifyTaskDetails,
} from '../../common/TaskUtils';
import { DATA_ASSETS } from '../../constants/constants';
import { DATABASE_SERVICE } from '../../constants/EntityConstant';
import { SERVICE_CATEGORIES } from '../../constants/service.constants';
const ENTITY_TABLE = {
term: DATABASE_SERVICE.entity.name,
displayName: DATABASE_SERVICE.entity.name,
entity: DATA_ASSETS.tables,
serviceName: DATABASE_SERVICE.service.name,
schemaName: DATABASE_SERVICE.schema.name,
entityType: 'Table',
};
describe('Task flow should work', () => {
before(() => {
cy.login();
cy.getAllLocalStorage().then((data) => {
const token = Object.values(data)[0].oidcIdToken;
createEntityTable({
token,
...DATABASE_SERVICE,
tables: [DATABASE_SERVICE.entity],
});
});
});
after(() => {
cy.login();
cy.getAllLocalStorage().then((data) => {
const token = Object.values(data)[0].oidcIdToken;
hardDeleteService({
token,
serviceFqn: ENTITY_TABLE.serviceName,
serviceType: SERVICE_CATEGORIES.DATABASE_SERVICES,
});
});
});
beforeEach(() => {
cy.login();
interceptURL('GET', '/api/v1/permissions/*/name/*', 'entityPermission');
interceptURL('GET', '/api/v1/feed/count?entityLink=*', 'entityFeed');
interceptURL('GET', '/api/v1/search/suggest?q=*', 'suggestApi');
interceptURL('PUT', '/api/v1/feed/tasks/*/resolve', 'taskResolve');
interceptURL(
'GET',
`/api/v1/search/query?q=*%20AND%20disabled:false&index=tag_search_index*`,
'suggestTag'
);
});
feat(ui): supported resolution center in data quality (#14037) * feat(ui): supported resolution center in data quality * resolution details page added * components added in test case result page * connected listing and detail page * added severity modal and addressed comments * added support to edit status * change resolution center name to incident manager * severity crud support * added incident-manager-api * updated listing page and added navigation for incident manager in left menu bar * updated icon * added issue tab in incident manager * translation-sync * commented the security check for timebing * updated label style * added below filters in incident manager listing page - Assignee - Status - Test case name * fix status modal was not working in incident manager listing page issue * - integrated permissions in incident listing page and details page - added update owner functionality - IncidentDetails page updated as per mock - fixed DQ component added redirection from status * added test case resolution stepper in issue tab * updated task details tab as per mock * updated testcase ui * added beta tag in left panel * added reference line in graph for single count * fixed failing unit test * added unit test for severity and severityModal component * added unit test for testCaseIssueTab * added unit test for testCaseResultTab component * added unit test for testCaseIncidentManagerStatus component * added unit test for TaskTabIncidentManagerHeader component * added unit test for below component - incidentManagerPage - IncidentManagerDetailPage * added cypress for incident manager * fixed failing cypress * updated ui as per mock * translation sync * skip cypress for incident manager * fixed dataQuality cypress test --------- Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com> Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
2024-01-09 23:00:40 +05:30
const assignee = 'Adam Matthews';
const tag = 'Personal';
const createTagTask = (value) => {
interceptURL('POST', 'api/v1/feed', 'createTask');
cy.get('#title').should(
'have.value',
value.tagCount > 0
? `Update tags for table ${value.term}`
: `Request tags for table ${value.term}`
);
cy.get('[data-testid="select-assignee"] > .ant-select-selector').type(
assignee
);
// select value from dropdown
verifyResponseStatusCode('@suggestApi', 200);
cy.get(`[data-testid="assignee-option-${assignee}"]`)
.trigger('mouseover')
.trigger('click');
cy.clickOutside();
if (value.tagCount > 0) {
cy.get('[data-testid="tag-selector"]')
.find('[data-testid="remove-tags"]')
.each(($btn) => {
cy.wrap($btn).click();
});
}
cy.get('[data-testid="tag-selector"]').click().type(tag);
verifyResponseStatusCode('@suggestTag', 200);
cy.get('[data-testid="tag-PersonalData.Personal"]').click();
cy.get('[data-testid="tags-label"]').click();
cy.get('button[type="submit"]').click();
verifyResponseStatusCode('@createTask', 201);
toastNotification('Task created successfully.');
// verify the task details
verifyTaskDetails(
value.tagCount > 0
? /#(\d+) UpdateTagfortags/
: /#(\d+) RequestTagfortags/
);
// edit task assignees
editAssignee();
// Accept the description suggestion which is created
cy.get('.ant-btn-compact-first-item').contains('Accept Suggestion').click();
verifyResponseStatusCode('@taskResolve', 200);
toastNotification('Task resolved successfully');
verifyResponseStatusCode('@entityFeed', 200);
};
it('Task flow for table description', () => {
interceptURL(
'GET',
`/api/v1/${ENTITY_TABLE.entity}/name/*`,
'getEntityDetails'
);
visitEntityDetailsPage({
term: ENTITY_TABLE.term,
serviceName: ENTITY_TABLE.serviceName,
entity: ENTITY_TABLE.entity,
});
cy.get('[data-testid="request-description"]').click();
cy.wait('@getEntityDetails').then((res) => {
const entity = res.response.body;
// create description task
createAndUpdateDescriptionTask({
...ENTITY_TABLE,
term: entity.displayName ?? entity.name,
});
});
});
it('Task flow for table tags', () => {
interceptURL(
'GET',
`/api/v1/${ENTITY_TABLE.entity}/name/*`,
'getEntityDetails'
);
visitEntityDetailsPage({
term: ENTITY_TABLE.term,
serviceName: ENTITY_TABLE.serviceName,
entity: ENTITY_TABLE.entity,
});
cy.get('[data-testid="request-entity-tags"]').click();
cy.wait('@getEntityDetails').then((res) => {
const entity = res.response.body;
// create tag task
createTagTask({
...ENTITY_TABLE,
term: entity.displayName ?? entity.name,
tagCount: entity.tags.length ?? 0,
});
});
});
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
);
});
});
});