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); createDescriptionTask(value);
// verify the task details // verify the task details
verifyTaskDetails(/#(\d+) UpdateDescriptionfordescription/); verifyTaskDetails(/#(\d+) Request to update description for/);
// edit task assignees // edit task assignees
editAssignee(); editAssignee();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -59,6 +59,7 @@ import {
getTagsDetailsPath, getTagsDetailsPath,
getTopicDetailsPath, getTopicDetailsPath,
NO_DATA, NO_DATA,
ROUTES,
} from '../constants/constants'; } from '../constants/constants';
import { EntityField } from '../constants/Feeds.constants'; import { EntityField } from '../constants/Feeds.constants';
import { GlobalSettingsMenuCategory } from '../constants/GlobalSettings.constants'; import { GlobalSettingsMenuCategory } from '../constants/GlobalSettings.constants';
@ -94,6 +95,7 @@ import {
} from '../generated/entity/data/table'; } from '../generated/entity/data/table';
import { Topic } from '../generated/entity/data/topic'; import { Topic } from '../generated/entity/data/topic';
import { DataProduct } from '../generated/entity/domains/dataProduct'; import { DataProduct } from '../generated/entity/domains/dataProduct';
import { TestCase } from '../generated/tests/testCase';
import { Edge, EntityLineage } from '../generated/type/entityLineage'; import { Edge, EntityLineage } from '../generated/type/entityLineage';
import { EntityReference } from '../generated/type/entityUsage'; import { EntityReference } from '../generated/type/entityUsage';
import { TagLabel } from '../generated/type/tagLabel'; import { TagLabel } from '../generated/type/tagLabel';
@ -112,6 +114,7 @@ import {
getDataProductsDetailsPath, getDataProductsDetailsPath,
getDomainPath, getDomainPath,
getGlossaryPath, getGlossaryPath,
getIncidentManagerDetailPagePath,
getSettingPath, getSettingPath,
} from './RouterUtils'; } from './RouterUtils';
import { getSearchIndexTabPath } from './SearchIndexUtils'; import { getSearchIndexTabPath } from './SearchIndexUtils';
@ -1371,6 +1374,8 @@ export const getEntityLinkFromType = (
fullyQualifiedName, fullyQualifiedName,
ServiceCategory.METADATA_SERVICES ServiceCategory.METADATA_SERVICES
); );
case EntityType.TEST_CASE:
return getIncidentManagerDetailPagePath(fullyQualifiedName);
default: default:
return ''; 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 = ( export const getEntityBreadcrumbs = (
entity: entity:
| SearchedDataProps['data'][number]['_source'] | 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.TOPIC:
case EntityType.DASHBOARD: case EntityType.DASHBOARD:
case EntityType.PIPELINE: case EntityType.PIPELINE:

View File

@ -241,7 +241,12 @@ class SearchClassBase {
} }
public getListOfEntitiesWithoutTier() { 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) { public getServiceIcon(source: SearchSourceAlias) {
@ -249,7 +254,7 @@ class SearchClassBase {
} }
public getListOfEntitiesWithoutDomain(): string[] { public getListOfEntitiesWithoutDomain(): string[] {
return []; return [EntityType.TEST_CASE];
} }
public getEntityBreadcrumbs( 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 GlossaryIcon } from '../assets/svg/glossary.svg';
import { ReactComponent as IconDown } from '../assets/svg/ic-arrow-down.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 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 DashboardIcon } from '../assets/svg/ic-dashboard.svg';
import { ReactComponent as DataProductIcon } from '../assets/svg/ic-data-product.svg'; import { ReactComponent as DataProductIcon } from '../assets/svg/ic-data-product.svg';
import { ReactComponent as DatabaseIcon } from '../assets/svg/ic-database.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 }} 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 { } else {
return ( return (
<img <img