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

119 lines
3.4 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.
*/
import {
descriptionBox,
interceptURL,
toastNotification,
verifyResponseStatusCode,
} from './common';
const owner = 'admin';
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 secondAssignee = 'Aaron Johnson';
export const verifyTaskDetails = (regexPattern) => {
cy.get('#task-panel').should('be.visible');
cy.get('[data-testid="task-title"]')
.invoke('text')
.then((textContent) => {
const matches = textContent.match(regexPattern);
expect(matches).to.not.be.null;
});
cy.get('[data-testid="owner-link"]').should('contain', owner);
cy.get(`[data-testid="${assignee}"]`).should('be.visible');
};
export const editAssignee = () => {
interceptURL('PATCH', 'api/v1/feed/*', 'editAssignee');
cy.get('[data-testid="edit-assignees"]').click();
cy.get('[data-testid="select-assignee"] > .ant-select-selector').type(
secondAssignee
);
// select value from dropdown
verifyResponseStatusCode('@suggestApi', 200);
cy.get(`[data-testid="assignee-option-${secondAssignee}"]`)
.should('be.visible')
.trigger('mouseover')
.trigger('click');
cy.clickOutside();
cy.get('[data-testid="inline-save-btn"]').click();
verifyResponseStatusCode('@editAssignee', 200);
cy.get(`[data-testid="${assignee}"]`).should('be.visible');
};
export const createDescriptionTask = (value, assigneeDisabled) => {
interceptURL('POST', 'api/v1/feed', 'createTask');
cy.get('#title').should(
'have.value',
`Update description for table ${value.term}`
);
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');
cy.get('button[type="submit"]').click();
verifyResponseStatusCode('@createTask', 201);
toastNotification('Task created successfully.');
};
export const createAndUpdateDescriptionTask = (value) => {
createDescriptionTask(value);
// verify the task details
verifyTaskDetails(/#(\d+) UpdateDescriptionfordescription/);
// 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);
};