Minor: Fix the encoding issue on edit ingestion page (#17552)

* Fix the encoding issue on edit ingestion page

* fixed incident manager user search issue

* fix cypress test for serviceIngestion failure

---------

Co-authored-by: Shailesh Parmar <shailesh.parmar.webdev@gmail.com>
Co-authored-by: Ashish Gupta <ashish@getcollate.io>
This commit is contained in:
Aniket Katkar 2024-08-23 03:22:16 +05:30 committed by GitHub
parent d0c08fb6e6
commit b44d5d47ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 94 additions and 39 deletions

View File

@ -360,34 +360,6 @@ class ServiceBaseClass {
verifyResponseStatusCode('@pipelineServices', 200);
// click and edit pipeline schedule for Minutes
cy.get('[data-testid="more-actions"]').click();
cy.get(
'[data-testid="actions-dropdown"]:visible [data-testid="edit-button"]'
).click();
cy.get('[data-testid="submit-btn"]').click();
// select schedule
cy.get('[data-testid="cron-type"]').click();
cy.get('.ant-select-item-option-content').contains('Minutes').click();
cy.get('[data-testid="minute-segment-options"]').click();
cy.get('.ant-select-item-option-content').contains('10').click();
// Deploy with scehdule
cy.get('[data-testid="deploy-button"]').click();
cy.get('[data-testid="view-service-button"]').click();
cy.get('[data-testid="schedule-primary-details"]').should(
'contain',
'Every 10 minutes'
);
cy.get('[data-testid="schedule-secondary-details"]').should(
'contain',
'Every hour, every day'
);
// click and edit pipeline schedule for Day
cy.get('[data-testid="more-actions"]').click();

View File

@ -24,12 +24,50 @@ class MysqlIngestionClass extends ServiceBaseClass {
name: string;
tableFilter: string;
constructor() {
super(Services.Database, 'cypress-mysql', 'Mysql', 'bot_entity');
super(Services.Database, 'cypress%mysql', 'Mysql', 'bot_entity');
this.tableFilter = 'bot_entity{enter} alert_entity{enter} chart_entity';
}
createService() {
super.createService();
// Edit Ingestion pipeline
cy.contains('td', 'metadata') // find the element with the text
.parent('tr') // find the parent 'tr'
.find('[data-testid="more-actions"]')
.click();
interceptURL(
'GET',
'/api/v1/services/ingestionPipelines/name/*',
'getIngestionDetails'
);
cy.get(
'[data-testid="actions-dropdown"]:visible [data-testid="edit-button"]'
).click();
verifyResponseStatusCode('@getIngestionDetails', 200);
cy.get('#root\\/enableDebugLog').scrollIntoView().click();
cy.get('[data-testid="submit-btn"]').scrollIntoView().click();
interceptURL(
'PATCH',
'/api/v1/services/ingestionPipelines/*',
'updateIngestionPipeline'
);
interceptURL(
'POST',
'/api/v1/services/ingestionPipelines/deploy/*',
'deployIngestionPipeline'
);
cy.get('[data-testid="deploy-button"]').scrollIntoView().click();
verifyResponseStatusCode('@updateIngestionPipeline', 200);
verifyResponseStatusCode('@deployIngestionPipeline', 200);
}
fillConnectionDetails() {

View File

@ -19,10 +19,14 @@ const teamURL =
'/api/v1/search/query?q=*%20AND%20teamType:Group&from=0&size=10&index=team_search_index&sort_field=displayName.keyword&sort_order=asc';
export const generateRandomUser = () => {
const firstName = `firstName-${uuid()}`;
const lastName = `lastName-${uuid()}`;
const email = `${firstName}${lastName}@example.com`;
return {
firstName: `firstName-${uuid()}`,
lastName: `lastName-${uuid()}`,
email: `user${uuid()}@example.com`,
firstName,
lastName,
email,
password: 'User@OMD123',
};
};

View File

@ -18,6 +18,7 @@ import {
visitEntityDetailsPage,
} from '../../common/Utils/Entity';
import { getToken } from '../../common/Utils/LocalStorage';
import { generateRandomUser } from '../../common/Utils/Owner';
import { uuid } from '../../constants/constants';
import { EntityType, SidebarItem } from '../../constants/Entity.interface';
import { DATABASE_SERVICE } from '../../constants/EntityConstant';
@ -33,6 +34,11 @@ const testCases = [
`cy_second_table_column_count_to_be_between_${uuid()}`,
`cy_third_table_column_count_to_be_between_${uuid()}`,
];
const user1 = generateRandomUser();
const user2 = generateRandomUser();
const userName1 = `${user1.firstName}${user1.lastName}`;
const userName2 = `${user2.firstName}${user2.lastName}`;
const userIds: string[] = [];
const goToProfilerTab = () => {
interceptURL(
@ -89,12 +95,15 @@ const assignIncident = (testCaseName: string) => {
cy.get('#testCaseResolutionStatusDetails_assignee').should('be.visible');
interceptURL(
'GET',
'/api/v1/search/suggest?q=Aaron%20Johnson&index=user_search_index',
`/api/v1/search/suggest?q=*${user1.firstName}*${user1.lastName}*&index=user_search_index*`,
'searchAssignee'
);
cy.get('#testCaseResolutionStatusDetails_assignee').type('Aaron Johnson');
interceptURL('GET', '/api/v1/users/name/*', 'userList');
cy.get('#testCaseResolutionStatusDetails_assignee').click();
cy.wait('@userList');
cy.get('#testCaseResolutionStatusDetails_assignee').type(userName1);
verifyResponseStatusCode('@searchAssignee', 200);
cy.get('[data-testid="aaron_johnson0"]').click();
cy.get(`[data-testid="${userName1.toLocaleLowerCase()}"]`).click();
interceptURL(
'POST',
'/api/v1/dataQuality/testCases/testCaseIncidentStatus',
@ -114,6 +123,24 @@ describe('Incident Manager', { tags: 'Observability' }, () => {
cy.getAllLocalStorage().then((data) => {
const token = getToken(data);
// Create a new user
cy.request({
method: 'POST',
url: `/api/v1/users/signup`,
headers: { Authorization: `Bearer ${token}` },
body: user1,
}).then((response) => {
userIds.push(response.body.id);
});
cy.request({
method: 'POST',
url: `/api/v1/users/signup`,
headers: { Authorization: `Bearer ${token}` },
body: user2,
}).then((response) => {
userIds.push(response.body.id);
});
createEntityTableViaREST({
token,
...DATABASE_SERVICE,
@ -190,6 +217,15 @@ describe('Incident Manager', { tags: 'Observability' }, () => {
endPoint: EntityType.DatabaseService,
entityName: DATABASE_SERVICE.service.name,
});
// Delete created user
userIds.forEach((userId) => {
cy.request({
method: 'DELETE',
url: `/api/v1/users/${userId}?hardDelete=true&recursive=false`,
headers: { Authorization: `Bearer ${token}` },
});
});
});
});
@ -224,14 +260,19 @@ describe('Incident Manager', { tags: 'Observability' }, () => {
.scrollIntoView()
.click();
cy.get('[role="menu"').find('[data-menu-id*="re-assign"]').click();
interceptURL(
'GET',
'/api/v1/search/suggest?q=admin&index=*user_search_index*',
`/api/v1/search/suggest?q=*${user2.firstName}*${user2.lastName}*&index=user_search_index*`,
'searchAssignee'
);
cy.get('[data-testid="select-assignee"]').click().type('admin');
interceptURL('GET', '/api/v1/users/name/*', 'userList');
cy.get('[data-testid="select-assignee"]').click();
cy.wait('@userList');
cy.get('[data-testid="select-assignee"]').type(userName2);
verifyResponseStatusCode('@searchAssignee', 200);
cy.get('[data-testid="admin"]').click();
cy.get(`[data-testid="${userName2.toLocaleLowerCase()}"]`).click();
interceptURL(
'POST',
'/api/v1/dataQuality/testCases/testCaseIncidentStatus',

View File

@ -121,7 +121,7 @@ export const getEditIngestionPath = (
path = path
.replace(PLACEHOLDER_ROUTE_SERVICE_CAT, serviceCategory)
.replace(PLACEHOLDER_ROUTE_FQN, getEncodedFqn(serviceFQN))
.replace(PLACEHOLDER_ROUTE_INGESTION_FQN, ingestionFQN)
.replace(PLACEHOLDER_ROUTE_INGESTION_FQN, getEncodedFqn(ingestionFQN))
.replace(PLACEHOLDER_ROUTE_INGESTION_TYPE, ingestionType);
return path;