MINOR: support testCase data in entity card popover and fix cypress (#14887)

* support testcase data in entity card popover and fix cypress

* remove unwanted changes

* minor changes
This commit is contained in:
Ashish Gupta 2024-01-26 14:21:43 +05:30 committed by GitHub
parent c936ac3a41
commit f1c76ab371
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 53 additions and 12 deletions

View File

@ -102,7 +102,7 @@ export const createAndUpdateDescriptionTask = (value) => {
createDescriptionTask(value);
// verify the task details
verifyTaskDetails(/#(\d+) UpdateDescriptionfordescription/);
verifyTaskDetails(/#(\d+) Request to update description for/);
// edit task assignees
editAssignee();

View File

@ -357,7 +357,9 @@ describe('Activity feed', () => {
cy.get('[data-testid="message-container"]')
.invoke('text')
.then((textContent) => {
const matches = textContent.match(/#(\d+) UpdateDescriptionfortable/);
const matches = textContent.match(
/#(\d+) Request to update description for/
);
expect(matches).to.not.be.null;
});

View File

@ -123,8 +123,8 @@ describe('Task flow should work', () => {
// verify the task details
verifyTaskDetails(
value.tagCount > 0
? /#(\d+) UpdateTagfortags/
: /#(\d+) RequestTagfortags/
? /#(\d+) Request to update tags for/
: /#(\d+) Request tags for/
);
// edit task assignees

View File

@ -35,6 +35,7 @@ import { MlmodelService } from '../../generated/entity/services/mlmodelService';
import { PipelineService } from '../../generated/entity/services/pipelineService';
import { SearchService } from '../../generated/entity/services/searchService';
import { StorageService } from '../../generated/entity/services/storageService';
import { TestCase } from '../../generated/tests/testCase';
import { Aggregations, SearchResponse } from '../../interface/search.interface';
import { QueryFilterInterface } from '../../pages/ExplorePage/ExplorePage.interface';
import { SearchDropdownOption } from '../SearchDropdown/SearchDropdown.interface';
@ -131,6 +132,7 @@ export type EntityUnion =
| Database
| Glossary
| Tag
| TestCase
| DashboardDataModel
| StoredProcedure
| SearchIndexEntity

View File

@ -43,8 +43,8 @@ import { getContainerByFQN } from '../../../rest/storageAPI';
import { getStoredProceduresByFqn } from '../../../rest/storedProceduresAPI';
import { getTableDetailsByFQN } from '../../../rest/tableAPI';
import { getTagByFqn } from '../../../rest/tagAPI';
import { getTestCaseByFqn } from '../../../rest/testAPI';
import { getTopicByFqn } from '../../../rest/topicsAPI';
import { getTableFQNFromColumnFQN } from '../../../utils/CommonUtils';
import { getEntityName } from '../../../utils/EntityUtils';
import { getDecodedFqn } from '../../../utils/StringsUtils';
import { useApplicationConfigContext } from '../../ApplicationConfigProvider/ApplicationConfigProvider';
@ -101,8 +101,8 @@ export const PopoverContent: React.FC<{
break;
case EntityType.TEST_CASE:
promise = getTableDetailsByFQN(getTableFQNFromColumnFQN(decodedFqn), {
fields,
promise = getTestCaseByFqn(decodedFqn, {
fields: ['owner'],
});
break;

View File

@ -125,7 +125,7 @@ const IncidentManagerDetailPage = () => {
'incidentId',
],
});
setTestCaseData((prev) => ({ ...prev, data: response.data }));
setTestCaseData((prev) => ({ ...prev, data: response }));
} catch (error) {
showErrorToast(
error as AxiosError,

View File

@ -39,7 +39,7 @@ function TestCaseDetailsPage() {
const response = await getTestCaseByFqn(testCaseFQN, {
fields: ['testSuite', 'testCaseResult'],
});
setTestCaseData(response.data);
setTestCaseData(response);
} catch (error) {
showErrorToast(
error as AxiosError,

View File

@ -106,7 +106,7 @@ export const getTestCaseByFqn = async (
}
);
return response;
return response.data;
};
export const getTestCaseById = async (
id: string,

View File

@ -59,6 +59,7 @@ import {
getTagsDetailsPath,
getTopicDetailsPath,
NO_DATA,
ROUTES,
} from '../constants/constants';
import { EntityField } from '../constants/Feeds.constants';
import { GlobalSettingsMenuCategory } from '../constants/GlobalSettings.constants';
@ -94,6 +95,7 @@ import {
} from '../generated/entity/data/table';
import { Topic } from '../generated/entity/data/topic';
import { DataProduct } from '../generated/entity/domains/dataProduct';
import { TestCase } from '../generated/tests/testCase';
import { Edge, EntityLineage } from '../generated/type/entityLineage';
import { EntityReference } from '../generated/type/entityUsage';
import { TagLabel } from '../generated/type/tagLabel';
@ -112,6 +114,7 @@ import {
getDataProductsDetailsPath,
getDomainPath,
getGlossaryPath,
getIncidentManagerDetailPagePath,
getSettingPath,
} from './RouterUtils';
import { getSearchIndexTabPath } from './SearchIndexUtils';
@ -1371,6 +1374,8 @@ export const getEntityLinkFromType = (
fullyQualifiedName,
ServiceCategory.METADATA_SERVICES
);
case EntityType.TEST_CASE:
return getIncidentManagerDetailPagePath(fullyQualifiedName);
default:
return '';
}
@ -1491,6 +1496,21 @@ export const getBreadcrumbForContainer = (data: {
];
};
export const getBreadcrumbForTestCase = (entity: TestCase) => [
{
name: i18next.t('label.incident-manager'),
url: ROUTES.INCIDENT_MANAGER,
},
{
name: entity.name,
url: getEntityLinkFromType(
entity.fullyQualifiedName ?? '',
(entity as SourceType)?.entityType as EntityType
),
},
];
export const getEntityBreadcrumbs = (
entity:
| SearchedDataProps['data'][number]['_source']
@ -1705,6 +1725,10 @@ export const getEntityBreadcrumbs = (
];
}
case EntityType.TEST_CASE: {
return getBreadcrumbForTestCase(entity as TestCase);
}
case EntityType.TOPIC:
case EntityType.DASHBOARD:
case EntityType.PIPELINE:

View File

@ -241,7 +241,12 @@ class SearchClassBase {
}
public getListOfEntitiesWithoutTier() {
return [EntityType.GLOSSARY_TERM, EntityType.TAG, EntityType.DATA_PRODUCT];
return [
EntityType.GLOSSARY_TERM,
EntityType.TAG,
EntityType.DATA_PRODUCT,
EntityType.TEST_CASE,
];
}
public getServiceIcon(source: SearchSourceAlias) {
@ -249,7 +254,7 @@ class SearchClassBase {
}
public getListOfEntitiesWithoutDomain(): string[] {
return [];
return [EntityType.TEST_CASE];
}
public getEntityBreadcrumbs(

View File

@ -39,6 +39,7 @@ import { ReactComponent as IconForeignKey } from '../assets/svg/foreign-key.svg'
import { ReactComponent as GlossaryIcon } from '../assets/svg/glossary.svg';
import { ReactComponent as IconDown } from '../assets/svg/ic-arrow-down.svg';
import { ReactComponent as IconRight } from '../assets/svg/ic-arrow-right.svg';
import { ReactComponent as TestCaseIcon } from '../assets/svg/ic-checklist.svg';
import { ReactComponent as DashboardIcon } from '../assets/svg/ic-dashboard.svg';
import { ReactComponent as DataProductIcon } from '../assets/svg/ic-data-product.svg';
import { ReactComponent as DatabaseIcon } from '../assets/svg/ic-database.svg';
@ -223,6 +224,13 @@ export const getServiceIcon = (source: SourceType) => {
style={{ color: DE_ACTIVE_COLOR }}
/>
);
} else if (source.entityType === EntityType.TEST_CASE) {
return (
<TestCaseIcon
className="service-icon h-7"
style={{ color: DE_ACTIVE_COLOR }}
/>
);
} else {
return (
<img