2023-08-31 17:42:01 +05:30
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2024-03-07 17:06:33 +05:30
|
|
|
|
2023-08-31 17:42:01 +05:30
|
|
|
import {
|
|
|
|
customFormatDateTime,
|
|
|
|
getCurrentMillis,
|
|
|
|
getEpochMillisForFutureDays,
|
|
|
|
} from '../../../src/utils/date-time/DateTimeUtils';
|
|
|
|
import {
|
|
|
|
descriptionBox,
|
|
|
|
interceptURL,
|
|
|
|
verifyResponseStatusCode,
|
|
|
|
} from '../../common/common';
|
2024-02-14 12:20:16 +05:30
|
|
|
import { verifyKpiChart } from '../../common/DataInsightUtils';
|
2024-03-15 17:34:31 +05:30
|
|
|
import { getToken } from '../../common/Utils/LocalStorage';
|
2024-04-17 17:58:30 +05:30
|
|
|
import {
|
|
|
|
EXPLORE_PAGE_TABS,
|
|
|
|
SidebarItem,
|
|
|
|
} from '../../constants/Entity.interface';
|
2024-01-24 14:27:52 +05:30
|
|
|
import { GlobalSettingOptions } from '../../constants/settings.constant';
|
2023-08-31 17:42:01 +05:30
|
|
|
|
|
|
|
const KPI_DATA = [
|
|
|
|
{
|
|
|
|
dataInsightChart: 'Percentage of Entities With Description',
|
|
|
|
displayName: 'Cypress description with percentage',
|
|
|
|
metricType: 'completedDescriptionFraction (PERCENTAGE)',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
dataInsightChart: 'Percentage of Entities With Owner',
|
|
|
|
displayName: 'Cypress Owner with percentage',
|
|
|
|
metricType: 'hasOwnerFraction (PERCENTAGE)',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const deleteKpiRequest = () => {
|
|
|
|
cy.get('[data-menu-id*="kpi"]').click();
|
|
|
|
cy.wait('@getKpi').then(({ response }) => {
|
|
|
|
const data = response.body.data;
|
|
|
|
if (data.length > 0) {
|
2024-03-15 17:34:31 +05:30
|
|
|
cy.getAllLocalStorage().then((storageData) => {
|
|
|
|
const token = getToken(storageData);
|
|
|
|
|
|
|
|
data.forEach((element) => {
|
|
|
|
cy.request({
|
|
|
|
method: 'DELETE',
|
|
|
|
url: `/api/v1/kpi/${element.id}?hardDelete=true&recursive=false`,
|
|
|
|
headers: { Authorization: `Bearer ${token}` },
|
|
|
|
}).then((response) => {
|
|
|
|
expect(response.status).to.eq(200);
|
|
|
|
});
|
2023-08-31 17:42:01 +05:30
|
|
|
});
|
|
|
|
});
|
|
|
|
cy.reload();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const addKpi = (data) => {
|
|
|
|
const startDate = customFormatDateTime(getCurrentMillis(), 'yyyy-MM-dd');
|
|
|
|
const endDate = customFormatDateTime(
|
|
|
|
getEpochMillisForFutureDays(1),
|
|
|
|
'yyyy-MM-dd'
|
|
|
|
);
|
|
|
|
interceptURL('POST', '/api/v1/kpi', 'createKpi');
|
|
|
|
cy.get('#dataInsightChart').click();
|
|
|
|
cy.get(`.ant-select-dropdown [title="${data.dataInsightChart}"]`).click();
|
|
|
|
cy.get('[data-testid="displayName"]').type(data.displayName);
|
|
|
|
cy.get('#metricType').click();
|
|
|
|
cy.get(`.ant-select-dropdown [title="${data.metricType}"]`).click();
|
|
|
|
cy.get('[data-testid="metric-percentage-input"] [role="spinbutton"]')
|
|
|
|
.scrollIntoView()
|
2024-04-05 15:44:11 +05:30
|
|
|
.type('100');
|
2023-08-31 17:42:01 +05:30
|
|
|
cy.get('[data-testid="start-date"]').click().type(`${startDate}{enter}`);
|
2023-10-30 15:43:55 +05:30
|
|
|
cy.get('[data-testid="end-date"]').click().type(`${endDate}{enter}`);
|
2023-08-31 17:42:01 +05:30
|
|
|
cy.get(descriptionBox).scrollIntoView().type('cypress test');
|
|
|
|
cy.get('[data-testid="submit-btn"]').scrollIntoView().click();
|
|
|
|
verifyResponseStatusCode('@createKpi', 201);
|
|
|
|
};
|
|
|
|
|
2024-07-30 17:38:43 +05:30
|
|
|
// Need to migrate it to playwright
|
|
|
|
describe.skip('Data Insight feature', { tags: 'Observability' }, () => {
|
2023-08-31 17:42:01 +05:30
|
|
|
beforeEach(() => {
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/analytics/dataInsights/charts/aggregate?*',
|
|
|
|
'dataInsightsChart'
|
|
|
|
);
|
|
|
|
interceptURL('GET', '/api/v1/kpi?fields=*', 'getKpi');
|
|
|
|
cy.login();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Initial setup', () => {
|
2024-01-23 15:30:05 +05:30
|
|
|
cy.sidebarClick(SidebarItem.DATA_INSIGHT);
|
2023-08-31 17:42:01 +05:30
|
|
|
verifyResponseStatusCode('@dataInsightsChart', 200);
|
|
|
|
deleteKpiRequest();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Create description and owner KPI', () => {
|
2024-01-23 15:30:05 +05:30
|
|
|
cy.sidebarClick(SidebarItem.DATA_INSIGHT);
|
2023-08-31 17:42:01 +05:30
|
|
|
verifyResponseStatusCode('@dataInsightsChart', 200);
|
|
|
|
cy.get('[data-menu-id*="kpi"]').click();
|
|
|
|
KPI_DATA.map((data) => {
|
|
|
|
cy.get('[data-testid="add-kpi-btn"]').click();
|
|
|
|
verifyResponseStatusCode('@getKpi', 200);
|
|
|
|
addKpi(data);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Deploy data insight index', () => {
|
2023-10-19 14:09:25 +05:30
|
|
|
interceptURL('GET', '/api/v1/apps?limit=*', 'apps');
|
2023-08-31 17:42:01 +05:30
|
|
|
interceptURL(
|
|
|
|
'GET',
|
2023-11-10 13:53:47 +05:30
|
|
|
'/api/v1/apps/name/DataInsightsApplication?*',
|
2023-10-19 14:09:25 +05:30
|
|
|
'dataInsightsApplication'
|
2023-08-31 17:42:01 +05:30
|
|
|
);
|
|
|
|
interceptURL(
|
|
|
|
'POST',
|
2023-10-25 18:03:13 +05:30
|
|
|
'/api/v1/apps/deploy/DataInsightsApplication',
|
2023-08-31 17:42:01 +05:30
|
|
|
'deploy'
|
|
|
|
);
|
|
|
|
interceptURL(
|
|
|
|
'POST',
|
2023-10-19 14:09:25 +05:30
|
|
|
'/api/v1/apps/trigger/DataInsightsApplication',
|
2023-08-31 17:42:01 +05:30
|
|
|
'triggerPipeline'
|
|
|
|
);
|
2024-01-24 14:27:52 +05:30
|
|
|
cy.settingClick(GlobalSettingOptions.APPLICATIONS);
|
2023-10-19 14:09:25 +05:30
|
|
|
verifyResponseStatusCode('@apps', 200);
|
|
|
|
cy.get(
|
2023-11-10 13:53:47 +05:30
|
|
|
'[data-testid="data-insights-application-card"] [data-testid="config-btn"]'
|
2023-10-19 14:09:25 +05:30
|
|
|
).click();
|
|
|
|
verifyResponseStatusCode('@dataInsightsApplication', 200);
|
|
|
|
cy.get('[data-testid="deploy-button"]').click();
|
2023-10-25 18:03:13 +05:30
|
|
|
verifyResponseStatusCode('@deploy', 200);
|
2023-08-31 17:42:01 +05:30
|
|
|
cy.reload();
|
2023-10-19 14:09:25 +05:30
|
|
|
verifyResponseStatusCode('@dataInsightsApplication', 200);
|
2024-04-05 15:44:11 +05:30
|
|
|
|
|
|
|
// Adding a manual wait to allow some time between deploying the pipeline and triggering it
|
|
|
|
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
2024-05-14 14:24:49 +05:30
|
|
|
cy.wait(2000);
|
2023-10-25 18:03:13 +05:30
|
|
|
cy.get('[data-testid="run-now-button"]').click();
|
2023-08-31 17:42:01 +05:30
|
|
|
verifyResponseStatusCode('@triggerPipeline', 200);
|
2023-10-25 18:03:13 +05:30
|
|
|
cy.reload();
|
2024-02-14 12:20:16 +05:30
|
|
|
verifyKpiChart();
|
2023-08-31 17:42:01 +05:30
|
|
|
});
|
|
|
|
|
|
|
|
it('Verifying Data assets tab', () => {
|
2024-01-23 15:30:05 +05:30
|
|
|
cy.sidebarClick(SidebarItem.DATA_INSIGHT);
|
2024-07-22 20:21:59 +05:30
|
|
|
cy.get('[data-testid="date-picker-menu"]').click();
|
|
|
|
cy.contains('[role="menuitem"]', 'Last 60 days').click();
|
2023-08-31 17:42:01 +05:30
|
|
|
verifyResponseStatusCode('@dataInsightsChart', 200);
|
|
|
|
cy.get('[data-testid="search-dropdown-Team"]').should('be.visible');
|
|
|
|
cy.get('[data-testid="search-dropdown-Tier"]').should('be.visible');
|
|
|
|
cy.get('[data-testid="summary-card"]').should('be.visible');
|
|
|
|
cy.get('[data-testid="kpi-card"]').should('be.visible');
|
|
|
|
cy.get('#entity-summary-chart').scrollIntoView().should('be.visible');
|
|
|
|
cy.get('#PercentageOfEntitiesWithDescriptionByType-graph')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get('#PercentageOfServicesWithDescription-graph')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get('#PercentageOfEntitiesWithOwnerByType-graph')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get('#PercentageOfServicesWithOwner-graph')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get('#TotalEntitiesByTier-graph').scrollIntoView().should('be.visible');
|
|
|
|
});
|
|
|
|
|
2024-04-17 17:58:30 +05:30
|
|
|
it('Verify No owner and description redirection to explore page', () => {
|
|
|
|
cy.sidebarClick(SidebarItem.DATA_INSIGHT);
|
|
|
|
verifyResponseStatusCode('@dataInsightsChart', 200);
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/search/query?*descriptionStatus*INCOMPLETE*',
|
|
|
|
'noDescriptionAssets'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="explore-asset-with-no-description"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.click();
|
|
|
|
Object.values(EXPLORE_PAGE_TABS).map((tab) => {
|
|
|
|
cy.get(`[data-testid="${tab}-tab"]`).scrollIntoView().click();
|
|
|
|
verifyResponseStatusCode('@noDescriptionAssets', 200);
|
|
|
|
cy.get('[data-testid="advance-search-filter-text"]').should(
|
|
|
|
'contain',
|
|
|
|
"descriptionStatus = 'INCOMPLETE'"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
cy.sidebarClick(SidebarItem.DATA_INSIGHT);
|
|
|
|
verifyResponseStatusCode('@dataInsightsChart', 200);
|
|
|
|
interceptURL(
|
|
|
|
'GET',
|
|
|
|
'/api/v1/search/query?*must_not*exists*owner.displayName.keyword*',
|
|
|
|
'noOwnerAssets'
|
|
|
|
);
|
|
|
|
cy.get('[data-testid="explore-asset-with-no-owner"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.click();
|
|
|
|
|
|
|
|
Object.values(EXPLORE_PAGE_TABS).map((tab) => {
|
|
|
|
cy.get(`[data-testid="${tab}-tab"]`).scrollIntoView().click();
|
|
|
|
verifyResponseStatusCode('@noOwnerAssets', 200);
|
|
|
|
cy.get('[data-testid="advance-search-filter-text"]').should(
|
|
|
|
'contain',
|
|
|
|
'owner.displayName.keyword IS NULL'
|
|
|
|
);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-08-31 17:42:01 +05:30
|
|
|
it('Verifying App analytics tab', () => {
|
2024-01-23 15:30:05 +05:30
|
|
|
cy.sidebarClick(SidebarItem.DATA_INSIGHT);
|
2024-07-22 20:21:59 +05:30
|
|
|
cy.get('[data-testid="date-picker-menu"]').click();
|
|
|
|
cy.contains('[role="menuitem"]', 'Last 60 days').click();
|
2024-07-08 13:18:54 +05:30
|
|
|
verifyResponseStatusCode('@getKpi', 200);
|
2023-08-31 17:42:01 +05:30
|
|
|
cy.get('[data-menu-id*="app-analytics"]').click();
|
|
|
|
verifyResponseStatusCode('@dataInsightsChart', 200);
|
|
|
|
cy.get('[data-testid="summary-card-content"]').should('be.visible');
|
|
|
|
cy.get('[data-testid="entity-summary-card-percentage"]')
|
|
|
|
.contains('Most Viewed Data Assets')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get('[data-testid="entity-page-views-card"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get('[data-testid="entity-active-user-card"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get('[data-testid="entity-summary-card-percentage"]')
|
|
|
|
.contains('Most Active Users')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Verifying KPI tab', () => {
|
2024-01-23 15:30:05 +05:30
|
|
|
cy.sidebarClick(SidebarItem.DATA_INSIGHT);
|
2024-07-22 20:21:59 +05:30
|
|
|
cy.get('[data-testid="date-picker-menu"]').click();
|
|
|
|
cy.contains('[role="menuitem"]', 'Last 60 days').click();
|
2023-08-31 17:42:01 +05:30
|
|
|
cy.get('[data-menu-id*="kpi"]').click();
|
2024-05-26 14:12:27 +05:30
|
|
|
verifyResponseStatusCode('@getKpi', 200);
|
2023-08-31 17:42:01 +05:30
|
|
|
cy.get('[data-testid="kpi-card"]').should('be.visible');
|
|
|
|
cy.get(
|
|
|
|
'[data-row-key="cypress-description-with-percentage-completed-description-fraction"]'
|
|
|
|
)
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
cy.get('[data-row-key="cypress-owner-with-percentage-has-owner-fraction"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.should('be.visible');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Update KPI', () => {
|
|
|
|
interceptURL('GET', '/api/v1/kpi/name/*', 'fetchKpiByName');
|
|
|
|
interceptURL('PATCH', '/api/v1/kpi/*', 'updateKpi');
|
2024-01-23 15:30:05 +05:30
|
|
|
cy.sidebarClick(SidebarItem.DATA_INSIGHT);
|
2023-08-31 17:42:01 +05:30
|
|
|
verifyResponseStatusCode('@dataInsightsChart', 200);
|
|
|
|
cy.get('[data-menu-id*="kpi"]').click();
|
2024-05-14 14:24:49 +05:30
|
|
|
verifyResponseStatusCode('@getKpi', 200);
|
2023-08-31 17:42:01 +05:30
|
|
|
KPI_DATA.map((data) => {
|
|
|
|
cy.get(`[data-testid="edit-action-${data.displayName}"]`).click();
|
|
|
|
verifyResponseStatusCode('@fetchKpiByName', 200);
|
|
|
|
cy.get('[data-testid="metric-percentage-input"] [role="spinbutton"]')
|
|
|
|
.scrollIntoView()
|
|
|
|
.clear()
|
2024-04-05 15:44:11 +05:30
|
|
|
.type('50');
|
2023-08-31 17:42:01 +05:30
|
|
|
cy.get('[data-testid="submit-btn"]').scrollIntoView().click();
|
|
|
|
verifyResponseStatusCode('@updateKpi', 200);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Delete Kpi', () => {
|
|
|
|
interceptURL('GET', '/api/v1/kpi/name/*', 'fetchKpiByName');
|
|
|
|
interceptURL(
|
|
|
|
'DELETE',
|
|
|
|
'/api/v1/kpi/*?hardDelete=true&recursive=false',
|
|
|
|
'deleteKpi'
|
|
|
|
);
|
2024-01-23 15:30:05 +05:30
|
|
|
cy.sidebarClick(SidebarItem.DATA_INSIGHT);
|
2023-08-31 17:42:01 +05:30
|
|
|
verifyResponseStatusCode('@dataInsightsChart', 200);
|
|
|
|
cy.get('[data-menu-id*="kpi"]').click();
|
2024-05-26 14:12:27 +05:30
|
|
|
verifyResponseStatusCode('@getKpi', 200);
|
2023-08-31 17:42:01 +05:30
|
|
|
KPI_DATA.map((data) => {
|
|
|
|
cy.get(`[data-testid="delete-action-${data.displayName}"]`).click();
|
|
|
|
cy.get('[data-testid="confirmation-text-input"]').type('DELETE');
|
|
|
|
cy.get('[data-testid="confirm-button"]').click();
|
|
|
|
verifyResponseStatusCode('@deleteKpi', 200);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|